wtorek, 17 września 2019

BOOTMGR IS MISSING

1. Boot your computer to the Windows 7 DVD
2. Select your language and click next.
3. Click the button for “Use recovery tools”.
4. Then select “Command Prompt”.
5. When command window shows:
a. set partition as active:
diskpart
list disk
sel disk 0
(if disk 0 is your boot disk)

*disk may be read-only so:
attributes disk clear readonly

list vol
sel vol 2
(if your partition is 2 on list)
active
exit

b. fix mbr
bootrec /fixmbr
bootrec /fix boot
bootrec /rebuildbcd

* if "the system cannot find the path specified" message show:
bcdboot C:\windows (if C is your windows partition)

if error:
switch to instalation CD:
cd D:\boot
d:\
bootsect /nt60 SYS /mbr


exit

restart

niedziela, 2 września 2018

remove password from VBA project

  1. Open the XLSM file with 7-Zip (right click -> 7-Zip -> Open archive).
  2. Copy the xl/vbaProject.bas file out of the file (you can drag and drop from 7-Zip), don't close 7-Zip
  3. Open the vbaProject.bas file with HexEdit
  4. Search for "DPB=" and replace it with "DPx="
  5. Save the file
  6. Copy this file back into 7-Zip (again, drag and drop works)
  7. Open the XLSX file in Excel, if prompted to "Continue Loading Project", click Yes. If prompted with errors, click OK.
  8. Press F11 to open the VBA editor.
  9. Right click on the VBA project, select properties. Open the Protection tab then uncheck "Lock project for viewing". Press OK
  10. Save and Close the XLSM file
  11. Re-open the XLSM file and proceed to edit/view the VBA project macros.

czwartek, 6 kwietnia 2017

MS Office Excel Ribbon Dynamic Combobox Items from SQL Server Database

1. Create Excel Workbook
2. Add CustomUI:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon startFromScratch="false"> <tabs> <tab id="customTab" label="TabLabel"> <group id="dd" label="GroupLabel"> </comboBox> <comboBox id="Combo1" label="ComboBox" getItemCount="cboItemCount" getItemLabel="cboLabel" onChange="MyCombo"> </group> </tab> </tabs> </ribbon> </customUI>


3. Open VBA Editor and paste below code
4. Customize sql connection and query


Option Explicit
Public gobjRibbon As IRibbonUI
Dim cboData() As Variant

'sub running after changing combobox item
Public Sub MyCombo(cbo As IRibbonControl, strText As String)
   MsgBox "combo value selected = " & strText
End Sub

'sub adding items from cdoData collection
Sub cboLabel(control As IRibbonControl, Index As Integer, ByRef label)
    label = cboData(Index)
End Sub

'sub populating cdoData collection
Sub cboItemCount(control As IRibbonControl, ByRef count)
Dim con As ADODB.Connection
Set con = New ADODB.Connection
Dim strConn As String


'choose connection authentication type

'dataBase authentication:
strConn = "PROVIDER=SQLOLEDB;DATA SOURCE=DataBaseServer;USER ID=DataBaseUserName;Password=Password;Initial Catalog=DataBase;MultipleActiveResultSets=True"

OR

'Windows authentication:
strConn = "PROVIDER=SQLOLEDB;DATA SOURCE=DataBaseServer;Initial Catalog=DataBase;Integrated Security=true;MultipleActiveResultSets=True"


con.Open strConn
Dim i As Integer
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.ActiveConnection = con
rst.Open "select distinct YourItem FROM Table order by YourItem desc "
ReDim cboData(i) ' Labels is a dynamic array
i = 1
Do Until rst.EOF
ReDim Preserve cboData(i)
    cboData(i) = rst!data_danych
    rst.Move 1
    i = i + 1
Loop
count = i

rst.Close
con.Close
Set rst = Nothing
Set con = Nothing
End Sub


środa, 20 maja 2015

T450 clickpad (with buttons) in T440 T440s T440p - Unable to connect to the synaptics pointing device driver

If you buy (at ebay or aliexpress) 3-button touchapd from T450 for your T440 / t440s / T440p you can get following error:
"Unable to connect to Synaptics Pointing Device Driver" .

BASIC SOLUTION
  • uninstall Synaptic software
  • remove "mouse" pointing device
  • restart windows
  • clean Synaptic registry entries using CCleaner
  • restart windows
  • install UltraNav[n10gx25w] driver
... usually works.
While not...

ADVANCED SOLUTION
  • Go to "Device manager""
  • Expand pointing devices
  • Click properties
  • Go to details tab
  • Check Hardware ID
  • if there's:

  • ACPI\VEN_LEN&DEV_0036
    ACPI\LEN0036
    *LEN0036

it can be used driver for YOGA 15 (http://support.lenovo.com/de/de/downloads/ds101993).
Its ALPS driver so it's obviouse that Synaptic driver don't work :-)


Devices with hardware id: ACPI\VEN_LEN&DEV_0035 worked with Synaptic driver
Inspiration:
http://jonsson.ninja/t450-touchpad-on-t440-upgrade/
http://forum.notebookreview.com/threads/t450-t550-touchpad-on-t440-t540-mod.769254/

środa, 9 października 2013

SQL Server - jak z ciągu dzielonego separatorem zrobić kolumny

create function [dbo].[function]() RETURNS @ResultTable TABLE ( id_tabeli int, atrybut_opis varchar(1000) ) as begin declare @id_w int declare @id_p varchar(50) declare @p int declare @wynik varchar(1000) DECLARE C1 CURSOR READ_ONLY FOR SELECT distinct id_tabeli , id_atrybut FROM dbo.tabela_1 -- [dbo].[v_r_sprawy_przejete_km] OPEN C1 FETCH NEXT FROM C1 INTO @id_w, @id_p WHILE @@FETCH_STATUS = 0 BEGIN while len(@id_p) > 0 begin if PATINDEX('%;%', @id_p) > 0 begin set @p = SUBSTRING(@id_p, 0 , PATINDEX('%;%', @id_p)) set @wynik = (select distinct atrybut_opis from dbo.tabela_2 where id_atrybut = @p) insert @ResultTable(id_tabeli, atrybut_opis) values (@id_w, @wynik) set @id_p = SUBSTRING(@id_p, len(@p)+2, LEN(@id_p)) end else begin set @p = @id_p set @id_p = null set @wynik = (select distinct atrybut_opis from dbo.tabela_2 where id_atrybut = @p) insert @ResultTable(id_tabeli, atrybut_opis) values (@id_w, @wynik) end end FETCH NEXT FROM C1 INTO @id_w, @id_p END CLOSE C1 DEALLOCATE C1 return end

środa, 20 marca 2013

SSRS SQL 2008R2 ReportServer DB Lista Raportów z parametrami

--lista raportów z parametrami: ;WITH XMLNAMESPACES ( DEFAULT 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition', 'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner' AS rd ) SELECT NAME as NazwaRaportu , PATH as SciezkaRaportu , x.value ('@Name', 'VARCHAR(100)') AS NazwaParametru , x.value ('DataType[1]', 'VARCHAR(100)') AS TypDanych , x.value ('AllowBlank[1]', 'VARCHAR(50)') AS CzyPuste , x.value ('Prompt[1]', 'VARCHAR(100)') AS Tekst , x.value ('Hidden[1]', 'VARCHAR(100)') AS Ukryty , x.value ('data(DefaultValue/Values/Value)[1]', 'VARCHAR(100)') AS Wartosc FROM ( SELECT PATH , NAME , CAST(CAST(content AS VARBINARY(MAX)) AS XML) AS ReportXML FROM ReportServer.dbo.Catalog WHERE CONTENT IS NOT NULL AND TYPE = 2 ) A CROSS APPLY ReportXML.nodes('/Report/ReportParameters/ReportParameter') R(x) --WHERE NAME = 'Nazwa Raportu' ORDER BY NAME

wtorek, 18 grudnia 2012

Excel ADO ADODB update named range

works for single cell

Sub test() 
strFile = "D:\1.xlsb" 

Dim cn As ADODB.Connection 
Dim cmd As ADODB.Command 
Dim rs As ADODB.Recordset 
strCon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strFile & _ ";Extended Properties=""Excel 12.0;HDR=No;Readonly=True""" 

Set cn = CreateObject("ADODB.Connection") 
Set rs = CreateObject("ADODB.Recordset") 
cn.Open strCon 

'check current value: 
sqlm = "SELECT * FROM namedRange" 
rs.Open sqlm, cn 
m = rs.GetString 
Debug.Print m 

'update single cell
Set cmd = New ADODB.Command 
cmd.ActiveConnection = cn 
cmd.CommandType = adCmdText 
cmd.CommandText = "update namedRange set F1 = '123456789'" 
cmd.Execute 
End Sub