I was thinking about the offer to buy VisualStudio.Net here on CodeProject and it got me to thinking that there has to be other ways for us to help support CodeProject (Alot of us do not purchase our own copies of VisualStudio, it comes thru the company, and many probably are not in position to afford it) Here are some suggestions that may allow us who use CodeProject to help support it. These ideas came from seeing how variuos 'bloggers' try to make some money off of their writings. 1. Add a simple "tip jar". I know I've used articles/code from CodeProject and these items have saved me many hours of work (time == money). If there was a mechanism in place like a tip jar to donate a small amount of money, I would toss in a bit- even if people gave 1 or 2 bucks for code they used in their products. It would generate some revenue. 2. Add a link to Amazon and work out a deal with them that CodeProject gets a % of the sales (Andrew Sullivan- www.andrewsullivan.com - has a book club where people buy books thru Amazon and he gets a cut- I think anywhere from 5-15% - not only on the books but also on any other items they may purchase). I buy a fair number of books and I would certainly click thru CodeProject - I would then be helping this site to raise revenue and it would seemingly cost me nothing. I'm sure many others would be willing to do the same. I think the trick is to not make it obtrusive - Things like "Hey here's a tip jar why don't you give me some money". A simple link with a jar and another link to Amazon (or whereever). Just some thoughts. Mike
MikeG 0
Posts
-
Suggestions t o help support CodeProject -
Metafiles (Scaling and Offseting)Is there a trick to get the function SetViewportOrgEx to work with a metafile? I am creating a metafile in memory (MapMode is MM_ANISOTROPIC), then I am loading metafiles (WMF) off disk an using PlayMetaFile to play the loaded metafile into the new metafile (I am essentially creating 1 metafile from a combination of parts for a detail drawing). The problem is I need to place the loaded metafiles in various locations however I do not seem to be able to get the xy offset to move, although I have been able to scale the images using ScaleViewportExtEx. I have tried to convert the WMF files to Enhanced metafiles (EMF) - In memory then using then using the Enhanced metafile functions - I haven't had any luck this way either. Any suggestions?
-
How much should I charge?I have done it both ways and they both have they're advantages. When I was working full time and took on a side project I charged a "flat fee". I figured the project would take about 180 hours and I didn't actucally need to deliver the finished product for 9 months (they were expecting a "beta" around 6 months). This worked out well because I had alot of time and I could work on it at MY CONVIENENCE- it didn't interfere with my fulltime job and I didn't need to kill myself by working long hours at home after long hours at the office. A few learned suggestions for this method: 1) Get everything in writing. 2) Put a project plan together that includes milestones and deliverables. Make sure that you agree on a procedure for large scale changes/redisgns that may affect your time estimates/delivery dates. 3) Setup a payment schedule- Collect a % of the money at each milestone or at major points (i.e 25% at each of 4 points etc). I would shoot for at least 75% of the money collected BEFORE final delivery and 100% at delivery of final product. Do not turn over source code until final payment is made. 4) At each milestone, make sure you get your customer to "sign-off" on the items. Have a meeting at each review to discuss progress and make sure you are all still on the same page. Use your judgement on requested changes- if they're small and don't have impact on the schedule go ahead and do it (build good will with the customer; alot of little things are easy and customers appreciate them). If they're major changes and you designed it based on a spec- you will have an easier time getting more money if more time is involved. 5) Consider charging for the project plan- this will take many hours and will also demonstrate that you are serious about the plan. If you think the client will not go for this, show it as a discount on the total project (i.e. Total project amout $6500: $7500 base cost - $1000 for project plan - of course you already figured in extra hours for the project plan) The nice thing about doing this is that you get a decent sum of money up front early in the project- this can be spent on expenses to help with the project- hardware upgrade, software- and you don't need to worry about dipping into your own money. It also gives you a good sense as to what to expect with payments- Are they quick to pay out, do you wait weeks to get a PO only to submit it back to the company to wait another 2 weeks to get a check, etc... (if they screw around this early in a project when it comes
-
APS Camera, your opinionI recently purchase (past month) a Minolta 150EX QD Panoramic camera and have had good success. The pictures have come out very well. It was a tossup between this and the Nikon 140 ED/QD. My sister has the Nikon and it takes excellent pictures. I chose the Minolta because of a good discount. Both sell for about $250.00 in the US. [Update] Woops I missed your price request- This is a little closer to your cost but still over. I also considered the Minolta 125 and Nikon 120. Both were equivalent to the ones mentioned above but less zoom capability (I don't think the Minolta 125 has Panoramic mode). These ones were around $200.00. Mike
-
CreateThread vs. _beginthreadexI've used bounds checker only on a limited basis. (picked it up in the development pack with SoftICE and DriverWorks/vtoolsd) Never actually compared it against other debugging products. Mike
-
CreateThread vs. _beginthreadexFrom what I've seen/remember, _beginthreadex is the proper call. Bounds Checker used to flag warnings about resources not being freed with CreateThread (something to do with the runtime libraries) and I believe this is where this issue arises from. I ran into and read this a few years ago- I've been using _beginthreadex since. Mike
-
Real-time programming: which OSI would agree with this suggestion. I have seen this successfully implemented in complex situations that require determinism. Given your time constraints (from the sound of the project, I don't think it will add a significant amount of $$ to the total cost), this will probably be the best route. Mike
-
Rebuilding the WTCThis describes what happened. http://www.theregister.co.uk/content/57/21641.html Mike
-
Installation Wizards / ProgramsI would go with Wise. I have used both and Wise wins hand down. Mike
-
How to get the com-GUID directly from its dll or exe fileThis assumes you know the ProgID Mike { ISomeObject *pISomeObject = NULL; CLSID clsid = {0}; HRESULT hr; ... // // Create some object CLSIDFromProgID( L"SomeObjectProgID", &clsid ); hr = CoCreateInstance( clsid, NULL, CLSCTX_ALL, __uuidof(ISomeObject), (void **) &pISomeObject ); ... }
-
deleteI generally use the following macro (the idea originally came from a COM/OLE book 3-4yrs ago): #define DELETE_POINTER( p ) \ { \ if( p != NULL ) { \ delete p; \ } \ p = NULL; \ } So my code is: fx() { CSomeObj pSomeObj = new CSomePbj(); ... DELETE_POINTER( pSomeObj ); } The macro could easily be updated to include a try,catch block around the delete. If your using MFC you can throw in ASSERT_VALID like the other poster suggested. Or if your not using MFC you can lift the code from the MFC Source to determine if the pointer is valid (validadd.cpp, function AfxIsValidAddress) Mike
-
Get tree itemI think you are thinking about it backwards. It is probably easier to add your data to the TreeView items. You can accomplist this by using the lParam in the TVITEM. Whenever an item is selected, handle the TVN_SELCHANGED message for your treeview and retrieve the data and modify accordingly. Mike Some Code follows: HTREEITEM tvAddItem( HTREEITEM hParent, LPSTR szText, HTREEITEM hInsAfter, int iImage, LPVOID pvData ) // pvData would just be your MyStruct * { HTREEITEM hItem; TVITEM tvI = {0}; TVINSERTSTRUCT tvIns = {0}; // The pszText, iImage, and iSelectedImage members are filled out. // make sure we set the flag for TVIF_PARAM if( iImage == -1 ) { tvI.mask = TVIF_TEXT | TVIF_PARAM; } else { tvI.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; } tvI.pszText = szText; tvI.cchTextMax = lstrlen (szText); tvI.iImage = iImage; tvI.iSelectedImage = iImage; tvI.lParam = (LPARAM) pvData; tvIns.item = tvI; tvIns.hInsertAfter = hInsAfter; tvIns.hParent = hParent; // Insert the item into the tree. hItem = TreeView_InsertItem( iv_ctlTreeView.m_hWnd, &tvIns ); return( hItem ); } // update the data from the TreeView in the SELCHANGED event // selchange WM_NOTIFY, TVN_SELCHANGED LPNMTREEVIEW pnTree = (LPNMTREEVIEW) lParam; MyStruct *pMyStruct; pMyStruct = (MyStruct *) pnTree->itemNew.lParam;
-
Dynamic creation of objectsMake your objects COM objects. This way you can look them up based on the ProgID. CLSIDFromProgID( L"ClassName", &clsid ); hr = CoCreateInstance( clsid, NULL, CLSCTX_ALL, __uuidof(IClass), (void **) &pIClass ); This has the benefit of not needing to do some big if statement and adding a new string every time a new class is added. Mike
-
3D to 2D TransformationI'm trying to convert a series of 3D points (XYZ) to a 2D (XY) surface. In my application a series of lines run along the axes (think of pipes fitted together with elbows, tees, and crosses), they are 90 deg to each other. I simply do the following to map my XYZ points to the YZ plane: xp = (z + x * COS_45); yp = (y + x * SIN_45); This is not quite right. When drawn on a metafile, lines in the Z direction run Parallel to bottom edge, they should actually be at 30 deg. I can see that I need to get an x and y added value from the z-component, however I haven't had much luck. A simple set of points: (0,0,0) (20,0,0) (20,20,0) (20,20,20) (40,20,20) Does anyone have the appropriate transformation/formula that I should use? Or good place to look? (I was trying to avoid matrices and doing some type of world to eye to screen transform - it seems it should be easier, since all my lines are at 90's) Thanks Mike
-
DLL memory AllocationYou wouldn't need to keep a list of anything. s = CreateXXX(); ... DestroyXXX( s ); The functions would be something like this: char *CreateXXX() { return new char[20]; } /// //I would actually Code CreateXXX as follows //ERRCODE CreateXXX( char **s ) //{ // *s = new char[20]; // return NOERR; ///} ERRCODE DestroyXXX( char *s ) { delete s[]; }
-
DLL memory AllocationI usually go a different route in this case. I generally add 2 functions: a CreateXXX and a DestroyXXX. The Create does the allocation and destroy frees the memory. This has the following side benefit: usually you are not simply allocating a block of memory, you are setting up other things like access to ports, hw resources, etc. When it comes time to free the memory, you usually have to cleanup other stuff, so why not do it all in one spot and the end user doesn't have to worry about the details. Mike
-
STL: How can I delete a <list>...****From answer in C++ section**** To clear the whole list: list.erase( list.begin(), list.end() ); To delete a single item: // iter is the iterator of the item you want to delete // iter = list.begin(); // 1st item in list // iter = &(list.at(iIndex)); //iItem in lsi list.erase( iter ); Hope this helps Mike
-
STL: How can I delete a <list>...To clear the whole list: list.erase( list.begin(), list.end() ); To delete a single item: // iter is the iterator of the item you want to delete // iter = list.begin(); // 1st item in list // iter = &(list.at(iIndex)); //iItem in lsi list.erase( iter ); Hope this helps Mike
-
CreateEnhMetafile (EMF) and WMFI have the following problem: I am creating an Enhanced metafile using OpenGL and then trying to convert it to a metafile (WMF). Right now I have to do the following: HDC hDCEnhMetaFile = CreateEnhMetaFile(.."myfile.emf"); ...do my drawing... CloseEnhMetaFile(hDCEnhMetaFile); ... HENHMETAFILE hEnhMetafile = GetEnhMetafile( "myfile.emf") GetWinMetafileBits( hEnhMetafile, pBuffer, numBytes ); HMETAFILE hMemMetafile = GetMetafile() hMemWinMetaFile = SetMetaFileBitsEx( numBytes, pBuffer ) hFileWinMetaFile = CopyMetaFile(hMemWinMetaFile, "myfile.wmf") DeleteMetaFile( hFileWinMetaFile ) DeleteMetaFile(hMemWinMetaFile ) DeleteEnhMetaFile( hEnhMetaFile ) I do NOT want to actually create an EMF file. The problem is the CreateEnhMetafile function returns an HDC not HENHMETAFILE which is required for GetWinMetafileBits - I tried to just cast the HDC to an HENHMETAFILE but this doesn't seem to work (invalid parameter error). Is there someway to get the HENHMETAFILE from an HDC? Any example code out there (I can't find anything)? Thanks Mike