Archive for April, 2005
My wife reminded me… “So we must listen very carefully to the truth we have heard, or we may drift away from it.” (Hebrews 2:1 NLT)
Funny enough, I was thinking about that this morning while I brushed my teeth. Even though I know that my doubts about an upcoming step were clearly addressed a few weeks ago, they creep back. Only remembering that He put doubt to rest at that time remains to keep me from doubting now. The feeling of reassurance fades, but the certainty that it was given remains and is sufficient.
April 29 2005 | Jesus Stuff | No Comments »
I am having a difficult time reconciling the concept of desolation as a tool in God’s hands and the promise of Jesus that we will never thirst. On the one hand, experience and the word of people who testify in words and in love that they are disciples of Jesus Christ speak of desolation as a valuable, and perhaps necessary, experience. On the other hand, the testimony of this same Jesus.
I know that the classical writers (John of the Cross), experienced periods of desolation and describe them as part of the maturation process. Zaleski reference Mother Teresa’s fifty years of spiritual darkness. Teresa of Avila says that dryness and desolation of spirit may be better signs of progress than sweetness. Therese of Lisieux wrote “Do not believe I am swimming in consolations…my consolation is to have none on earth.” Jesus himself cried out in anguish at having been forsaken by His Father.
But Jesus said “…whoever drinks of the water that I give him shall never thirst…” (John 4:14) and “…he who comes to Me will never hunger, and he who believes in Me will never thirst.” (John 6:35). Furthermore, Jesus says “If you abide in Me, and My words abide in you, ask whatever you wish and it will be done for you.” (John 15:7).
I do not know how to reconcile this. Perhaps I misunderstand either the words of Jesus or of His followers (hrm… could be a translation issue… maybe suffer from thirst versus feeling thirsty?). Perhaps those who speak of desolation neglected to seek His presence or grieved His spirit in some way. Or, perhaps, having been in intimate contact with the the unbearable glory of God, everything else pales to such a degree that it can only be comprehended as darkness.
I need to read more about this (starting Ascent of Mount Carmel now) and welcome comments.
April 29 2005 | Jesus Stuff | 1 Comment »
Jesus tells us to love our neighbor as ourself (Mark 12:31) and to love one another the way He loved us (John 13:34). How did He love us? More than Himself.
Jesus declares that our neighbor is not only those who share our faith, race, or class, but also as everyone who needs our help. This command to love one another as ourself is not merely a philosophical ideal. When the crowd asked John the Baptist what they should do, he gave very practical advice: if we have food or more clothes than we can wear at one time, we should share that with someone who has none. Our command is not only that we avoid cause harm, but also that we treat others as we would like to be treated. This is not merely one of the “cause no harm” standards that are so popular in our selfish culture; this is a “do good” standard, and it applies to everyone we touch.
Love between believers is so important that Jesus declares that it is the identifying characteristic of His disciples. Not our words, even when they are good, and not prophetic utterances or miracles in His name, but our love for the body of Christ. Paul encourages us to not only look out for our own interests, but also for the interests of others. That is a good starting point, but only takes us to the point of loving others as much as ourself. In Jesus, we see an example of loving more. I love how the New Living Translation captures this so well… “He made himself nothing“. By both word and action, Jesus taught that there is no greater love than to lay down our life for our friends. Paul punctuates the point when he instructs the Philippians to consider each other more important than themselves.
Jesus declared that we are his friends if we obey his commandments. If we are obeying His commandments then we are loving our neighbor as much as ourself. If we identify so closely with Jesus that His friends are our friends then we are laying down our life for the body of Christ. How serious are we about loving when it isn’t convenient, and when it is perhaps even painful?
Priorities Index
April 25 2005 | Jesus Stuff | No Comments »
RegEnumKeyEx seems simple enough. Open the parent key, call RegEnumKeyEx specifying dwIndex=0, then increment dwIndex and call RegEnumKeyEx until you get ERROR_NO_MORE_ITEMS.
There are, however, two caveats in the documentation that are easy to overlook.
Did you notice that the documentation says “Because subkeys are not ordered, any new subkey will have an arbitrary index. This means that the function may return subkeys in any order”? That’s not so bad; we don’t generally need subkeys in any particular order.
Did also you scroll down far enough to catch the caveat “While an application is using the RegEnumKeyEx function, it should not make calls to any registration functions that might change the key being enumerated”? Ohh… now that is annoying. If we’re reading only, things aren’t too bad; the odds of another process or thread getting in our way are pretty slim. It could be unpleasant if another thread or process mucks with one of “our” key’s subkeys. (I haven’t confirmed this… there may be magic that stops a subkey from being deleted while the parent is being enumerated, but I’m only aware of “open” keys being protected.) If we want to delete subkeys, this becomes important.
Say we have this…
HKLM\SOFTWARE\Test
HKLM\SOFTWARE\Test\Sub1\\Data=”Good”
HKLM\SOFTWARE\Test\Sub2\\Data=”Bad”
HKLM\SOFTWARE\Test\Sub3\\Data=”Good”
HKLM\SOFTWARE\Test\Sub4\\Data=”Bad”
And we want to remove all of the Subkeys of HKLM\SOFTWARE\Test that have the string “Bad” in the REG_SZ value “Data”.
We RegOpenKeyEx HKLM\SOFTWARE\Test with KEY_ALL_ACCESS|DELETE rights and use the handle to the open key to start enumerating happily along. We get to Sub2, and realize that it needs to be deleted. Easy enough, call RegDeleteKeyEx(hKey, _T(”Sub2″), KEY_WOW64_32KEY, 0), and continue iterating. Uh oh…
Sometimes we get lucky, but this is where the combination of “the function may return subkeys in any order” and we “should not make calls to any registration functions that might change the key being enumerated” becomes important. The key returned by the next call to RegEnumKeyEx may be the next key in the list, but it is just as likely that we will skip a key or even get the name of the key that we just deleted.
So, to enumerate and delete some subkeys, here are two options.
1. As soon as you find a key that needs to be deleted, set dwIndex back to 0 and re-enumerate all of the subkeys. This is lame and inefficient, but it may also be the best solution in some cases.
2. Build a list of the subkeys that need to be deleted while enumerating, then iterate through that list and delete each subkey by name.
Not rocket science, clearly documented, but still annoying and easy to overlook.
April 22 2005 | Geek Stuff | No Comments »
Here’s a quick introduction to HRESULTS and Win32 Error Codes. There are essentially three steps. Get the error, Convert the error, and Look up the error.
Get the error:
- Read it off the error message (someone else’s code)
- Read the error from the Event Log (someone else’s code)
- Call GetLastError() in your code.
- Add @ERR pseudoregister to your Watch/QuickWatch Window. It will show the value you’d get if you called GetLastError() in your code from this thread.
Convert the error to the right format:
- Many errors are displayed as decimals, and Win32 Error codes will be reported as a negative number. Drop the negative sign if present, then convert the number to a DWORD.
- It can be a bit tricky when the error is displayed as a DWORD. If the code doesn’t return anything helpful look for an 0×80XXYYYY value), try converting the DWORD to Decimal, making the Decimal negative, then converting the negative value back to DWORD
- Some examples:
- If our error code is 0×80070005 we’re already in a good format, and can simply look up the error.
- If our error code is -2147024891, drop the negative and convert to Hexadecimal 0×80070005
- If our error code 0×7FF8FFFB is reported, convert it to Decimal 2147024891, make that negative (-2147024891), then convert to DWORD 0×80070005
Look up the error:
Once you’ve got the error code, there are a number of methods available to convert that cryptic DWORD to a meaningful string.
- Use Microsoft Error Lookup. Visual C++ Error Lookup (ERRLOOK.exe) is part of the Visual Studio .NET Tools, and has been included with Visual C++ installations “forever”. If the error code is not a system message, ERRLOOK provides the option of specifying a specific EXE or DLL module to translate the code to a message.
- From within Visual Studio, type <errorcode>,hr in the Watch or Quickwatch window. This will format the error message as an HRESULT, and display the “friendly” error (e.g. 0×80070002,hr). This same formatting works with the @ERR pseudoregister, so @ERR,hr will format the error code as an error message, killing two birds with one stone by both capturing and translating the result code.
- To routinely handle errors at runtime in your C++ code, see the MSDN topic.
- If you’re doing COM Interop with Managed code then you better not need this introduction, but just in case, check out Adam Nathan’s comments and a FormatMessage shortcut tip from shawnfa on the .NET Security Blog.
- I’m no VB expert, but I understand that if you’re using VB (classic), the LastDLLError property of the Err object is more reliable due to the nature of most VB applications. Francesco Balena implies that LastDLLError may have a significant performance impact.
- Finally, if you really want to do it the hard way, you can translate it manually. In general, you’re going to get a number like this 0×80XXYYYY. Ignore the 0×80 part for now. What you care about is XXYYYY.
- XX indicates the system this came from. See WINERROR.H for a complete list, but here are a few common system codes:
- 8 Windows
- 7 Win32 (non-Windows Microsoft stuff)
- 25 HTTP
- Look up the specific error value (YYYY) in MSDN’s list of system error codes, WINERROR.H or your local copy of WINERROR.H. Here are a few of the more common error codes:
- 0 ERROR_SUCCESS (aka NO_ERROR)
- 2 ERROR_FILE_NOT_FOUND (err..the file is not present with that name)
- 5 ERROR_ACCESS_DENIED (insufficient rights)
- 6 ERROR_INVALID_HANDLE (are you sure that previous call succeeded?)
That’s a wrap, with two final caveats:
- GetLastError can return unexpected values if system calls are being executed behind the scenes. If the error looks wrong… it might be.
- Win32 Error Codes aren’t really HRESULTS, so be careful about using macros to check for success or failure. Know your return types and handle them appropriately.
April 18 2005 | Geek Stuff | No Comments »
I may be slightly off base here, but here’s what it looks like from my chair…
When you build a binary with Microsoft Visual Studio .NET 2003 and select to generate a program database, a MSPDBSRV.exe process is spawned. MSPDBSRV generates the PDB (and copies it to the output folder?), then stays running until it is explicitly terminated or the system shuts down. In most cases, you can completely ignore MSPDBSRV.exe and MSPDB80.dll and MSPDBCORE.dll that support it.
If you routinely use multiple versions of the Visual Studio compiler, you may run into occasional difficulties with MSPDBSRV. The error condition is usually accompanied by a “Fatal Error C1902″. A quick search of the MSDN Library indicates that this error means “A program database file (.pdb) was created using a newer version of DBI.dll than the one found while compiling. Install the latest version of DBI.dll on your system.” Unfortunately, that isn’t terribly helpful since DBI.dll appears to have been deprecated.
The two errors I have encountered are:
ERROR: MSPDB80.DLL: unable to connect: unable to spawn mspdbsrv.exe (0×80070002)<C:\Projects\foo\foo.cpp> : fatal error C1902: Program database manager mismatch; please check your installation
This may indicate that MSPDBSRV.exe is missing, corrupt or not in the same path as MSPDB80.DLL (which apparently launches mspdbsrv.exe). Look up the error code (that’s the 0×80070002 in this example) to see what’s going on here.
Fatal Error C1902 program database manager mismatch; please check your installation
This may indicate that your PDB was created using a newer version of MSPDBSRV.
- In most cases, a full rebuild (clean and build) will resolve this.
- Occasionally (ok, once), I had to manually stop the MSPDBSRV.exe that was running, then rebuild.
- If you’re pulling multiple versions of the VC compiler out of a source control depot or from an archive (you do archive your tools along with your source code when you escrow your code, right?) and are re-using the same location, or if you recently updated the VC compiler you are using, it is possible that MSPDBSRV.exe was running at the time you did the copy. Kill the MSPDBSRV.exe process, re-copy MSPDB*.*, and try again.
April 18 2005 | Geek Stuff | 1 Comment »
God has not spoken to me much the past few days, and I hate it.
I was depressed yesterday and could not bear the thought of praying. I have recognized that tendency in myself before. Instead of pleading for his presence, I withdraw. There could hardly be a more foolish response. I do not watch much TV, but I sat down last night with my love and we watched “America’s Next Top Model” and “American Idol” together. One of the wannabe models was released because she just didn’t have passion. Bo was low in the Idol vote count, and I was disappointed that he was too cool to care. It wasn’t until this morning that I realized that I am having the same problem.
I realized this morning that it is not primarily His guidance I miss, but His presence. His word promises that He will give guidance, and He has been faithful to do so. God rarely gives instructions in a time and manner of my choosing, but, in retrospect, His timing is always perfect. Jesus is my Lord, and he directs my steps, but it is my friend Jesus that I miss. I miss His warmth, His comfort, His whispered “peace, be still”, and His occasional “Rock on Brother!” The sad thing is that I miss it only because I have failed to ask for it.
We value most those things we have lacked. For the family who has lost a child, the promise that “No longer will there be in it an infant who lives but a few days” rings loudly. Of the promises in Isaiah 65, one is dearest to my heart: “It will also come to pass that before they call, I will answer, and while they are still speaking, I will hear.” The Lord has taught me to thirst for Him. When I stop thirsting, He is kind enough to withdraw His presence until I draw near to Him again with my heart.
God has not spoken to me much the past few days, and it has been a blessing.
April 14 2005 | Jesus Stuff | 2 Comments »
A lot of priorities are easy to set and hard to keep. Putting Jesus ahead of family is challenging to contemplate, excruciating to execute, and rewarding in retrospect.
The bad news is that Jesus says what he means. Luke (Luke 14:26 NASB) quotes Jesus as saying “If anyone comes to Me, and does not hate(1) his own father and mother and wife and children and brothers and sisters, yes, and even his own life, he cannot be My disciple.” Matthew (Matthew 10:37 NASB) recalls it as “He who loves father or mother more than Me is not worthy of Me; and he who loves son or daughter more than Me is not worthy of Me.”
The good news is that Jesus means what he says. Jesus tells us ”everyone who has left houses or brothers or sisters or father or mother or children or farms for My name’s sake, will receive many times as much, and will inherit eternal life.” (Matthew 19:29 NASB) When Jesus is first, we don’t suffer, we gain. The lad in John 6:1-14, had a few loaves and fishes to feed himself and his family. When he gave that to Jesus, he was filled, the multitude was filled, and the crumbs remaining were greater than the whole had been. When Jesus is first, our families do not suffer, they gain.
Do we value God enough to put Him above our family? He valued us that much.
Priorities Index
(1) See http://www.tektonics.org/gk/jesussayshate.html for comments on the word “hate” in this context. The summary version is that Semitic peoples tended to speak in hyperbole and to choose black-and-white language. Matthew has the right sense of the thing.
April 12 2005 | Jesus Stuff | No Comments »
It is easy for us to dismiss idolatry as a sin for “primitive” cultures, but idols are not just ugly statues. An idol is anything that takes the place in our life that God has reserved for Himself.
As pleasure becomes our clay god, we are consumed even as we consume. Pleasure is an incessantly hungry god. The more we feed him, the hungrier he gets, and more is never enough. Without realizing that our hand-fed beast intends to devour us, we feed ourselves to him one hour at a time and wait in vain to be filled.
Idols of gold and silver destroy our souls more subtly. Worthwhile endeavors like work, service, and our childrens’ soccer games edge God out of our life. Driven by duty, guilt, and even love, these are idols that we polish and display proudly. We become a “Martha”, so busy doing that we neglect to be with the lover of our soul. Our golden idols crush the life from us with their inexorably increasing pressure.
Idols demand our all and give nothing in return. There is no time for work when we worship Pleasure, and no time for family when we worship at the altar of Work. When we place God first, we are filled to overflowing instead of consumed by our desires. We have time and energy enough for love, for work, and for pleasure. He pulls us out of the mire and sets our feet upon a rock. We have life, and we have it abundantly.
Priorities Index
April 04 2005 | Jesus Stuff | No Comments »