Posts

Showing posts from March, 2019

Color disabled in Windows 10

Color disabled in Windows 10 It is due to the Windows 10 color filters. To turn on or off the filter, press below key combination: Windows + CTRL + C It's a toggle switch.

Python on Mac: Installation of Python 2.7.12 and Kivy Module

2016.12.11 Python on Mac: Installation of Python 2.7.12 and Kivy Module 1. Goto Python WebSite " https://www.python.org/downloads/ " to download the below package Python-2.7.12-macox10.6.pkg 2. Install the package 3. Command+SPACE \ Terminal, to Open Terminal 4. Type below command to install the latest pip easy_install pip 5. Type below command to install pygame pip install --user pygame 6. Prerequisite for kivy installation: pip install --user cython 7. pip install --user kivy 8. pip install --user buildozer Done!

PHP connect to SQL Database

function dbConnect() { //$dsn = "sqlsrv:Server=localhost,1433;Database=AbcData;ConnectionPooling=0"; $dsn = "sqlsrv:server=(localdb)\\v11.0; AttachDBFilename=C:\MyLocalDB\AbcData.mdf; Database=AbcData"; $user = "AbcUser"; $password = "AbcPsw"; //$conn = new PDO($dsn, "AbcDev", "AbcPsw"); try { $conn = new PDO($dsn, $user, $password); $conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); }

Toll Fee between Singapore and Malaysia (Updated on 19 Apr 2018)

Toll Fee between Singapore and Malaysia (Updated on 19 Apr 2018): Tuas: Total: S$16.67 Singapore side: S$5.00 ($2.50 on leaving Singapore and $2.50 when returning.) Malaysia side: RM35 (RM20 on entering Malaysia, RM7.50 at the toll plaza going to Malaysia and RM7.50 at the toll plaza when leaving Malaysia.) Woodland: Total: S$8.63 Singapore side: S$1.00 ($1.00 on leaving Singapore and $0.00 when returning.) Malaysia side: RM22.90 (RM22.90 on entering Malaysia)

一个程序猿的爱情故事

一个程序猿的爱情故事 小伟毕业后顺利的进了一家软件公司,他天生就是干这行的料。不爱说话,不善于言谈,热衷于解决程序中的难题,程序员的这些标签都贴在了他的身上。 每次解决一个难题,小伟总习惯对着电脑傻笑一会。刚开始大家都以为他脑子有点问题,后来久了也就习惯了。 突然有一天,公司来了一名女程序员。在他看来她一点没有程序员的样貌,长发飘飘,一副大边框的眼镜里藏着一双美丽的大眼睛,连走路时身边带过来的风都夹着淡淡的清香。 她的位置被安排在了小伟边上,她向小伟问好同时对他笑了一下。 就这个很平常的举动让小伟有些不知所措,她的微笑足以埋没他当天发现的所有Bug。 美女是刚毕业的小妹妹,在工作中难免有很多问题需要问小伟,小伟总是很快的帮她解决了。美女进步很快,为了答谢这段时间来小伟对她的帮助,她请他吃了个饭。 饭桌上,几乎是美女一个在说话,或者说是美女在审问他,她问一句,他答一句。但小伟也是个男人,也有男人都有的想法,但却没有男子汉应该有的勇气,一直红着脸低头吃饭。最后忍不住想看她一眼,却差点噎着了。 生活又在平淡中过了半年,一个晚上,他依然一个人在办公室里加班。突然她给她打了个电话,她说她喝多了,让他去接她。 他见到她的时候,她是撑到了极限。如果他晚点到,她可能就睡地上了。 她刚问完她的地址,她就醉倒了。她吃力的扶着她上了出租车,这也许是他第一次能如此近距离的和美女接触,能如此近距离的味着长发的味道。他费了好大的劲终于把她弄到了屋里,他自己也累得倒在了她边上。房间很静,他能听到她的心跳,能感受到她呼吸的空气撞到他脸上……。 他感觉自己心跳的频率比处理线上支付系统的Bug跳得还要快,他想尝试靠近她一点。就在这时,她吐了出来,弄得两个人一身污垢。 他给自己和她简单擦了一下,然后他拿出了电脑继续写代码。本来三天的工作量,他一个晚上就写完了,效率高得连他自己都不敢相信。 第二天她醒后,连连说谢谢。她说她和男友分手了,心情不好,然后自己跑出去喝酒了,要不是他还真不知道会发生什么事。 这以后,他工作总是心不在焉了。终于,有一天,她要他帮忙解决一个难题。他很快帮她写过完了,他把他对她的喜欢写在了代码注释里,希望她能看到。除了这种方式,他找不出更好表达自己想法的办法了。可没想到那天她有事,代码直接被她提交了,上线后就再也没有改过这个地方...

Cornerstone OnDemand Technology Stack

Cornerstone OnDemand provides a 100% SaaS product which is browser based. Technology: ASP.NET 4.0 and C# Microsoft SQL Server 2008 Asynchronous JavaScript and XML (Ajax) Web Services WCF

Programming tricks (Apr 2018)

Programming tricks (Apr 2018) 1. How to create an Icons DLL like the “Shell32.DLL” which make its icons visible for shortcut icon setting, and how to use its icons for shortcut via codes 2. How to create a professional MSI installer via Visual Studio Windows Installer (User Interface, Custom Actions and Installer Class) Create Shortcut on desktop for every user or current user Create Shortcut under StartMenu 3. The limitation of InstallShield Limited Edition 4. The WiX open source Toolset for Visual Studio 5. Office Addin and Ribbon (XML), finally get the trick to hide all unwanted menu Tabs include “FileTab” 6. Expose .Net functions to Office VBA via type library or Addin
Image
Only the developer got the gut?

Why the developer couldn’t find his own bug?

Image
Why the developer couldn’t find his own bug?

Great show with fantasy music

Great show with fantasy music Ana Yang Gazillion Bubble Show

"Change Password" option is missing from "Ctrl+Alt+Del" screen

Image
"Change Password" option is missing from "Ctrl+Alt+Del" screen Run GPEdit.msc, looking for Local Computer Policy\User Configuration\Administrative Templates\System\Ctrl+Alt+Del Options. Change the status of "Remove Change Password" from "Enabled" to "Disabled", restart the Windows, that's all!

How to replace the Windows Explorer with custom user interface?

Image
How to replace the Windows Explorer with custom user interface?

Why no Windows 9?

Why no Windows 9? Because 7 Ate 9.

Partial

Partial Partial. This modifier specifies that a class is specified in multiple declarations. With Partial, were open a class and add new parts to it. A Class can span multiple files. VB.NET program that uses Partial Module Module1     Partial Class Test         Public Sub X()             Console.WriteLine("X")         End Sub     End Class     Partial Class Test         Public Sub Y()             Console.WriteLine("Y")         End Sub     End Class     Sub Main()         ' Invoke methods on the partial class.         Dim t As Test = New Test()      ...

Setup the SQL Database development environment in VS2015

To setup the SQL Database development environment in VS2015, SQL Server Data Tools (SSDT) is required. Follow the link below to download and install: https://msdn.microsoft.com/en-us/mt186501.aspx SQL Server Data Tools in Visual Studio 2015 SQL Server Data Tools in Visual Studio 2015. Latest update: October 26, 2016. Version: 14.0.61021.0. Download SQL Server Data Tools. Note: This will download an installer in the language your current browser uses. To install a different language, please use one of the Administrative Download links ... msdn.microsoft.com

Mixed data types in Excel column to OLEDB Destination

Mixed data types in Excel column to OLEDB Destination Below is a copy of this topic from Microsoft MSDN Forum: Question I am importing the Source: Excel 2007 (xlsx) to Destination:SQL Server DB Table.. One filed had 739 records in that First 700 had General (i.e., Numeric ) last 39 had General(Alpha Numeric) CT --- 4564 45645 4548 0125 ''''' '''' 700 rows ADF456 ADER156 DER1234 '''''' '''''39 rows So I applied :: REGEDIT::: HKEY_LOCAL_MACHINE\Software\Microsoft\Office\14.0\Access Connectivity Engine\Engines\Excel\TypeGuessRows ::TypeGuessRows value to zero (0) IMEX=1 Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\destination.xlsx;Extended Properties="Excel 12.0 XML;HDR=YES;IMEX=1"; But SQL Table Last 39 Records Dumped as NULL whichever is Alphanumeric. Why? Dynamically How Can I import without doing Text to column in Excel on that column ? ...

VBA codes showing the list of users who open the shared workbook

Image
VBA codes showing the list of users who open the shared workbook: ThisWorkbook: Private Sub Workbook_Open()     Application.OnKey "{F2}", "UsersInfo"     UsersInfo End Sub Module1: Public Sub UsersInfo()     Users = ActiveWorkbook.UserStatus         Dim sMsg As String         Dim nLen1 As Integer Dim nLen2 As Integer     nLen1 = 0 nLen2 = 0     For Row = 1 To UBound(Users, 1)         If Len(Users(Row, 1)) > nLen1 Then             nLen1 = Len(Users(Row, 1))         End If         If Len(Users(Row, 2)) > nLen2 Then             nLen2 = Len(Users(Row, 2))         End If   ...

VBA notes

VBA notes: To view the macro assigned to a button on a worksheet, do the following 3 steps 1. Unprotect the worksheet 2. Enter the VBA project (if password protected) 3. On Developer Tab, turn on the “Design Mode” 4. Select the button of interest, right click mouse. There are 2 type of controls: - Form Control: the pop up menu will show “Assign macro...”, click on it you will see the current assigned macro - ActiveX Control: the pop up menu will show “View Code”, click on it you will see the click event of this button. Note: If the buttons (controls) which the macro assigned to is grouped, excel won’t show the macro name. In order to see the assigned macro, you have to ungroup the controls first.

Read and Write Registry on both Windows 7 & 10

Read and Write Registry on both Windows 7 & 10 Windows 7:     Private Function GetRegKeyValue32(sFullKeyPath As String, sKeyName As String) As String         Return My.Computer.Registry.GetValue(sFullKeyPath, sKeyName, "")     End Function     Private Sub SetRegKeyValue32(sFullKeyPath As String, sKeyName As String, sValue As String)         My.Computer.Registry.SetValue(sFullKeyPath, sKeyName, sValue)     End Sub Windows 10:     Private Function GetRegKeyValue(eRegHive As RegistryHive, sSubKeyPath As String, sKeyName As String) As String         Dim baseReg As RegistryKey = RegistryKey.OpenBaseKey(eRegHive, RegistryView.Registry64)         Dim subReg As RegistryKey = baseReg.OpenSubKey(sSubKeyPath, True)         Return s...

Excel 2010 Addin

Excel 2010 Addin 1. Installation folder C:\Program Files\Microsoft Office\Office14\Library or a network drive folder (Add it to the “Trusted Location” of Excel 2. Create a shortcut (change the icon)

VS 2015 Note

VS 2015 Note Nullable Type declaration Dim variableName As Nullable(Of type) [= expression] Dim variableName? As type [= expression] Dim variableName As type? [= expression] Examples Dim quantity As Nullable(Of Integer) quantity = 0 quantity = 20 quantity = Nothing Dim salesTotal? As a Decimal Dim isValid As Boolean Dim paymentTerms As Nullable(Of Terms) ' Dim message As Nullable(Of String) ' not allowed 2 properties for working with Nullable types HasValue Value

Auto-Incrementing Build Numbers in Visual Studio.NET

Auto-Incrementing Build Numbers in Visual Studio.NET 1.Open the file AssemblyInfo.vb 2.Change [assembly: AssemblyVersion(“1.0.0.0”)] to [assembly: AssemblyVersion(“1.0.*”)] 3.Remove [assembly: AssemblyFileVersion(“1.0.0.0”)] 4.Rebuild the project and verify that the version is incremented properly by viewing the properties of the newly compiled assembly.

Friend

Friend Friend. This modifier makes a member (like a Class, Sub or Function) unavailable outside the present assembly. An assembly is physical file that contains compiled code. Here: We specify that Display() is a Friend Sub. So it is Public inside the assembly, but not available outside. VB.NET that uses Friend Class Item     Friend Sub Display()         Console.WriteLine("Friend Class used")     End Sub End Class Module Module1     Sub Main()         ' The Display Sub is public if we are in the same assembly.         Dim local As Item = New Item()         local.Display()     End Sub End Module Output Friend Class used

Microsoft SQL Server Management Studio 2012 How to Connect to LocalDB

Microsoft SQL Server Management Studio 2012 How to Connect to LocalDB Server type: Database Engine Server name: (localdb)\V11.0 Authentication: Windows Authentication Connect to database: CMGxpData

InstallShield Limited Notes

InstallShield Limited Notes: DI Shell Project Regitery Setting: For Windows 7: Name Data Shell [INSTALLDIR]DIShell.exe For Windows 10: Name Data Shell C:\Program Files (x86)\DI Shell\DIShell.exe

VBA call VSTO Method

VBA call VSTO Method Sub CallVSTOMethod()     Dim addIn As COMAddIn     Dim automationObject As Object     Set addIn = Application.COMAddIns("AddInNameInRegistry")     Set automationObject = addIn.Object     Dim bSuccess As Boolean     Dim sEngineID As String     Dim sDisplayName As String     sEngineID = ""     bSuccess = automationObject.IsAuthorizedUser(sEngineID, sDisplayName)     MsgBox (bSuccess & vbCrLf & sEngineID & vbCrLf & sDisplayName)     Set automationObject = Nothing     Set addIn = Nothing End Sub Note: If not sure about the "AddInName", you can use below method to enumerate all the AddIns loaded.     Dim addIn As COMAddIn     Dim automationObject As Object         Dim nAddInsCount As Integer ...

VBA Regular Expression

VBA Regular Expression Open Excel VBA project, @Tools\Reference… Check “Microsoft VBA Regular Expression 5.5”, click “Ok” Now the Regular Expression engine is at your service. Add a module in your VBA project, copy & paste below code snippets to test the power of Regular Expression: ‘————————————————————————————————— Const BatchNoPattern As String = "^[1]\d{7}(\(\d*\))?$|^[0,2-9,a-z,A-Z].*$" Function GetUserName() GetUserName = Environ$("Username") End Function Function IsValidPattern(ByVal MyData As Variant, Optional ByVal MyPattern As String = BatchNoPattern, Optional ByVal MyIgnoreCase As Boolean = False) As Boolean ' // defines an Object used for Regular Expression (late binding) Dim objRegExp As Object Set objRegExp = CreateObject("VBScript.RegExp") ' // set Case objRegExp.IgnoreCase = MyIgnoreCase ' // set Pattern objRegExp.Pattern = MyPattern ' // return True for a valid match or False for an invalid m...

VS2017 MS Installer project with Protection

VS2017 MS Installer project with Protection Recently encounter a strange issue for MS Installer project with Protection (such as Obfuscation), the post build of original project works fine, it protected the exe and DLL files it generated. However, the MS Installer project still pick up the unprotected version of exe, after installation, in the installed folder, DLL files are protected, but exe file is not protected. The development environment is as follow: - Windows 10 - Visual Studio Enterprise 2017 version 15.9.5 After a few hours of try and error, I finally work out the following solution: 1. In VS Installer project from “Solution Explorer” pane, click “File System Editor” 2. In left pane “File System on Target Machine”, choose “Application Folder”, find the “Primary output from ### (Active)”, right click mouse 2. Click “ExcludeFilter”, then click “Add Filter” 3. In the text box below “New filter:” enter the exe file name, click Ok 4. Back to “Application Folder”, ri...

Outlook Automation

Outlook Automation C:\users\[userID]\AppData\mobile\Microsoft\Office\Outlook\Vba Project.OTM

LifeCycle ES4 & Word 2016 Error

LifeCycle ES4 & Word 2016 Error LifeCycle Designer ES4 does not recognize MS Word 2016 on Windows 10 While launching LifeCycle Designer ES4 and try to start from a Word doc, below error message pop up: "Word (version XP or onwards) could not be found on the machine" Problem is in Registry. LiveCycle searches only the following folders on Windows 10 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\10.0\Word\InstallRoot HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\11.0\Word\InstallRoot HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\12.0\Word\InstallRoot Create following Path in Registry: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\12.0\Word\InstallRoot create new "string value" "Path" with value "C:\Program Files (x86)\Microsoft Office\Office16\" Please remember to reboot PC for the changed registry to be effective. Reference: https://forums.adobe.com/thread/897696

How to create mutually exclusive radio buttons in word without using ActiveX control?

Image
How to create mutually exclusive radio buttons in word without using ActiveX control? To create a fillable word form, the content controls of Microsoft Word is very useful. Unfortunately the radio button control is missing from current content control toolbox. Here is an example of using Checkbox as the radio button. Create a table (2 rows, 3 columns) Insert 5 check boxes @ row 1, column 2, set their tags from opt11 to opt15 Insert 5 check boxes @ row 2, column 2, set their tags from opt21 to opt25 Paste below code snippet into ThisDocument code pane Option Explicit Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl) Dim sOptNo As String Dim nOptNo As Integer Dim oCell As Word.Cell Dim oRng As Word.Range Dim oCtrl As ContentControl sOptNo = Replace(ContentControl.Tag, "opt", "") If sOptNo <> "" Then nOptNo = CInt(sOptNo) If nOptNo >= 11 And nOptNo <= 15 Then Set oCell = ActiveDocument.Table...

Error - vbe6ext.olb could not be loaded

Issue description: The target PC has both Office 2010 and 2016 installed, after uninstalled the Office 2016, and open an Excel Spreadsheet, the above error happened. Fix: Go to below folder: C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6 Rename the file "VBE6EXT.OLB" to "VBE6EXT.OLD”. Open Excel again, click Alt+F11, a popup window prompting for repairing, click "Yes". After repair completed, the problem is fixed also.

Excel 2003-2016 Keyboard Shortcuts Disabled Issue

Excel 2003-2016 Keyboard Shortcuts Disabled Issue Fix For Excel 2016: 1. Run RegEdit and find below key 2. HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Options 3. Right click mouse, click "Delete" That's all. Registry Subkey Look Up Table for different Office Versions: Excel 2016 HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Options Excel 2013 HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Excel\Options Excel 2010 HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Options Excel 2007 HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Options Excel 2003 HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Options Reference: How to troubleshoot problems that occur when you start or use Word ( https://support.microsoft.com/en-us/help/921541/how-to-troubleshoot-problems-that-occur-when-you-start-or-use-word )

Word 2003-2016 Restrict Edit Panel disappear

Word 2003-2016 Restrict Edit Panel disappear Fix For Word 2016: 1. Run RegEdit and find below key 2. HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Word\Data 3. Right click mouse, click "Delete" That's all. Registry Subkey Look Up Table for different Office Versions: Word 2016 HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Word\Options Word 2013 HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Word\Options Word 2010 HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Word\Options Word 2007 HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\Options Word 2003 HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Word\Options Reference: How to troubleshoot problems that occur when you start or use Word ( https://support.microsoft.com/en-us/help/921541/how-to-troubleshoot-problems-that-occur-when-you-start-or-use-word )

Visual Studio $(TargetDir) macro is empty

I encounter this issue in VS2017, it shall apply to older version also. To repeat the issue: 1. Create a PreBuildEvent, and type below script echo TargetDir = "$(TargetDir)" 2.  Build the project, you will see: TargetDir = "" Solution: Open the project file with a text editor, then remove the PreBuildEvent section, including the outer <PropertyGroup>. Then re-add the Pre Build Events using Visual Studio.   <PropertyGroup>     <PreBuildEvent>          <!-- Pre build commands go here -->     </PreBuildEvent>   </PropertyGroup>