Tuesday, June 5, 2012

MinGW can't find my libraries

 How to command MinGW using hbmk2 to read my own libraries during compilation of a Harbour source code? Unlike BCC, MinGW is always playing "hard-to-get" to newbies like me. So I made an experiment I would like to share with you. I created a library known as "myLib". With BCC the compiled file name will always be: myLib.LIB; whereas, with MinGW, a prefix "lib" is added to the file name, hence the resulting lib file would look like this:
"libmyLib.a". Note that the suffix is ".a", not ".lib".

1) First Step: Let's create a library.

////////////////////////////////// A program that returns the current path.
/////////////////////////////////// Usage: ? GetPath() --> D:\dev\lib
/////////////////////////////////// File name: trylib.prg
 FUNCTION GetPath()
  RETURN (DiskName()+":\"+CurDir())


2) Second Step: Let's compile our .prg named trylib.prg for us to produce libmyLib.a. In order to prepare our myLib library to contain more functions in the future we need to create an .hbp (Harbour project file. In XBase++, it is termed as .xpj file).

##  myLib.hbp - hbp filename.

# this .hbp file contains only one .prg named trylib.prg which contains a GetPath() function.  

# hblib is the hbmk2 option we need to use in creating a library

 -hblib

# for our compiler, let's use the -compiler switch. If you use a batch file, use
#    set HB_COMPILER=mingw

 -compiler=mingw

# switch -o is needed in order to control the name of the resulting output file.
# We want the name: myLib
-omyLib

# let's now include our .prg/s
trylib.prg

# done

3) Third Step: Let's write our main.prg, which will call our myLib library

/////////////////////////////////// A program that calls getpath() from myLib library
///////////////////////////////////              also known as libmyLib.a
/////////////////////////////////// Usage: just type try.exe at the dot prompt
/////////////////////////////////// File name: try.prg
FUNCTION Main()

cls

? getpath() // returns your current path

inkey(0)

RETURN NIL

4) Fourth Step: Let's write now our .hbp file for our project known as try.exe program. Use number sign "#" to make comments.

## try.hbp, the name of our .hbp file.

# for our compiler
-compiler=mingw

# if we want to control which directory hbmk2 has to do its compiling routines
# after your current path, you will find a new path HB\win\mingw
# hb_plat for platform; hb_comp for compiler

-workdir=HB/${hb_plat}/${hb_comp}

# this is key to command mingw to find your own library.
#     In my experience, mingw can't see your lib file even
#    if it is located in the directory where you compiled your source codes.
# use the following hbmk2 switch: an upper case "L" or -L then your path/current directory

-LD:\dev\lib


# note that in my experiment I didn't add the name of my library, just the path where my library stays.
# then I added another hbmk2 switch, -l, where I need to mention already the name of my library
# take note that this time it is small letter "l" or -l.

-lmyLib


# minGW created libmyLib.a, but I need to write only: -lmyLib


# the name of my output: try.exe, I need the switch -o
-otry


5) Fifth Step: We're almost done, but to make things easier and fast, let's create a batch file we call s.bat (s because I'm left-handed and I want to just easily press s on my keyboard for a trial-and-error compilation I am doing many times in the course of creating a software).

rem batch file name: s.bat
rem I want to set again my compiler, because I want to make sure. To avoid redundancy,
rem you may delete the one written in our .hbp, namely: -compiler=mingw

cls

set HB_COMPILER=mingw

hbmk2 myLib.hbp

rem after compiling our myLib library, we may delete already the above command

rem the added command "1>log.txt 2>&1 is for our log file necessary in tracing errors.

hbmk2 try.hbp 1>log.txt 2>&1

6. Sixth Step. At the command prompt type "dir" to see: try.exe and libmyLib.a. If you'll find them, it means you succeeded. Now is the time to type "try" to see it minGW finds your library. If you are successful you'll find something like this on your screen depending of course on the name of your path:

D> D>dev\myLib

Having the above on your screen, it means the function getpath() in our myLib library was successfully called by try.exe.

Thanks for the patience. Happy Harbour-ing!

Monday, June 4, 2012

How to save hbmk2's error messages?

If you are familiar with XBase++'s PBuild, you will notice that error messages during compilation are written into an "error.log." Do we have the same feature with our hbmk2? Of course the ">" (greater than) sign will normally save messages to a text file if you will place them in a batch file. For example:

                            try1.bat

                            c:> dir *.prg /b > log.txt

                            The result of the above command will look like this:

                                     try1.prg
                                     try2.prg, etc


In hbmk2, all you have to do in order to save error messages during compilation into a log file is this one (put together into a batch file):


                               try2.bat
              
                               set HB_COMPILER=mingw
                               hbmk2 try.hbp -rebuild 1> log.txt 2>&1

This above saves anything displayed on screen during complilation into a text file, in this example, log.txt.

Remove This copy of Windows 7 is not genuine Build 7600

How to remove this annoying message: "This copy of Windows 7 is not genuine Build 7600"? It was just a wink of an eye: your screen turned black then the above message. I surfed the Web and found RemoveWat.Exe for the solution of it.


After downloading it, I noticed a folder which has this name: RemoveWat 2.2.6 Hazar SCTV83.blogspot. I checked the properties of this free "Exe" and the following info came out:



Details

File Description           RemoveWat
Type Application File   Version 2.2.6.0
Copyright                    Copyright Hazar & Co. (c) 2010
Size                             6.35 MB
Date Modified             9/19/2010 9:05 PM
Language                    Language Neutral
Original Filename        RemoveWat

Judge for yourself if RemoveWat is not worthy of one's trust. I am so happy finding it, for it finally solved the "not genuine" mark in my desktop. Although RemoveWat didn't help my friend's computer, it perfectly helped mine and for it I wanted to suggest to one having the same problem to try RemoveWat (it removes "other things" also!).

Friday, May 18, 2012

Computer Suddenly Turning Off

My laptop suddenly turned off, losing all of my unsaved data as a result. I googled the problem immediately, but I found the same problem instead of a concrete solution of this computer-turns-off issue. Here's an example of what I gathered:


"Some would say it's overheating, but I don't think so, since it has a nice cooling and it didn't change from some time to now. I (just wonder, no clue) think it could be some voltage issue, some hard disk problem, power cable issue, possibly some wire overheating (!?!), maybe too many devices connected to the power socket. Could his be caused by any BIOS configuration? By the way, it's running with no memory or processor overclock."


A friend of mine told me that laptop's battery is sometimes problematic. In fact, the power icon of my laptop has a red "x" mark indicating that it is not charging. The reality however, is that it is functioning normally and useful within 20 minutes.
Annoyed, I made an experiment: I removed my laptop's battery and my laptop-turns-off-suddenly problem found a solution. It never went back.

Sunday, May 13, 2012

How to remove Chrome's insecure content alert

I am developing few sites using https://sites.google.com, but was so annoyed just recently of Chrome's "This Site has insecure content (Don't load, Load anyway)" alert in the pages of all my websites. One blogger wrote that I need to press CTRL+SHIFT+j to see what was causing it. Surprised, it was caused by google sites themselves.


Can you imagine the following causes--it's almost all google's or at least the word "google" such as "http://pagead2.googlesyndication.com/pagead/js...show_ads_impl.js".


The page at about:blank displayed insecure content from http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-5117933205504599&format=728x90_as&output=html&h=90&w=728&lmt=1336946874&host=pub-6693688277674466&ad_type=text_image&color_bg=FFFFFF&color_border=FFFFFF&color_link=000000&color_text=444444&color_url=0033CC&flash=11.2.202&url=https%3A%2F%2Fsites.google.com%2Fsite%2Fstrengthenedbythisverse%2F&dt=1336975683109&bpp=4&shv=r20120502&jsv=r20110914&prev_fmts=120x600_as&correlator=1336975683106&frm=20&adk=1335628509&ga_vid=1546748914.1336975221&ga_sid=1336975369&ga_hid=1490068524&ga_fc=1&u_tz=-480&u_his=13&u_java=1&u_h=768&u_w=1024&u_ah=728&u_aw=1024&u_cd=32&u_nplug=7&u_nmime=13&dff=arial&dfs=12&adx=199&ady=358&biw=1008&bih=667&oid=3&ref=https%3A%2F%2Fsites.google.com%2Fsite%2Fstrengthenedbythisverse%2Fsystem%2Fapp%2Fpages%2Fadmin%2Fappearance%2FpageElements&fu=0&ifi=2&dtd=642&xpc=XvnqvfMIXT&p=https%3A//sites.google.com.
The page at https://sites.google.com/site/strengthenedbythisverse/ ran insecure content from http://pagead2.googlesyndication.com/pagead/js/r20120502/r20120410/show_ads_impl.js.
2The page at https://sites.google.com/site/strengthenedbythisverse/ ran insecure content from http://pagead2.googlesyndication.com/pagead/expansion_embed.js.
The page at https://sites.google.com/site/strengthenedbythisverse/ ran insecure content from http://pagead2.googlesyndication.com/pagead/js/r20120502/r20120410/show_ads_impl.js.
The page at about:blank displayed insecure content from http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-5117933205504599&format=300x250_as&output=html&h=250&w=300&lmt=1336946874&host=pub-6693688277674466&ad_type=text_image&color_bg=FFFFFF&color_border=FFFFFF&color_link=000000&color_text=444444&color_url=0033CC&flash=11.2.202&url=https%3A%2F%2Fsites.google.com%2Fsite%2Fstrengthenedbythisverse%2F&dt=1336975683114&bpp=4&shv=r20120502&jsv=r20110914&prev_fmts=120x600_as%2C728x90_as&correlator=1336975683106&frm=20&adk=30073298&ga_vid=1546748914.1336975221&ga_sid=1336975369&ga_hid=1490068524&ga_fc=1&u_tz=-480&u_his=13&u_java=1&u_h=768&u_w=1024&u_ah=728&u_aw=1024&u_cd=32&u_nplug=7&u_nmime=13&dff=arial&dfs=12&adx=431&ady=983&biw=1008&bih=667&oid=3&ref=https%3A%2F%2Fsites.google.com%2Fsite%2Fstrengthenedbythisverse%2Fsystem%2Fapp%2Fpages%2Fadmin%2Fappearance%2FpageElements&fu=0&ifi=3&dtd=1430&xpc=ZFB4wjTJQx&p=https%3A//sites.google.com.
The page at https://sites.google.com/site/strengthenedbythisverse/ displayed insecure content from http://pagead2.googlesyndication.com/pagead/abglogo/adc-en-100c-000000.png.
The page at about:blank displayed insecure content from http://googleads.g.doubleclick.net/pagead/drt/s?v=r20120211.
The page at https://sites.google.com/site/strengthenedbythisverse/ displayed insecure content from http://pagead2.googlesyndication.com/pagead/abglogo/adc-en-100c-000000.png.
The page at about:blank displayed insecure content from http://googleads.g.doubleclick.net/pagead/drt/s?v=r20120211.
3The page at http://googleads.g.doubleclick.net/pagead/drt/s?v=r20120211 displayed insecure content from http://google.com/pagead/drt/ui.

I also followed "googleads.g.doubleclick.net" where one author (see hubpages) wrote in his page a blog entitled "What is http://googleads.g.doubleclick.net/ pagead/test_domain.js ? (By ) that his Kaspersky alerted him that this site was blocked due to password and credit card issues; but that an email from Kaspersky confirmed that it was just a false alarm, since this site was already bought by Google.

In one forum I followed the instruction of inserting the command-line option "--allow-running-insecure-content" and the message alert "insecure content" went away. (The reverse command in case you'll be interested is "--no-displaying-insecure-content"--if you want Chrome to go with its insecure content routine).

To insert the --allow-running-insecure-content command, go to Chrome's icon on your desktop (or at the start menu), right click, then go to Properties -> Shortcut, then Start in, and you'll find something like this: C:\Users\yourcomputername\AppData\Local\Google\Chrome\Application...at the end allow one space then paste or type: --allow-running-insecure-content.

Not the end of the story yet: Chrome continued to place a red mark on my "https" indicating that it just allowed, but the problem known as insecure-content is still there.

Others testified of a fully normal webpage browsing and total gmail insecure-content solution. But I was not as lucky. Of course, I will continue digging for other concrete solutions yet to this very annoying Chrome's security feature.


Friday, May 4, 2012

Full screen mode in Windows 7

I am no expert, but I have an experience about forcing your Windows 7 to display a full screen mode particularly on DOS programs. Windows thrust of forcing the world to obey it is always unacceptable. Time will come when Windows will see that the computer world is now slowly going against its submit-to-Windows-whims philosophy.

I love writing programs through using a DOS editor for long years. I have no problem with Windows XP; but Windows 7 is getting more unfriendly. I went to the Web and someone said that I needed to change the DISPLAY ADAPTER PROPERTIES. In short, all this trouble is adapter-related. I followed the instructions. He wrote that I have to "right click" at desktop and to PERSONALIZE -> DISPLAY -> ADVANCED SETTINGS -> ADAPTER -> PROPERTIES -> DISPLAY ADAPTER PROPERTIES -> BROWSE MY COMPUTER FOR DRIVER SOFTWARE, then click on LET ME PICK FROM A LIST OF DEVICE DRIVERS ON MY COMPUTER and select: STANDARD VGA GRAPHICS ADAPTER. Bingo! It worked.

But big problem. When I reinstalled my Windows 7, and have all these so-called updates in place, I could no longer find the "LET ME PICK UP FROM A LIST..." and no more SELECT STANDARD VGA GRAPICHS ADAPTER. Perhaps, such an option was no longer allowed in the newest updates.

Since my theory of Windows 7 not allowing full screen mode is adapter-related, I went directly to DEVICE MANAGER,  and disabled that very-controlling adapter there to see what would then happen. It worked.

Having no expertise, I could only say that doing so crippled consequently the good purpose (if it is really invented for the good - better ask Bill Gates!) for which the modern adapter was developed. To me, I have freed myself from my utter dislike with Windows 7 and that is the intentional crippling of full screen mode.

Good news: to disable your Windows 7 modern adapter is as easy as to enable it should your games or other programs be affected in the process. To do it, just right click at the COMPUTER icon on your desktop, then click DEVICE MANAGER, then look for DISPLAY ADAPTER. Depending on the device installed in your system, but in mine, I found under DISPLAY ADAPTER, "ATI Mobility Radeon HD 5000 Series". Double clicking it will lead you to a window and a prompt (click it!): DISABLE DEVICE.

Thursday, April 26, 2012

Entry point libiconv_set_relocation_prefix libiconv-2.dll


I didn't know what to do with this error at first: Error...Entry point
libiconv_set_relocation_prefix libiconv-2.dll. In my readings, I found
Victor saying concerning this error: "you met .dll hell." Yes, I did.
I deleted all occurrences of libiconv-2.dll and left only the ones
embedded in the hb31 nightly package. But still the "hell' didn't
leave me when I already deleted the same .dll in c:\Windows\System32.

Confused, I visited c:Windows\System32 and found there (again):
libiconv-2.dll. Did it resurrect? Anyway, I deleted it the second time
and pasted into c:\Windows\System32 libiconv-2.dll from hb31 in order
to stop its reproduction, if my theory proves right amidst my
ignorance of how did this broken dll found a place again at System32.
Then I ran hbmk2 and the "hell" went away. The problem was solved
which was caused by the libiconv-2.dll found in my c:\Window\System32.

I shared this experience for the others who will be meeting the same
error in the course of Harbour programming. Thanks to the Gurus who
give Harbour to the world for free.

For more information about Harbour Programming Language, please visit the following links:

http://groups.google.com/group/harbour-users?pli=1

http://www.harbour-project.org/