Skip to content

Instantly share code, notes, and snippets.

@haintwork
haintwork / visio_fit_to_draw.md
Last active June 17, 2017 10:01
In Visio, the "Fit to Drawing" command does not resize the page to fit the drawing's dimensions

Symptoms

In Microsoft Visio 2010 or Visio 2013, when you click Fit to Drawing in the Size group on the Design tab, the page resizes. But a small margin remains between the edge of the page and the drawing.

Cause

This issue occurs because of a design change in Visio. The Fit to Drawing command takes the margin settings of the page into consideration when the command resizes the page to fit the drawing.

Resolution

To resolve this issue, follow these steps:

  1. On the File tab, click Options, and then in the navigation pane, click Customize Ribbon.
  2. In the Main Tabs pane, click to select the Developer check box, and then click OK.
  3. On the Developer tab, click Show ShapeSheet, and then click Page.
  4. In the Print Properties section of the ShapeSheet, set the following values to 0:
@haintwork
haintwork / atom_custom_keymap.cson
Created June 17, 2017 02:45
Atom Custom Key Binding
'.platform-win32 atom-text-editor, .platform-linux atom-text-editor':
'ctrl-d': 'editor:delete-line'
'atom-workspace atom-text-editor:not([mini])':
'ctrl-alt-down': 'editor:duplicate-lines',
@haintwork
haintwork / copy_modified_only.bat
Created June 16, 2017 06:21
Copy only modified files and sub folders
xcopy source_folder\* "destination_folder_path" /D /E /C /Q /H /R /Y /K
@haintwork
haintwork / mysql_service_run_with_no_password_required.md
Last active June 15, 2017 11:49
How to start MySQL with --skip-grant-tables?

Stop the MySQL service through Administrator tools, Services.

Modify the my.ini configuration file (assuming default paths)

C:\Program Files\MySQL\MySQL Server 5.5\my.ini

or for MySQL version >= 5.6

C:\ProgramData\MySQL\MySQL Server 5.6\my.ini 
@haintwork
haintwork / java_set_read_write_property.java
Created June 13, 2017 03:40
Set file is read only or writable in Java
import java.io.File;
import java.io.IOException;
public class FileReadAttribute
{
public static void main(String[] args) throws IOException
{
File file = new File("c:/file.txt");
@haintwork
haintwork / java7_write_file.java
Last active November 4, 2019 06:49
[Write file in Java using FileOutputStream] #java #write #file #file_output_stream
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class WriteFileExample {
public static void main(String[] args) {
File file = new File("c:/newfile.txt");
String content = "This is the text content";
@haintwork
haintwork / java7_read_file.java
Last active June 13, 2017 03:44
Read file in Java using FileInputStream
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class ReadFileExample {
public static void main(String[] args) {
File file = new File("C:/robots.txt");
@haintwork
haintwork / java_rename_file.md
Last active June 12, 2017 09:52
Rename file in java

How to rename file in Java

Java comes with renameTo() method to rename a file. However , this method is really platform-dependent: you may successfully rename a file in *nix but failed in Windows. So, the return value (true if the file rename successful, false if failed) should always be checked to make sure the file is rename successful.

File.renameTo() Example

package com.mkyong.file;

import java.io.File;
@haintwork
haintwork / gist_sublimetext2_code_snippet_management.md
Created June 12, 2017 09:04
Manage code snippet using Gist and SublimeText 2
@haintwork
haintwork / 0_reuse_code.js
Created June 12, 2017 07:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console