Archive

Archive for the ‘Uncategorized’ Category

Setting TimeZone Linux Ubuntu

February 24th, 2011
cd /usr/share/zoneinfo

#remove the current localtime sym link (if its wrong, if it were correct, you would not be looking for this blog)
sudo rm localtime

#Create the new symlink to the new timezone I am in the NYC timezone...so
sudo ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

Greg Uncategorized

MYSQLDUMP and Import over SSH OneLiner

December 18th, 2010

So you want to Import a mysql database from Server A to Server B over ssh? Easy!

1) Setup SSH to login automatically from Server A to Server B

On server A

Create a private and public key.

     ssh-keygen -t rsa
     cat id_rsa.pub | ssh user@ServerB ‘cat >> ~/.ssh/authorized_keys’

Test that login works automatically

ssh user@ServerB

Still from Server A “MYSQLDUMP One Liner”
ssh user@ServerB ‘mysqldump –u mysqlUser -pMyPassword –lock-tables=false yourdatabase’ | mysql -h localhost -u greg –pYourOtherPassword yourImportDatabae

Greg Uncategorized

Dear Grandpa,

December 4th, 2010

I usually hate all of the political junk mail that circulates through my inbox. Many times, I find the data points being used inaccurate, and it bothers the heck out of me, that people read the stuff and take it as gospel, without knowing the truth. However, this one hit closer to home for me. As a recent small business owner, I pay much closer attention to my taxes than I did when I was straight W2. And trust me, when you are paying lump sums out of pocket on a quarterly basis, it feels alot different than it did when it was skimmed off my bi-weekly paycheck.

Anyway, I enjoyed reading this…I hope you will too. Even if the truth hurts you.

See below…

 

John G. Is 63 years old and owns a small business.  He’s a life-long Republican and sees that his dream of retiring next year has all but evaporated.  With the stock market crashing and new taxes coming his way, John now assumes that he will work to his dying day.

John has a granddaughter.  Ashley is a recent college grad.  She drives a flashy hybrid car, wears all the latest fashions, and loves to go out to nightclubs and restaurants.  Ashley campaigned hard for Barack Obama.  After the election she made sure her grandfather (and all other Republican family members) received a big I told-you-so earful on how the world is going to be a much better place now that Obama and her party is taking over.

Having lost both roommates, Ashley recently ran short of cash and cannot pay the rent (again) on her 3-bedroom townhouse.  As she had done many times in the past, she e-mailed her grandfather asking for some financial help.

Here is his reply…

Sweetheart, I received your request for assistance.  Ashley, you know I love you dearly and I ‘m sympathetic to your financial plight.  Unfortunately, times have changed.  With the election of President Obama, your grandmother and I have had to set forth a bold new economic plan of our own…"The Ashley Economic Empowerment Plan."  Let me explain.

Your grandmother and I are life-long, wage-earning tax payers.  We have lived a comfortable life, as you know, but we have never had the fancier things like European vacations, luxury cars, etc.  We have worked hard and were looking forward to retiring soon.  But the plan has changed.  Your president is raising our personal and business taxes significantly.  He says it is so he can give our hard-earned money to other people.  Do you know what this means, Ashley?  It means less for us, and we must cut back on many business and personal expenses.
You know the wonderful receptionist who worked in my office for more than 23 years?  The one who always gave you candy when you came over to visit?  I had to let her go last week.  I can’t afford to pay her salary and all of the government-mandated taxes that go with having employees.  Your grandmother will now work 4 days a week to answer phones, take orders and handle the books.  We will be closed on Fridays and will lose even more income to the new Wal-Mart store that recently opened.
I’m also very sorry to report that your cousin Frank will no longer be working summers in the warehouse.  I called him at school this morning.  He already knows about it and he’s upset because he will have to give up skydiving and his yearly trip to Greenland to survey the polar bears.
That’s just the business side of things.  Some personal economic effects of Obama’s new taxation policies include none other than you.  You know very well that over the years your grandmother and I have given you thousands of dollars in cash, tuition assistance, food, housing, clothing, gifts, etc., etc. But, by your vote, you have chosen to help others — not at your expense — but at our expense.
If you need money now, sweetheart, I recommend you call 202-456-1111.  That is the direct phone number for the White House.  You can also contact the White House here:
http://www.whitehouse.gov/CONTACT/.
You yourself told me how foolish it is to vote Republican.  You said Mr. Obama is going to be the People’s President, and is going to help every American live a better life.  Based on everything you’ve told me, along with all the promises we heard during the campaign, I’m sure Mr. Obama will be happy to transfer some stimulus money into your bank account.  Have him call me for the account number, which I memorized years ago…
Perhaps you can now understand what I’ve been saying all my life:  Those who vote for a president should consider the impact on the nation as a whole, and not be just concerned with what they can get for themselves.  What Obama supporters don’t seem to realize is all of the money he is redistributing to illegal aliens and non-taxpaying Americans (the so-called "less fortunate") comes from tax-paying families. 
Remember how you told me, "Only the richest of the rich will be affected"?  Well, guess what, honey? Because we own a business, your grandmother and I are now considered to be the richest of the rich. On paper, it might look that way, but in the real world, we are far from it.
As you said while campaigning for Obama, some people will have to carry more of the burden so all of America can prosper.  You understand what that means, right?  It means that raising taxes on productive people results in their having less money; less money for everything, including granddaughters.
I’m sorry, Ashley, but the well has run dry…  The free lunches are over…  I have no money to give you now.  So, congratulations on your choice for "change”.  For future reference, I encourage you to try and add up the total value of the gifts and cash you have received from us, just since you went off to college, and compare it to what you expect to get from Mr. Obama over the next 4 (or 8) years. I have not kept track of it, Ashley.  It has all truly been the gift of our hearts.
Remember, we love you dearly… but from now on you’ll need to call the number mentioned above.  Your "Savior" has the money we would have given to you.  Just try to get it from him.
Good luck, sweetheart.
Love,
Grandpa

Greg Uncategorized

Cutting through “Red Tape” with Free software and API from TODOIST

October 17th, 2010

One client I was working with in the past wanted a weekly update and priority list of work that was completed in the last week, and what was on my plate for the coming week. Being someone that just can’t deal with red tape, I thought immediately, How am I going to automate this?

I began my search for a simple, easy to use Task Manager. The criteria were as follows.

1) Easy to add/remove/manage tasks.

2) UI when mobile. I have a blackberry, so just an Iphone App won’t do. although todist has one. Along with a chrome plugin…which needs some work, but is pretty good.

3) Easy to manage multiple Projects

4) Free

5) Has an API

First stop Lifehacker, and came across this post http://goo.gl/QJYr

 

After messing with todoist, I was impressed. The UI was so clean and simple. I love that.

Here is how my code works….

1. [Client A] is setup as a project.

2. I add tasks and check them off.

3. Then Sunday morning,

     a. my script looks up everything that was completed since last monday and puts it in the last week category.

     b. takes all uncompleted tasks and set them as next week priorities.

     c. I get an email that looks like:

WEEK PRIORITIES
* Post on Twitter
* Email Clients
* Order a new computer

LAST WEEK
* Did some good work
* Installed SoftwareUI
* Configured Router
* Created Stock Alert System

Very simple but cutting through red tape with technology.

Greg Uncategorized

svnsync: Can’t open ‘C:\DOCUME~1 Error

May 28th, 2009

I had this very annoying error the other day when trying to sync my repositories. The answer was so simple, but took me forever to figure out, as some files would sync and some would fail.

The answer….

Turn off your Virus Protection! That’s it! :)

Hope it helps you out.

Greg Uncategorized

IIS Manager MMC could not create the snap-in

May 1st, 2009

image

 

From the Command Line run

“regsvr32 %windir%\system32\inetsrv\inetmgr.dll”

image

Greg Uncategorized

Using WebOrb as a Web Service Proxy when CrossDomain.xml is not available

April 16th, 2009

So you have the CrossDomain.xml blues. I had the same issue and I need to grab an RSS Feed to display in my Flex App.

A simple demonstration can be seen here http://gregjessup.net/marketevents/

image

The Latest Market News is actually an RSS request from yahoo finance top stories, which would return XML but when done directly using HTTPService (seen below)…

<mx:HTTPService result="gotData(event)" showBusyCursor="true" id="RSSfeed"  
url="http://finance.yahoo.com/rss/topstories" resultFormat="object" />

you’d get the god forsaken Security Sandbox Error because the request is not trusted by finance.yahoo.com … ( see for yourself http://finance.yahoo.com/crossdomain.xml )

So the fix is to use a proxy. I’ve seen some stuff out on the net that allows you to do it with PHP, but I am a WebOrb fanatic, and it allows me to stick with C#, and not have to worry about another environment. To be honest, once you learn WebOrb…you’ll never look back.

 

So the solution is quite simple and you can download the

.Net code hereMarketEvents.zip

 

You’ll see in my WebFetch class, I am just passing a URL and it returns the HTML or XML as a string. That like the rest of the code is very straight forward…but I’m not going to go into much detail here.

 

In the MarketEvents.cs file you’ll see getNews() and getNewsDataSet()

I would recommend getNewsDataSet() simply because it parse the XML into an object in your Middle Tier, and thus is leaves doing much less work on the FLEX client side.

public DataSet getNewsDataSet()
       {
           //create a new DataSet that will hold our values
           DataSet rssDataSet = null;
           WebFetch.WebFetch wf = new WebFetch.WebFetch();
           string xmlString = wf.getWebPage("http://finance.yahoo.com/rss/topstories");
           //check if the xmlString is not blank
           if (String.IsNullOrEmpty(xmlString))
           {
               //stop the processing
               return rssDataSet;
           }
           try
           {
               using (StringReader stringReader = new StringReader(xmlString))
               {                    
                   rssDataSet = new DataSet();
                   rssDataSet.ReadXml(stringReader);
               }
           }
           catch
           {
               rssDataSet = null; 
           }
           return rssDataSet;
       }

 

Using getNewDataSet() the Flex side is easy just set your datagrid.dataprovidere.result.item

If you prefer to return a string and then work on the XML on the FLEX side…I’ll give you both the C# and the FLEX code….

C# Code

public string getNews()
       {
           WebFetch.WebFetch wf = new WebFetch.WebFetch();
           return wf.getWebPage("http://finance.yahoo.com/rss/topstories");
 
       }

 

FLEX Code (I’m assuming you know how to call a remote object from Flex so this is what happens when you get the result back)

private function gotNews (e:ResultEvent) : void {
            RSS = new ArrayCollection();
            var xml:XML = new XML(e.result);
            var obj:Object = xmlToObject(xml);
            entries.dataProvider=obj.rss.channel.item; //where entries is my datagrid           
        }
 
private function xmlToObject(value:XML):Object {
                var xmlStr:String = value.toXMLString();
                var xmlDoc:XMLDocument = new XMLDocument(xmlStr);
                var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
                var resultObj:Object = decoder.decodeXML(xmlDoc);
                return resultObj;
            }

 

Greg Uncategorized

Change Browser Title in FLEX using Javascript

March 27th, 2009

If you only need to statically set the Browser Title in FLEX, then just set the pageTitle property of your <mx:Application>

<mx:Application backgroundColor="#ffffff" pageTitle="My Application: By Greg Jessup"
    xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
    initialize="init()"
    width="100%"
    height="100%"
>

Howerver, sometimes you want to do it dynamically. The only way to do this is by making a call from Flex to the HTML template and invoking a JavaScript function.

We use the flash.external.ExternalInterface to accomplish this task.

Here is how its done…..

FLEX CODE

import flash.external.ExternalInterface;
 
private function SetBrowserTitle(newTitle:String) : void {
                if ( ExternalInterface.available ) {                     
                    ExternalInterface.call("changeTitle",newTitle);        
                }            
}

 

Javascript

Simply edit the html-template/index.template.html in you project. Your header will look something like this. The main thing you are concerned with here is adding the changeTitle function….see below

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${title}</title>
<script src="AC_OETags.js" language="javascript"></script>
<script language="JavaScript" type="text/javascript">
    function changeTitle(newTitle) {      
      document.title=newTitle;  // this works with IE only      
     }
</script>
<style>
body { margin: 0px; overflow:hidden }
</style>
</head>

Greg Uncategorized

Replace Non Printable Characters in PERL String

March 26th, 2009
#replace non printable characters in the description
my %good = map {$_=>1} (9,10,13,32..126);
$description =~ s/(.)/$good{ord($1)} ? $1 : ' '/eg;

Greg Uncategorized

ComboBox ItemRenderer in Flex AdvancedDatagrid

March 9th, 2009

image

 

If you are declaring your AdvancedDataGridColumn in MXML then simply add

headerRenderer="View.HeaderRenderer"

<mx:AdvancedDataGridColumn wordWrap="true"  headerRenderer="View.HeaderRenderer"  
    sortable="false" dataField="chkbox" width="200" textAlign="center">

 

Then Create your ComboBox in either MXML or ActionScript. I chose MXML in this case.

<?xml version="1.0"?>
 
<mx:HBox creationComplete="setStyles()" horizontalAlign="center" xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Style>
        HeaderComboBox {
           cornerRadius: 0;
           arrowButtonWidth: 0;
           openDuration: 10;
           closeDuration: 10;
           textAlign: left;
           fontSize: 10;
        }
    </mx:Style>
    
    <mx:Script>
        <![CDATA[
            import mx.events.ListEvent;         
            [Bindable]    public var headerRendererData: Array = [ {label:"Select Action", data:0, buttonName: ""}, 
                    {label:"Close Selected", data:"close",  buttonName: "Close these Tickets"},                
                    {label:"Update Selected", data:"update",  buttonName: "Update these Tickets"}];                   
 
 
 
               public function doWork(e:ListEvent) : void {                   
                   //Put code here to action a selection event
                   combo.selectedIndex = 0;  //reset combo to first value
                   trace (e);
               }
               private function setStyles() : void {
                   
                try {
                   combo.dataProvider = this.headerRendererData;;
                   combo.setStyle("cornerRadius",0);
                   combo.setStyle("openDuration",10);
                   combo.setStyle("closeDuration",10);
                }
                catch (e:Error) {}
               }
               
        ]]>
    </mx:Script>
 
    <mx:ComboBox id="combo" width="98%" dataProvider="{this.headerRendererData}" change="doWork(event)">
        
    </mx:ComboBox>
    
 
</mx:HBox>
 

Greg Uncategorized