Search Results

Search found 370 results on 15 pages for 'merlyn morgan graham'.

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

  • Problem with Freetype and OpenGL

    - by Morgan
    Hey, i'm having a weird issue with drawing text in openGL loaded with the Freetype 2 library. Here is a screenshot of what I'm seeing. http://img203.imageshack.us/img203/3316/freetypeweird.png Here are my code bits for loading and rendering my text. class Font { Font(const String& filename) { if (FT_New_Face(Font::ftLibrary, "arial.ttf", 0, &mFace)) { cout << "UH OH!" << endl; } FT_Set_Char_Size(mFace, 16 * 64, 16 * 64, 72, 72); } Glyph* GetGlyph(const unsigned char ch) { if(FT_Load_Char(mFace, ch, FT_LOAD_RENDER)) cout << "OUCH" << endl; FT_Glyph glyph; if(FT_Get_Glyph( mFace->glyph, &glyph )) cout << "OUCH" << endl; FT_BitmapGlyph bitmap_glyph = (FT_BitmapGlyph)glyph; Glyph* thisGlyph = new Glyph; thisGlyph->buffer = bitmap_glyph->bitmap.buffer; thisGlyph->width = bitmap_glyph->bitmap.width; thisGlyph->height = bitmap_glyph->bitmap.rows; return thisGlyph; } }; The relevant glyph information (width, height, buffer) is stored in the following struct struct Glyph { GLubyte* buffer; Uint width; Uint height; }; And finally, to render it, I have this class called RenderFont. class RenderFont { RenderFont(Font* font) { mTextureIds = new GLuint[128]; mFirstDisplayListId=glGenLists(128); glGenTextures( 128, mTextureIds ); for(unsigned char i=0;i<128;i++) { MakeDisplayList(font, i); } } void MakeDisplayList(Font* font, unsigned char ch) { Glyph* glyph = font->GetGlyph(ch); glBindTexture( GL_TEXTURE_2D, mTextureIds[ch]); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, glyph->width, glyph->height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, glyph->buffer); glNewList(mFirstDisplayListId+ch,GL_COMPILE); glBindTexture(GL_TEXTURE_2D, mTextureIds[ch]); glBegin(GL_QUADS); glTexCoord2d(0,1); glVertex2f(0,glyph->height); glTexCoord2d(0,0); glVertex2f(0,0); glTexCoord2d(1,0); glVertex2f(glyph->width,0); glTexCoord2d(1,1); glVertex2f(glyph->width,glyph->height); glEnd(); glTranslatef(16, 0, 0); glEndList(); } void Draw(const String& text, Uint size, const TransformComponent* transform, const Color32* color) { glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glTranslatef(100, 250, 0.0f); glListBase(mFirstDisplayListId); glCallLists(text.length(), GL_UNSIGNED_BYTE, text.c_str()); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); glLoadIdentity(); } private: GLuint mFirstDisplayListId; GLuint* mTextureIds; }; Can anybody see anything weird going on here that would cause the garbled text? It's strange because if I change the font size, or the DPI, then some of the letters that display correctly become garbled, and other letters that were garbled before then display correctly.

    Read the article

  • vb.net .aspxauth

    - by Morgan
    I am working with a large site trying to implement web parts for particular users in a particular subdirectory but I can't get the .ASPXAUTH cookie to be recognized. I've read dozens of tutorials and MS class library pages that tell me how it should work to no avail. I am brand new to Web parts, so I'm sorry if I'm unclear. The idea is that logged in users can travel the site, but then when they go to their dashboard, they are programmatically authenticated using Membership and FormsAuthentication to pull up their Personalization. When I step through the code, I can see the cookie being set, and that it exists on the following page, but Membership.GetUser() and User.Identity are both empty. I know the user exists because I created it programmatically using Membership.CreateUser() and I can see it when I do Membership.GetAllUsers() and it's online when i use Membership.GetUser(username) but the Personalization doesn't work. Right now, I'm just trying to get the proof of concept going. I've tried creating the ticket and cookie myself, and also using SetAuthCookie() (code follows). I really just need a clue as to what to look for. Here's the "login" page... If Membership.ValidateUser(testusername, testpassword) Then -- Works FormsAuthentication.SetAuthCookie(testusername, true) Response.Redirect("webpartsdemo1.aspx", False) End If And the next page (webpartsdemo1.aspx) Dim cookey As String = ".ASPXAUTH" lblContent.Text &= "<br><br>" & Request.Cookies(cookey).Name & " Details" lblContent.Text &= "<br>path = " & Request.Cookies(cookey).Path lblContent.Text &= "<br>domain = " & Request.Cookies(cookey).Domain lblContent.Text &= "<br>expires = " & Request.Cookies(cookey).Expires lblContent.Text &= "<br>Secure only? " & Request.Cookies(cookey).Secure lblContent.Text &= "<br>HTTP only? = " & Request.Cookies(cookey).HttpOnly lblContent.Text &= "<br>Has subkeys? " & Request.Cookies(cookey).HasKeys lblContent.Text &= "<br/><br/>request authenticated? " & Request.IsAuthenticated.ToString lblContent.Text &= " Getting user<br/>Current User: " Dim muGidget As MembershipUser If Request.IsAuthenticated Then muGidget = Membership.GetUser lblContent.Text &= Membership.GetUser().UserName Else lblContent.Text &= "none found" End If Output: .ASPXAUTH Details path = / domain = expires = 12:00:00 AM Secure only? False HTTP only? = False Has subkeys? False request authenticated? False Getting user Current User: none found Sorry to go on so long. Thanks for any help you can provide.

    Read the article

  • Building DLL via Maven with mojo-native

    - by graham.reeds
    I can build a simple dll consisting of a source file, a header file and a definition but now I am progressing beyond a simple toy dll and working towards something more complex. The DLL I am trying to compile has 2 source files, 2 headers and the dreaded stdafx pair. To compile normally you would use /Yc to compile the pch and /Yu to use it. How do you specify that with in the constraints of mojo-native's compiler options?

    Read the article

  • Create MSI for slipstream SQL 2008 install

    - by Graham
    I am looking at creating an MSI that will check/install the prerequisites of SQL Server 2008 and after the prerequisites are installed I will start my slipstream 2008 install. I am currently trying to do this through VS 2008 Deployment Projects, but I cannot just simple add the folders of the SQL slipstream into the setup project without recreating the entire folder structure of the SQL install. So my questions are: Is this a possible to do through Deployment Projects? (if yes, please assist with links or help) Is there a better way to do this? (I would prefer not to use WISE)

    Read the article

  • FileFinder using SQL

    - by James Morgan
    I was thinking of working on a project while I have some free time and this one looks pretty nice: http://mindprod.com/project/filefinder.html One thing I'm wondering about is that will it really be much faster compared to the regular windows search if I use SQL? I'm planning to use MySQL since it's open source. Also, do I need to be good at databases for this? I have basic knowledge about relational databases and can definitely make some SQL statements. Thanks.

    Read the article

  • Why JavaScript Statement "ga = ga || []" Works?

    - by Morgan Cheng
    Below javascript statements will cause error, if ga is not declared. if (ga) { alert(ga); } The error is: ga is not defined It looks undeclared variable cannot be recognized in bool expression. So, why below statement works? var ga = ga || []; To me, the ga is treated as bool value before "||". If it is false, expression after "||" is assigned to final ga.

    Read the article

  • integer constant does 'not reduce to an integer'

    - by Dan Morgan
    I use this code to set my constants // Constants.h extern NSInteger const KNameIndex; // Constants.m NSInteger const KNameIndex = 0; And in a switch statement within a file that imports the Constant.h file I have this: switch (self.sectionFromParentTable) { case KNameIndex: self.types = self.facilityTypes; break; ... I get error at compile that read this: "error:case label does not reduce to an integer constant" Any ideas what might be messed up?

    Read the article

  • Stop a stopwatch

    - by James Morgan
    I have the following code in a JPanel class which is added to a another class (JFrame). What I'm trying to implement is some sort of a stopwatch program. startBtn.addActionListener(new startListener()); class startListener implements ActionListener { public void actionPerformed(ActionEvent e) { Timer time = new Timer(); time.scheduleAtFixedRate(new Stopwatch(), 1000, 1000); } } This is another class which basically the task. public class Stopwatch extends TimerTask { private final double start = System.currentTimeMillis(); public void run() { double curr = System.currentTimeMillis(); System.out.println((curr - start) / 1000); } } The timer works fine and this is definitely far from complete but I'm not sure how to code the stop button which should stop the timer. Any advice on this? BTW I'm using java.util.timer

    Read the article

  • Storing third-party libraries in source control

    - by graham.reeds
    Should libraries that the application relies on be stored in source control? One part of me says it should and another part say's no. It feels wrong to add a 20mb library that dwarfs the entire app just because you rely on a couple of functions from it (albeit rather heavily). Should you just store the jar/dll or maybe even the distributed zip/tar of the project? What do other people do?

    Read the article

  • WCF Web Service chnage wsdl name and targetNamespace

    - by Graham
    All, I'm a little new to WCF over IIS but have done some ASMX web services before. My WCF service is up and running but the helper page generated by the web service for me has the default names, i.e. the page that says: You have created a service. To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax: svcutil.exe http://localhost:53456/ServicesHost.svc?wsdl In a standard ASMX site I would use method/class attributes to give the web service a name and a namespace. When I click on the link the WSDL has: <wsdl:definitions name="SearchServices" targetNamespace="http://tempuri.org/" i.e. not the WCF Service Contract Name and Namespace from my Interface. I assume the MEX is using some kind of default settings but I'd like to change them to be the correct names. How can I do this?

    Read the article

  • Using "Object.create" instead of "new"

    - by Graham King
    Javascript 1.9.3 / ECMAScript 5 introduces Object.create, which Douglas Crockford amongst others has been advocating for a long time. How do I replace new in the code below with Object.create? var UserA = function(nameParam) { this.id = MY_GLOBAL.nextId(); this.name = nameParam; } UserA.prototype.sayHello = function() { console.log('Hello '+ this.name); } var bob = new UserA('bob'); bob.sayHello(); (Assume MY_GLOBAL.nextId exists). The best I can come up with is: var userB = { init: function(nameParam) { this.id = MY_GLOBAL.nextId(); this.name = nameParam; }, sayHello: function() { console.log('Hello '+ this.name); } }; var bob = Object.create(userB); bob.init('Bob'); bob.sayHello(); There doesn't seem to be any advantage, so I think I'm not getting it. I'm probably being too neo-classical. How should I use Object.create to create user 'bob'?

    Read the article

  • How to implement Session timeout in Web Server Side?

    - by Morgan Cheng
    I beheld a web framework implementing in-memory session in this way. The session object is added to Cache with timeout. When the time is out, the session is removed from Cache automatically. To protect race condition, each request should acquire lock on given session object to proceed. Each request will "touch" the session in Cache to refresh the timeout. Everything looks fine, until this scenario is discovered. Say, one operation takes a long time, longer than timeout. Another request comes and wait on session lock which is currently hold by the long-time request. Finally, the long-time request is over, it releases the lock. But, since it already takes longer time than timeout, the session object is already removed from Cache. This is obvious because the only request holding the lock doesn't have a chance to "touch" the session object in cache. The second request gets the lock but cannot retrieve the expired Session object. Oops... To fix this issue, the second request has to re-create the Session object. But, this is just like digging a buried dead body from tomb and try to bring it back to life. It causes buggy code. I'm wondering what's the best way to implement timeout in session to handle such scenario. I know that current platform must have good session mechanism. I just want to know the under-the-hood how.

    Read the article

  • How to build Graceful Degradation AJAX web page?

    - by Morgan Cheng
    I want to build web page with "Graceful Degradation". That is, the web page functions even javascript is disabled. Now I have to make design decision on the format of AJAX response. If javascript is disabled, each HTTP request to server will generate HTML as response. The browser refreshes with the returned HTML. That's fine. If javascript is enabled, each AJAX HTTP request to server will generate ... well, JSON or HTML. If it is HTML, it is easy to implement. Just have javascript to replace part of page with the returned HTML. And, in server side, not much code change is needed. If it is JSON, then I have to implement JSON-to-html logic in javascript again which is almost duplicate of server side logic. Duplication is evil. I really don't like it. The benefit is that the bandwidth usage is better than HTML, which brings better performance. So, what's the best solution to Graceful Degradation? AJAX request better to return JSON or HTML?

    Read the article

  • How does session_start lock in PHP?

    - by Morgan Cheng
    Originally, I just want to verify that session_start locks on session. So, I create a PHP file as below. Basically, if the pageview is even, the page sleeps for 10 seconds; if the pageview is odd, it doesn't. And, session_start is used to obtain the page view in $_SESSION. I tried to access the page in two tabs of one browser. It is not surprising that the first tab takes 10 seconds since I explicitly let it sleep. The second tab would not sleep, but it should be blocked by sessiont_start. That works as expected. To my surprise, the output of the second page shows that session_start takes almost no time. Actually, the whole page seems takes no time to load. But, the page does take 10 seconds to show in browser. obtained lock Cost time: 0.00016689300537109 Start 1269739162.1997 End 1269739162.1998 allover time elpased : 0.00032305717468262 The page views: 101 Does PHP extract session_start out of PHP page and execute it before other PHP statements? This is the code. <?php function float_time() { list($usec, $sec) = explode(' ', microtime()); return (float)$sec + (float)$usec; } $allover_start_time = float_time(); $start_time = float_time(); session_start(); echo "obtained lock<br/>"; $end_time = float_time(); $elapsed_time = $end_time - $start_time; echo "Cost time: $elapsed_time <br>"; echo "Start $start_time<br/>"; echo "End $end_time<br/>"; ob_flush(); flush(); if (isset($_SESSION['views'])) { $_SESSION['views'] += 1; } else { $_SESSION['views'] = 0; } if ($_SESSION['views'] % 2 == 0) { echo "sleep 10 seconds<br/>"; sleep(10); } $allover_end_time = float_time(); echo "allover time elpased : " . ($allover_end_time - $allover_start_time) . "<br/>"; echo "The page views: " . $_SESSION['views']; ?>

    Read the article

  • Building a DLL via Maven with mojo-native

    - by graham.reeds
    I can build a simple dll consisting of a source file, a header file and a definition but now I am progressing beyond a simple toy dll and working towards something more real (ie: more complex). The DLL I am trying to compile has 2 source files, 2 headers and the dreaded stdafx pair. To compile normally you would use /Yc for the pch and /Yu to use it. How do you specify that with in the constraints of mojo-native's compiler options?

    Read the article

  • Exception Handling in ASP.NET MVC and Ajax - [HandleException] filter

    - by Graham
    All, I'm learning MVC and using it for a business app (MVC 1.0). I'm really struggling to get my head around exception handling. I've spent a lot of time on the web but not found anything along the lines of what I'm after. We currently use a filter attribute that implements IExceptionFilter. We decorate a base controller class with this so all server side exceptions are nicely routed to an exception page that displays the error and performs logging. I've started to use AJAX calls that return JSON data but when the server side implementation throws an error, the filter is fired but the page does not redirect to the Error page - it just stays on the page that called the AJAX method. Is there any way to force the redirect on the server (e.g. a ASP.NET Server.Transfer or redirect?) I've read that I must return a JSON object (wrapping the .NET Exception) and then redirect on the client, but then I can't guarantee the client will redirect... but then (although I'm probably doing something wrong) the server attempts to redirect but then gets an unauthorised exception (the base controller is secured but the Exception controller is not as it does not inherit from this) Has anybody please got a simple example (.NET and jQuery code). I feel like I'm randomly trying things in the hope it will work Exception Filter so far... public class HandleExceptionAttribute : FilterAttribute, IExceptionFilter { #region IExceptionFilter Members public void OnException(ExceptionContext filterContext) { if (filterContext.ExceptionHandled) { return; } filterContext.Controller.TempData[CommonLookup.ExceptionObject] = filterContext.Exception; if (filterContext.HttpContext.Request.IsAjaxRequest()) { filterContext.Result = AjaxException(filterContext.Exception.Message, filterContext); } else { //Redirect to global handler filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = AvailableControllers.Exception, action = AvailableActions.HandleException })); filterContext.ExceptionHandled = true; filterContext.HttpContext.Response.Clear(); } } #endregion private JsonResult AjaxException(string message, ExceptionContext filterContext) { if (string.IsNullOrEmpty(message)) { message = "Server error"; //TODO: Replace with better message } filterContext.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError; filterContext.HttpContext.Response.TrySkipIisCustomErrors = true; //Needed for IIS7.0 return new JsonResult { Data = new { ErrorMessage = message }, ContentEncoding = Encoding.UTF8, }; } }

    Read the article

  • In terms of loss of volume or corruption, is failure probability of an Amazon EBS volume 'x', indepe

    - by Tony Morgan
    In terms of loss of volume or corruption, is failure probability of an Amazon EBS* volume 'x', independent of the failure of another volume 'y'. Amazon states[1] AFR** of between 0.1%-0.5%, lets say 0.5%, 0.005. To restate the question is the AFR composed of two EBSs mirrored actually 0.005*0.005 = 0.000025? To be clear I'm not interested in high availability here, just very high durability. *EBS = elastic block storage (amazons persistant disks) **AFR = annual failure rate. [1] http://aws.amazon.com/ebs/

    Read the article

  • Min/Max across an array of objects

    - by graham.reeds
    It has been done to death pretty much, here on SO and around the 'Net. However I was wondering if there was a way to leverage the standard min/max functions of: Array.max = function(array) { return Math.max.apply(Math, array); }; Array.min = function(array) { return Math.min.apply(Math, array); }; So I can search across an array of objects of say: function Vector(x, y, z) { this.x = x; this.y = y; this.z = z; } var ArrayVector = [ /* lots of data */ ]; var min_x = ArrayVector.x.min(); // or var max_y = ArrayVector["y"].max(); Currently I have to loop through the array and compare the object values manually and craft each one to the particular need of the loop. A more general purpose way would be nice (if slightly slower).

    Read the article

  • Unpacking Argument Lists and Instantiating WTForms objects from web.py

    - by Morris Cornell-Morgan
    After a bit of searching, I've found that it's possible to instantiate a WTForms object in web.py using the following code: form = my_form(**web.input()) web.input() returns a "dictionary-like" web.storage object, but without the double asterisks WTForms will raise an exception: TypeError: formdata should be a multidict-type wrapper that supports the 'getlist' method From the Python documentation I understand that the two asterisks are used to unpack a dictionary of named arguments. That said, I'm still a bit confused about exactly what is going on. What makes the web.storage object returned by web.input() "dictionary-like" enough that it can be unpacked by ** but not "dictionary-like" enough that it can be passed as-is to the WTForms constructor? I know that this is an extremely basic question, but any advice to help a novice programmer would be greatly appreciated!

    Read the article

  • Returning control codes as JSON to a jquery ajax json call

    - by Graham
    I want to know if it is possible to return ascii control codes in JSON format from classic ASP to a jQuery ajax call. This is my jQuery call: $.ajax({ url: "/jsontest.asp", type: "POST", cache: false, dataType: "json", complete: function(data) { var o = $.parseJSON(data.responseText.toString()); }, error: function(data1, data2) { alert("There has been an error - please try again"); } }); This is my called page: {"val1":123,"val2","abcdef"} The above works fine, but if I change my called page to include ascii character 31 (1F) like so: {"val1":123,"val2","abc\x1Fdef"} then I get the alert in my error function. Can this be done, and if so, how please. Note: I'm using jQuery 1.7.1 and both IIS 6 and IIS 7 I have tried: \x1f, %1f, and \u001f

    Read the article

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