PHP tip : how to remove columns and save to another file

Hello guys,

Had a special request to trim the csv fields in the file.

After searching, found a code to satisfy the request.

Posted the URL from the original link

Enjoy,

Coffee Cup

http://stackoverflow.com/questions/8608970/writing-to-csv-using-fgetcsv

$input = 'input.txt';
$output = 'output.txt';

if (false !== ($ih = fopen($input, 'r'))) {
    $oh = fopen($output, 'w');

    while (false !== ($data = fgetcsv($ih))) {
        // this is where you build your new row
        $outputData = array($data[0], $data[1], $data[4], $data[5], $data[6]);
        fputcsv($oh, $outputData);
    }

    fclose($ih);
    fclose($oh);
}

What TCP port does InterBase use?

Before it was like clockwork, this port is no mystery to me. But recently, especially today, i had to write it down somethere.

I guess this comes with age.

Magic interbase port is 3050. This must be both in the INCOMING and OUTGOING windows firewall settings.

Coffee Cup

Solved – Windows cannot connect to the printer. The local print spooler service is not running

When adding a printer on a network, it seems that sometimes something creeps up from the woodwork that you haven’t seen before.

If you have been in my line of business for quite some time, you wouldn’t be shocked anymore.  It’s like for the Ghost busters. Once they see a ghost, they just put their game face on.

For me, this is a bit of a problem. You usually find the user on the file explorer and right click connect right??? in this case, an error occurs

“Connect to Printer

Windows cannot connect to the printer. The local print spooler service is not running. Please restart the spooler or restart the machine”

Reading it again now it occurred that it was pointing where you need to go. Yeah the service.msc if you are using windows.

  • In the Services.msc, right-click Print Spooler and click Properties.
  • If the service is not automatic, right-click the service and choose Properties and select Automatic
  • The last step should be that the service must be Started.

 

Now for me, i had to do this 2 times because the first time i changed the settings, it did not push through (i think) so i had to go back in again and change it for the second time around.

After that, i was able to connect to the printer through the network.

Till next time…

Delphi / Interbase : General SQL Error invalid transaction handle (expecting explicit transaction start)

i have using delphi 6 for quite some time now and it seems that errors of the past still haunt us today.

experiencing this error code when i try to create a duplicate entry of a delivery receipt transaction. one of the suggestions i got was to disable the optimization checkbox in delphi.

after doing this it unfortunately did nothing. so i searched again, it turned out that a lot of people assumed it was a problem with the database.

what i did was to trace, line by line, my code until i reach the StoredProc in question. What i did was to put a try… except outside the storedproc procedure and everything went into place.

hope this article can help somebody in the same pickle jar as me.

Pocket Calculator Turns On by Itself and Keyboard is Shorted

I had a case today where the several pocket calculators turned on by itself and some of them even types a digit by itself.

another strange thing is the keyboard of the computer seems to keep the solid green light while the USB mouse seems to be unaffected by this strange scenario.

i transferred the cpu to another location and tested and it turned out fine. no hangs no keyboard anomaly or any of that.

then finally, somebody suggested that the monitor is the culprit. i changed the monitor and all is well.

the monitor is now relocated to the archives and this is quite an x-files episode i can tell you that.  life in the computer world just got it’s own taste of the paranormal. if somebody can explain it to me in layman’s terms i would really appreciate it. hahaha.

Coffee Cup

Holidays in the country of the Philippines for 2017

Hi there,

These are the holidays that so far, President Rodrigo Duterte has signed in his  Proclamation No. 50 on August 16. It was released to the public on Thursday, August 18.

The regular holidays are (if you work on these dates, you get double pay) :

January 1, 2017, Sunday – New Year’s Day
April 9, 2017, Sunday – Araw ng Kagitingan
April 13, 2017 – Maundy Thursday
April 14, 2017 – Good Friday
May 1, 2017, Monday – Labor Day
June 12, 2017, Monday – Independence Day
August 28, 2017, last Monday of August – National Heroes’ Day
November 30, 2017, Thursday – Bonifacio Day
December 25, 2017, Monday – Christmas Day
December 30, 2017, Saturday – Rizal Day

Special (non-working) days (if you work on these days you get 30% more from your daily wage) :

January 2, 2017, Monday – based on Proclamation No. 117
January 28, 2017, Saturday – Chinese New Year
February 25, 2017, Saturday – EDSA Revolution Anniversary
April 15, 2017 – Black Saturday
August 21, 2017, Monday – Ninoy Aquino Day
October 31, 2017, Tuesday – additional special (non-working) day
November 1, 2017, Wednesday – All Saints’ Day
December 31, 2017, Sunday – last day of the year

Additional special holidays are Eid’l Fitr and Eid’l Adha, which will be announced after approximate dates for the Islamic holidays have been determined.

Coffee Cup