Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
T

Tadeusz Westawic

@Tadeusz Westawic
About
Posts
44
Topics
14
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Shortest Path on Unweighted Edges
    T Tadeusz Westawic

    This is an easy read if you are familiar with set notation. http://planning.cs.uiuc.edu/node4.html I have an unfinished project on the shelf which attempts to find the shortest path through a maze by "pressurizing" the maze at the entrance and coloring-in "temperature" or "pressure" at each cell in the maze. The "coolest" or "lowest pressure" (bluest) path is the shortest solution. Good Luck

    Tadeusz Westawic Sum quid sum.

    Algorithms algorithms game-dev data-structures help question

  • Backup Algorithm
    T Tadeusz Westawic

    As you have pointed-out; a backup of files alone is not enough to guarantee synchronisation on restore. Even if all files can be accessed there is still the time-sync/event-sync problem. A backup from which an app can restore itself is usually called a checkpoint. Such a "backup" would involve a transaction history file and a log file, as well as a "checkpoint" copy of pertinent files. Such backups are always built-into the app itself. The restore phase restores the files and then runs the app forward using the transaction history elements as input. The app must be suspended for the time it takes to perform the checpoint. There are techniques for minimising the timespan of the suspension, such as file twinning. A system-wide backup is not in my ken for today's platforms. However, anti-malware apps perform system-wide scans all the time, so I don't think file access is an issue, here. So what kind of backup do you have in mind?

    Tadeusz Westawic Sumi quid sum.

    Algorithms algorithms question

  • One-click close inactive child modeless dialog
    T Tadeusz Westawic

    I am self-taught in C++ and this is as deep as I've ever been in messaging. I have a modeless parent dialog maintaining a typed ptr list of modeless child dialog pointers. The children are all of the same class and hold memory and file resources (sets of parts and subassembly populations). The parent modeless supervises set operations on the children: unary transforms such as rotations, and binary operations such as set intersection, etc. So the parent is usually holding a kind of focus on one or two of the child operands. I have been several days now, learning different ways that the parent dialog can crash via a null position pointer in the collection class operations, or crash via a pointer to a deleted child. I'm not crying about it, I needed the knowlege, anyway. At this point my code no longer crashes but I have to perform two mouse clicks to close an inactive child; first click activates and second click closes ("close" means user clicked the X-button in the menu bar). The activation click causes the parent to lose its hold on current operands. Here are my event captures:

    int CPop::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
    {
    // If user moused sys menu bar, let OnSysCommand() handle it.

    if(nHitTest != HTSYSMENU)
    	{
    	GetParent()->PostMessageW(WMU\_POP\_TO\_POPMAN\_CHILD\_M\_ACTIVE, (WPARAM)0, m\_ptoken);
    	}
    //	Don't call base.
    //return CDialog::OnMouseActivate(pDesktopWnd, MY\_nHitTest, message);
    
    //	Tell Wnd to ignore MA message.
    return MA\_ACTIVATEANDEAT;
    }
    

    void CPop::OnSysCommand(UINT nID, LPARAM lParam)
    {
    // The one and only way to close a child Pop without closing parent.

    if((0xfff0 & nID) == SC\_CLOSE)
    	{
    	OnClose();
    	}
    else
    	{
    	GetParent()->PostMessageW(WMU\_POP\_TO\_POPMAN\_CHILD\_M\_ACTIVE, (WPARAM)0, m\_ptoken);
    	//	Don't call base.
    	//CDialog::OnSysCommand(nID, lParam);
    	}
    }
    

    I saw a #define HTCLOSE in winuser but it is not listed in the docs for OnMouseActivate(). Of course I tried it but it is unreliable. Child acivation causes the parent to lose "currency" of previously activated children, a real pia. I would like to know a method for one-click closing an inactive child. Just point me to an article if there is one.

    Tadeusz Westawic Sum quid sum.

    C / C++ / MFC learning c++ performance

  • Find an algorithm
    T Tadeusz Westawic

    There are unanswered posts of my own that are months old and I would still appreciate any other point of view as long as it is mathematically valid and programmable. Are you saying my post is illegal? Take off that heavy badge once in a while. Tadeusz Westawic Sum quid sum.

    Algorithms algorithms debugging regex question learning

  • Find an algorithm
    T Tadeusz Westawic

    Is it simply the number of TRUE arguments passed? No TRUE args ==> FALSE even no of TRUE args ==> TRUE Otherwise ==> FALSE :confused: Tadeusz Westawic Sum quid sum.

    Algorithms algorithms debugging regex question learning

  • Simple Algebra
    T Tadeusz Westawic

    y = (1 - R) ^ (23 / 10) C'mon kid, crack that book. Tadeusz Westawic Sum quid sum.

    Algorithms tutorial

  • Interest Calculation (for Pensions Schemes)
    T Tadeusz Westawic

    Solve for December to get rid of P? Or sum the year? Or do I grossly misunderstand? Tadeusz Westawic Sum quid sum.

    Algorithms help question algorithms

  • TRUE == FALSE in GDI: Another rtfm?
    T Tadeusz Westawic

    This statement is going to one of my pgm docs. It's no big deal, I just want to know if anyone recalls a doc? I know I haven't run across one and this took a while to debug. Working with monochrome bitmaps and DCs introduces a surjective-only mapping of 32-bit COLORREF values onto 1-bit mono pixel values (as in FillSolidRect(), e.g.). Here is the map: 0x00000000 <= '0' <= 0x00000fff 0x00001000 <= '1' <= 0xfffff000 I don't know about adding more bitplanes to the bitmap. Tadeusz Westawic Sum quid sum.

    Graphics graphics debugging question

  • Freeing Selected BM from DC in GDI
    T Tadeusz Westawic

    That is a great answer; I now understand completely. Thank You Tadeusz Westawic Sum quid sum.

    Graphics graphics question announcement learning

  • Freeing Selected BM from DC in GDI
    T Tadeusz Westawic

    Yes, thank you, it is the way I used to do it. Let me ask this, then: what does the dc.SelectObject() doc (msdn) mean in explanation of return value, where it says about func may return ptr to temp object? That is the thing that scared me off the tried and true. Tadeusz Westawic Sum quid sum.

    Graphics graphics question announcement learning

  • Freeing Selected BM from DC in GDI
    T Tadeusz Westawic

    I have recently discovered that dc.SelectObject(&mybitmap); ... dc.SelectObject((CBitmap*)NULL); does not cause the release of mybitmap. What is the proper way to cause dc to release bitmap without assigning another "real" resource (return the dc to its freshly created state) so that another dc in another subroutine can select mybitmap? Tadeusz Westawic Sum quid sum.

    Graphics graphics question announcement learning

  • Counting set bits in bitmap
    T Tadeusz Westawic

    I think I have failed to impress the nature of the problem and the constraint that it be a bitmap. Too bad. There are very good links from aptroot. And his links may indeed take me away. Your supposition that the OR and AND at the top of a swim loop buy nothing is wrong. No one has yet suggested a CA solution. Oh yeah, my notion of "swim" came from feeding fish in a tank: if you sprinkle the food in a corner they all travel from random locations in the tank to the corner with the food. Tadeusz Westawic Sum quid sum.

    Algorithms graphics question

  • Counting set bits in bitmap
    T Tadeusz Westawic

    Yah, that's why its fuzzy and I call swim because the lower half now has to shift and try again, or something. I truly dk, this is one that I never mastered. I thought my post would generate interest but I hoped there might be someone else out there active with this sort of thing. More specifically, someone active in this particular forum who is doing the same nonsense I am. I notice here there dwell engineers, most sites are full of k-12 folks but my math is weak for formally describing what is going-on in my work. I have parallel rotate xforms for discrete 8x8x8 manifolds, parallel collision and collision detectors for the same but no bit counter. :(( Tadeusz Westawic Sum quid sum.

    Algorithms graphics question

  • Counting set bits in bitmap
    T Tadeusz Westawic

    What and why I count could be for any reason that yields meaningful results upon well-defined processing. Can you do parallel swimming adders? The generic term is 'collision counting' it is first related to 'collision detection'. Although the old raster arcade games employed these techniques extensively my work is not about games and accomodation in Windows is paltry; so lets say analysis where you want to count hits by vectors against a surface (in simplest form but my work is more mundane). So, this problem implies we have some loci in discrete 3-space: the surface under test, and one each also for each projectile path, lets say 16 path locii. Immediately map the discrete loci to congruent 2-space bitmaps, call the size (w x h). Actuate three new bitmaps bmSRC, bmTGT and bmRSLT each (16w x 16h). Tile bmSRC with 16 identical copies of the surface bm. Tile bmTGT as mosaic of the 16 paths. AND the bms into bmRSLT The number of bits set in bmRSLT represents the number of paths intersecting the surface. ****************************** That looks like I solved 16 sets of simultaneous equations in parallel but if one needs to know "WHERE?" the collisions occurred then one is in need of an algorithm. So one does not employ thes techniques if one needs to know "WHERE?", but when the yes/no answer to "IF" will suffice. You would also normally avoid "HOW MANY?", but in the case of a running model, one needs to benchmark and perform some "reality check" routines and count the actual number of bits to compare against a statistical projection. Blit happens. Tadeusz Westawic Sum quid sum.

    Algorithms graphics question

  • Counting set bits in bitmap
    T Tadeusz Westawic

    No, not that way, although you should not lose your idea, it is applicable elsewhere especially using "color" bitmaps. The room proctor wishes I explain myself so I have to go qualify for next level or some such. Patience, ****BEGIN EDIT Consider 1-dimensional bm 16 bits wide as {0011 1011 0100 0110} nb 8 bits are set OR low-order on high-order to get {0111 1111 dont care low-order 8 bits} nb 7 bits are set AND low on hi to get {0000 0010} nb 1 bit is set, the one missing from the OR The OR yields an undercount which is tallied by the AND. ****END EDIT Tadeusz Westawic Sum quid sum. -- Modified Thursday, June 24, 2010 4:40 PM

    Algorithms graphics question

  • Counting set bits in bitmap
    T Tadeusz Westawic

    OK. "Swim" is my term to describe the motion of the bits in the bitmap (my wheel unsticks as I write). In my actual code for other bitmap projects tricks are IN but only generic boolean blitting, no graphics languages per se but certainly take what a device interface gives. All need know are bm dims. "Swim" would blit the lower portion of bm against the upper in binary shrinking row count. Take OR blit to 'swim' all the bottom half bits to upper half bitmap. Take AND on same two bitmaps to preserve the bits that could not swim due to collision with bits already in upper half. . . Too fuzzy yet. Tadeusz Westawic Sum quid sum.

    Algorithms graphics question

  • Counting set bits in bitmap
    T Tadeusz Westawic

    Good links, thanks. All bitmaps are mono. I was thinking of taking the bits on a boolean swim to upper left of bm using bitblt()and then binary look for first zero row, etc. I don't have a swim algorihm though. Does that get anyone's wheels turning? *********START EDIT Um, assume theoretical mono bitmaps so we avoid platform dependency and speed discussion. I can always xlate to MS at code time. *********END EDIT Tadeusz Westawic Sum quid sum. -- Modified Thursday, June 24, 2010 12:28 PM

    Algorithms graphics question

  • Counting set bits in bitmap
    T Tadeusz Westawic

    Any known methods here for counting the number of 'ON' bits in a bitmap? Tadeusz Westawic Sum quid sum.

    Algorithms graphics question

  • algorithm to get each individual digit from a decimal number (integer)
    T Tadeusz Westawic

    int source int digit while source { digit = source % 10 output digit source /= 10 } get u started Tadeusz Westawic Sum quid sum.

    Algorithms algorithms help tutorial

  • hex calculator
    T Tadeusz Westawic

    new sig Tadeusz Westawic Caveat juris excretorium.

    Algorithms question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups