Our Craft

Making it better

Change default runlevel (target) on Fedora

Posted by danielmeyer on March 31, 2014

I’m running on Fedora 20, and the graphical boot (Plymouth-something-something) sometimes waits a long time and then times out, which when it happens makes the computer take several minutes to boot. This doesn’t happen if I boot to “runlevel 3″ (now called multi-user.target) and then run startx from there.

You can change the default target to “runlevel 3″ like this:
systemctl set-default multi-user.target

Posted in Technical Stuff | Leave a Comment »

Easy peasy JPGs to PDF conversion

Posted by danielmeyer on January 29, 2014

Our scanner at home is an old flatbed that scans to a .jpg file. When you have several pages that you need to scan and send to someone, a pile of JPGs isn’t very nice—you’d rather have one PDF.

If you’re running Linux (at home I’m currently running Fedora 20 – “Heisenbug”), this is easy peasy: with ImageMagick installed, just use the convert command:

convert 1.jpg 2.jpg 3.jpg 1-2-3.pdf

Posted in Uncategorized | Leave a Comment »

Mumps-style “dotted do” notation example

Posted by danielmeyer on January 29, 2014

FT                                      # A label (for jumping to)
  NEW X,MSG2
  I $$RDVALS^MISC22()=SUCCESS DO QUIT   # The second space between DO and QUIT is significant
  . S X="DO ACTN5^ACTNS"
  . X X                                 # The two Xs mean different things (Cache' is not a context-free language)
  . S MSG2=MSG_" succeeded."            # Expect MSG to float in from somewhere else
  E DO
  . S ERRMSG=INVALIDREADMSG
  . W 1/0

Posted in Uncategorized | Leave a Comment »

Method signature joke

Posted by danielmeyer on January 29, 2014

STDMETHODIMP CI3DBTranDataSet::GetReal(), man.

Posted in Uncategorized | Leave a Comment »

How to have the bash prompt display the full current working directory

Posted by danielmeyer on January 11, 2014

To display the full working directory at the bash prompt (Linux command line), edit /etc/bashrc and where the PS1 variable is set, change \W to \w .

I’m running Fedora 19.

Posted in Technical Stuff | Leave a Comment »

How to remote restart your Windows PC

Posted by danielmeyer on August 30, 2013

You’re remoting in from home and some app goes haywire on your (Windows) work PC. You’ve already asked your co-worker to power cycle your PC but now the problem is happening again. You don’t want to keep bugging your co-worker and you don’t want to have to drive in to work. You could have enabled the Remote Registry service, but you really don’t want to do that. Are there any other options?

There is, and a pretty simple one. You can issue a shutdown command from another PC on your network. The trick is to establish a connection to your main PC with your username first. At a command prompt on the second PC then:

net use \\MyMainPC\IPC$ /user:mydomain\myuser *
shutdown -m \\MyMainPC -r

There are other options you can send to the shutdown command, but this gets us (re)started. I tested this on Windows 7.

Posted in Technical Stuff | Leave a Comment »

Rough notes on SQL Server bulk insert

Posted by danielmeyer on July 15, 2013

(I recently found these notes that I had written up in January and Feburary of 2010. I am posting them in the hope that they may be a help to me and others, even in their rough form.)

It worked to just generate all the fields, with empty fields for ones I didn’t care to fill in.

for %d in (Foo Bar Baz Quux) do bcp MyDatabase.dbo.%d format nul -T -c -f %d.fmt

This resulted in the creation of Foo.fmt, Bar.fmt, Baz.fmt, and Quux.fmt files.

Foo.fmt:

9.0
10
1       SQLCHAR       0       22      "\t"   1     FooID                            SQL_Latin1_General_CP1_CI_AS
2       SQLINT        0       4       "\t"   2     FooTypeID                        ""
3       SQLINT        1       4       "\t"   3     TitleID                            ""
4       SQLNCHAR      2       100     "\t"   4     LastName                           SQL_Latin1_General_CP1_CI_AS
5       SQLNCHAR      2       100     "\t"   5     FirstName                          SQL_Latin1_General_CP1_CI_AS
6       SQLNCHAR      2       100     "\t"   6     MiddleName                         SQL_Latin1_General_CP1_CI_AS
7       SQLNCHAR      2       100     "\t"   7     Department                         SQL_Latin1_General_CP1_CI_AS
8       SQLNCHAR      2       200     "\t"   8     Company                            SQL_Latin1_General_CP1_CI_AS
9       SQLCHAR       2       22      "\t"   9     OrgID                              SQL_Latin1_General_CP1_CI_AS
10      SQLTINYINT    0       1       "\r\n"   10    Active                             ""

Read the rest of this entry »

Posted in Technical Stuff | Tagged: , , | Leave a Comment »

How to change to a different schema in Oracle SQL Developer

Posted by danielmeyer on July 15, 2013

ALTER SESSION SET CURRENT_SCHEMA = I3_IC;

Posted in Technical Stuff | Leave a Comment »

How to put a delay in an Oracle sproc, for testing

Posted by danielmeyer on April 11, 2013

To simulate your Oracle stored procedure taking 15 minutes to execute, put this in your sproc:

dbms_lock.sleep(15 * 60);

But first you’ll need to give your user EXECUTE permissions on the dbms_lock module:

C:\>sqlplus sys@clayoracle3 as sysdba
...
SQL> GRANT EXECUTE ON dbms_lock TO my_user;

Grant succeeded.

If you’re trying this out outside a sproc, put an exec on the beginning, thus:

exec dbms_lock.sleep(15 * 60);

Note: dbms_lock.sleep() is known to be unreliable past about a 10 minute nap.

Posted in Technical Stuff | Leave a Comment »

How to put a delay in a SQL Server sproc, for testing

Posted by danielmeyer on February 21, 2013

To simulate your SQL Server stored procedure taking 15 minutes to execute, put this in your sproc:

WAITFOR DELAY '00:15'

Posted in Technical Stuff | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.