What is the PHP enye (“ñ”) version conversion

When you live in the Philppines, you will probably encounter names and places that have the enye (“ñ”) symbol. For us developers, it comes out diferently especially in databases and labels.

For the database, it comes out as DASMARIñAS CAVITE with the character “ñ”

Once you put this character in your code, it will translate to enye (“ñ”).

What i use when a user encodes it, is to convert it using string replace.

$mystring = str_replace("DASMARI?","DASMARIñ",$mystring);
$mystring = str_replace("DASMARI�","DASMARIñ",$mystring);

Hope this helps someone out there in the web.

Coffee Cup

PHP File going to Microsoft Excel “The file is corrupt and cannot be opened” [solved]

Encoutered this issue with a website I was working on. When i convert the data to excel it comes out with message “The file is currpt and cannot be opened”.

When I tried to do research I found a page that says you open the file using notepad and then save it. Once done, you can open it normally.

To my end I was able to solve it by moving the access codes (user , password , database) of the mysql to the actual page itself. Usually I reference it from another php page. But this time, moving it solved my problem

Hope this helps somebody out there

Coffee Cup

Delphi Buttons – Create an hour glass impression while waiting

Got a chance to receive source code from a software vendor and the button on this program made me smile.

Haven’t though of it that way. But i think it works.

procedure TSFTPClientFrame.btConnectSSHClick(Sender: TObject);
var
  OldCursor: TCursor;
begin
  OldCursor := Screen.Cursor;
  try
    Screen.Cursor := crHourGlass;
    ScSSHClient.Connect;
  finally
    Screen.Cursor := OldCursor;
  end;
end;

The hour glass cursor is within the try row. Once it is done, it revert backs the cursor to the original one used. Pretty awesome.

Just wanted to share

Coffee Cup

Oracle Virtual PC – menu missing [solved]

It’s been days since the menu on top of virtual pc dissapeared after I chose the fullscreen mode. Good thing there is google.

Found the switch. And it is RIGHT-CONTROL yeah, not the left control key. It’s RIGHT+CONTROL + C

Viola! Enjoy!

Coffee Cup

Network is connected but no internet is sent [SOLVED]

connected but no internet

Recently we had this issue with our Globe fiber wifi setup. After August 1, 2024 (need to check this one as well), wifi sticks are having a hard time getting internet. We can see that the wifi is connected but no internet is received.

  • at first the culprit might be the wifi stick. standing that we have been using it for months and years, is there a cut-off for them as well?
  • second is the wifi router itself. is it defective or have reached the limit of 60 devices (based on the manual that i read) ?

So far what we did to solve this issue is to use the command prompt and then issue a ‘ipconfig / release’ and ‘ipconfig / renew’ command and viola! It’s now working.

Hope it could help someone out

Coffee Cup

Not Acceptable! An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security [SOLVED]

Working on programming for so many years, it amazes me that i have really much to learn. This recent issue cropped up out of nowhere.

I decided to disable mod security , which is a bad idea honestly. But true enough, i found the culprit. It seems when you pass a get parameter with special characters, our websites seem to be on high alert against hack attack

<IfModule mod_security.c>
  SecFilterEngine Off
  SecFilterScanPOST Off
</IfModule>

What i was passing is the name of a client through get command. Yeah i know . It came out as link.php?name=M&M

I changed then parameter to a session id i had given before and it solved the issue. sigh. another lesson learned.

Coffee Cup

Disable Device Driver Signing in Windows 10 [SOLVED]

The original title should be “the hash for the file is not present in the specified catalog file”. I had recently encountered apps not being installed because the has file was not there. And then i wondered. Why would software developers deploy programs without this hash thing.

After a few google searches it turns out it was microsoft thing and you can disable it.

Enjoy

Coffee Cup

To solve this problem, I had to disable Device Driver Signing. Here’s how it’s done in Windows 10.

Option 1 – Command to Enable or Disable

  1. Click the “Start” button.
  2. Type “command“.
  3. Right-click on “Command Prompt” and select “Run As Administrator“.
  4. Do one of the following:
    • To disable device driver signing, type “BCDEDIT /set nointegritychecks ON” then press “Enter
    • To enable device driver signing, type “BCDEDIT /set nointegritychecks OFF” then press “Enter

You’re done! The Device Driver setting is now modified.

Option 2 – Disable From Menus

I figured this was security that was built into Windows to prevent me from installing bad drivers. This is a feature called Device Driver Signing. After going through the steps to disable driver signing in Windows 8, I was able to get my community drivers installed. Here’s how I did it.

  1. Select the “Start” button.
  2. Type “startup”.
  3. Select “Change advanced startup settings“.
  4. Select “Restart now” under the “Advanced startup” area.
  5. Select “Troubleshoot“.
  6. Select “Advanced Options“.
  7. Select “Startup Options“.
  8. Select “Restart“.
  9. A menu will appear where you can press “7” on your keyboard to choose “Disable driver signing enforcement“.

Now Device Driver Signing should be disabled, allowing you to install any driver you like in Windows 10 until you reboot.

http://www.hackaapl.com/trouble-installing-windows-10-drivers-the-hash-for-the-file-is-not-present-fix-toggle-driver-signing/

Delphi 6 + QuickReport – Removing or Disabling the Save and Load Buttons during preview [solved]

This has been an age old question that one needs to tackle if you have clients that want to control data coming in and out of the company.

That is why I am quite happy and relieved to have found it as well.

Without further adue, here it is

uses
, QRPrntr, QRPrev;

procedure TqrpLabelGrader.QuickRep1Preview(Sender: TObject);
var
  qrStandardPreview: TQRStandardPreview;
begin
  //, QRPrntr, QRPrev;
  qrStandardPreview:=TQRStandardPreview.CreatePreview(Self, TQRPrinter(Sender));
  qrStandardPreview.SaveReport.Enabled := False;
  qrStandardPreview.LoadReport.Enabled := False;
  qrStandardPreview.Show;
end;

Enjoy

Coffee Cup

Delphi 6 : using scroll in a DBGrid with WheelMouse

There was a request to make the mouse wheel as the scrolling. I found the code and wanted to save it as well here.

Enjoy

Coffee Cup

//with delphi7

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, DB, DBTables;

type
  TForm1 = class(TForm)
    DataSource1: TDataSource;
    Table1: TTable;
    DBGrid1: TDBGrid;
    procedure FormCreate(Sender: TObject);
    procedure DBGridMouseWheel(Sender: TObject; Shift: TShiftState;
      WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  TWheelDBGrid = class(TDBGrid)
  public
    property OnMouseWheel;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  TWheelDBGrid(DBGrid1).OnMouseWheel := DBGridMouseWheel;
end;

function GetNumScrollLines: Integer;
begin
  SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, @Result, 0);
end;

procedure TForm1.DBGridMouseWheel(Sender: TObject; Shift: TShiftState;
  WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
var
  Direction: Shortint;
begin
  Direction := 1;
  if WheelDelta = 0 then
    Exit
  else if WheelDelta > 0 then
    Direction := -1;

  with TDBGrid(Sender) do
  begin
    if Assigned(DataSource) and Assigned(DataSource.DataSet) then
      DataSource.DataSet.MoveBy(Direction * GetNumScrollLines);
    Invalidate;
  end;
end;

end.

https://www.swissdelphicenter.ch/en/showcode.php?id=2142