|
Thanks for replying
I think your idea is right in some ways.
Indeed, a good software developer can solve many problems.
But, the more programming languages he masters, the more problems he can solve. So, in this way, the idea that "the more languages, the better" seemes to be right.
Can you still hold your opinion?
|
|
|
|
|
It is right in all ways.
What pisses me off is job specs that list the source controll SW they use! As if that is important!
What makes a good product is good architecture, good design. Everything else after that is just implementation. Use the tools you need, beit VB, C#, C, and if you dont know the tools then read up and start coding. Soon enough you will know them well enough to write a great project.
Oh, and most of the fancy features of a language are useless. They are juct mental bling, and do not add one jot of usability to the project.
Look, as a mechanical engineer are you expected to revel in the interface of a particular milling machine?
No, you design the product and use what ever milling mechine is to hand. Period.
==============================
Nothing to say.
|
|
|
|
|
Besides what's already been said, to flip this around, I've grown quite skeptical of developers who know lots of languages and platforms and claim mastery in many of them. My own observation is that it takes 5 to 7 years to become an expert at anything. There are exceptions, like Marc Clifton, but they are exceptions. (To be fair, too many companies don't care--regardless of what they say, "good enough" is their actual standard of quality.)
|
|
|
|
|
Joe Woodbury wrote: platforms
That is the key, not the laguage, but the space you work in. It can take many many years to know it well, and of course in this I include technologies too.
Take networking. Is it more important to know C++ or know TCP/IP?
Nuf said I think.
==============================
Nothing to say.
|
|
|
|
|
I always found it very refreshing to learn and know multiple programming languages. I've found that broadening my horizons that way can give me unique insights or alternative looks on coding, which can be helpful and enjoyable.
I'd say it also makes communication easier with other programmers, as they might not be proficient in the same languages as you; a broader view of the coding landscape can help.
Also, just because one knows multiple languages this doesn't prohibit you from mastering one. It can even help in this regard, as more knowledge is always welcome.
That said, I do not believe that just because one only knows one language this means that they are more limited than those who know multiple. As has been noted in this topic by others, it's also very important to be able to tackle problems from multiple angles, regardless of the language.
All in all, I'd argue that a change of scenery is a good thing, and that it can never hurt to broaden your view. It can also be a lot of fun to learn a new language, and you don't have to go as far as mastering it.
My best programming experience, the most fun I ever had, was learning Common Lisp (I started in VB6 and C++). Has this made me a better programmer? I'd like to think so, if only because I better recognise the strengths and limits of the various languages and platforms out there.
|
|
|
|
|
Thanks for your view~
It's really helpful. Maybe learning a new coding skill can be as much fun as it can provide~
|
|
|
|
|
|
I have Microsoft Visual C++ 2008 and Windows 8. Please how can I make an existing project compile into static mode (not dynamic mode), so that variables and malloc()'ed storage stay in the same place through a run of a program?
A program which compiled and ran correctly under Windows Vista now acts odd as if declared variables and/or malloc()'ed storage sometimes move about.
|
|
|
|
|
Chances are there is a bug in your code, but without more information we cannot beging to guess what or where.
Use the best guess
|
|
|
|
|
The affected program text was writing to a .BMP graphics file.
It used fopen() and fwrite(), and it acted odd. (It always behaved correctly under Windows Vista; I now have Windows 8.).
Just now I changed it to using _sopen_s() and _write(), and FOR NOW it seems to be behaving correctly.
The text that writes to the .BMP file is now this:-
if(_sopen_s(&fil,out,_O_RDWR|_O_CREAT|_O_BINARY, _SH_DENYNO, _S_IREAD|_S_IWRITE)) {
M="I can't open this file"; goto BAD;}
for(i=0;i<256;i++) {BM[54+i*4]=BM[54+i*4+1]=BM[54+i*4+2]=(char)i; BM[54+i*4+3]=0;} /* palettes */
BM[0]='B'; BM[1]='M'; *((long*)(BM+2))=(54+1024+ly*lxx)&0x7fffffff; /* file size */
BM[6]=BM[7]=BM[8]=BM[9]=0;
BM[10]=54; BM[11]=4; BM[12]=BM[13]=0; /* 54+1024 = data offset, little-endian */
BM[14]=40; BM[15]=BM[16]=BM[17]=0;
*((long*)(BM+18))=lx; *((long*)(BM+22))=ly; /* image size */ BM[26]=1; BM[27]=0; /* nplanes*/
BM[28]=8; BM[29]=0; /* bpp */
BM[30]=BM[31]=BM[32]=BM[33]=0; /* no compression */
*((long*)(BM+34))=ly*lxx; /* image size */
BM[38]=100; BM[39]=BM[40]=BM[41]=0; BM[42]=100; BM[43]=BM[44]=BM[45]=0; /* resolution/inch */
BM[46]=0; BM[47]=1; BM[48]=BM[49]=BM[50]=0; BM[51]=1; BM[52]=BM[53]=0; /* 256 = ncolors'es */
BM[5]&=0x7f; _write(fil,BM,54+1024); _write(fil,D,ly*lxx); _close(fil);
sprintf(BM,"I have created this texture map file, it should have %d bytes",54+1024+ly*lxx);
MessageBox(wn,out,BM,MB_OK); BAD: FF(D); FF(DI); goto DEF;}
modified 16-May-13 6:02am.
|
|
|
|
|
That should make no difference, since all you are doing is opening the file with sharing enabled. This has nothing to do with your variables getting corrupted in memory. The fact that it works now, is more luck than judgement. And given all the index values to your arrays, it's highly likely that you are overruning or otherwis writing in the wrong place in your buffer.
BTW it makes it much easier for us to read your code if you format your code with proper indents, and place it between <pre> tags, like:
if(_sopen_s(&fil,out,_O_RDWR|_O_CREAT|_O_BINARY, _SH_DENYNO, _S_IREAD|_S_IWRITE))
{
M="I can't open this file";
goto BAD;
}
for(i = 0; i < 256; i++)
{
BM[54+i*4] = BM[54+i*4+1] = BM[54+i*4+2] = (char)i;
BM[54+i*4+3] = 0;
}
Use the best guess
|
|
|
|
|
Anthony Appleyard wrote: and malloc()'ed storage stay in the same place through a run of a program?
I doubt that concept even exists in Vista although if you can educate me otherwise I would like to see something about it. Specifically what options you set in the compiler to get it to do that.
Excluding perhaps some of the most basic parts of the OS and perhaps, only perhaps, so very low level drivers everything else is relocatable because that is how virtual memory works. I suppose there might be a way to change the relocation address or whatever it is called and then if one uses no threads and fixed input data then one run to the next would map the same. But it still can move in physical memory when it runs.
|
|
|
|
|
hello,
I tried googling for an algorithm to compress/encrypt a shor fixed size string from 52 characters down to 40 but can't seem to find any.
Target strings are random alphanumeric [A-Z0-9]
e.g "M5KS07VHN2X42JCY1PFHE1ZZGI2XUBDFAKQBEPFB7CH4SECXHJXL"
I have tried huffman and smaz (https://github.com/antirez/smaz") and both inflated to size of the original string.
Does anyone know a good algorith for such purpose?
Thanks,
|
|
|
|
|
The characters in the given range are hex 0x30 to 0x5A. When subtracting 0x30, you will get a range from 0 to 0x2A which can be represented by 6 bits (there is also space for handling null when subtracting 0x29). The range can be additionally reduced by subtracting different values for digits and letters. When using 6 bits, you can compress the data to 52 / 8 * 6 = 39 byte. All you have to do is subtracting the offset from each character and shifting the 6 bits into your output buffer.
|
|
|
|
|
Try LZ4 (http://code.google.com/p/lz4/[^]). It's great, though I don't know how much it would help you since that's a very short string and not very compressible as is.
|
|
|
|
|
If your input characters are all 0-127 ASCII, you could store 9 characters in 8 bytes. It only amounts to about a 12.5% savings (which does not meet your requirement), but it's easy enough to code up.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I was just wondering, but have you made any progress with this?
|
|
|
|
|
yes. the answer is base64. (since all characters are alphanumeric, they can be encoded in 6 bits instead of 8)
btw, thank you all for your answers.
|
|
|
|
|
I want to check the checkboxes in a CLIstCtrl object, on a CDialog based application:
void CTestListCtrlDlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
if(0 <= pNMListView->iItem)
m_List.SetCheck(pNMListView->iItem, TRUE);
*pResult = 0;
}
when I made a click on a list item, the checkbox of the clicked item will check, but when I try to check the checkbox from check box itself (made a click inside of checkbox), it does not check it ... why ? It will be checked only from a double-click ... what I'm doing wrong ?
|
|
|
|
|
The list control handles clicks on the check box itself. Whenever a click on the box occurs, the check is toggled. When now clicking on a check box, your handler will set the check and the default handler which is called afterwards will toggle the check so that it is removed. This can be verified when you click on a marked check box: The check marker disappears.
The solution would be to do nothing in your handler when clicking on the box. To determine the width of the check box, use ImageList_GetIconSize passing the image list returned by GetImageList(LVSIL_STATE) . The check box itself is drawn with some spacing so that it may be necessary to add some pixels to the width.
|
|
|
|
|
But I am already do nothing in checking box handler ... or not ? The only method that I had used is:
void CTestListCtrlDlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
if(0 <= pNMListView->iItem)
m_List.SetCheck(pNMListView->iItem, TRUE);
*pResult = 0;
}
is the only thing that I treat it ...
|
|
|
|
|
You are setting the check marker when clicking on a row. That is more than nothing.
I will try to explain in more detail what happens:
When you click on a row right of a check box:
Your handler is called and sets the check.
When you click on a check box:
Your handler is called and sets the check and then the internal check box click handler is called and toggles the check.
What I mean with do nothing: When clicking on the check box, your handler should not set the check.
|
|
|
|
|
Yes, I understand now ... I'm getting harder ... thanks ! You are trying to say that when I click on checkbox (inside of checkbox) I will do nothing ... remain the question, how can I know if I had click inside of checkbox, or not ? I will start digging ....
|
|
|
|
|
The passed struct to the click handler is of type NMITEMACTIVATE . This struct contains the ptAction member indicating where the click occurs. You must check if the x position is right of the check box (see my first answer on how to determine the width of the check box). As far as I remember, the width is 13 pixels by default. But there is also some spacing between the left border and the check box. To make it more complicat, you must also check if the list is scrolled horizontically.
|
|
|
|
|
I think that I had solved :
void CTestListCtrlDlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
const CPoint pt = pNMListView->ptAction;
const BOOL bCurrentCheckState = m_List.GetCheck(pNMListView->iItem);
if(0 <= pNMListView->iItem && 15 < pt.x)
m_List.SetCheck(pNMListView->iItem, ! bCurrentCheckState);
*pResult = 0;
}
I don't know if is OK, but seems to work ...
|
|
|
|