Launch Sublime Text 3 from the command line from OS X

Written by r2d2. Posted in OS X, Tips

If the path /usr/local/bin does not exist, then create it.

sudo mkdir /usr/local/bin

Create the symbolic link:

sudo ln -s “/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl” /usr/local/bin/subl

close and reopen terminal and then your are set.

Testing

Open a Terminal window and run:

1
sublime ~/Documents

or

1
2
cd
sublime Documents/

or even

1
2
# to open the entire current directory
sublime .

How to ‘insert if not exists’ in MySQL?

Written by r2d2. Posted in Mysql, PHP, Tips

see http://bogdan.org.ua/2007/10/18/mysql-insert-if-not-exists-syntax.html

there’s also INSERT … ON DUPLICATE KEY UPDATE syntax, you can find explanations on dev.mysql.com


Post from bogdan.org.ua
18th October 2007

To start: as of the latest MySQL, syntax presented in the title is not possible. But there are several very easy ways to accomplish what is expected using existing functionality.

There are 3 possible solutions: using INSERT IGNORE, REPLACE, or INSERT … ON DUPLICATE KEY UPDATE.Imagine we have a table:

CREATE TABLE `transcripts` (

Compare two MySQL databases

Written by r2d2. Posted in Tips

If you’re working with small databases I’ve found running mysqldump on both databases with the --skip-comments and --skip-extended-insert options to generate SQL scripts, then running diff on the SQL scripts works pretty well.

By skipping comments you avoid meaningless differences such as the time you ran the mysqldump command. By using the --skip-extended-insert command you ensure each row is inserted with its

fpdf – tabel-cells example

Written by r2d2. Posted in PHP, Programmering

$pdf->SetX(5);

$pdf->Cell(40,5,'[ x ] checkbox1′,1,0,’L’,0);
$pdf->Cell(40,5,'[ x ] checkbox2′,1,0,’L’,0);
$pdf->Cell(40,5,'[ x ] checkbox3′,1,0,’L’,0);

$pdf->Ln();
$pdf->SetX(5);

$pdf->Cell(40,5,'[ x ] checkbox4′,1,0,’L’,0);
$pdf->Cell(40,5,'[ x ] checkbox5′,1,0,’L’,0);
$pdf->Cell(40,5,'[ x ] checkbox6′,1,0,’L’,0);

Word tips

Written by r2d2. Posted in Tips

Ctrl + F1: Vis eller fjern topfanen (Ribbon).
Ctrl + K: Indsæt et hyberlink på den markerede tekst.
Ctrl + F: Fed (dansk version) / Åben et søgefelt (engelsk version). Ctrl + B er søgefeltet på dansk.
Alt + Ctrl + 5: Split eller fjern split i et dokumentvindue.
Ctrl + Backspace: Slet ét ord mod venstre.
Shift + F3: ændre bogstavstørrelse (R –> r) på de markerede ord.

Check if service is running

Written by r2d2. Posted in Dos, Programmering

@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
sc query "%~1"|findstr "STATE.*:.*4.*RUNNING" >NUL
IF ERRORLEVEL 1 (
ECHO service %1 is stopped
goto :end
)
echo Service %1 is running
:end
EXIT /b

Call of Duty OU screen resolution

Written by r2d2. Posted in Game, Tips

Append

seta cg_fov 96.4183
seta r_mode -1
seta r_customheight 1080
seta r_customwidth 1920

to the file \Call of Duty\uo\uoconfig_mp.cfg

 

 

Quake II server

Written by r2d2. Posted in Server, Tips

Quake II – Co-Op Dedicated Server Tutorial

I think this is the best way to create a Co-Op server.

  • Create a .bat file in your Quake II folder. Name it anything you like.
  • Edit the .bat file with WordPad. It should look like this:

Code:
@echo off
quake2.exe +set dedicated 1 +exec servercoop.cfg
exit

  • Now go into your baseq2 folder. It’s in your Quake II folder.
  • Create a .cfg file. Name it “servercoop.cfg”.
  • Edit the .cfg file with WordPad. It should look like this: