MachineInfo GitHub

by GarciaPL on Wednesday 26 December 2012


I would like to introduce my new repo on GitHub which is called MachineInfo. More information after clicking the link below :

https://pastebin.com/aefQhyTj

Bad interpreter: No such file or directory PHP

by GarciaPL on Friday 14 December 2012


I used to write some scripts in PHP which i was going to run on Linux. Unfortunately, I was faced with this small error :

Bad interpreter: No such file or directory

All you need to fix it is just run this command :

dos2unix /path/to/your/script.php


Reference :
[1] Fixing error bad interpreter cyprich.com

MySQL Find duplicate records

by GarciaPL on Wednesday 5 December 2012


I used to find many times duplicates in my table in MySQL database this time. First of all, I will paste here my table structure below (yes i know that it is difficult to read) :

mysql> describe proxy_parser_statistics;
+-----------------------+---------+------+-----+---------+----------------+
| Field                 | Type    | Null | Key | Default | Extra          |
+-----------------------+---------+------+-----+---------+----------------+
| ID                    | int(11) | NO   | PRI | NULL    | auto_increment |
| file_name             | text    | NO   |     | NULL    |                |
| processing_stamp_date | date    | YES  |     | NULL    |                |
| processing_stamp_time | time    | YES  |     | NULL    |                |
| processed_records     | int(11) | YES  |     | NULL    |                |
+-----------------------+---------+------+-----+---------+----------------+

I just use this query :

SELECT a.id, a.file_name FROM proxy_parser_statistics a INNER JOIN proxy_parser_statistics b ON a.file_name = b.file_name WHERE a.id <> b.id

Results of above query :

+-----+-----------------------------+
| id  | file_name                   |
+-----+-----------------------------+
| 803 | access1211170012.merged.log |
| 804 | access1211170112.merged.log |
| 805 | access1211170212.merged.log |
| 806 | access1211170312.merged.log |
| 807 | access1211170412.merged.log |
| 808 | access1211170512.merged.log |
| 809 | access1211170612.merged.log |
| 810 | access1211170712.merged.log |
| 811 | access1211170812.merged.log |
| 812 | access1211170912.merged.log |
| 813 | access1211171012.merged.log |
| 814 | access1211171112.merged.log |
| 815 | access1211171212.merged.log |
| 816 | access1211171312.merged.log |
| 817 | access1211171412.merged.log |
| 818 | access1211171512.merged.log |
| 819 | access1211171612.merged.log |
| 820 | access1211171712.merged.log |
| 821 | access1211171812.merged.log |
| 822 | access1211171912.merged.log |
| 823 | access1211172012.merged.log |
| 824 | access1211172112.merged.log |
| 825 | access1211172212.merged.log |
| 826 | access1211172312.merged.log |
| 827 | access1211172359.merged.log |
| 727 | access1211170012.merged.log |
| 728 | access1211170112.merged.log |
| 729 | access1211170212.merged.log |
| 730 | access1211170312.merged.log |
| 731 | access1211170412.merged.log |
| 732 | access1211170512.merged.log |
| 733 | access1211170612.merged.log |
| 734 | access1211170712.merged.log |
| 735 | access1211170812.merged.log |
| 736 | access1211170912.merged.log |
| 737 | access1211171012.merged.log |
| 738 | access1211171112.merged.log |
| 739 | access1211171212.merged.log |
| 740 | access1211171312.merged.log |
| 741 | access1211171412.merged.log |
| 742 | access1211171512.merged.log |
| 743 | access1211171612.merged.log |
| 744 | access1211171712.merged.log |
| 745 | access1211171812.merged.log |
| 746 | access1211171912.merged.log |
| 747 | access1211172012.merged.log |
| 748 | access1211172112.merged.log |
| 749 | access1211172212.merged.log |
| 750 | access1211172312.merged.log |
| 751 | access1211172359.merged.log |
+-----+-----------------------------+

Reference :
[1] Table structure Pastebin.com [2] Query result Pastebin.com

Crontab run job every hour

by GarciaPL on Wednesday 21 November 2012

Hi, I would like to show you very quick and I hope so, quite useful advice, how to run some job in every hour using crontab :

0 * * * * /destination/to/your/script.pl


Enjoy!

OpenAPI Orange Plus T-Mobile and Play

by GarciaPL on Thursday 15 November 2012


In recent time Institute of Communications (Instytut Łączności) began work on create a common API for telecom operators in Poland such a Orange, Plus, T-Mobile and Play to unificate using of their network functionality for instance sending and receiving SMS/MMS/USSD, make phone calls, phone localization etc.

I think that this work of Institute of Communications and major telecoms in Poland, will help developers and small companies to reduce costs associated with the need to adopt their services to telecom networks in Poland.



Reference :
[1] Institute of Communications (Instytut Łączności)
[2] Statement of Institute of Communications (pdf) [Polish]
[3] Statement of Institute of Communications (pdf) [English]
[4] Home page of OpenAPI initiative [English]

Ubuntu 12.04 Eclipse SWT lib

by GarciaPL on Wednesday 24 October 2012


I have recently installed Eclipse using Ubuntu Software Center in Ubuntu 12.04 and when I run it I have below message in log :

java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
no swt-gtk-3740 in java.library.path
no swt-gtk in java.library.pathCan't load library: /home/tom/.swt/lib/linux/x86_64/libswt-gtk-3740.so
Can't load library: /home/tom/.swt/lib/linux/x86_64/libswt-gtk.so

at org.eclipse.swt.internal.Library.loadLibrary(Library.java:285)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:194)
at org.eclipse.swt.internal.C.<clinit>(C.java:21)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:132)
at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:695)
at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:153)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:95)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

So, fix of this problem is one of those lines which you should run in terminal :

For Ubuntu 12.04 32 bit :

ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86/

For Ubuntu 12.04 64-bit:

ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/


Reference :
[1] Stackoverflow.com Eclipse cannot load SWT

Chrome deletes downloaded files

by GarciaPL on Saturday 20 October 2012


Recently I have problem with Google Chrome from version 22.0.1229.94 in one moment, when I am downloading some file. After complete the download, Chrome immediately delete the file.

There are two possibilities to solve the problem :
1. Roll back Chrome to previous version
2. Remove from Windows (of course if you are using it) one of those updates (I do not know which one ;)) :

Cumulative Security Update for Internet Explorer 8 for Windows 7 for x64-based systems
KB 2744842

All labelled "Security Update for WIndows 7 for x64-based Systems"
KB 2705219
KB 2724197
KB 2731847
KB 274355


Reference :
[1] Google Product Forums

Nagios HP BladeSystem Ambient Temperature

by GarciaPL


I uploaded to my github (link in reference) a script which allow you to check average ambient temperature for all Bays stored in HP BladeSystem using it's Onboard Administrator from which I put below sample output.


VM-CPX-CPD-1> show server temp all

Device Bay #1 Temperature Information
Locale                              Status      Temp    Caution   Critical
----------------------------------- ------    --------  -------   --------
Ambient Zone     (Inlet Ambient   ) OK        18C/ 64F    42C       46C
System Zone      (System Board    ) OK        23C/ 73F    85C       90C
CPU Zone         (CPU 1           ) OK         7C/ 44F    75C       80C
CPU Zone         (CPU 2           ) OK        19C/ 66F    75C       80C
CPU Zone         (CPU 3           ) OK          N/A
CPU Zone         (CPU 4           ) OK          N/A
Memory Zone      (DIMMs 1         ) OK        30C/ 86F    87C       92C
Memory Zone      (DIMMs 2         ) OK        29C/ 84F    87C       92C
Memory Zone      (DIMMs 3         ) OK          N/A
Memory Zone      (DIMMs 4         ) OK          N/A
Memory Zone      (Mem 1 1-4 Zone  ) OK        34C/ 93F    85C       90C
Memory Zone      (Mem 1 5-8 Zone  ) OK        35C/ 95F    85C       90C
Memory Zone      (Mem 2 1-4 Zone  ) OK        30C/ 86F    85C       90C
Memory Zone      (Mem 2 5-8 Zone  ) OK        34C/ 93F    85C       90C
Memory Zone      (Mem 3 1-4 Zone  ) OK        23C/ 73F    85C       90C
Memory Zone      (Mem 3 5-8 Zone  ) OK        23C/ 73F    85C       90C
Memory Zone      (Mem 4 1-4 Zone  ) OK        22C/ 71F    85C       90C
Memory Zone      (Mem 4 5-8 Zone  ) OK        24C/ 75F    85C       90C
I/O Board Zone   (IOH 1           ) OK        64C/147F   100C      105C
I/O Board Zone   (IOH 2           ) OK        62C/143F   100C      105C
I/O Board Zone   (NIC Zone        ) OK        67C/152F    90C       95C
I/O Board Zone   (Mezz Zone       ) OK        60C/140F    90C       95C
System Zone      (Chassis Exit    ) OK        64C/147F   100C      105C
Storage Zone     (HDD Max         ) OK        35C/ 95F    60C       65C

Virtual Fan: 28%

Device Bay #2 Temperature Information
Locale                              Status      Temp    Caution   Critical
----------------------------------- ------    --------  -------   --------
Ambient Zone     (Inlet Ambient   ) OK        17C/ 62F    42C       46C
System Zone      (System Board    ) OK        23C/ 73F    85C       90C
CPU Zone         (CPU 1           ) OK         6C/ 42F    75C       80C
CPU Zone         (CPU 2           ) OK         5C/ 41F    75C       80C
CPU Zone         (CPU 3           ) OK          N/A
CPU Zone         (CPU 4           ) OK          N/A
Memory Zone      (DIMMs 1         ) OK        30C/ 86F    87C       92C
Memory Zone      (DIMMs 2         ) OK        27C/ 80F    87C       92C
Memory Zone      (DIMMs 3         ) OK          N/A
Memory Zone      (DIMMs 4         ) OK          N/A
Memory Zone      (Mem 1 1-4 Zone  ) OK        33C/ 91F    85C       90C
Memory Zone      (Mem 1 5-8 Zone  ) OK        35C/ 95F    85C       90C
Memory Zone      (Mem 2 1-4 Zone  ) OK        28C/ 82F    85C       90C
Memory Zone      (Mem 2 5-8 Zone  ) OK        32C/ 89F    85C       90C
Memory Zone      (Mem 3 1-4 Zone  ) OK        23C/ 73F    85C       90C
Memory Zone      (Mem 3 5-8 Zone  ) OK        23C/ 73F    85C       90C
Memory Zone      (Mem 4 1-4 Zone  ) OK        22C/ 71F    85C       90C
Memory Zone      (Mem 4 5-8 Zone  ) OK        22C/ 71F    85C       90C
I/O Board Zone   (IOH 1           ) OK        58C/136F   100C      105C
I/O Board Zone   (IOH 2           ) OK        44C/111F   100C      105C
I/O Board Zone   (NIC Zone        ) OK        62C/143F    90C       95C
I/O Board Zone   (Mezz Zone       ) OK        57C/134F    90C       95C
System Zone      (Chassis Exit    ) OK        63C/145F   100C      105C
Storage Zone     (HDD Max         ) OK        35C/ 95F    60C       65C

Virtual Fan: 27%

Parameters :


-H
print help message

-c CRITICAL
critical level for average temperature

-w WARNING
warning level for average temperature

-U USERNAME
username to HP Onboard Administrator

-P PASSWORD
password to HP Onboard Administrator

-m TEMPERATURE
minimum temperature 

-x TEMPERATURE
maximum temperature


Example usage :

./NagiosHPBladeSystemTemperature.php -U <userName> -P <Password> -c <criticalLevel> -w <warningLevel> -m <minTemperature> -x <maxTemperature>