Tags: | Categories: Blog Posted by admin on 1/14/2010 10:31 AM | Comments (0)


 

C# Tip. To make sure you clean your string from non ASCII characters you can use Regex class instead of using string functions. The [\x01-\x1F] is the range you want to keep.

temp = Regex.Replace(temp, "[\x01-\x1F]", "");

Happy coding.

Cheers

Al

Follow me in twitter | bookmark me | Subscribe to my feed | Add stats to your blog

Tags: | Categories: Blog Posted by admin on 1/14/2010 9:50 AM | Comments (1)


Because you are a geek, does not mean your carbon footprint is allowed to be bigger than other people. You should be smarter by selecting the technology that saves you money as well as is friendly to the planet. This is my modest recommendation to you.

A few tips to become a green geek.

  • Rechargeable batteries: Instead of keep purchasing disposable batteries, start buying rechargeable batteries, find a place in the garage or the house to add 2 boxes mark them with recharged and To Recharge and then purchase a battery recharge station that can recharge any kind of battery. With time will save you lots of money as well as you won’t have to dispose your batteries.
  • Buy an eReader: Ok let’s save the trees and space in your house and buy the bloody Amazon Kindle or your favorite eReader. I would personally wait to see what is going to happen with the Apple Tablet coming up on January 26, it might be a tablet and a eReader for all we know. Yet, stop purchasing those big books with yellow pages and save a tree or two. The future of books is in an electronic format,  jump in the wagon sooner than later and the price of the books will come down as well.
  • Get rid of all your printers and get a wireless network printer for the house:  You might think you need all the printers, one for the office, one for the kids to print the homework and then the photo printer. Just replace all that for one wireless network printer for all computers in the house, the photo printer needs to go, you know is actually cheaper to send your pictures to Costco, so you better off by unplugging it. More and more, people realize that you don’t need to print every email that comes in for reading it later. I found myself working almost paperless.
  • Portable solar phone recharger: One of the best purchases I made, was my portable solar charger for the iPhone, now I can charge it almost anywhere. Hopefully solar power will become more powerful to be able to even charge you laptop, I have always wondered why nobody ever added a solar panel on the laptops back?
  • Energy smart light bubs: A given, you should not need a reason to buy those instead of regular light bubs, I’m not saying that you should replace all light bubs in your home right now, just when you need to replace, use the new ones. Enough said.
  • Buy a NetBook: This one is actually pretty important, if you are a developer, you got your laptop and you should also carry a Netbook, most of the time you should be using only your netbook for emails, browser, twitter, blogging, etc … Only when you need to develop or when you have to work in something where the big computer is needed, the big laptop comes out. Your laptop’s life will be longer by just carrying an extra 3 pounds.

Well this is my list, I’m sure I’m forgetting many there.Do you have a recommendation you would like to share?

Cheers

Al

Tags: | Categories: Blog Posted by admin on 1/11/2010 12:42 PM | Comments (0)


Back in July last year I posted how to create and deploy a CLR Trigger for MS SQL to add your business logic in the database, so when somebody inserts a new row, you can do some work. Great if you control the MS SQL Server. You can read the blog post here:

http://alpascual.com/blog/sql-2008-clr-triggers-use-a-net-class-library-in-sql-using-wpf/

I have been lately receiving lots of emails and questions about that post, that tells me one thing, I don’t have readers, there are only people using Bing or Google looking how to do that. No problem let me fix the main concern for many people. When installing dependent dlls on MS SQL it may fail as you are required to add another dll before, so the order was very important, to avoid the problem you can just copy all dlls to a temp location, as MS SQL looks for dependencies in the same directory than the dll you are trying to insert on the databse.

Create the MS SQL table on the database if you haven’t.

Copy all the dlls referenced on the CLR trigger DLL into a temp directory. This are the recommended list you going to need.

'C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\SMDiagnostics.dll'

'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.Runtime.Serialization.dll' 'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.Linq.dll'

'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\system.core.dll'

'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\windowsbase.dll' 'C:\Windows\Microsoft.NET\Framework\v3.0\WPF\PresentationCFFRasterizer.dll' 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll'

'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationCore.dll' 'C:\Windows\Microsoft.NET\Framework\v3.0\WPF\PresentationHostDLL.dll' 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll' 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.DirectoryServices.dll'

'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll' 'C:\Windows\Microsoft.NET\Framework\v3.0\WPF\PresentationUI.dll' 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.dll' 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Messaging.dll'

'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.IdentityModel.dll'

'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.IdentityModel.Selectors.dll' 'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.ServiceModel.dll' 'C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\Microsoft.Transactions.Bridge.dll'

'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.Extensions.dll'

'C:\Program Files\WPF Toolkit\v3.5.40128.1\wpftoolkit.dll'

Then run the SQL script to set up the database and to enable clr:

--------------------------------------

USE DatabaseName
GO

ALTER DATABASE DatabaseName SET TRUSTWORTHY ON

GRANT UNSAFE ASSEMBLY to public

EXEC sp_configure 'show advanced options' , '1';

go

reconfigure;

go

EXEC sp_configure 'clr enabled' , '1'

go

reconfigure;

-------------------------------------

Do this per each assembly you copy into a temp directory:

--------------------------------------

CREATE ASSEMBLY [SMDiagnostics]  FROM 'C:\mypath\SMDiagnostics.dll'  WITH permission_set = unsafe

-------------------------------------

Add the CLR trigger into the database and create the trigger

-------------------------------------

CREATE ASSEMBLY TriggerName
FROM 'C:\Path\TriggerName.dll'
WITH permission_set = unsafe
GO

CREATE TRIGGER TriggerName
ON TableName
FOR INSERT
AS EXTERNAL NAME Namespace.HandleTrigger
GO

Hope this is much better than the previous version of the post.

Cheers

Al

Tags: | Categories: Blog Posted by admin on 1/11/2010 7:46 AM | Comments (0)

 

Finally this weekend I had the time to start looking at Graffiti 1.3 that Telligent decided to open source it for the world to enjoy and contribute. Before that I was looking to move to WordPress.com not the php add from Wordpress.org that you can download. The commercial application its a very complete blog application, yet can get very expensive for me. After looking into all the options, I believe that I should stick with Telligent, as Community Server was my first hosted blog engine and Graffiti CMS without any doubt the most customizable one out there so far.

So I downloaded Graffiti CMS 1.3. You can find the open source blog here to download contribute and help. I compiled it, check the source code and upgraded my old Graffiti 1.2, no many changes at all since the previous version. You’ll find in the Site Option and new configuration tab.

image

Version 1.3 is backwards compatible with the database structure from 1.2, something good that you don’t need to upgrade the database schema.

There are a few things to keep in consideration when upgrading, is not as straight forward and things you need to make sure.

  1. Back up the previous version as you going to need a few directories.
  2. After backing up, delete the whole structure from Graffiti version 1.2
  3. Make the changes on the web.config for you existing connection string and compile the whole solution.
  4. Publish ALL files to a directory and ftp them to the root directory.
  5. Copy the files directory to the deployment.
  6. Important, if you have IIS 7 you are set, however if not you need to go to the admin –>Site Options –> Configuration –> Generate Folders for Posts/Categories/Tags (Legacy) and check the box, save the changes.
    1. If you have check the box, you’ll need to copy the directories for your content plus the feed directory.
  7. Everything should be working fine.

In my opinion Graffiti CMS is one of the best blog engines out there, now that is open source the future is not very clear, if many people get involved in improving and adding new feature, Graffiti CMS has a great future, otherwise I don’t see it making it this year and becoming another dead project in Codeplex.com. I haven’t seen much activity since Telligent decided to open it. Now the future will tell. I’ll be still running Graffiti CMS for a few reasons, the main one, is I can change anything that does not work, or add functionality I would like.

If you want to get involved this is how, download the source code and start looking at what could be improved. My modest suggestions or things that should be done to Graffiti CMS

  • Add a option to detect mobile phones and the iPhone to show the blog better, a theme option for mobile devices like WordPress.com
  • Better reporting
  • More Themes
  • Twitter sync for retweet button
  • Improve the performance.
  • Silverlight widgets.

One more thing. You may get an erorr using Live Writer if you do not delete the previous version of the bin directory before uploading 1.3

Method not found: 'System.String Graffiti.Core.SiteSettings.get_ProxyHost()'.

Also if you get a 404 when trying to access one of the post, is because you forgot task 6 above. Make sure that if you are running IIS 6 to have that option enable.

Hope this helps, looking for any other suggestions.

Cheers

Al

Tags: | Categories: Blog Posted by admin on 1/8/2010 1:41 PM | Comments (1)

If you are around the social networks, by now you've found people sharing the new finding in Windows 7, how to control every setting from a folder. To share the steps again, create a folder in the desktop, to make it easy to find.

  1. Create a new folder
  2. Rename it to GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
  3. Open the folder.

image

 

image

 

You’ll see a list of stuff that normally is found in the control panel in a list of groups

image

This is the complete list of groups

image

A nice little find I think, happy playing God.

Cheers

Al

Follow me in twitter | bookmark me | Subscribe to my feed | Add stats to your blog

Tags: | Categories: Blog Posted by admin on 12/27/2009 5:22 AM | Comments (2)

What about changing how cell phones communicate with each other? What about moving away from GSM and CDMA and just use your Wi-Fi or data connection like 3G or 4G to make Voice Over the Internet calls?

The Google phone with Android OS is coming out, their name it Nexus One, guess will also be Nexus Two some day. A few rumors are running around the Internet about the usability of the device itself. Google has been trying to push Google Voice to other devices, the way to use a phone better then any existing platform out there; now, with the release of Nexus One, they may have an advantage to just let you buy a phone without any affiliation to any carrier. What means for you? Probably a very expensive device ‘cos you don’t need a contract, yet means to be able to select your carrier.

Now what plan does it require? If Google can get away with it, you’ll only need a data plan, no need for any minutes, the phone will use your data plan to make and receive phone calls. Are we too early for something like that? I personally think so, carriers make their money in the minutes, not much on a flat data plan.

Is this the way to lower you monthly cell phone charge? And the best question of all for iPhone users stuck with AT&T. Is now finally Apple will see that they need to unlock the iPhone with other carriers?

Without any doubt the Google Nexus One, can be a game changer for all  in the market, now. Where in the market the Apple Table “iSlate coming out with 3G fits? New Amazon Kindle or a really big iPhone? Can I share my 3G from my iPhone with my Apple Table?

Those 2 devices will be a topic of conversation for many of us on 2010. Like the iPhone will start seeing them around, and like the iPhone the price will also mark the acceptance of those.

How much will you pay for the Google Nexus One? What about the Apple Table?

Cheers

Al

Tags: | Categories: Blog Posted by admin on 12/21/2009 10:55 AM | Comments (0)

So the new WCF RIA Services are here for Visual Studio 2008 SP1, and with that the older applications created with the preview .NET RIA Services back in July need a few work to be updated. If you created any application using the templates that came with .NET RIA Services like the Navigation template of the Business Application Template, there are a few things you need to do to upgrade to the new WCF RIA Services.

replace all instances of RiaContext as became WebContext.

The Context become DataContext also.

The App.xaml need to change from

 <Application.ApplicationLifetimeObjects>
        <app:RiaContext>
            <app:RiaContext.Authentication>
                <appsvc:FormsAuthentication/>
                <!--<appsvc:WindowsAuthentication/>-->
            </app:RiaContext.Authentication>
        </app:RiaContext>
    </Application.ApplicationLifetimeObjects>

 

to

 <Application.ApplicationLifetimeObjects>
        <app:WebContext>
            <app:WebContext.Authentication>
                <appsvc:FormsAuthentication/>
                <!--<appsvc:WindowsAuthentication/>-->
            </app:WebContext.Authentication>
        </app:WebContext>
    </Application.ApplicationLifetimeObjects>
 
Logout method on LoginControl.xaml.cs change from
 private void LogoutButton_Click(object sender, RoutedEventArgs e)
        {
            _authService.Logout();
        }

to

 private void LogoutButton_Click(object sender, RoutedEventArgs e)
        {
            this.authService.Logout(logoutOperation =&gt;
            {
                if (logoutOperation.HasError)
                {
                    ErrorWindow.CreateNew(logoutOperation.Error);
                    logoutOperation.MarkErrorAsHandled();
                }
            }, /* userState */ null);
        }
 

Hope this helps.

Cheers

Al

Tags: | Categories: Blog Posted by admin on 12/18/2009 5:16 AM | Comments (0)

Mix 10K Challenge

image006

Inspire the World with Just 10K
What could you create for the Web if you only had 10 kilobytes of code? It's time to exercise your minimalist creativity and get back to basics - back to optimizing every little byte like your life depended on it!  The MIX 10K Challenge is back, and this time we’ve upped the our game with an expanded set of web technologies and standards, including Gestalt, Silverlight, HTML5, and more.   The Grand Prize winner will receive a trip to MIX10, and there are more great prizes for the Community Winner and Runners-Up.    Learn more!

Cheers

Al

Follow me in twitter | bookmark me | Subscribe to my feed | Add stats to your blog

Tags: | Categories: Blog Posted by admin on 12/13/2009 4:01 PM | Comments (1)

 Re Blogging http://blog.lozanotek.com/archive/2009/12/13/ASP.beer_Seattle.aspx

Can you answer at least one of the following questions:

  • Are you an ASP.NET or related web technology enthusiast?
  • Are you going to be in Bellevue, WA on 2/16 for the MVP Summit?
  • Do you live in the Seattle area?
  • Do you like to eat/drink with fellow geeks?

If you have answered at least one of these questions, come hang out with us at ASP.beer!

When: Feb 16, 2009 @ 8:00 PM (PST).

Where: , 550 106TH AVENUE NE BELLEVUE, WA 98004, USA

Description: Come join us at the Tap House Grill for an informal social gathering for MVPs, Insiders and Product Team for ASP.NET, other MVPs welcomed too!

To register, go here (http://bit.ly/aspbeerseattle).

See you there!

Tags: | Categories: Blog Posted by admin on 12/4/2009 9:26 AM | Comments (1)

Save the date! SoCal Code Camp is coming. Details below!

January 30 & 31, 2010
University of California Fullerton

SCCC_Banner2[1]

You can register (or log in) to the site here: http://www.socalcodecamp.com
Registration need only be done once, so remember that if you are already registered you can log in and just sign up for the upcoming event! Otherwise, register now and sign up!

Code Camp is a place for developers to come and learn from their peers. This community driven event has become an international trend where peer groups of all platforms, programming languages and disciplines band together to bring content to the community.

Who is speaking at Code Camp? YOU are, YOUR PEERS are, and YOUR LOCAL EXPERTS are…all are welcome! This is a community event and one of the main purposes of the event is to have local community members step up and offer some cool presentations! Don’t worry if you have never given a presentation before, we’ll give you some tips if you need help, and this a great opportunity to spread your wings. Of course, we do have some ringers on our speaker list as well…stay tuned…

Cheers

Al

Follow me in twitter | bookmark me | Subscribe to my feed | Add stats to your blog