I will agree with you that Linux is much harder to setup than Windows, but its because it appeals to a different crowd. If Linux were designed for Grandma's everywhere, then it would be as easy to install as Windows. I think Fedora does a good job, every time I've set it up I've had few problems. I use Gentoo on my machines however. Once you get linux setup, I perfer it much more to Windows. There are no CD's to find, install, you just download the latest version from the internet via a simple command (emerge program_name). You can update your whole collection in one command and you get free software that rivials products for Windows. Linux is great for development too, I think the IDE is good, not quite all of the features of VS.NET, but most places are still using VS98, which Kdevelop easily beats. Plus there are so many available libraries and programs to build your code more quickly. You look on this site and you will see lots of SMTP code... not needed on Linux, just use sendmail. Linux runs much faster than Windows (except for some bloated distros like Fedora, my kernel is 2 mb in Gentoo vs 66 mb in Fedora), especially once you get your spyware and oversized registry on there. On best thing about Linux though, is the Wireless support. It is a pain in the ass to setup, but once you set it up it works. Unlike my Windows XP which would randomly connect distant access points it couldn't get any reception to and then kill my internet leaving my trying reconfigure for my old access point. In Linux I just tell is my essid and it connects and stays connected. Plus I don't have the anoying hiss on my portable phones that Windows XP causes when it randomly searches for weaker access points. Another great thing is how modular it is. In KDE every program uses KIOSlaves for reading. Which means ANY kde program can open files directly off of FTP sites, webdav, etc. Which makes it great for editing, and you can use your favourite editor not some crappy program you live with because of one feature. One that sticks out in my head is how Interdev has replace in files support and MSDEV does not. I have opened Interdev to get this feature for C++ projects enough times! Oh and I don't have to talk to some stupid dog everytime I want to search. And when I say don't save my password, it uh.. doesn't save my password *cough*msn*cough*.
mwilliamson
Posts
-
My 3rd Linux experience -
Is there a way to allocate memory, where you can increase the size, without losing information?No. But you can do this: unsigned int size; int* array; for( int i = 0;i < 10;i++ ) { int* temp = array; size++; array = new int[size]; memcpy( array, temp, sizeof(int) * (size-1) ); delete[] temp; }
-
MPEG Tool?Theres on called DVTool or something like that. You may want to search for an MPEG Splitter.
-
Importing Text Files into SQLServerYou might want to use DTS (distributed transaction server) to do a bulk insert from your file. You can even set DTS to run at a later point in time too. Check the SQL Server documentation, I don't remember exactly how DTS works, but there is a VBScript object for it.
-
AutoNumber field limitIts the limit of a long interger, roughly 2 billion. I would be interested to know what happens when it hits the max too :)
-
Delete records after certain periodDELETE FROM temp WHERE created <= DATEADD( h, CURDATE(), -3); This will work for SQL Server, but I'm not sure about MySQL. Give it a shot :)
-
Erotic IE Toolbar ButtonJust click, then you won't have to resist anymore :)
-
New Spam TrickThats not a new trick, thats someone trying to spam on your behalf. I have actually got emails to myself using my own account! Unfortunately, if your email is anywhere on a site indexed by search engines, you are a huge target for spam :(
-
Outlook help pls.View | Customize Current View gives you many more options.
-
Filling out other application dialogsYou will to determine the window id of all the windows on the dialog you want to fill out and a handle to window you are filling out. Then simply use ::SetDlgItemText( hWnd, WindowId, "value" ); There was a password retival tool posted here, some of the code from it should help you to determine the window ids.
-
PrintDlgEx, Visual C++ 6.0, and the Platform SDKSorry, my mistake. From CommDlg.h: #if(WINVER >= 0x0500) // // PrintDlgEx structure. // typedef struct tagPDEXA { DWORD lStructSize; // size of structure in bytes HWND hwndOwner; // caller's window handle HGLOBAL hDevMode; // handle to DevMode HGLOBAL hDevNames; // handle to DevNames HDC hDC; // printer DC/IC or NULL DWORD Flags; // PD_ flags DWORD Flags2; // reserved DWORD ExclusionFlags; // items to exclude from driver pages DWORD nPageRanges; // number of page ranges DWORD nMaxPageRanges; // max number of page ranges LPPRINTPAGERANGE lpPageRanges; // array of page ranges DWORD nMinPage; // min page number DWORD nMaxPage; // max page number DWORD nCopies; // number of copies HINSTANCE hInstance; // instance handle LPCSTR lpPrintTemplateName; // template name for app specific area LPUNKNOWN lpCallback; // app callback interface DWORD nPropertyPages; // number of app property pages in lphPropertyPages HPROPSHEETPAGE *lphPropertyPages; // array of app property page handles DWORD nStartPage; // start page id DWORD dwResultAction; // result action if S_OK is returned } PRINTDLGEXA, *LPPRINTDLGEXA; #endif That means you need to define WINVER at 0x0500 before including Windows.h or CommDlg.h.
-
Dealing with Duplicate RecordsThe simple way to solve your problem is to run DELETE * FROM Table WHERE sUserName = 'whatever' INSERT INTO Table (...) VALUES (...) every time. This way you will have no dupes. You can also make a sorted procedure like IF EXISTS( SELECT * FROM Table WHERE sUserName = 'whatever' ) THEN UPDATE Table SET .... ELSE INSERT INTO Table (...) VALUES (...) END
-
Automate registering a DSNHeres some code I have been using: // Create ODBC Datasource //////////////////////////////////////////////// char szConfig[256] = ""; sprintf(szConfig, "DSN=MyDSN\0Description=My Description\0DBQ=%s\0UID=Admin\0\0", m_sDatabasePath); SQLConfigDataSource(NULL, ODBC_ADD_DSN, "Microsoft Access Driver (*.mdb)\0", szConfig ); ////////////////////////////////////////////////////////////////////////// You might need to modify it slightly for SQL Server. I just run this in InitInstace, there is no need to check if it exists since it will just be overwritten if it does.
-
Application Error only on some computersLet drwatson write the log and then you can use it to find your problem. C:\Documents and Settings\All Users\Documents\DrWatson\drwtsn32.log. Goto the last crash, and it will tell you the call stack around the crash. You will see fault in the margin for the line on which it crashed. Hopefully you will have enough information to trace it back to a line in your source. If not, build your release with debug information. Then let it crash, you should now see what function caused the crash and in what windows function. You might want to do this off the bat because drwatson is usually hard to read.
-
PrintDlgEx, Visual C++ 6.0, and the Platform SDKYou must define _WIN_NT 0x500 in stdafx before you include the common dialog files. This means that your application will only run on windows 2000 / xp (which is when printdlgex as added).
-
GetMailslotInfo returns incorrect lpMessageCountI've got a program that uses mail slots. My problem is that when I send a mail message to the local machine the message is recieved twice. I have narrowed this down to my sending code by changing it to send to the microsoft messenger service. The messeneger service recieves the message twice too. However, it I use net send to send the message it is only recieved once. I think net send uses the NetMessageBufferSend function, but I should still only recieve once. If I send to a remote machine with the same code, it is only recieved once. I have tested it on two machines and both have the problem. My code to send is as follows: { int nResult; HANDLE pHandle; DWORD dwBytesSent; CString strMailslotName; strMailslotName = _T("\\\\"); strMailslotName += m_sComputerName; strMailslotName += _T("\\mailslot\\messngr"); pHandle = CreateFile( strMailslotName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if( pHandle == INVALID_HANDLE_VALUE ) { AfxMessageBox("Error accessing mail slot \"" + strMailslotName + "\""); CloseHandle( pHandle ); return; } else { nResult = WriteFile( pHandle, strMsgText, ( DWORD )strMsgText.GetLength(), &dwBytesSent, NULL ); if( nResult == 0 || ( DWORD )strMsgText.GetLength() != dwBytesSent ) { CString Error; LPVOID lpMsgBuf; if (!::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL )) { AfxMessageBox("An unknown error occured."); } else { Error = "Error writing to mailslot: "; Error += (LPCTSTR)lpMsgBuf; AfxMessageBox(Error); } LocalFree( lpMsgBuf ); } } CloseHandle( pHandle ); } Any ideas whats wrong with this? I don't see how it could be sending two messages. m_sComputerName is the local computer's name. Thanks for you help!