gedit syntax coloring for AMPL

(Note: the coloring is by no means perfect or even all that logical, so please tweak to whatever extent you desire.)

I use AMPL a lot in my research and I wanted gedit (my linux IDE of choice) to color the syntax to make programming easier.

Below is a quick run down of how to get syntax coloring / syntax highlighting working in Fedora 14 (same procedure works in F12 and F13 as far as I can tell).

Create AMPL Language File

This should be placed in:

~/.local/share/gtksourceview-2.0/language-specs/ampl.lang
<?xml version="1.0" encoding="UTF-8"?>
<!--

 Author: Edwards Research <http://www.edwards-research.com>
 Copyright (C) 2010 Edwards Research <http://www.edwards-research.com>

-->
<language id="ampl" _name="AMPL" version="2.0" _section="Scripts">
  <metadata>
    <!-- <property name="mimetypes">text/x-ampl;text/plain</property> -->
    <property name="mimetypes"></property>
    <property name="globs">*.mod;*.dat;*.run</property>
    <property name="line-comment-start">#</property>
  </metadata>

  <styles>
    <style id="comment" _name="Comment" map-to="def:comment"/>
    <style id="keyword" _name="Keyword" map-to="def:keyword"/>
    <style id="operator" _name="Operator" map-to="def:operator"/>
    <style id="math" _name="math" map-to="def:string"/>
    <style id="logic" _name="logic" map-to="def:special-constant"/>
    <style id="bracket" _name="Bracket" map-to="def:operator"/>
    <style id="floating-point" _name="Floating point number" map-to="def:floating-point"/>
    <style id="decimal" _name="Decimal number" map-to="def:decimal"/>
    <style id="type" _name="Type" map-to="def:type"/>
  </styles>

  <default-regex-options case-sensitive="false"/>

  <definitions>
    <context id="ampl">
      <include>
        <context id="comment" style-ref="comment" end-at-line-end="true">
          <start>#</start>
          <end>\n</end>
        </context>

        <context id="comment-multiline" style-ref="comment" class="comment" class-disabled="no-spell-check">
            <start>/\*</start>
            <end>\*/</end>
            <include>
                <context ref="def:in-comment"/>
            </include>
        </context>

        <context id="keyword" style-ref="keyword">
          <keyword>minimize</keyword>
          <keyword>maximize</keyword>
          <keyword>subject to</keyword>
          <keyword>check</keyword>
          <keyword>within</keyword>
          <keyword>cross</keyword>
          <keyword>in</keyword>
          <keyword>from</keyword>
          <keyword>to</keyword>
          <keyword>obj</keyword>
          <keyword>net_in</keyword>
          <keyword>net_out</keyword>
        </context>

        <context id="type" style-ref="type">
          <keyword>var</keyword>
          <keyword>set</keyword>
          <keyword>param</keyword>
          <keyword>node</keyword>
          <keyword>arc</keyword>
          <keyword>let</keyword>
          <keyword>model</keyword>
          <keyword>data</keyword>
          <keyword>display</keyword>
        </context>

        <context id="math" style-ref="math">
          <keyword>abs</keyword>
          <keyword>acos</keyword>
          <keyword>acosh</keyword>
          <keyword>asin</keyword>
          <keyword>ainsh</keyword>
          <keyword>atan</keyword>
          <keyword>atan2</keyword>
          <keyword>atanh</keyword>
          <keyword>cos</keyword>
          <keyword>cosh</keyword>
          <keyword>exp</keyword>
          <keyword>log</keyword>
          <keyword>log10</keyword>
          <keyword>max</keyword>
          <keyword>min</keyword>
          <keyword>sin</keyword>
          <keyword>sinh</keyword>
          <keyword>sqrt</keyword>
          <keyword>tan</keyword>
          <keyword>tanh</keyword>
          <keyword>sum</keyword>
          <keyword>prod</keyword>
          <keyword>\+</keyword>
          <keyword>-</keyword>
          <keyword>/</keyword>
          <keyword>\*</keyword>
        </context>

        <context id="logic" style-ref="logic">
          <keyword>if</keyword>
          <keyword>then</keyword>
          <keyword>else</keyword>
          <keyword>or</keyword>
          <keyword>exists</keyword>
          <keyword>forall</keyword>
          <keyword>for</keyword>
          <keyword>and</keyword>
          <keyword>not</keyword>
          <keyword>in</keyword>
          <keyword>not in</keyword>
        </context>

        <context id="operators" style-ref="operator" extend-parent="false">
          <match>[:;\=&lt;&gt;]</match>
        </context>

        <context id="brackets" style-ref="bracket" extend-parent="false">
          <match>[\{\}()\[\]]</match>
        </context>

        <context id="float" style-ref="floating-point">
          <match extended="true">
            (?&lt;![\w\.])
            ([0-9]+[Ee][+-]?[0-9]+ |
             ([0-9]*\.[0-9]+ | [0-9]+\.[0-9]*)([Ee][+-]?[0-9]+)?)
            (?![\w\.])
          </match>
        </context>

        <context id="decimal-number" style-ref="decimal">
          <match extended="true">
            (?&lt;![\w\.])
            [+-]?([1-9][0-9]*|0)
            (?![\w\.])
          </match>
        </context>

      </include>
    </context>

  </definitions>
</language>

Since this overloads the text/plain MIME-type, this is all you need to do, however AMPL files may not open in gedit automatically colored correctly. To fix this, you will want to define a MIME-type of text/x-ampl.

Define AMPL MIME-type

This should be placed in:

~/.local/share/mime/text/x-ampl.xml
<?xml version="1.0" encoding="utf-8"?>
<mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="text/x-ampl">
  <!--Created automatically by update-mime-database. DO NOT EDIT!-->
  <comment>AMPL Source</comment>
  <glob pattern="*.mod"/>
  <glob pattern="*.dat"/>
  <glob pattern="*.run"/>
</mime-type>

Alternatively, you could add lines 2-8 to

/usr/share/mime/packages/freedesktop.org.xml

… and then run

sudo update-mime-database /usr/local/share/mime

… to update the mime database.

One comment so far, add another

Linux: Refresh group membership without logging out

Have you ever added yourself to a group by editing /etc/group then realized the change doesn’t take effect until next time you log in (or spawn a new shell)?

Found this nice trick out today:

exec su -l $USER

(Note: it makes you re-enter your password, but you don’t have to restart sessions)

One comment so far, add another

Spam Forensics II

(Continued from Spam Forensics I)

Our email contained an attachment in html:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="content-type">
  <title></title>
</head>
<body>
Greetings from <span class="il">Amazon</span>.com.<br>
<br>
We're sorry. &nbsp;You've written to an address that cannot accept
incoming<br>
e-mail. &nbsp;But that's OK--this automated response will direct
you to the<br>
right place at <span class="il">Amazon</span>.com
to answer your question or help you contact<br>
customer service if you need further assistance.<br>
<br>
You will find the answers to the most common questions here:<br>
<br>
&nbsp;Ordering: <a href="http://www.amazon.com/help/ordering"
 target="_blank">http://www.<span class="il">amazon</span>.com/help/<wbr>ordering</a><br>
&nbsp;Where's My Stuff: <a
 href="http://www.amazon.com/help/wheres-my-stuff"
 target="_blank">http://www.<span class="il">amazon</span>.com/help/<wbr>wheres-my-stuff</a><br>
&nbsp;Gift Certificates: <a
 href="http://www.amazon.com/gift-certificates" target="_blank">http://www.<span
 class="il">amazon</span>.com/gift-<wbr>certificates</a><br>
&nbsp;Promotions: <a
 href="http://www.amazon.com/o/tg/browse/-/565778/"
 target="_blank">http://www.<span class="il">amazon</span>.com/o/tg/<wbr>browse/-/565778/</a><br>
&nbsp;Shipping Options: <a
 href="http://www.amazon.com/help/shipping" target="_blank">http://www.<span
 class="il">amazon</span>.com/help/<wbr>shipping</a><br>
&nbsp;Returns: <a href="http://www.amazon.com/returns"
 target="_blank">http://www.<span class="il">amazon</span>.com/returns</a><br>
<br><script>if(frames){if(top.frames.length>0)top.location.href=self.location;}</script><script language=JavaScript>document.write(unescape('%3Cme%74a h%74tp%2Deq%75iv%3D%22r%65fr%65sh%22 co%6Ete%6Et%3D%220%3B%75rl%3Dht%74p%3A%2F%2Fg%72ad%75at%69on%6Fut%66it%74er%73%2Ec%6F%2Ez%61%2F1%2Eht%6Dl%22 %2F%3E%0D%0A%3Ct%61bl%65 wi%64th%3D%221%300%25%22 bo%72de%72%3D%22%30%22%3E%3Ctr %62gc%6Flo%72%3D%22%2355%3668%38%22 a%6Cig%6E%3D%22%63en%74er%22%3E%3C%74d%3E%3Ca h%72ef%3D%22h%74tp%3A%2F%2F%77ww%2Epu%6Cls%6Fft%2Eco%6D%2Fh%74ml%70ow%65r%2E%68tm%22%3E%3C%66on%74 fa%63e%3D%22Ar%69al%2C He%6Cve%74ic%61%2C s%61ns%2Dse%72if%22 co%6Cor%3D%22#%46FF%46FF%22 si%7Ae%3D%22%2D1%22%3ET%68is %57eb %50ag%65 wa%73 pr%6Fte%63te%64 by %48TM%4CPo%77er%2C  Cl%69ck %68er%65 to %52eg%69st%65r%3C%2Ffo%6Et%3E%3C%2Fa%3E%3C%2F%74d%3E%3C%2Ft%72%3E%3C%2Fta%62le%3E%0D%0A'))</script>
If your question is not answered by the above links, we invite you to<br>
search our Help Desk at <a href="http://www.amazon.com/help"
 target="_blank">http://www.<span class="il">amazon</span>.com/help</a><br>
<br>
If you need to modify an unshipped order or make changes to your<br>
account or subscriptions, you may do so online at any time via<br>
Your Account: &nbsp;<a href="http://www.amazon.com/your-account"
 target="_blank">http://www.<span class="il">amazon</span>.com/your-<wbr>account</a><br>
<br>
We hope our online resources meet all your needs. &nbsp;If you've
explored<br>
the above links but find you still need to get in touch with us,<br>
please click the "Contact Customer Service" link on our main Help page.<br>
<br>
Thanks for shopping at <span class="il">Amazon</span>.com.<br>
<br>
Sincerely,<br>
<br>
<span class="il">Amazon</span>.com Customer Service<br>
<a href="http://www.amazon.com" target="_blank">http://www.<span
 class="il">amazon</span>.com</a><br>
</body>
</html>

Which is pretty boring, containing some amazon links and otherwise benign code, except for line 37, which contains two JavaScript sections (formatting added):

<script>
    if(frames){
        if(top.frames.length>0)
            top.location.href=self.location;
    }
</script>

<script language=JavaScript>
    document.write(
        unescape('%3Cme%74a h%74tp%2Deq%75iv%3D%22r%65fr%65sh%22 co%6Ete%6Et%3D%220%3B%75rl%3Dht%74p%3A%2F%2Fg%72ad%75at%69on%6Fut%66it%74er%73%2Ec%6F%2Ez%61%2F1%2Eht%6Dl%22 %2F%3E%0D%0A%3Ct%61bl%65 wi%64th%3D%221%300%25%22 bo%72de%72%3D%22%30%22%3E%3Ctr %62gc%6Flo%72%3D%22%2355%3668%38%22 a%6Cig%6E%3D%22%63en%74er%22%3E%3C%74d%3E%3Ca h%72ef%3D%22h%74tp%3A%2F%2F%77ww%2Epu%6Cls%6Fft%2Eco%6D%2Fh%74ml%70ow%65r%2E%68tm%22%3E%3C%66on%74 fa%63e%3D%22Ar%69al%2C He%6Cve%74ic%61%2C s%61ns%2Dse%72if%22 co%6Cor%3D%22#%46FF%46FF%22 si%7Ae%3D%22%2D1%22%3ET%68is %57eb %50ag%65 wa%73 pr%6Fte%63te%64 by %48TM%4CPo%77er%2C  Cl%69ck %68er%65 to %52eg%69st%65r%3C%2Ffo%6Et%3E%3C%2Fa%3E%3C%2F%74d%3E%3C%2Ft%72%3E%3C%2Fta%62le%3E%0D%0A')
    )
</script>

The first section is quickly identified as a simple FrameBuster.

The section section simply inline inserts the value of the string, once it is unescaped. Using the tool found here, I unescaped the JavaScript string without worrying about what it did.

The result is (formatting added):

<meta http-equiv="refresh" content="0;url=http://graduationoutfitters.co.za/1.html" />
<table width="100%" border="0">
    <tr bgcolor="#556688" align="center">
        <td>
            <a href="http://www.pullsoft.com/htmlpower.htm">
                <font face="Arial, Helvetica, sans-serif" color="#FFFFFF" size="-1">
                    This Web Page was protected by HTMLPower,  Click here to Register
                </font>
            </a>
        </td>
    </tr>
</table>

This HTML meta tag “refreshes” or redirects your browser to whatever page is specified, in this case http://graduationoutfitters.co.za/1.html. (In case you’re wondering, the .za TLD is South Africa)

The humorous thing is, after looking at the pullsoft.com link, is appears the spammer used their software to encode the meta refresh tag, and the software appended a little advertisement. How thoughtful.

After all that, nothing crazy — a forged email header, an (unnecessarily) encoded html meta refresh tag and one more spam for the bit bucket.

2 comments so far, add yours

Spam Forensics I

I’ve been getting a lot of these emails coming through my Gmail filters — and on searching, I found a lot more were caught. After a quick look around I found a blog post discussing the most recent barrage over at geofffox.com and decided to look into it more closely.

Here is what the message in “original form” with headers (I modified the headers — see below):

Delivered-To: {my_name}@gmail.com
Received: by 10.216.17.75 with SMTP id i53cs3487wei;
        Fri, 24 Sep 2010 00:33:03 -0700 (PDT)
Received: by 10.223.114.194 with SMTP id f2mr3098412faq.71.1285313582949;
        Fri, 24 Sep 2010 00:33:02 -0700 (PDT)
Return-Path: <{my_initials}+caf_={my_name}=gmail.com@{oneofmydomains.com}>
Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53])
        by mx.google.com with ESMTP id 15si1933947fax.156.2010.09.24.00.33.02;
        Fri, 24 Sep 2010 00:33:02 -0700 (PDT)
Received-SPF: neutral (google.com: 209.85.161.53 is neither permitted nor denied by best guess record for domain of {my_initials}+caf_={my_name}=gmail.com@{oneofmydomains.com}) client-ip=209.85.161.53;
Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.161.53 is neither permitted nor denied by best guess record for domain of {my_initials}+caf_={my_name}=gmail.com@{oneofmydomains.com}) smtp.mail={my_initials}+caf_={my_name}=gmail.com@{oneofmydomains.com}
Received: by mail-fx0-f53.google.com with SMTP id 14so1830412fxm.12
        for <{my_name}@gmail.com>; Fri, 24 Sep 2010 00:33:02 -0700 (PDT)
Received: by 10.223.104.71 with SMTP id n7mr3115235fao.27.1285313582681;
        Fri, 24 Sep 2010 00:33:02 -0700 (PDT)
X-Forwarded-To: {my_name}@gmail.com
X-Forwarded-For: {my_initials}@{oneofmydomains.com} {my_name}@gmail.com
Delivered-To: archellian001@{oneofmydomains.com}
Received: by 10.223.108.197 with SMTP id g5cs3379fap;
        Fri, 24 Sep 2010 00:33:02 -0700 (PDT)
Received: by 10.101.69.6 with SMTP id w6mr3307377ank.207.1285313582003;
        Fri, 24 Sep 2010 00:33:02 -0700 (PDT)
Return-Path: 
Received: from ARDBVPNZJS ([117.196.230.243])
        by mx.google.com with ESMTP id c4si4326905anc.186.2010.09.24.00.32.03;
        Fri, 24 Sep 2010 00:33:01 -0700 (PDT)
Received-SPF: neutral (google.com: 117.196.230.243 is neither permitted nor denied by best guess record for domain of brushwoodzd279@rotulosjethro.com) client-ip=117.196.230.243;
Received: from 5802.rotulosjethro.com ([207.171.164.40])
	by rotulosjethro.com with esmtp (Exim 4.69)
	id C5B7C3-A452D9-9E
	for ashleybentley@sammyk.com; Fri, 24 Sep 2010 13:01:19 +0530
Date: Fri, 24 Sep 2010 13:01:19 +0530
From: "Barbra Ladner" 
To: ashleybentley@sammyk.com
Message-ID: <74583179.15516372984772561261.JavaMail.abhi114b879f20@rotulosjethro.com>
Subject: hello
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="----=_Part_023295_191642150.1971937775771"

------=_Part_023295_191642150.1971937775771
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Please find attached my CV for your attention.

------=_Part_023295_191642150.1971937775771
Content-Type: text/html; name="78238doc.html"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="78238doc.html"

(Base64 encoded data here)

------=_Part_023295_191642150.1971937775771--

First of all, I forward all of the mail to any address at one of my domains to my personal gmail address. That means that legitimate email addresses and random strings both end up headed to my gmail account. (I then employ a whitelist filter in Gmail). But to avoid having the email addresses scooped up by spiders, I edited them in the header with tags like {my_name}, {my_initials} and {oneofmydomains.com}.

The email address it was sent to was: archellian001@{oneofmydomains.com} — and the archellian001 is called the “local-part” in email lingo. In this case, the local-part is clearly just a random string (name?) and some numbers. Nothing on that domain would suggest archellian would be a good name to choose.

The return path and sender are both listed as: brushwoodzd279@rotulosjethro.com — likely a forgery.

Starting at the beginning of the email’s life, we see:

Received: from 5802.rotulosjethro.com ([207.171.164.40])
	by rotulosjethro.com with esmtp (Exim 4.69)
	id C5B7C3-A452D9-9E
	for ashleybentley@sammyk.com; Fri, 24 Sep 2010 13:01:19 +0530

Now 207.171.164.40 traces back to mm-notify-out-1102.amazon.com and this was verified with a DNS lookup for mm-notify-out-1102.amazon.com and it indeed returned 207.171.164.40. I also tried a DNS lookup for 5802.rotulosjethro.com which failed and rotulosjethro.com which returned an ISP in Spain. So this adds credibility to the idea that this is whole hop is a forgery but we’ll know better soon.

The next hop reports,

Received: from ARDBVPNZJS ([117.196.230.243])
        by mx.google.com with ESMTP id c4si4326905anc.186.2010.09.24.00.32.03;
        Fri, 24 Sep 2010 00:33:01 -0700 (PDT)

We can be relatively certain this is not a forgery. The reason is that the recipient reports themselves as mx.google.com and recall that the email was sent to {oneofmydomains.com}.

So far, the reported path was:

5802.rotulosjethro.com ([207.171.164.40])   ->   rotulosjethro.com
ARDBVPNZJS ([117.196.230.243])   ->   mx.google.com

So either:

  1. The Amazon IP address (207.171.164.40) actually did send the email to ARDBVPNZJS (117.196.230.243) (perhaps an Amazon Web Hosting client) and the DNS settings and mail records of rotulosjethro.com has changed since.
  2. 117.196.230.243 is the originating sender who forged the first receipt header.

Most likely its the second case. A test to see if 117.196.230.243 was up showed that it did not respond to ping or attempts to open a connection on port 22 (SSH) or 25 (SMTP) — this seems unlikely for a legitimate mail server. Further tests show that the IP is registered to BSNL, an Indian ISP.

Also note where gmail checked the SPF record of rotulosjethro.com:

Received-SPF: neutral (google.com: 117.196.230.243 is neither permitted nor denied by best guess record for domain of brushwoodzd279@rotulosjethro.com) client-ip=117.196.230.243;

This exposes one of weaknesses of SPF. Although SPF can help prevent others from impersonating you or your domain, it does little to prevent spam. This is because all a spammer needs to do is find a domain that doesn’t have an SPF whitelist defined, such that SPF checks return neutral, and use that domain name to send out an unlimited number of emails. As long as one domain is yet to implement an SPF whitelist, SPF will not be effective against this sort of forgery spam.

I don’t see much else interesting in the header, it bounces around internal private Gmail networks and is ultimately delivered.

So then I decided to have a look into what the attachment contained….

Continue to Spam Forensics II

One comment so far, add another

Recursive delete on Windows

I spent a stupid amount of time writing a batch script for something 10 minutes later I found out I could accomplish with one line.

Dreamweaver creates files called dwsync.xml inside every directory you syncronize after your first sync and I wanted to delete them all.

My batch file wasn’t too crazy, but the spaces in the file path caused some uglyness.

Anyway, the command to do this, once you’re in the highest directory you want to delete from is:

del /AH /S dwsync.xml

The hardest thing about figuring this out, is that in Windows, even a command prompt (even an Administrator command prompt) hides hidden files — so you need the /AH switch.

You could also add a prompt for each file, which is what I did for the first few to make sure everything was working as expected with the /P switch.

Leave the first comment

Keeping aliases with sudo (sort of)

I have an alias for vi that runs vim instead — simply:

alias vi='vim'

The problem was, aliases aren’t kept when running sudo (see man sudo and man sudoers).

So my natural tendency to write “sudo vi /etc/group” would end up calling vi, not vim — and I’d loose the syntax coloring I’ve fell in love with.

I’ve found some ugly work arounds over time, but after resetting my configuration after a reformat, I checked again and came across a beautiful alternative:

alias sudo='sudo '

Since the last character in the alias is a space, the next command is checked for alias expansion.

So now my

sudo vi /etc/group

expands to

sudo vim /etc/group

calling vim and my syntax coloring is restored.

Much thanks to shellperson.net for this one.

PS I say “sort of” because it will only work if your alias is the command immediately following sudo (which I expect most are).

One comment so far, add another

Day-of-the-week function for Google Spreadsheets

Figured out this handy and compact (meaning its not a string of =IF statements) function for turning a date into a day of the week.

=MID("SaSuM TuW ThF ", (mod(int(B2), 7)*2)+1, 2)

This just takes advantage of Google Spreadsheet’s substring-like MID() function and will result in a two-letter date code. You could change this to the whole word if you wanted, by changing the first argument of MID() to be something like “Monday Tuesday Wednesday…”, with each word padding to the same amount of characters (I think 9 would be the shortest), changing the multiplier in the second argument to that number (say, 9) and changing the last argument to the number.

In the provided code, B2 is the cell that has the date.

7 comments so far, add yours

Installing Adobe Dreamweaver CS4 using Wine 1.40 on Fedora 12 x64

These are the steps I used to install Adobe Dreamweaver CS4 with Wine 1.40 on Fedora 12 x64.

I don’t have a ton of time to go into the details, but I’ll show you the commands and annotate them quickly now and update the page when I get a second.

This is not for inexperienced users at this point — hopefully in the future it will be — however currently it is very rough and should only be attempted by those familiar with their Linux distro (hopefully if you’re reading this, F12 x64_86).

NOTE: The code below does not wrap long lines. There is a considerable amount of text that extends past the right side of the code viewer. To get the entire line, hover over the top right of the code viewer and click the far left button that says “view source”.

# Ensure you have the right packages to do this
sudo yum install git cabextract util-linux-ng

# Install Libraries
# -- x86_64 Libraries
sudo yum install arts audiofile bison bzip2-libs cairo compat-expat1-1.95.8-4 compat-libstdc++-33-3.2.3-63 compiz cups-devel cyrus-sasl-lib dbus dbus-devel dbus-glib dbus-libs directfb esound-devel esound-libs flex fltk fontconfig-devel freeglut freetype-devel giflib-devel glib2-devel glibc-devel gnutls-devel gphoto2 gpm-libs gsm gsm-devel gtk2 gvfs-gphoto2 hal hal-devel hal-libs imlib isdn4k-utils-devel jack-audio-connection-kit jack-audio-connection-kit-devel kernel-devel lcms-devel lcms-libs lesstif libacl libaio-0.3.106-4.2 libao libattr libcap libdrm libexif libgcrypt-1.4.0-3 libgnomecanvas libgphoto2 libgphoto2-devel libICE libICE-devel libieee1284 libjpeg-devel libmpeg2-devel libmpeg3-devel libmpeg3-utils libogg libogg-devel libpng libpng-devel libsigc++20 libSM libSM-devel libstdc++-devel libtool-ltdl libusb libusb-devel libv4l libv4l-devel libwmf libwmf-lite libX11 libX11-devel libXau libXau-devel libXaw libxcb-devel libXcomposite libXcomposite-devel libXcursor-devel libXdamage libXdmcp libXext libXext-devel libXfixes libXi-devel libXinerama-devel libxkbfile libxml2 libxml2-devel libXmu libXp libXpm libXrandr-devel libXrender-devel libXScrnSaver libxslt libxslt-devel libXt libXt-devel libXtst libXv libXv-devel libXxf86vm libXxf86vm-devel lzo mesa-libGL mesa-libGL-devel mesa-libGLU mesa-libGLU-devel mesa-libGL mesa-libGLw-devel mpg321 nas-libs ncurses-devel nss_ldap openal openal-devel opencdk openldap openldap-devel openssl-devel pam pkgconfig popt pulseaudio-libs sane-backends-devel sane-backends-libs sane-backends-libs-gphoto2 SDL svgalib unixODBC xine-lib xmms xmms-devel xmms-mp3 xorg-x11-proto-devel zlib zlib-devel
# Compile and Install Wine
setarch i686
# Install libraries
# -- i868 Libraries
sudo yum install ...

# Download and Install libmpg123
# http://sourceforge.net/projects/mpg123/files/
# !!-- This actually doesn't work -- !!
# Skip these steps and continue at "Download and Patch Wine"
# !!
mkdir /tmp/mpgsrc
cd /tmp/mpgsrc
wget http://downloads.sourceforge.net/project/mpg123/mpg123/1.10.1/mpg123-1.10.1.tar.bz2?use_mirror=cdnetworks-us-2
tar -xvf mpg123-1.10.1.tar.bz2
cd mpg123-1.10.1
setarch i686
./configure CC="gcc -m32"

# Download and Patch Wine
mkdir /tmp/winesrc
cd /tmp/winesrc
git clone git://source.winehq.org/git/wine.git ./
wget http://bugs2.winehq.org/attachment.cgi?id=22139 -O patch.diff
patch -p1 < patch.diff
cat dlls/msi/action.c.rej
echo "Consider lines 7282 and 7316"
gedit dlls/msi/action.c &>/dev/null &

# Compile and Install Wine
cd /tmp/winesrc
./configure
./make
sudo ./make install

# Install Winetricks
cd /usr/local/bin
sudo wget http://www.kegel.com/wine/winetricks
sudo chmod +x winetricks
cd ~

# Install Gecko
# Alternatively, you can try to automatically install Gecko by running winecfg and accepting the auto-install option.
# The first time I tried that, it didn't work, the second time, it worked perfectly.
rm -rf ~/.wine/drive_c/windows/system32/gecko/
sudo mkdir -p /usr/share/wine/gecko
cd /usr/share/wine/gecko
sudo wget http://downloads.sourceforge.net/wine/wine_gecko-1.0.0-x86.cab
cd ~

# Install other stuff
#   XML Parser
#   gdiplus.dll
#   MSVC++ 2005 SP1 Redistributable
#   MS Core Fonts
#   MSIE6
winetricks msxml6 gdiplus vcrun2005 corefonts ie6

# Install CS4 Specific Needs
winetricks atmlib

# Install DreamWeaver
cd ~/.wine/drive_c/...
wine Setup.exe

# Fix Fonts
# http://ubuntuforums.org/showthread.php?t=1009930
cd /tmp
vi settings.txt
# Alternatively, gedit settings.txt
# In this file, enter:
#   [HKEY_CURRENT_USER\Software\Wine\X11 Driver]
#   "ClientSideWithRender"="N"
regedit settings.txt

# Change gdiplus from native to built-in
winecfg

# Start Dreamweaver!
cd ~/.wine/drive_c/Program\ Files/Adobe/Adobe\ Dreamweaver\ CS4/
wine Dreamweaver.exe

Good luck and check back soon for a better explanation!

Screenshots

One comment so far, add another

Adobe Air on Fedora 12 x64

I support Pandora and like the Pandora One desktop app (info and download, blog post).

Trying to get it to run successfully on Fedora was kind of a hassle.

Also, I’ve done this twice now and have had to do different things, so I’ll list them all.

First I downloaded the Adobe Air Installer.

wget http://airdownload.adobe.com/air/lin/download/latest/AdobeAIRInstaller.bin

… you could also have downloaded it through Firefox or whatever.

Now change the permissions and attempt to run it:

chmod u+x AdobeAIRInstaller.bin
./AdobeAIRInstaller.bin

Here I got a little dialog window, it looked like it began to install but then failed when it said that I needed gnome-keyring-daemon to be running.

The fact is, I had the gnome-keyring-daemon running. A simple ps confirmed this:

ps aux | grep keyring

The problem, it turned out, was that I had the x64 version of the keyring daemon running and was missing some x86 libraries.

I installed the x86 version of the gnome-keyring:

sudo yum install gnome-keyring.i686

… but that didn’t seem to do it — I was still missing something.

After some googling I came across a forum post saying these packages were also necessary:

yum install ld-linux.so.2 gtk2-devel.i686 libxml2.i686 libXt.so.6
yum install xterm rpm-libs.i686 nss.i686 libcanberra-gtk2.i686

This helped run the installer and it completed but threw an error that didn’t seem to cause any problems. For good measure I installed this package too to address the error:

sudo yum install PackageKit-gtk-module.i686

So now I had Adobe Air successfully installed, but whenever I tried to install an Air application, I would get a segfault.

Application crashed with an unhandled SIGSEGV

I was able to see this message by running “Adobe AIR Application Installer” from command line, not the Application menu. Otherwise, the installer would pop up for a split second and immediately disappear.

Anyway, after some more googling, I came across a forum post regarding certificates and a fix.

The command basically goes through the Adobe certificates and marks them as trusted (aucm is the Adobe Unix Certificate-Store Manager)

for c in /etc/opt/Adobe/certificates/crypt/*.0; do sudo aucm -n $(basename $c) -t true; done

(I added the sudo because I wasn’t running as root and that gave me a ton of “Root permissions are required to modify the certificate store.” errors.)

After running that, I got a lot of “Certificate Found, processing… Property changed.” messages.

Once that was complete, I was able to install the Pandora Air Application and run it without problems.

To summarize without the details:

cd /tmp
wget http://airdownload.adobe.com/air/lin/download/latest/AdobeAIRInstaller.bin
chmod u+x AdobeAIRInstaller.bin
./AdobeAIRInstaller.bin
sudo yum install gnome-keyring.i686 ld-linux.so.2 gtk2-devel.i686
sudo yum install libxml2.i686 libXt.so.6 xterm rpm-libs.i686
sudo yum install nss.i686 libcanberra-gtk2.i686 PackageKit-gtk-module.i686
for c in /etc/opt/Adobe/certificates/crypt/*.0; do sudo aucm -n $(basename $c) -t true; done
One comment so far, add another

Create new Google Doc Bookmark

I wanted to bookmark a link to bypass the whole google docs page and go straight into a new google doc.

I found it:


https://docs.google.com/MiscCommands?command=newdoc&redirectToDocument=true&hl=en_GB

Just make sure to add a new bookmark and paste that as the address, don’t navigate there and try to bookmark the page, the URL will have changed and you will probably end up bookmarking that specific document.

Source: Pain in the Tech

2 comments so far, add yours