![]() |
bztronics
Advanced Technology for Better Living
|
|
Customer Support Phone Customer Center Code Tips Circuits |
Tips for Computer Programmers Murphy's Laws for Computer Geeks
Make your own application Help with the C++ Web Browser component To read local files you need to use the UNC format. A quick and easy way to do this is by using the command below...
Delphi -
WebBrowser1.Navigate(ExpandUNCFileName('main.htm')); main.htm is your main Help file page with links to other topics. This may seem like more work, but it's really not and your customers will be very happy after a rogue Windows Update!
Here is a seriously easy and cool one liner to launch a web site or
file from a form (Windows Updated 12-10-11 for Windows 7)
string =
"http://www.bztronics.com"; If you are using Delphi in Rad Studio 2009 - 2011 XE
uses ShellApi
ShellExecute( handle, 'open' , 'http://www.bztronics.com', ' ', ' ' , SW_SHOW); Remember that this is just a simple Windows API call. The function will open any file that Windows has as an association to. If it is web address it will open the default browser. If it is a text file, it will open Notepad. This ancient function has been switched around in the last versions of Visual Studio 2008 and Rad Studio 2007. If you use ShellExecute() from older code, you will have to rearrange a few things. Pay attention - this is tricky for beginners! Newer versions of Rad Studio and Visual Studio have a "Link Button" to get the same results. If you have FireMonkey, you can just create a binding. HTTP with Java Java and old J++ makes it very easy to do HTTP requests. You can use this code template as a guide when performing HTTP requests...
public
void HTTP_Request() One liner PHP to get an entire HTTP request document into a string variable This is a cool one liner to get a web document into a string variable. This is very handy when you want to retreive an XML document or an RSS feed and use PHP parsing functions for dynamic web content. $xm = file_get_contents('http://rss.news.yahoo.com/rss/mostviewedtc'); The entire html or XML document is contained in the variable $xm. Why would you use this? Many search engines increase page rank by how often content is changed, however many do not read "active content" from PHP or Java Scripts. You can use this little gem to create dynamic, updated HTML pages that all search engines recognize! Optimizing 8051, PIC Microcontroller routines for speed If you are using C to create your Micro Firmware, it is a good idea to drop into simple Assembly language routines to speed things up. As you probably already know, C handles stack routines automatically. Sometimes, the generated code is inefficient. This is because when you do a function call, ALL variables are automatically pushed to the FIFO stack. There are even more pushed to the stack when you cross a page boundary. Fortunately, you can use Assembly routines to override the default C operations. There are many times when you do not need to push and pop all of your variables to and from the stack, as many will not change in the called function. Depending on your compiler, you may even be able to avoid #PRAGMA directives, if your compiler supports inline Assembly. Before function call...
asm { //On return
asm { Just be sure not to leave anything out. This is an advanced optimization method, yet simple enough to be easily implemented by greenhorns. Depending on your compiler, compiler directives may need to be added and a complete Assembly function can be written to handle this automatically. Happy Coding! © bztronics 2011 All Rights Reserved
|