那些年我们赚过的外快

可能童鞋们都看到园子里有很多大神,赚钱快又轻松。这里我们讨论下苦逼程序员如何增加自己的收入。像xiaotie啊、吉日啊这些个前辈是怎么做到的呢?你们想过没有!当然我也是苦逼大众之一,还没到达那境界,我作个简单分析。然后分享一下最近5、1期间一次技术救急的经历,分享一下自己做私活的心得。

成功没有捷径,因为专业,所以出色!

1、做软件多年明白一个道理:需求很值钱,业务很值钱。

比如我以前是做酒店管理系统、餐饮管理系统、桑拿收银系统等等,这些国内信息化比较早的传统管理软件。这些软件能够成就北京中软、泰能、杭州西湖软件等上市公司,还有无数的中小软件作坊。所以专业的管理软件必须体现那个行业的先进的管理理念、实现先进的管理方法,能够提高客户的收益,提升客户的管理水平。所以说需求很值钱,业务很值钱。悲剧的是,我没进到做这些系统的大公司,我入行时那公司只是作坊的规模。所以就悲催了。但是因为在这个行业做了几年,积累了些人脉,后面换工作因为熟悉这个行业的一些需求、业务,找到了项目经理、产品经理的职位。所以大家不必死死盯着最新的技术,术业有专攻。当你在某一领域做到最专业最有名就成功了。xiaotie是图像界泰斗,吉日是权限方面的专家,还有像老魏啊医疗HIS方面的、企业级快速开发平台等领域...

一个有趣的现象,同样是程序员:

一些人累得半死,一个月赚不了多少。有些人很轻松依靠自己的独门绝技,闷声发财,关键还有时间找妹纸。

对于这现象我也是只有惊叹,人和人怎么就那么大区别啊!不科学啊!%……&%¥###

2、机遇很重要,人脉很重要。苦逼码农你要写博客,多看牛人的博客。

订阅园子优秀博客的rss以来这几年逛园子的习惯让我增长了知识,拓宽了眼界,还有幸结识了一些大牛。苦逼码农要想发展好,必须注重建立自己的圈子。对,圈子!君不见牛人换工作都是猎头自己找上门来,成功的码农跳槽都是朋友推荐,同样做外快也大都是自己圈子里朋友介绍,或者是人家看了你博客找到你。精明的商家已经学会了微博营销,码农你要写博客,你也可以实现博客营销。吉日大哥一句话惊醒梦中人:这几年一写博客,每年就增加10万收入!当然我不是在这里找抽,拜金。一个码农不能养家糊口,算什么英雄。在天朝你没买房买车,你得不到尊重!

3、个人一次技术援助的分享。

五一前,有位帅哥:山东日照做计生软件的李哥。通过看我的博客,认为我能解决他遇到的条形码打印的问题,通过QQ要求我加他。他说可以付费请我帮忙。先是加了他,然后远程协助了一下,写了一段代码那条形码打印机有反应了,但是打出来东西是空白。无奈那东西需要大量调试,那厂家提供的SDK也只有VB和Delphi、VFP等的。没有C#的。我使用的是GDI+进行测试,跳开了使用厂家SDK的办法。但是证明不行,那么只有把Delphi的DEMO转成C#的一条路了。我说必须多次调试,没有打印机。李哥二话不说,网上订了打印机,第二天就到了。李哥老问多少钱,我出于有研究的兴趣一直没答复他,我说简单的话就免费了。刚好放假有时间花了一天时间搞定了。在通知李哥前,他QQ上留言给我寄了点心意,我擦,山东李哥真豪爽!李哥的答谢礼是一台台电4核的平板电脑!价值1300多!估计李哥是看我说说你们照片发现最近在学安卓开发吧。无图无真相,上图得瑟下!

送上一段代码,CODE39条形码图像生成。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Code39GenApp
{
    /// <summary>
    /// Code39表形码图形生成器
    /// </summary>
    public class Code39BarCode
    {
        /// <summary>
        /// 条码文本,最后一次调用时的BarCode
        /// </summary>
        public static string BarCodeText = string.Empty;
        /// <summary>
        /// 生成条码Bitmap 默认大小
        /// </summary>
        /// <param name="sourceCode"></param>
        /// <returns></returns>
        public static Bitmap GetCode39(string sourceCode)
        {
            int leftMargin = 5;
            int topMargin = 0;
            int thickLength = 2;
            int narrowLength = 1;
            int barCodeHeight = 35;
            int intSourceLength = sourceCode.Length;
            string strEncode = "010010100"; //添加起始码“*”.
            var font = new System.Drawing.Font("Segoe UI", 5);

            string AlphaBet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*";

            string[] Code39 = 
             {
                 /* 0 */ "000110100",  
                 /* 1 */ "100100001",  
                 /* 2 */ "001100001",  
                 /* 3 */ "101100000",
                 /* 4 */ "000110001",  
                 /* 5 */ "100110000",  
                 /* 6 */ "001110000",  
                 /* 7 */ "000100101",
                 /* 8 */ "100100100",  
                 /* 9 */ "001100100",  
                 /* A */ "100001001",  
                 /* B */ "001001001",
                 /* C */ "101001000",  
                 /* D */ "000011001",  
                 /* E */ "100011000",  
                 /* F */ "001011000",
                 /* G */ "000001101",  
                 /* H */ "100001100",  
                 /* I */ "001001100",  
                 /* J */ "000011100",
                 /* K */ "100000011",  
                 /* L */ "001000011",  
                 /* M */ "101000010",  
                 /* N */ "000010011",
                 /* O */ "100010010",  
                 /* P */ "001010010",  
                 /* Q */ "000000111",  
                 /* R */ "100000110",
                 /* S */ "001000110",  
                 /* T */ "000010110",  
                 /* U */ "110000001",  
                 /* V */ "011000001",
                 /* W */ "111000000",  
                 /* X */ "010010001",  
                 /* Y */ "110010000",  
                 /* Z */ "011010000",
                 /* - */ "010000101",  
                 /* . */ "110000100",  
                 /*' '*/ "011000100",
                 /* $ */ "010101000",
                 /* / */ "010100010",  
                 /* + */ "010001010",  
                 /* % */ "000101010",  
                 /* * */ "010010100"  
             };
            sourceCode = sourceCode.ToUpper();

            Bitmap objBitmap = new Bitmap(
              ((thickLength * 3 + narrowLength * 7) * (intSourceLength + 2)) + (leftMargin * 2),
              barCodeHeight + (topMargin * 2));
            Graphics objGraphics = Graphics.FromImage(objBitmap);

            objGraphics.FillRectangle(Brushes.White, 0, 0, objBitmap.Width, objBitmap.Height);

            for (int i = 0; i < intSourceLength; i++)
            {
                //非法字符校验
                if (AlphaBet.IndexOf(sourceCode[i]) == -1 || sourceCode[i] == '*')
                {
                    objGraphics.DrawString("Invalid Bar Code",
                      SystemFonts.DefaultFont, Brushes.Red, leftMargin, topMargin);
                    return objBitmap;
                }
                //编码
                strEncode = string.Format("{0}0{1}", strEncode,
                 Code39[AlphaBet.IndexOf(sourceCode[i])]);
            }

            strEncode = string.Format("{0}0010010100", strEncode); //添加结束码“*”

            int intEncodeLength = strEncode.Length;
            int intBarWidth;

            for (int i = 0; i < intEncodeLength; i++) //绘制 Code39 barcode
            {
                intBarWidth = strEncode[i] == '1' ? thickLength : narrowLength;
                objGraphics.FillRectangle(i % 2 == 0 ? Brushes.Black : Brushes.White,
                 leftMargin, topMargin, intBarWidth, barCodeHeight);
                leftMargin += intBarWidth;
            }

            //绘制 明码
            SizeF sizeF = objGraphics.MeasureString(sourceCode, font);
            float x = (objBitmap.Width - sizeF.Width) / 2;
            float y = objBitmap.Height - sizeF.Height;
            objGraphics.FillRectangle(Brushes.White, x, y, sizeF.Width, sizeF.Height);
            objGraphics.DrawString(sourceCode, font, Brushes.Black, x, y);

            return objBitmap;
        }
       
        /// <summary>
        /// 生成条码Bitmap,自定义条码高度
        /// </summary>
        /// <param name="sourceCode"></param>
        /// <returns></returns>
        public static Bitmap GetCode39(string sourceCode, int barCodeHeight)
        {
            BarCodeText = sourceCode.ToUpper();
            int leftMargin = 5;
            int topMargin = 0;
            int thickLength = 2;
            int narrowLength = 1;           
            int intSourceLength = sourceCode.Length;
            string strEncode = "010010100"; //添加起始码“*”.
            var font = new System.Drawing.Font("Segoe UI", 5);
            string AlphaBet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*";
            string[] Code39 = 
             {
                 /* 0 */ "000110100",  
                 /* 1 */ "100100001",  
                 /* 2 */ "001100001",  
                 /* 3 */ "101100000",
                 /* 4 */ "000110001",  
                 /* 5 */ "100110000",  
                 /* 6 */ "001110000",  
                 /* 7 */ "000100101",
                 /* 8 */ "100100100",  
                 /* 9 */ "001100100",  
                 /* A */ "100001001",  
                 /* B */ "001001001",
                 /* C */ "101001000",  
                 /* D */ "000011001",  
                 /* E */ "100011000",  
                 /* F */ "001011000",
                 /* G */ "000001101",  
                 /* H */ "100001100",  
                 /* I */ "001001100",  
                 /* J */ "000011100",
                 /* K */ "100000011",  
                 /* L */ "001000011",  
                 /* M */ "101000010",  
                 /* N */ "000010011",
                 /* O */ "100010010",  
                 /* P */ "001010010",  
                 /* Q */ "000000111",  
                 /* R */ "100000110",
                 /* S */ "001000110",  
                 /* T */ "000010110",  
                 /* U */ "110000001",  
                 /* V */ "011000001",
                 /* W */ "111000000",  
                 /* X */ "010010001",  
                 /* Y */ "110010000",  
                 /* Z */ "011010000",
                 /* - */ "010000101",  
                 /* . */ "110000100",  
                 /*' '*/ "011000100",
                 /* $ */ "010101000",
                 /* / */ "010100010",  
                 /* + */ "010001010",  
                 /* % */ "000101010",  
                 /* * */ "010010100"  
             };
            sourceCode = sourceCode.ToUpper();
            Bitmap objBitmap = new Bitmap(((thickLength * 3 + narrowLength * 7) * (intSourceLength + 2)) + 
                                           (leftMargin * 2),barCodeHeight + (topMargin * 2));
            Graphics objGraphics = Graphics.FromImage(objBitmap);
            objGraphics.FillRectangle(Brushes.White, 0, 0, objBitmap.Width, objBitmap.Height);
            for (int i = 0; i < intSourceLength; i++)
            {
                //非法字符校验
                if (AlphaBet.IndexOf(sourceCode[i]) == -1 || sourceCode[i] == '*')
                {
                    objGraphics.DrawString("Invalid Bar Code",SystemFonts.DefaultFont, Brushes.Red, leftMargin, topMargin);
                    return objBitmap;
                }
                //编码
                strEncode = string.Format("{0}0{1}", strEncode,
                Code39[AlphaBet.IndexOf(sourceCode[i])]);
            }
            strEncode = string.Format("{0}0010010100", strEncode); //添加结束码“*”
            int intEncodeLength = strEncode.Length;
            int intBarWidth;
            for (int i = 0; i < intEncodeLength; i++) //绘制 Code39 barcode
            {
                intBarWidth = strEncode[i] == '1' ? thickLength : narrowLength;
                objGraphics.FillRectangle(i % 2 == 0 ? Brushes.Black : Brushes.White,leftMargin, topMargin, intBarWidth, barCodeHeight);
                leftMargin += intBarWidth;
            }
            //绘制明码          
            Font barCodeTextFont = new Font("黑体", 10F);
            RectangleF rect = new RectangleF(2, barCodeHeight - 20, objBitmap.Width - 4, 20);          
            objGraphics.FillRectangle(Brushes.White,rect);
            //文本对齐
            StringFormat barCodeTextFormat = new StringFormat();
            barCodeTextFormat.Alignment = StringAlignment.Center;
            barCodeTextFormat.LineAlignment = StringAlignment.Center;
            objGraphics.DrawString(BarCodeText, barCodeTextFont, Brushes.Black, rect, barCodeTextFormat);
            return objBitmap;
        }

        /// <summary>
        /// 生成条码Bitmap,自定义条码高度,自定义文字对齐样式
        /// </summary>
        /// <param name="sourceCode"></param>
        /// <param name="barCodeHeight"></param>
        /// <param name="sf"></param>
        /// <returns></returns>
        public static Bitmap GetCode39(string sourceCode, int barCodeHeight,StringFormat sf)
        {
            BarCodeText = sourceCode.ToUpper();
            int leftMargin = 5;
            int topMargin = 0;
            int thickLength = 2;
            int narrowLength = 1;
            int intSourceLength = sourceCode.Length;
            string strEncode = "010010100"; //添加起始码“*”.
            var font = new System.Drawing.Font("Segoe UI", 5);
            string AlphaBet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*";
            string[] Code39 = 
             {
                 /* 0 */ "000110100",  
                 /* 1 */ "100100001",  
                 /* 2 */ "001100001",  
                 /* 3 */ "101100000",
                 /* 4 */ "000110001",  
                 /* 5 */ "100110000",  
                 /* 6 */ "001110000",  
                 /* 7 */ "000100101",
                 /* 8 */ "100100100",  
                 /* 9 */ "001100100",  
                 /* A */ "100001001",  
                 /* B */ "001001001",
                 /* C */ "101001000",  
                 /* D */ "000011001",  
                 /* E */ "100011000",  
                 /* F */ "001011000",
                 /* G */ "000001101",  
                 /* H */ "100001100",  
                 /* I */ "001001100",  
                 /* J */ "000011100",
                 /* K */ "100000011",  
                 /* L */ "001000011",  
                 /* M */ "101000010",  
                 /* N */ "000010011",
                 /* O */ "100010010",  
                 /* P */ "001010010",  
                 /* Q */ "000000111",  
                 /* R */ "100000110",
                 /* S */ "001000110",  
                 /* T */ "000010110",  
                 /* U */ "110000001",  
                 /* V */ "011000001",
                 /* W */ "111000000",  
                 /* X */ "010010001",  
                 /* Y */ "110010000",  
                 /* Z */ "011010000",
                 /* - */ "010000101",  
                 /* . */ "110000100",  
                 /*' '*/ "011000100",
                 /* $ */ "010101000",
                 /* / */ "010100010",  
                 /* + */ "010001010",  
                 /* % */ "000101010",  
                 /* * */ "010010100"  
             };
            sourceCode = sourceCode.ToUpper();
            Bitmap objBitmap = new Bitmap(((thickLength * 3 + narrowLength * 7) * (intSourceLength + 2)) +
                                           (leftMargin * 2), barCodeHeight + (topMargin * 2));
            Graphics objGraphics = Graphics.FromImage(objBitmap);
            objGraphics.FillRectangle(Brushes.White, 0, 0, objBitmap.Width, objBitmap.Height);
            for (int i = 0; i < intSourceLength; i++)
            {
                //非法字符校验
                if (AlphaBet.IndexOf(sourceCode[i]) == -1 || sourceCode[i] == '*')
                {
                    objGraphics.DrawString("Invalid Bar Code", SystemFonts.DefaultFont, Brushes.Red, leftMargin, topMargin);
                    return objBitmap;
                }
                //编码
                strEncode = string.Format("{0}0{1}", strEncode,
                Code39[AlphaBet.IndexOf(sourceCode[i])]);
            }
            strEncode = string.Format("{0}0010010100", strEncode); //添加结束码“*”
            int intEncodeLength = strEncode.Length;
            int intBarWidth;
            for (int i = 0; i < intEncodeLength; i++) //绘制 Code39 barcode
            {
                intBarWidth = strEncode[i] == '1' ? thickLength : narrowLength;
                objGraphics.FillRectangle(i % 2 == 0 ? Brushes.Black : Brushes.White, leftMargin, topMargin, intBarWidth, barCodeHeight);
                leftMargin += intBarWidth;
            }
            //绘制明码          
            Font barCodeTextFont = new Font("黑体", 10F);
            RectangleF rect = new RectangleF(2, barCodeHeight - 20, objBitmap.Width - 4, 20);
            objGraphics.FillRectangle(Brushes.White, rect);
            //文本对齐
            objGraphics.DrawString(BarCodeText, barCodeTextFont, Brushes.Black, rect, sf);
            return objBitmap;
        }
    }
}

 

后续希望可以成为条形码、RFID等物联网技术领域的专家。所以我开心的笑了,等我哪天成功了,我来园子炫下富,刺激一下你们眼球...

~_~ 抛了砖,接你们的玉!谢谢CCTV、谢谢博客园...

posted @ 2013-05-04 09:36  数据酷软件  阅读(7430)  评论(52编辑  收藏  举报