A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

SPD - Stikked
From eloaders, 5 Years ago, written in GAMBAS.

A PHP Error was encountered

Severity: Warning

Message: sizeof(): Parameter must be an array or an object that implements Countable

Filename: helpers/language_helper.php

Line Number: 81

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/helpers/language_helper.php
Line: 81
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/themes/geocities/views/view/view.php
Line: 24
Function: random_expire_msg

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
Line: 173
Function: include

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
Line: 43
Function: _ci_load

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 700
Function: view

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Notice

Message: Trying to access array offset on value of type null

Filename: helpers/language_helper.php

Line Number: 81

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/helpers/language_helper.php
Line: 81
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/themes/geocities/views/view/view.php
Line: 24
Function: random_expire_msg

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
Line: 173
Function: include

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
Line: 43
Function: _ci_load

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 700
Function: view

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

This paste will in 1 Second.
Embed
  1. ' Gambas module file
  2.  
  3. Private spd_i2c_eeprom_dir As String[] = ["/sys/bus/i2c/drivers/eeprom/",
  4.   "/sys/bus/i2c/drivers/ee1004/",
  5.   "/sys/bus/i2c/drivers/at24/",
  6.   "/home/michal/Dokumenty/SPD/"]
  7. Private spd_i2c_eeprom_files As New String[]
  8. Private eeprom_file_name As String = "eeprom"
  9.  
  10. Private Enum UNKNOWN = 0,
  11.   DIRECT_RAMBUS = 1,
  12.   RAMBUS = 2,
  13.   FPM_DRAM = 3,
  14.   EDO = 4,
  15.   PIPELINED_NIBBLE = 5,
  16.   SDR_SDRAM = 6,
  17.   MULTIPLEXED_ROM = 7,
  18.   DDR_SGRAM = 8,
  19.   DDR_SDRAM = 9,
  20.   DDR2_SDRAM = 10,
  21.   DDR3_SDRAM = 11,
  22.   DDR4_SDRAM = 12,
  23.   N_RAM_TYPES = 13
  24.  
  25. Private ram_types As String[] = ["Unknown", "Direct Rambus",
  26.   "Rambus", "FPM DRAM", "EDO",
  27.   "Pipelined Nibble", "SDR SDRAM",
  28.   "Multiplexed ROM", "DDR SGRAM",
  29.   "DDR SDRAM", "DDR2 SDRAM",
  30.   "DDR3 SDRAM", "DDR4 SDRAM"]
  31.  
  32. Public spd_size As New Long[]
  33. Public ram_type_str As New String[]
  34. Public ram_type_int As New Integer[]
  35. Public spd_revision As New String[]
  36. Public part_number As New String[]
  37. Public module_type As New String[]
  38. Public module_speed As New String[]
  39. Public module_size As New String[]
  40. Public voltage As New String[]
  41. Public module_manufacturer As New String[]
  42. Public module_dram_manufacturer As New String[]
  43. Public module_manufacture_date As New String[]
  44. Public eeprom As New Byte[512]
  45.  
  46. Private Function read_spd(file_path As String)
  47.  
  48.   Dim eeprom_file As File
  49.   eeprom_file = Open file_path For Read
  50.   eeprom.Read(eeprom_file, 0, Lof(eeprom_file))
  51.   eeprom_file.Close
  52.  
  53.  
  54. Private Function calculate_spd_size(file_path As String) As Long
  55.  
  56.   If Exist(file_path) Then
  57.     Return Stat(file_path).Size
  58.   Else
  59.     Return Null
  60.  
  61.  
  62. Private Function find_spd_eeprom_file()
  63.  
  64.   Dim eeprom_file As File
  65.   Dim eeprom_byte As New Byte[512]
  66.  
  67.   For i = 0 To spd_i2c_eeprom_dir.Max
  68.     If Exist(spd_i2c_eeprom_dir[i]) Then
  69.       For Each element As String In Dir(spd_i2c_eeprom_dir[i], "*-****")
  70.         If Exist(spd_i2c_eeprom_dir[i] &/ element &/ eeprom_file_name) Then
  71.           eeprom_file = Open (spd_i2c_eeprom_dir[i] &/ element &/ eeprom_file_name) For Read
  72.           eeprom_byte.Read(eeprom_file, 0, Lof(eeprom_file))
  73.           If eeprom_byte[0] > 0 Then
  74.             spd_i2c_eeprom_files.Add(spd_i2c_eeprom_dir[i] &/ element &/ eeprom_file_name)
  75.           Endif
  76.           eeprom_file.Close
  77.         Endif
  78.       Next
  79.     Endif
  80.   Next
  81.  
  82.  
  83. Public Sub Main()
  84.  
  85.   Dim eeprom_file As File
  86.   Dim eeprom_byte As New Byte[]
  87.  
  88.   find_spd_eeprom_file()
  89.  
  90.   For Each Variable As String In spd_i2c_eeprom_files
  91.     spd_size.Add(calculate_spd_size(Variable))
  92.   Next
  93.  
  94.   For i = 0 To spd_i2c_eeprom_files.Max
  95.     read_spd(spd_i2c_eeprom_files[i])
  96.     ram_type_str.Add(ram_types[decode_ram_type(eeprom)])
  97.     ram_type_int.Add(decode_ram_type(eeprom))
  98.    
  99.     Select ram_type_int[i]
  100.       Case SDR_SDRAM
  101.       Case DDR_SDRAM
  102.       Case DDR2_SDRAM
  103.       Case DDR3_SDRAM
  104.         spd_revision.Add(decode_ddr3_spd_revision(eeprom))
  105.         part_number.Add(decode_ddr3_part_number(eeprom))
  106.         module_type.Add(decode_ddr3_module_type(eeprom))
  107.         module_speed.Add(decode_ddr3_module_speed(eeprom))
  108.         module_size.Add(decode_ddr3_module_size(eeprom))
  109.         voltage.Add(decode_ddr3_voltage(eeprom))
  110.         module_manufacturer.Add(decode_ddr3_module_manufacturer(eeprom))
  111.         module_dram_manufacturer.Add(decode_ddr3_module_dram_manufacturer(eeprom))
  112.         module_manufacture_date.Add(decode_ddr3_module_date(eeprom[120], eeprom[121]))
  113.         'Print "Manufacturer:" & Hex(eeprom[117] And &h7F) & " " & Hex(eeprom[118])
  114.         'Print CMemVendors.MemVendors[CString(Hex(eeprom[117] And &h7F))][LCase(Hex(eeprom[118]))]
  115.        
  116.         'decode_ddr34_manufacturer(eeprom[117], eeprom[118])
  117.       Case DDR4_SDRAM
  118.         part_number.Add(decode_ddr4_part_number(eeprom))
  119.         module_type.Add(decode_ddr4_module_type(eeprom))
  120.         module_speed.Add(decode_ddr4_module_speed(eeprom))
  121.         module_size.Add(decode_ddr4_module_size(eeprom))
  122.         module_manufacturer.Add(decode_ddr4_module_manufacturer(eeprom))
  123.         module_dram_manufacturer.Add(decode_ddr4_module_dram_manufacturer(eeprom))
  124.         module_manufacture_date.Add(decode_ddr4_module_date(eeprom, spd_size[i], eeprom[323], eeprom[324]))
  125.     End Select
  126.   Next
  127.   Print
  128.   For i = 0 To spd_size.max
  129.     Try Print ram_type_str[i];;
  130.    
  131.     Try Print module_manufacturer[i];;
  132.     Try Print module_dram_manufacturer[i]
  133.     Try Print "Manufacturing Date: "; module_manufacture_date[i]; " | ";
  134.     Try Print part_number[i]
  135.     Try Print module_type[i];;
  136.    
  137.     Try Print module_speed[i]
  138.     Try Print module_size[i] & " MB";;
  139.     Try Print voltage[i];;
  140.     Try Print spd_size[i];;
  141.    
  142.     Try Print ram_type_int[i];;
  143.     Try Print spd_revision[i]
  144.     Print "\n"
  145.    
  146.   Next
  147.  
  148.  
  149. Private Function decode_ddr3_spd_revision(bytes As Byte[]) As String
  150.  
  151.   Return Mid(Hex(bytes[1]), 1, 1) & "." & Mid(Hex(bytes[1]), 2, 1)
  152.  
  153.  
  154. Private Function decode_ddr3_part_number(bytes As Byte[], Optional partnumber As String) As String
  155.  
  156.   For i = 128 To 145
  157.     partnumber &= Chr(bytes[i])
  158.   Next
  159.   Return partnumber
  160.  
  161.  
  162. Private Function decode_ddr4_part_number(bytes As Byte[], Optional partnumber As String) As String
  163.   For i = 329 To 348
  164.     partnumber &= Chr(bytes[i])
  165.   Next
  166.   Return partnumber
  167.  
  168. Private Function decode_ddr3_module_type(bytes As Byte[]) As String
  169.  
  170.   Dim type As String
  171.   Select bytes[3]
  172.     Case 01
  173.       type = "RDIMM (Registered Long DIMM)"
  174.     Case 02
  175.       type = "UDIMM (Unbuffered Long DIMM)"
  176.     Case 03
  177.       type = "SODIMM (Small Outline DIMM)"
  178.     Default
  179.       type = Null
  180.   Return type
  181.  
  182.  
  183. Private Function decode_ddr4_module_type(bytes As Byte[]) As String
  184.  
  185.   Dim type As String = "Unknown" ''Default Unknown if no detect
  186.   Select Hex(bytes[3], 2)
  187.     Case "01"
  188.       type = "RDIMM (Registered DIMM)"
  189.     Case "02"
  190.       type = "UDIMM (Unbuffered DIMM)"
  191.     Case "03"
  192.       type = "SODIMM (Small Outline Unbuffered DIMM)"
  193.     Case "04"
  194.       type = "LRDIMM (Load-Reduced DIMM)"
  195.     Case "05"
  196.       type = "Mini-RDIMM (Mini Registered DIMM)"
  197.     Case "06"
  198.       type = "Mini-UDIMM (Mini Unbuffered DIMM)"
  199.     Case "08"
  200.       type = "72b-SO-RDIMM (Small Outline Registered DIMM, 72-bit data bus)"
  201.     Case "09"
  202.       type = "72b-SO-UDIMM (Small Outline Unbuffered DIMM, 72-bit data bus)"
  203.     Case "0c"
  204.       type = "16b-SO-UDIMM (Small Outline Unbuffered DIMM, 16-bit data bus)"
  205.     Case "0d"
  206.       type = "32b-SO-UDIMM (Small Outline Unbuffered DIMM, 32-bit data bus)"
  207.     Default
  208.       type = Null
  209.   Return type
  210.  
  211.  
  212. Private Function decode_ddr3_module_speed(bytes As Byte[]) As String
  213.   ' Dim ctime As Float
  214.   ' Dim ddrclk As Float
  215.   ' Dim tbits, pcclk As Integer
  216.   ' Dim mtb As Float = 0.125
  217.   '
  218.   ' If (bytes[10] == 1 And bytes[11] == 8) Then mtb = 0.125
  219.   ' If (bytes[10] == 1 And bytes[11] == 15) Then mtb = 0.0625
  220.   ' ctime = mtb * bytes[12]
  221.   ' ddrclk = 2 * (1000 / ctime)
  222.   '
  223.   ' tbits = 64
  224.   ' Select bytes[8]
  225.   '   Case 1
  226.   '     tbits = 16
  227.   '   Case 4
  228.   '     tbits = 32
  229.   '   Case 3
  230.   '   Case 0
  231.   '     tbits = 64
  232.   ' End Select
  233.   '
  234.   ' pcclk = ddrclk * (tbits / 8)
  235.   ' pcclk -= pcclk % 100
  236.   '
  237.   ' Return Subst("DDR3-&1Mhz PC3-&2", CInt(ddrclk), pcclk)
  238.  
  239.   Dim divisor As Integer = bytes[10]
  240.   Dim dividend As Integer = bytes[11]
  241.   Dim ratio As Integer = bytes[12]
  242.  
  243.   If dividend = 0 And divisor = 0 And ratio = 0 Then
  244.     Return "DDR3-Unknown Mhz"
  245.   Else
  246.     Return Subst("DDR3-&1Mhz", ((2000 * dividend) / (divisor * ratio)))
  247.  
  248.  
  249. Private Function decode_ddr4_module_speed(bytes As Byte[]) As String
  250.  
  251.   Dim mincycle As Integer = bytes[18]
  252.   Dim fineadjust As Integer = Bytes[125]
  253.   Dim frequency As Integer
  254.  
  255.   frequency = (2000000 / (mincycle * 125 + fineadjust))
  256.   Return Subst("DDR4-&1Mhz", frequency)
  257.  
  258.  
  259. Private Function decode_ddr3_module_size(bytes As Byte[]) As String
  260.  
  261.   Dim size As Integer
  262.   ' Dim sdr_capacity As Integer = Lsl(256, Hex(bytes[4]) And &hF)
  263.   ' Dim sdr_width As Integer = Lsl(4, Hex(bytes[7]) And &h7)
  264.   ' Dim bus_width As Integer = Lsl(8, Hex(bytes[8]) And &h7)
  265.   ' Dim ranks As Integer = 1 + Lsr(3, Hex(bytes[7]) And &h7)
  266.  
  267.   ' Print "sdr_capacity = " & Lsl(256, Bytes[4])
  268.   ' Print "sdr_width = " & Lsl(4, bytes[7])
  269.   ' Print "bus_width = " & Lsl(8, bytes[8])
  270.   ' Print "ranks = " & (Lsr(3, bytes[7]) + 1)
  271.  
  272.   ' size = sdr_capacity / 8 * bus_width / sdr_width * ranks
  273.  
  274.   size = ((Hex(bytes[4]) And &h0f) + 28) + ((Hex(bytes[8]) And &h7) + 3)
  275.   size -= (Hex(bytes[7]) And &h7) + 25
  276.   size = (Lsl(1, size)) * (Lsr(3, bytes[7] And &h1f) + 1)
  277.   Return Subst("Module size: &1", size / 1024)
  278.  
  279.  
  280. Private Function decode_ddr4_module_size(bytes As Byte[]) As String
  281.   Dim sdram_width As Integer
  282.   Dim ranks As Integer
  283.   Dim signal_loading As Integer
  284.   Dim die_count As Integer
  285.   Dim cap As Integer
  286.  
  287.   sdram_width = 4 * CInt(2 ^ (bytes[12] And &h07))
  288.   ranks = ((bytes[12] \ CInt(2 ^ 3)) And &h07) + 1
  289.   signal_loading = (bytes[6] And &h03)
  290.   die_count = ((bytes[12] \ CInt(2 ^ 4)) And &h07) + 1
  291.   cap = (256 * CInt(2 ^ (bytes[4] And &h0f))) / 8
  292.   cap *= (8 * CInt(2 ^ (bytes[13] And &h07))) / sdram_width
  293.   cap *= ranks
  294.   If signal_loading = &h02 Then
  295.     cap *= die_count
  296.   ' Print "sdram_width: " & sdram_width
  297.   ' Print "ranks: " & ranks
  298.   ' Print "signal_loading: " & signal_loading
  299.   ' Print "die_count: " & die_count
  300.   ' Print "cap: " & cap
  301.  
  302.   Return Subst("&1", cap)
  303.  
  304. ' # Size computation
  305. '   my $sdram_width = 4 << ($bytes->[12] & 0x07);
  306. '   my $ranks = (($bytes->[12] >> 3) & 0x07) + 1;
  307. '   my $signal_loading = $bytes->[6] & 0x03;
  308. '   my $die_count = (($bytes->[6] >> 4) & 0x07) + 1;
  309. '   my $cap = (256 << ($bytes->[4] & 0x0f)) / 8;
  310. '   $cap *= (8 << ($bytes->[13] & 0x07)) / $sdram_width;
  311. '   $cap *= $ranks;
  312. '   $cap *= $die_count if $signal_loading == 0x02;    # 3DS
  313. '   printl("Size", $cap . " MB");
  314.  
  315. Private Function decode_ddr3_voltage(bytes As Byte[]) As String
  316.  
  317.   Return If(bytes[6] = 4, "1.25V ", "") & If(bytes[6] = 2, "1.35V ", "") & If(bytes[6] = 1, "", "1.5V")
  318.  
  319.  
  320. Private Function decode_ddr3_module_manufacturer(bytes As Byte[]) As String
  321.  
  322.   Return decode_ddr34_manufacturer(bytes[117], bytes[118])
  323.  
  324.  
  325. Private Function decode_ddr3_module_dram_manufacturer(bytes As Byte[]) As String
  326.  
  327.   Return decode_ddr34_manufacturer(bytes[148], bytes[149])
  328.  
  329.  
  330. Private Function decode_ddr4_module_manufacturer(bytes As Byte[]) As String
  331.  
  332.   Return decode_ddr34_manufacturer(bytes[320], bytes[321])
  333.  
  334.  
  335. Private Function decode_ddr4_module_dram_manufacturer(bytes As Byte[]) As String
  336.  
  337.   Return decode_ddr34_manufacturer(bytes[350], bytes[351])
  338.  
  339.  
  340. Private Function decode_ddr34_manufacturer(count As Byte, code As Byte) As String
  341.  
  342.   Dim Manufacturer As String
  343.   Dim bank As String
  344.  
  345.   bank = Hex(count And &h7f, 1)
  346.   index = Hex(code And &h7f, 2)
  347.   Manufacturer = CMemVendors.MemVendors[bank][index]
  348.  
  349.   If Manufacturer = Null Then
  350.     index = LCase(index)
  351.     Manufacturer = CMemVendors.MemVendors[bank][index]
  352.  
  353.   If Manufacturer = Null Then
  354.     index = LCase(Hex(code))
  355.     Manufacturer = CMemVendors.MemVendors[bank][index]
  356.   Return Manufacturer
  357.  
  358.  
  359. Private Function decode_ddr3_module_date(syear As Byte, sweek As Byte) As String
  360.   'Print syear; " "; sweek
  361.   syear = Hex(syear)
  362.   sweek = Hex(sweek)
  363.   'Print syear; " "; sweek
  364.   If (syear And &hf0) <= &h90 Or (syear And &h0f) <= &h09 Or (sweek And &hf0) <= &h90 Or (sweek And &h0f) <= &h09 Then
  365.    
  366.     Return Subst("&1&2 W&3", IIf(syear >= &h80, 19, 20), syear, sweek)
  367.    
  368.   Else If (syear <= 99 Or sweek >= 1 Or sweek <= 53) Then
  369.    
  370.     Return Subst("&1&2 W&3", IIf(syear >= 80, 19, 20), syear, sweek)
  371.  
  372.   Else
  373.  
  374.     Return Subst("&1 W&2", syear, sweek)
  375.    
  376.   Return "UNKNOWN"
  377.  
  378. Private Function decode_ddr4_module_date(Optional bytes As Byte[], Optional spd_size As Long, syear As Byte, sweek As Byte) As String
  379.   'Print "DDR4 Byte"; syear; " "; sweek
  380.   syear = Hex(syear)
  381.   sweek = Hex(sweek)
  382.   'Print "DDR4 Hex"; syear; " "; sweek
  383.   If (spd_size < 324) Then
  384.     Return "Unknown"
  385.   If bytes[323] = &h0 Or bytes[323] = &hff And If bytes[324] = &h0 Or bytes[324] = &hff Then
  386.     Return "Unknown"
  387.  
  388.   Return Subst("&1&2 W&3", IIf(syear >= 80, 19, 20), syear, sweek)
  389.  
  390.  
  391. Private Function decode_ram_type(bytes As Byte[]) As Integer
  392.  
  393.   If bytes[0] < 4 Then
  394.     Select bytes[2]
  395.       Case 1
  396.         Return DIRECT_RAMBUS
  397.       Case 17
  398.         Return RAMBUS
  399.     End Select
  400.   Else
  401.     Select bytes[2]
  402.       Case 1
  403.         Return FPM_DRAM
  404.       Case 2
  405.         Return EDO
  406.       Case 3
  407.         Return PIPELINED_NIBBLE
  408.       Case 4
  409.         Return SDR_SDRAM
  410.       Case 5
  411.         Return MULTIPLEXED_ROM
  412.       Case 6
  413.         Return DDR_SGRAM
  414.       Case 7
  415.         Return DDR_SDRAM
  416.       Case 8
  417.         Return DDR2_SDRAM
  418.       Case 11
  419.         Return DDR3_SDRAM
  420.       Case 12
  421.         Return DDR4_SDRAM
  422.     End Select
  423.     Return UNKNOWN
  424.  
  425.