I had an old test box running XP and it was upgraded to Win7. In the process I lost my Firefox Sync with my main development box. Firefox Sync is wonderful, but it makes Byzantine bureaucracy look like a Manual for Dummies. It's full of blind alleys and circular mazes.
Going to "about:home" and clicking on the "sync" icon at the bottom put me in an Alice In Wonderland world where I needed my Sync Recovery Key to log in, but couldn't get those magic numbers until I was logged in. Hmmmm.
My solution:
1. Delete your account at https://account.services.mozilla.com
2. Recreate it with the same username and password, but be careful to get the "Sync Recovery Key" from the "Manage Account". The interface is a little odd, because it's assuming you want to change the key, not copy it. On the panel select "Cancel" after you have copied the key to a warm, dry place.
3. Went to my new device and started the process to pair the device.
Then it all worked. Good luck.
I'm blogging about programming, but ... hey look over there - it's something shiny!
Tuesday, November 26, 2013
Thursday, November 07, 2013
Visual Studio 2012 - Cannot evaluate expression because the code of the current method is optimized
While trying to debug my C# project, I kept getting the dreaded "Cannot evaluate expression because the code of the current method is optimized" message - meaning the compiler optimized away all the details of the methods to increase execution speed.
To see if your library is optimized, start the debugger and then go to "Debug/Windows/Modules" and see if your library is optimized. My problem child .dll was optimized.
Right clicking on the project and selecting "Properties", I looked at the "Build" tab.
I made sure the "Optimize code" checkbox was unchecked, but that is not enough.
My missing piece was on the same "Build" tab, but further down under "Advanced". I needed to set the "Output / Debug to "full", it's not enough just to be "pdb-only".
Now the project compiles with full debugging info.
My missing piece was on the same "Build" tab, but further down under "Advanced". I needed to set the "Output / Debug to "full", it's not enough just to be "pdb-only".
Now the project compiles with full debugging info.
Wednesday, November 06, 2013
"synwinxt.dll is missing or invalid" error after 1.4.14 upgrade on Windows XP
After loving synergy for the last few years, I decided to upgrade since it had one minor annoyance: When ever my server machine got a new IP address, the client couldn't find it - I had to manually reset it by reentering a different version of the host name which caused synergy to lookup the IP address.
Well, nothing is as easy as it looks.
I upgraded my windows7 server to the 64 bit version and windows XP client to the latest 32-bit version, 1.4.15. Didn't work. My XP box keep getting "synwinxt.dll is missing or invalid".
I downgraded to version 1.4.14 on both machines and still couldn't get them to communicate.
I finally installed the 1.4.15 32-bit version on my Windows 7 server and it all worked beautifully again.
Synergy is wonderful for sharing keyboard and mouse across multiple machines.
Well, nothing is as easy as it looks.
I upgraded my windows7 server to the 64 bit version and windows XP client to the latest 32-bit version, 1.4.15. Didn't work. My XP box keep getting "synwinxt.dll is missing or invalid".
I downgraded to version 1.4.14 on both machines and still couldn't get them to communicate.
I finally installed the 1.4.15 32-bit version on my Windows 7 server and it all worked beautifully again.
Synergy is wonderful for sharing keyboard and mouse across multiple machines.
Saturday, October 26, 2013
Photos from Pablo's Fiesta October 26, 2013 Austin TX
Lost Techies Fiesta Open Space Conference 2013
Thanks to all the Los Techies for their hard work on making this a great conference.
The opening session:
9:00 Session JavaScript Frameworks Session
Knockout is for data binding, but the syntax is a little awkward
Angular is a better knockout
Ember is a better backbone (it's like Rails, follow conventions and life is easy)
SPA is Single Page Application
Progression: jQuery -> Backbone -> Marionette -> Ember
Knockout -> Angular
Breeze is an ORM for the browser
One strategy is to use Razor template strictly to toss out div tags and have the js framework populate the content.
10:00 Not a Basic Git Introduction by Keith Dahlby
BeyondCompare is a recommended diff tool (a class of tools Microsoft has yet to include in their OS)
Set a union merge strategy in the git attributes file:
*.sln merge=union
Official notes of the conference are at https://github.com/lostechies/fiesta/wiki
11:00 Faster CodeMonkey, Faster
What helps you develop code faster?
Using Bootstrap Themes
Foundation, a competitor of Bootstrap, has flexible grids
PowerPoint 2012 Storyboard is great for prototyping GUIs
Lightswitch
Expresso is a RE utility
https://www.debuggex.com is an online Regular Expression utility - very slick
Dapper is a micro ORM
"Do not write clever code"
Jira has a planning view for Scrum
Lunch!
1:00 Care and Feeding of Developers with Gabriel
DISC personality test
Amir recommended "Greatness" by Dabid Marquet for ideas on training developers:
http://www.youtube.com/watch?v=OqmdLcyES_Q
2:00 Continuous Integration
Team City
Jenkins
Culture is the hard part
Toggle new features on a per user basis - have StuctureMap get the right version
Use Octopus for TeamCity for deployment
Rake is used in a lot of .Net builds
GitHub Enterprise is worth the price for some
3:00 Codebetter.CI
Chocalaty is used to install programs. It is NuGet package with standard .ps1
2013 version of msbuild.exe has moved, but the old one is still there. Change your batch files.
Ruby needed by new .Net project
nhibernate has not been actively developed lately
ORMs require a deep understanding of underlying topics
Dapper and Massive are micro-ORM alternatives
Friday, October 25, 2013
Photos from Pablos Fiesta, Austin Tx, Oct 25, 2013
Pablo's Fiesta Pics
Austin TX, October 25 2013
John welcomed the crowd to the Los Techies Annual Open Spaces Conference
Doc List retold the mythical history of Open Spaces
Participants, like Jeffery Palermo, wrote on sticky notes topics they would like to discuss.
Here's our list for tomorrow's sessions:
Fishbowl exercise on HealthCare.gov
Saturday, September 28, 2013
After iOS 7.0.2 Update, Podcast App Failing
I updated my iPhone 4S to iOS7.0.2 and it immediately put the phone in recovery mode. The phone was dead. Fortunately, iTunes had it backed up on my Windows XP (no smirks please, it's historical) and was able to restore the phone, mostly.
The Podcasts app would open and then die immediately.
It took a while to find the fix. I went to "App Store" on the phone and found an update for the "Podcasts" app. After applying the update it was all working again.
The Podcasts app would open and then die immediately.
It took a while to find the fix. I went to "App Store" on the phone and found an update for the "Podcasts" app. After applying the update it was all working again.
Wednesday, September 18, 2013
Convert Sql Server DateTime to Milliseconds Since 1970
Photo by Rich Masso |
My first attempt to convert the current UTC time was not successful:
select Datediff(s, '1970-01-01', GETUTCDATE())*1000 Msg 8115, Level 16, State 2, Line 1 Arithmetic overflow error converting expression to data type int.
Since the number of milliseconds is greater than the precision of int, we have to bring up the big guns: "bigint".
select cast(Datediff(s, '1970-01-01', GETUTCDATE()) AS bigint)*1000
This worked great. A good site to check the values is www.epochconverter.com.
Monday, September 16, 2013
How to unzip files in Windows 7 and Windows 2008 natively
Photo by: Klafubra |
Unix systems have had native unzipping programs for the last few decades that are easily accessible from scripts. Now Microsoft has darkened the door of the party.
Instead of downloading 7zip or WinZip, you can now natively unzip files provided your server has the latest software. You need .Net 4.5 and PowerShell 3.0, and then everything is unicorns and rainbows.
In PowerShell scripts to unzip file "$zipFile" into directory "$targetFolder" you can do this:
[System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') [System.IO.Compression.ZipFile]::ExtractToDirectory($zipFile, $targetFolder)
Monday, August 19, 2013
Pictures from Austin Code Camp 2013
Here's a few pics from the Austin Code Camp 2013.
The Camp was great. The advanced planning and hard work of all those involved was evident.
It always surprises me that the camp is free, with two free meals thrown in.
Registration was fast and easy.
My notes:
* Ryan stressed a resource-centric, guessable URL design like the apogee web site promoted I was not able to find the apogee web site) like Accounts/:id/Withdraw and not AccountWithdraw/:id
* Ryan used Postman for debugging URL, although Fiddler works as well
* HTTP 201 is the freturn code if you create a resource (Accounts/add) and in the headers you return "location: Accounts/12345"
* The MVC framework has HTTP codes so you don't need to put in a magic string, "201".
* They use a web api pipeline poster to discern where to insert their function into the sequence. Perhaps he was talking about this one.
* To create a Web Api project start with a new "MVC4 Web" app in VS.
* Use the Json.Net framework
* For versioning use something like "uship.com/api/v2/Resource"
* JSON to C# utilities are out there that create a C# object from JSON text
* For documentation, instead of WDSL use HelpPage from NuGet
My next class was Database Optimization with Anil Desai
* Don't look for the longest running query, but the longest time*frequency
* Use the Activity Monitor in mssql by right clicking on the db server in Management Studio
* He showed a bunch of reports I'd never seen by right clicking on the database and selecting "Reports"
* Sometimes autogrowth is set to 1 Meg - too small a value for today.
* When tracing you can add a filter to only catch queries only above a certain threshhold
* It's good to add the name of the app in the connection string.
* He showed a statement with "BETWEEN" which I'd never seen. BETWEEN 10 and 20
* When running a trace write to a file and then import to database, otherwise it soaks up more resources
* The big problem is the "new" operator, it makes for ridged code that is hard to test.
* Three types of IOC: Factory Pattern, Service Location and Dependency Injection
DI has three types: Constructor Injection, Setter/Property Injection, and Interface Injection
Anne hosted a "Lightening Talk" round where attendees gave informal 5 minute presentations.
Jeffrey Palermo gave in interesting talk on his new company, Clear Measure, started in January and quickly built the startup company by using Cloud based services. They use GoogleApps for mail and video calls, GoToMeeting for conferencing, EchoSign for authentication, Ring Central for phones, Quickbooks for accounting, LegalZoom for incorporation and BaseCamp for management.
Latish Sehgal talked about tools for .Net Development, his list is at http://dotnetsurfers.com/tools.
* Use ReSharper to locate unused libraries
* Use Firebug console mode to test jQuery commands; YSlow to get recommendations on speed
* Glimpse (http://getglimpse.com/) does for the server side what Firebug does for the client.
* SMSS Toolpack which is a little like ReSharper for Sql Enterprise Management Studio. It remembers all your handwritten sql queries.
* Gray Wolf was the most interesting. This (hacker) tool allows you to insert code into applications.
Amir Rajan gave an interesting talk on "JavaScript MVC Framework Rundown"
* jQuery - spaghetti code
* Backbone - event driven (most accessible) may use Marionette plugin
* Knockout - MVVM with DuRandal
* Angular.js - redefines HTML
* Ember - all MVC in browser, steep learning curve
https://github.com/tastejs/todomvc has an excellent overview of all the browser-based MVC frameworks.
Friday, August 09, 2013
C# WebClient .DownloadStringAsync Blocking Main Thread
Photo by Max Ronnersjö |
Here was a single call to solve my problem.
Great job Microsoft framework group!
Well, not so fast.
My unit tests for bad and malformed URLs were actually blocking.
The problem is that WebClient.DownloadStringAsync() blocks until the connection is made. If your application happens to call a bad url, the main thread will block until it gets an error code back. This can be up to 3 seconds for normal malformed urls. In one case, our internet proxy had problems with the malformed url and consistently hung for 10 seconds while it was sorting out the problem and eventually returned a timeout error.
If you ever suspect the url you are calling is ever going to have issues (and we know all sites are up all the time! Right.), don't use DownloadStringAsync, use DownloadString() wrapped in a Thread or Task. This way if the connection has problems, it's another thread's problem, and your main thread can move forward.
...
new Thread(() => DownloadUrlSynchronously(url)).Start();
...
public void DownloadUrlSynchronously(string url)
{
using (WebClient client = new WebClient())
{
try
{
var x = client.DownloadString(new Uri(url));
_logFileWrapper.LogInfo("Url called successful - " + _url);
}
catch (Exception e) { ...}
...
}
Friday, July 12, 2013
Continous Testing with SpecWatchr
I was impressed with Amir Rajan's talk at Austin .Net this week, and was intrigued by his use of the Continuous Testing framework SpecWatchr, so I decided to give it a spin.
You can download it at here.
I found the installation instructions very clear and concise. You need to download Ruby 1.9.2 and Growl.
By default it assumes nspec, but it was easy enough to change it in dotnet.watchr.rb to be NUnit.
By default SpecWatchr assumes all the tests for MyClass.cs are in a file named "describe_MyClass.cs", which mine were not. Mine tests are in MyClassTest.cs. But since this is open source, I cracked open "watcher_dot_net.rb" and changed half a dozen lines of Ruby and got it to recognize my convention. It worked like a charm.
Amir encouged the .Net group to reduce the friction in development. One of these frictions is to manually save and run tests. With SpecWatchr all you have to do is save a file and it will automagically compile and run affected tests. When all is happy you get this in the corner of your screen for a few seconds. :
If you have a compile time error you get this:
Things to like about SpecWatchr:
Overall SpecWatchr is a great tool.
By default it assumes nspec, but it was easy enough to change it in dotnet.watchr.rb to be NUnit.
By default SpecWatchr assumes all the tests for MyClass.cs are in a file named "describe_MyClass.cs", which mine were not. Mine tests are in MyClassTest.cs. But since this is open source, I cracked open "watcher_dot_net.rb" and changed half a dozen lines of Ruby and got it to recognize my convention. It worked like a charm.
Amir encouged the .Net group to reduce the friction in development. One of these frictions is to manually save and run tests. With SpecWatchr all you have to do is save a file and it will automagically compile and run affected tests. When all is happy you get this in the corner of your screen for a few seconds. :
If you have a compile time error you get this:
Things to like about SpecWatchr:
- It's free!
- It works.
- It's well documented.
- It's easy to install.
Overall SpecWatchr is a great tool.
Thursday, July 11, 2013
Pictures from Austin .Net Users Group July 8, 2013: Getting things done with dynamic ASP.NET
Amir Rajan (@amirrajan) gave an interesting talk on how to use C# 4.0's dynamic objects in MVC using the Oak framework to the 50 members present. Here's a few pics just in case you were wondering what a geekfest looks like.
My jumbled notes:
My jumbled notes:
- Hey, Amir is using Emacs - my people!
- Recommends AngularJS and Knockout
- Rake used to build and populate system
- used conEmu for console
- Oak has a DynamicDB and DymanicRepository
- "ghost methods" are not present at compile time, but added dynamically
- Use "System.Diagnostics.Debugger.Launch();" in code to bring up the debugger
- Amir recommended http://www.infoq.com/presentations/Simple-Made-Easy
- The Gemini extends the properties of System.Dynamic.DynamicObject to be more Rubyesque.
- Amir used specWatchr for automatic compiling and testing
- For GUI testing use "canopy F#", which is a layer above Selenium.
- Three things: reduce friction, dynamic typing, increase feedback
- dynamic is a thing. SignalR uses it.
Tuesday, July 02, 2013
How to disable Viewstate in .Net
Viewstate reminds me of a monster in a horror movie that just won't stay dead - it keeps coming back, and back. No matter how many silver bullets you pump into its chest, it keeps coming.
You can turn off viewstate by adding the attribute "EnableViewState" to your page.
<%@ Page language="c#" EnableViewState="false" Inherits="MyAwesomeApp.table" %>
But it didn't work in my page. The value of EnableViewState is overridden by the MasterPage's value.
You can also change "EnableViewState" in web.configs with
But depending on which subdirectory the web.config is in, it may be overridden by something else.
The way I finally killed viewstate was by explicitly setting the "EnableViewState" variable on the page:
private void Page_Load(object sender, EventArgs e)
{
this.EnableViewState = false;
...
}
Then it stayed dead.
Hmmm.... hey wait ... is that a heartbeat I'm hearing?
You can turn off viewstate by adding the attribute "EnableViewState" to your page.
<%@ Page language="c#" EnableViewState="false" Inherits="MyAwesomeApp.table" %>
But it didn't work in my page. The value of EnableViewState is overridden by the MasterPage's value.
You can also change "EnableViewState" in web.configs with
<pages enableViewState=“false” />
But depending on which subdirectory the web.config is in, it may be overridden by something else.
The way I finally killed viewstate was by explicitly setting the "EnableViewState" variable on the page:
private void Page_Load(object sender, EventArgs e)
{
this.EnableViewState = false;
...
}
Then it stayed dead.
Hmmm.... hey wait ... is that a heartbeat I'm hearing?
Monday, June 17, 2013
How to tell if you have .Net 4.5 installed
Since 4.5 is a drop in replacement for 4.0 you can't just look at the version and build number, v4.0.30319..
You have to look in the registry for
If you have only version 4.0, "Version" is "4.0" and there is no "Release" key.
The official Microsoft documentation says that if the "Release" key exists and it's value is greater than 378389, then it's 4.5.
My observation of looking at exactly two machines: If you already have .Net 4.5 installed, the value of "Version" is 4.5.50709.
You have to look in the registry for
HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full.
If you have only version 4.0, "Version" is "4.0" and there is no "Release" key.
The official Microsoft documentation says that if the "Release" key exists and it's value is greater than 378389, then it's 4.5.
My observation of looking at exactly two machines: If you already have .Net 4.5 installed, the value of "Version" is 4.5.50709.
Monday, June 10, 2013
Visual Studio 2012 Error: Could not find ... specified for Main method
This morning I ran into a problem while trying to compile. Visual Studio 2012 gave me this error:
"Could not find 'Test.GetWebPage' specified for Main method"
I tried removing the file with the method from the project - since I could find no other bit of code referencing "GetWebPage", but Visual Studio still would not compile, complaining that file "CSC" needed it.
The issue was I had set GetWebPage as the startup object and now the method was gone.
To fix: inside Solution Explorer, right click on the project and select "Properties...". Then under "Applicaiton" set the "Startup object:" to "(Not set)".
"Could not find 'Test.GetWebPage' specified for Main method"
I tried removing the file with the method from the project - since I could find no other bit of code referencing "GetWebPage", but Visual Studio still would not compile, complaining that file "CSC" needed it.
The issue was I had set GetWebPage as the startup object and now the method was gone.
To fix: inside Solution Explorer, right click on the project and select "Properties...". Then under "Applicaiton" set the "Startup object:" to "(Not set)".
Wednesday, April 24, 2013
Photos from Austin on Rails Apr 23, 2013
Just in case you wanted to know what the Austin on Rails group looks like in an IPhone panorama shot:
70 people listened as Matt Swain talked about Amazon's cloud solution and how to use Elastic Beanstalk, the Amazon tool for configuring virtual servers. (It took me way too long to get the Jack and The Beanstalk/Cloud connection).
Mike Myers from HomeAway gave a good overview of using a JRuby/Rails front end with a Java backend.
I talked with Jeff Hennigan, the main recruiter at KForce, before the meeting and he said a few interesting things: The Ruby job market is hot. Java and .Net are still good. This new generation of Ruby programmers is different than the Java/.Net crowd. Some of the startups use social media to communicate and don't even have a phone number.
My random jumble of notes:
AWS comes with Route53 for DNS and Cloudfront for CDN.
"eb" is a
Command Line Interpreter for Elastic Beanstalk; so you can do "eb init", "eb stop". It just abstracts our the
JSON file that really defines an AWS service.
Amazon offers a free virtual server for those wanting to try out the system. 750 hours per month free.
Amazon tunes the kernal in their own version of linux for different sized machines.
JRuby gives real Native Threads, while Ruby only has green threads.
Mike Myers from HomeAway gave a good overview of using a JRuby/Rails front end with a Java backend.
I talked with Jeff Hennigan, the main recruiter at KForce, before the meeting and he said a few interesting things: The Ruby job market is hot. Java and .Net are still good. This new generation of Ruby programmers is different than the Java/.Net crowd. Some of the startups use social media to communicate and don't even have a phone number.
My random jumble of notes:
AWS comes with Route53 for DNS and Cloudfront for CDN.
"eb" is a
Command Line Interpreter for Elastic Beanstalk; so you can do "eb init", "eb stop". It just abstracts our the
JSON file that really defines an AWS service.
Amazon offers a free virtual server for those wanting to try out the system. 750 hours per month free.
Amazon tunes the kernal in their own version of linux for different sized machines.
JRuby gives real Native Threads, while Ruby only has green threads.
Monday, April 08, 2013
Pictures from Austin .Net Meeting April 8th, 2013
Ryan Vice gave an interesting overview of Web API to 65 software professionals.
My brief jumbled notes:
AustinApi will be having it's first meeting Wednesday, April 24, 2013 for those interested in producing and comsuming web APIs.
The HTTP PUT verb is used for idempotent actions, otherwise use POST. "application/json" is the header for passing JSON.
Fiddler is a great tool to use for testing APIs.
Response.AddHeader("location", "http://example.com/Accounts/4")
The MVC4 model binder can grab values from the url, the body, or the headers.
Microsoft, to their credit, is using the open source JSON.NET serializer. You can customize the variables returned by using a custom ContractResolver. (return "first-choice", or "firstChoice" or "first_choice").
IAPIExplorer can document your APIs similar to a WSDL.
You can download the WebAPI "Help Pages" from nuget.
I liked Ryan's last comment about Web API bringing us closer to the "elusive dream of concentrating on business logic." (Not necessarily because I think Web API will do that for us, but it should be the focus of frameworks to remove all the mundane tasks that slow us down. Perhaps in 40 years we will get there.)
My brief jumbled notes:
AustinApi will be having it's first meeting Wednesday, April 24, 2013 for those interested in producing and comsuming web APIs.
The HTTP PUT verb is used for idempotent actions, otherwise use POST. "application/json" is the header for passing JSON.
Fiddler is a great tool to use for testing APIs.
Response.AddHeader("location", "http://example.com/Accounts/4")
The MVC4 model binder can grab values from the url, the body, or the headers.
Microsoft, to their credit, is using the open source JSON.NET serializer. You can customize the variables returned by using a custom ContractResolver. (return "first-choice", or "firstChoice" or "first_choice").
IAPIExplorer can document your APIs similar to a WSDL.
You can download the WebAPI "Help Pages" from nuget.
I liked Ryan's last comment about Web API bringing us closer to the "elusive dream of concentrating on business logic." (Not necessarily because I think Web API will do that for us, but it should be the focus of frameworks to remove all the mundane tasks that slow us down. Perhaps in 40 years we will get there.)
Friday, March 01, 2013
How To Create a simple .Net HttpHandler
I'm writing a heartbeat diagnostic page that will test all the database connections and make sure my application is up and running. Since it produces a page that will be read by a monitor very frequently I chose to make it an HttpHandler. Normal .aspx pages go through like
12 events or so. Since I don't need the full power, and resource consumption, of an aspx page, an HTTPHandler seemed like a good idea.
It's actually quite easy to create an HTTPHandler in .Net. This shows how to integrate a single HTTPHandler into an existing .Net 4.5 project using VS2012.
The first step is to create a .cs class which implements IHttpHandler, mine is named Heartbeat.cs:
using System;
using System.Web;
namespace MyNamespace
{
public class Heartbeat : IHttpHandler
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.Write("Hi There!");
}
}
}
The second step is to create a .ashx page with one line. Here's my Heartbeat.ashx page:
<% @ WebHandler language="C#" class="SurveyDirector.Heartbeat" codebehind="Heartbeat.cs" %>
And you are done.
Now entering the URL
http://127.0.0.1/MyProject/Heartbeat.ashx
I get
Hi There!
Done.
12 events or so. Since I don't need the full power, and resource consumption, of an aspx page, an HTTPHandler seemed like a good idea.
It's actually quite easy to create an HTTPHandler in .Net. This shows how to integrate a single HTTPHandler into an existing .Net 4.5 project using VS2012.
The first step is to create a .cs class which implements IHttpHandler, mine is named Heartbeat.cs:
using System;
using System.Web;
namespace MyNamespace
{
public class Heartbeat : IHttpHandler
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.Write("Hi There!");
}
}
}
The second step is to create a .ashx page with one line. Here's my Heartbeat.ashx page:
<% @ WebHandler language="C#" class="SurveyDirector.Heartbeat" codebehind="Heartbeat.cs" %>
And you are done.
Now entering the URL
http://127.0.0.1/MyProject/Heartbeat.ashx
I get
Hi There!
Done.
Wednesday, February 27, 2013
Corporations Should Not Drive National Politics - Bring back the Tillman Act
In addition to bringing back section 16 of the Glass-Steagall Act prohibiting investment banks from gambling with tax payer money, we need to bring back the Tillman Act of 1907 forbidding corporations from funding politics.
Teddy Roosevelt in his 1904 address to Congress said,
"All contributions by corporations to any political committee or for any political purpose should be forbidden by law; directors should not be permitted to use stockholders' money for such purposes;"
In 1907 Congress passed the Tillman Act which stated "... it shall be unlawful for any national bank, or any corporation organized by authority of any laws of Congress, to make a money contribution in connection with any election to any political office."
The part of corporations funding politics that bothers me is not the presidential election candidates, but to congressmen writing laws for corporations to follow. It's too easy for a corporation to tell a congressman they would like her to support a bill, like extending copyright way beyond its usefulness to encouraging people to create works of art. The congressman gets paid tens of thousands of dollars, and the corporation reaps millions of dollars profit at the expense of the American people.
If she doesn't support the law, the corporation can threaten to fund her opponent.
That's just too much leverage against the interests of the people.
Teddy Roosevelt in his 1904 address to Congress said,
"All contributions by corporations to any political committee or for any political purpose should be forbidden by law; directors should not be permitted to use stockholders' money for such purposes;"
In 1907 Congress passed the Tillman Act which stated "... it shall be unlawful for any national bank, or any corporation organized by authority of any laws of Congress, to make a money contribution in connection with any election to any political office."
The part of corporations funding politics that bothers me is not the presidential election candidates, but to congressmen writing laws for corporations to follow. It's too easy for a corporation to tell a congressman they would like her to support a bill, like extending copyright way beyond its usefulness to encouraging people to create works of art. The congressman gets paid tens of thousands of dollars, and the corporation reaps millions of dollars profit at the expense of the American people.
If she doesn't support the law, the corporation can threaten to fund her opponent.
That's just too much leverage against the interests of the people.
System.Net.WebException : Cannot handle redirect from HTTP/HTTPS protocols to other dissimilar ones.
Currently I am writing an integration test that enters a scenario into the database, then invokes a url on my web site, and then checks to make sure the database has been updated properly. While doing this I ran across this error:
System.Net.WebException : Cannot handle redirect from HTTP/HTTPS protocols to other dissimilar ones.
My C# code looked like this:
string webPageText;
using (WebClient client = new WebClient())
{
webPageText = client.DownloadString("http://www.myserver.com/appname/params");
}
It took me too long to understand the error message. The real problem is that my app was issuing a 302 redirect and my C# code doesn't know how to handle that. It failed the unit test, which is what it should have done. Once I corrected my input, the redirect to an error page was not raised, and my test passed.
System.Net.WebException : Cannot handle redirect from HTTP/HTTPS protocols to other dissimilar ones.
My C# code looked like this:
string webPageText;
using (WebClient client = new WebClient())
{
webPageText = client.DownloadString("http://www.myserver.com/appname/params");
}
It took me too long to understand the error message. The real problem is that my app was issuing a 302 redirect and my C# code doesn't know how to handle that. It failed the unit test, which is what it should have done. Once I corrected my input, the redirect to an error page was not raised, and my test passed.
Thursday, February 21, 2013
Upgrading from .Net 3.5 to 4.0
I'm upgrading an old ASP.Net app from .Net 3.5 to 4.0. Here were some of my issues:
1. Compile error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
This is error is from the build machine using the old 3.5 libraries. We have to tell it to use the 4.0 libraries in nant. I added this to my nant build script:
2. The automatic upgrade did not switch all the versions, I had to manually change the version number for many of my projects from:
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C5619000000"/>
3. Menu Items from Web.sitemap disappered
The orginal code looked like this:
if (SiteMap.CurrentNode != null && SiteMap.CurrentNode.IsDescendantOf(node))
{
Repeater repeater = (Repeater)e.Item.FindControl("repeaterBar");
repeater.DataSource = node.ChildNodes;
repeater.DataBind();
}
I added one new condition to see if the current node was the node:
if ((SiteMap.CurrentNode != null)
&& (SiteMap.CurrentNode.IsDescendantOf(node) ||
SiteMap.CurrentNode == node))
{
Repeater repeater = (Repeater)e.Item.FindControl("repeaterBar");
repeater.DataSource = node.ChildNodes;
repeater.DataBind();
}
}
Then it worked like it did in 3.5.
4. A form submission gave this error: "A potentially dangerous Request.Form value was detected from the client"
This was fixed by adding "<httpRuntime requestValidationMode="2.0" />" to the web.config under "<System.Web>"
Overall the upgrade was not too bad.
1. Compile error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
This is error is from the build machine using the old 3.5 libraries. We have to tell it to use the 4.0 libraries in nant. I added this to my nant build script:
<property name="nant.settings.currentframework" value="net-4.0" />
2. The automatic upgrade did not switch all the versions, I had to manually change the version number for many of my projects from:
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C5619000000"/>
to:<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C5619000000"/>
3. Menu Items from Web.sitemap disappered
The orginal code looked like this:
if (SiteMap.CurrentNode != null && SiteMap.CurrentNode.IsDescendantOf(node))
{
Repeater repeater = (Repeater)e.Item.FindControl("repeaterBar");
repeater.DataSource = node.ChildNodes;
repeater.DataBind();
}
I added one new condition to see if the current node was the node:
if ((SiteMap.CurrentNode != null)
&& (SiteMap.CurrentNode.IsDescendantOf(node) ||
SiteMap.CurrentNode == node))
{
Repeater repeater = (Repeater)e.Item.FindControl("repeaterBar");
repeater.DataSource = node.ChildNodes;
repeater.DataBind();
}
}
Then it worked like it did in 3.5.
4. A form submission gave this error: "A potentially dangerous Request.Form value was detected from the client"
This was fixed by adding "<httpRuntime requestValidationMode="2.0" />" to the web.config under "<System.Web>"
Overall the upgrade was not too bad.
Tuesday, February 05, 2013
The Coming Collapse of Gold
Photo by Bjørn Christian Tørrissen |
In all of human history we have managed to pan, blast, and pry about 176,000 metric tonnes of gold from mother earth. While the oceans are estimated contain about 20 million tons of dissolved gold. The gold is very low in concentration, about one milligram in a ton of sea water.
Although many people have tried to extract the gold from the sea, none have done so successfully. The most famous was German chemist Fritz Haber who tried to pan the oceans for gold to repay Germany's war debt. Many swindlers have tried to sell the idea, but only succeeded in mining gullible rich people.
Photo by US Mint |
1. Microbes are known to take dissolved gold and produce solid gold. Pedomicrobium
is an example as is Delftia acidovorans . These could be genetically altered to increase their yield.
2. Designing sheets of materials that have an affinity for gold and placing those in ocean currents. The sheets are anchored to the sea floor and recovered months later after filtering the precious metal. Japan has used a process like this to test the recovery of Uranium.. Uranium is much more abundant in ocean water, 4.5 billion metric ton, but the concept is the same.
3. Plants like kelp could be genetically engineered to have an affinity for gold and then be harvested. Although this solution has many obvious issues. Otters with gold-capped teeth anyone?
Photo by Bullion Vault |
As material science progresses, it is just a matter of time before we can start to pan the oceans for gold. It may take 10 years, or 50, but eventually someone will crack the code. When they do, vast new quantities will pour into the world's markets permanently depressing the gold market.
Saturday, February 02, 2013
Pictures from HTML5.tx 2013 in Austin TX Feb 2
I was fortunate enough to attend the sold-out HTML5.tx conference in Austin today. Here's a few photos I shot and a few of my jumbled, unedited notes.
Embedded JavaScript, HTML5 and the Internet of ThingsJesse Cravens
Ace editor
Noduino
web-sockets
Node.js communicates with Arduinos with web-sockets
node-serialport Node.js
BeagleBone by TI, fully functional Linux board $100
Cloud9
Node running on BeagleBone
firmata protocal
multiple arduinos talking to BeagleBone central hub
Raspberry Pi used instead of laptop
Node.js used on small devices as webhosting
konectic canvas library
ember.js is extremely impressive for single page app
Backbone: 3 Ways
Pamela Fox
push state to pretend to change url
single page web app
used Knockout
requireJS used for dependencies
before interview, look at web page and help them debug problems
no HTML - every element for javascript
directories are used for catagorizing becuase we don't have a tag based file system
django admin
you never want to delete stuff, add Delete column instead
add change log table
as you grow you need to change backend to scale, but not the front end
don't return php code, cause you can't change easily
only update partial
good frameworks: ember, spine, angularJS, enyou
start with Backbone tutorals, not the docs
Arduinos, BeagleBones, and Raspberry Pi, Oh My!
The New Rules of The Responsive Web
Matthew Carver
Laptops and desktops for creating, phone and tablets for consuming
Responsive web is more than squishy
Foundation or Bootstrap for prototyping
Style Tiles styletil.es
css preprocessors, scss, sass, or less
SMACSS Scalable and Modular Architecture of CSS book
Embrace unpredictability.
Lighting Talks:
The Softer Side of HTML5
Tony Farnsworth, Anne Epstein, William Moner
Foundation or Bootstrap for prototyping
Style Tiles styletil.es
css preprocessors, scss, sass, or less
SMACSS Scalable and Modular Architecture of CSS book
Embrace unpredictability.
parseInt(010) is octal 8
parseInt('010') is 10 in chrome and 8 in Firefox
javascript == is type coersive
=== is really equals
false == 0 // true
false === 0 //false
put comments inside function for debugging instead of on top
Austin Hallock Clay.io
16ms to do something for 60 frame per second
use window.requestAnimationFrame instead of setInterval or setTimeout
github.com/austinhallock/html5.tx
Unfolding the Box Model
Chris Ruppel
10 things you didn't know a browser could do
Estelle Well
estelle.github.com/10
document.querySelectorAll("#foo .bar")
every element has "classList" with functions .add(), .remove(),
h1.count
live node list, static node list
getElementByClassName is live, constantly updated
Rapid Templating: "Designing in the Browser" with Sass, Compass, and Serve
Nathan Smith
j.mp/get-serve
Marcotte Responsive Web Design, fluid grids and media queries
compass
get-serve.com
unsemantic.com is an example of using Sass, Compass and Serve
apache .htaccess Options +multiview finds close file names
One last note: Every presenter I saw was using a mac.
Subscribe to:
Posts (Atom)