Recently I've have had a look at a Python language. A played a bit with it, but found that I feel uncomfortable with it without a proper introduction. I've decided to go with Learn Python the Hard Way, even though it's biasied towards unexpirienced programmers, but the book name intrigued me and I've actually heard that book name for some time with positive recommendations. So, somethere around Lesson 1, there you print to a console, I've decided to try out printing in non-English language, Russian in particular, just to see how it goes. It didn't worked. So I headed to Stack Overflow. But even there I've spend a lot (relatively) of time to find solution that actually worked for me.
During this search I also found Python Unicode handling is confusing to say the least. I guess it's a matter of some time of studying the subject, but that is really annoying since string is the thing that you usually work a lot with. Because of that I find that Python feels like a JavaScript mixed with a C.
P.S. I also think Python Tools for Visual Studio is probably the best IDE to learn (and work) with Python on Windows, especially if you are a long time Visual Studio user, you will feel right at home.
Oct 19, 2013
Sep 26, 2013
How to POST (upload) a file in a Visual Studio web test
So, I've came up with a task of performing a basic load test of a web service. For that purpose I've chosen the WebTest of Visual Studio 2010 Ultimate Test Project. For the most part as long as only GET requests were performed everything was pretty straightforward.
But there was one POST request that requred a file upload. A little googling led to this blog entry which describes the situation in detail. The only problem was that recording of the file upload didn't work. It didn't record anything at all, to be more correct. I guess that's because I'm in the end of 2013 and using Windows 8 and IE 10, and this breaks it somehow (you know, Windows 8 breaks a lot of things).
So basically situation is pretty dumb: you can't add "Form Post Parameters" to your POST request with a right click menu. Why (it's a rhetorical for Microsoft, I know)? And the only semi-official solution doesn't work, and it's pretty dumb solution, I might add.
The solution is quite simple however. A .webtest file is a XML, which utilises a http://microsoft.com/schemas/VisualStudio/TeamTest/2010 schema, which is located at %VsInstallDir%\Xml\Schemas\vstst.xsd. Using that schema it wasn't hard to find required tags. To create "Form Post Parameters" create a new POST request ("Add Web-Service Request"), save, and reopen .webtest as XML file. In the tag <Request> insert child elements:
<FormPostHttpBody>
<FormPostParameter Name="dummy" Value="test1" RecordedValue="" CorrelationBinding="" UrlEncode="True" />
</FormPostHttpBody>
save and close. Now you can reopen webtest with it's standard editor, and voila, you have the parameters, you can now right click on it and two new options apper in menu, inluding "Add File Upload Parameter" which is that we need. Everything else is already described in blog entry mentioned above.
But there was one POST request that requred a file upload. A little googling led to this blog entry which describes the situation in detail. The only problem was that recording of the file upload didn't work. It didn't record anything at all, to be more correct. I guess that's because I'm in the end of 2013 and using Windows 8 and IE 10, and this breaks it somehow (you know, Windows 8 breaks a lot of things).
So basically situation is pretty dumb: you can't add "Form Post Parameters" to your POST request with a right click menu. Why (it's a rhetorical for Microsoft, I know)? And the only semi-official solution doesn't work, and it's pretty dumb solution, I might add.
The solution is quite simple however. A .webtest file is a XML, which utilises a http://microsoft.com/schemas/VisualStudio/TeamTest/2010 schema, which is located at %VsInstallDir%\Xml\Schemas\vstst.xsd. Using that schema it wasn't hard to find required tags. To create "Form Post Parameters" create a new POST request ("Add Web-Service Request"), save, and reopen .webtest as XML file. In the tag <Request> insert child elements:
<FormPostHttpBody>
<FormPostParameter Name="dummy" Value="test1" RecordedValue="" CorrelationBinding="" UrlEncode="True" />
</FormPostHttpBody>
save and close. Now you can reopen webtest with it's standard editor, and voila, you have the parameters, you can now right click on it and two new options apper in menu, inluding "Add File Upload Parameter" which is that we need. Everything else is already described in blog entry mentioned above.
Sep 11, 2013
Visual Studio 'Run' button is disabled, or problems with build
Sometime very strange things happens with Visual Studio. The one have happened to me maybe three times for all time, and each time I already forgot that I need to do to fix it! So basically your simptoms can be any of the like:
1) Your Run (F5) button is disabled;
2) Your program is not recompiled and hitting Run causes running old version of the 'exe' that lies in the Debug folder;
3) Then hitting F5 you receive error messages like "Visual Studio cannot start debugging because the debug target 'C:\your\path\bin\Debug\Project.exe' is missing. Please build the project and retry, or set the OutputPath and AssemblyName properties appropriately to point at the correct location for the target assembly.'
That usually that happens absolutely sporadically with you doing nothnig with the project or solution preferences, which confuses a lot. Now, in 99% of the cases the solution is to go to the Build->Configuration Manager... and check that Build checkbox is checked for required projects, see picture:
What makes them suddenly unchecked is still a mistery to me.
1) Your Run (F5) button is disabled;
2) Your program is not recompiled and hitting Run causes running old version of the 'exe' that lies in the Debug folder;
3) Then hitting F5 you receive error messages like "Visual Studio cannot start debugging because the debug target 'C:\your\path\bin\Debug\Project.exe' is missing. Please build the project and retry, or set the OutputPath and AssemblyName properties appropriately to point at the correct location for the target assembly.'
That usually that happens absolutely sporadically with you doing nothnig with the project or solution preferences, which confuses a lot. Now, in 99% of the cases the solution is to go to the Build->Configuration Manager... and check that Build checkbox is checked for required projects, see picture:
What makes them suddenly unchecked is still a mistery to me.
Microsoft CRM 2011, import CSV file with entity references (lookups)
While most of the time you probably could use a LookupMaps to set up an entity references in you import maps, you may come to situation there you want put actual ID's (references) in your CSV file. So, the tricky part here is the format. To create EntityReference you need entity type name and it's GUID. How would you put that into CSV string? The answer is like this:
"entity_type_name,{SOMEGUID-3FBA-47E5-ADD0-F6078ACDABB8}"
Note that surrounding quotes are required, because of the comma.
"entity_type_name,{SOMEGUID-3FBA-47E5-ADD0-F6078ACDABB8}"
Note that surrounding quotes are required, because of the comma.
Aug 7, 2013
Kickstarter, more analysis
I've already mentioned UnSubject blog on the Kickstarter topic, yet again I found more and more good articles on the subject in this blog.
Well, while I don't think that Kickstarter idea is not good, actually I think it's good, but pragmatic analysis is that is missing. Every baker should read that blog, to have clear view of that Kickstarter really is. More projects on Kickstarter will fail though, and they deserve that. I guess any honest developer will benefit from reading it too.
Well, while I don't think that Kickstarter idea is not good, actually I think it's good, but pragmatic analysis is that is missing. Every baker should read that blog, to have clear view of that Kickstarter really is. More projects on Kickstarter will fail though, and they deserve that. I guess any honest developer will benefit from reading it too.
Microsoft CRM 2011, hide system Save menu
Recently we were asked if it is possible to disable a standard 'Save' menu of Microsoft CRM 2011, since all data on forms is read-only anyway. So, after some searching I've found sample code how to do this. The key was to use "top" property which is containing parent frame which is necessary, since our code (called in "OnLoad" form event) is executing in inner frame. With some modifications this is what finally worked out for me:
var disableSaveMenu = function() { // your entities names var entities = ["account", "contact" /* add as necessary */]; var i; for(i = 0; i < entities.length; i++) { var ent = entities[i]; var save = top.document.getElementById(ent + "|NoRelationship|Form|Mscrm.Form." + ent + ".MainTab.Save"); if(save != null) { save.style.display = 'none'; break; } } // hide 'File' menu, additional 'Save' is also located there var jewel = top.document.getElementById("jewelcontainer"); if(jewel != null) { jewel.style.display = 'none'; } };
Aug 6, 2013
Microsoft CRM 2011, automatically load all subgrids
Microsoft CRM 2011 doesn't load by default data in all of the subgrids if they count exceed 4, displaying 'To load ... records, click here' message. It's actually extremely annoying.
It's not possible to change this behaviour with standard tools (i.e. via control preferences). So I've found how to do it using JavaScript function call on form OnLoad event. Unfortunatelly it did't worked in my case. For some reason the moment then OnLoad event was fired, the from subgrids were, apparently, not initialized on the form. I've decided then to call the function with a little delay:
And it worked! Not the solution I would like, but I guess that's all I can do now and it also would'n do any harm if something goes wrong.
It's not possible to change this behaviour with standard tools (i.e. via control preferences). So I've found how to do it using JavaScript function call on form OnLoad event. Unfortunatelly it did't worked in my case. For some reason the moment then OnLoad event was fired, the from subgrids were, apparently, not initialized on the form. I've decided then to call the function with a little delay:
var autoLoadSubgrids = function() { var maxAuto = 4; var loadDelay = 1000; var subgrids = Xrm.Page.ui.controls.get(function (control, index) { return control.getControlType() == "subgrid"; }); if (subgrids.length > maxAuto) { var subCall = function() { var i; for (i = maxAuto; i < subgrids.length; i++) { var grid = subgrids[i]; if(grid != null) { grid.refresh(); } } }; window.setTimeout(subCall, loadDelay); } };
And it worked! Not the solution I would like, but I guess that's all I can do now and it also would'n do any harm if something goes wrong.
May 10, 2013
OUYA IS F-F-Fun(dead)?
OUYA project raised some $15M from their new investors. They are excited of course. This is probably good for a company financial success. However is it good for a mission that OUYA originally started? I don't know, but I surely know that original founders are now not own 100% of the share. They could probably own 90%, or maybe 50% depending on how much company price was estimated at the moment of the deal. And that new shareholders can, in some future, have some other vision about what OUYA console should be. That's the facts part.
The ethics part is probably even more interesting. See, backers are, naturally, the real shareholders of the company. They have taken the real risk of funding the project on early stages. Yet thay will have just a console box as a revard for that. Now some big guys, which brobably wasn't happy to fund project at early stages, come in and skim the cream. I know, backers take what they have been told, but still they funded OUYA and their founders, not OUYA and NVIDIA et al.
I actually think that can be called some sort of abuse of crowd funding idea. The crowd takes highest risk at the start of the project and takes some product for that, then real investors are safe to take share of the company. That's really nice trick. Nobody probably like to fund a project that will use that to find some more funding.. or I'm wrong?
The ethics part is probably even more interesting. See, backers are, naturally, the real shareholders of the company. They have taken the real risk of funding the project on early stages. Yet thay will have just a console box as a revard for that. Now some big guys, which brobably wasn't happy to fund project at early stages, come in and skim the cream. I know, backers take what they have been told, but still they funded OUYA and their founders, not OUYA and NVIDIA et al.
I actually think that can be called some sort of abuse of crowd funding idea. The crowd takes highest risk at the start of the project and takes some product for that, then real investors are safe to take share of the company. That's really nice trick. Nobody probably like to fund a project that will use that to find some more funding.. or I'm wrong?
May 9, 2013
Using Google Analytics for desktop apps?
While searching for an answer to that question I found this SO topic which, at the moment doesn't supposed that Google Analytics can be used for desctop at all, searching, in fact, for an alternative.
But as it turned out in my continued search, it's now possible to use Google Analytics on desktop applications (and actually anywhere) with it's new Measurement Protocol which is, however, currently in beta.
But as it turned out in my continued search, it's now possible to use Google Analytics on desktop applications (and actually anywhere) with it's new Measurement Protocol which is, however, currently in beta.
Mar 5, 2013
Format a drive larger than 32Gb into FAT32 on modern Windows OS
IIRC Windows was restricting usage of FAT32 since Windows 2000, in favor of NTFS. And it is actually a good thing. NTFS is far superior than FAT32 in almost any aspect.
However, this activity come beyond reasonable amounts in my opinion. Simply put, you just can't format a drive larger than 32Gb into FAT32 using any modern Windows OS (Windows Vista/7/8, maybe even Windows XP). This is very, very annoying. I'm fine then you can't do something using standard approach, but I want be able to do that I want somehow, even if this is sounds unreasonable.
Now, users must fix that Microsoft must do itself. This utility (click on image to download) by fine fellas from Ridgecrop Consultants Ltd. do the thing. Since it's very valuable tool and "teh internets" fail us sometimes, here's a copy in the SkyDrive cloud.
However, this activity come beyond reasonable amounts in my opinion. Simply put, you just can't format a drive larger than 32Gb into FAT32 using any modern Windows OS (Windows Vista/7/8, maybe even Windows XP). This is very, very annoying. I'm fine then you can't do something using standard approach, but I want be able to do that I want somehow, even if this is sounds unreasonable.
Now, users must fix that Microsoft must do itself. This utility (click on image to download) by fine fellas from Ridgecrop Consultants Ltd. do the thing. Since it's very valuable tool and "teh internets" fail us sometimes, here's a copy in the SkyDrive cloud.
Feb 28, 2013
Running Apache on Windows 8: port 80 occupied by System
If you are using Windows 8 or Windows Server 2012, and Apache service won't run (you have something like make_sock: could not bind to address 0.0.0.0:80 immediately after installation) what means that something occupies port 80, which is Apache is trying to use. You can use Tcpview tool to see what occupies port 80. Then I did that I saw that is was a process called "System". While "System" can actually refer to many system services, it seems that there are two common cases present:
1) Web Development Agent Service (MsDepSvc);
2) World Wide Web Publishing Service (W3SVC).
If disabling any of these servies does not help you can use some other tools to dig deeper in your quest of finding service responsible for port 80.
P.S. There is of course other solutions to that, most simple of which is changing port to which Apache will be listening.
1) Web Development Agent Service (MsDepSvc);
2) World Wide Web Publishing Service (W3SVC).
If disabling any of these servies does not help you can use some other tools to dig deeper in your quest of finding service responsible for port 80.
P.S. There is of course other solutions to that, most simple of which is changing port to which Apache will be listening.
Jan 31, 2013
XNA the end
This entry at Promit Roy's blog finally confirmes that any last hope of XNA should be left. This is, probably, better than nothing, however it was almost obvious with release of Windows 8 SDK with DirectX merged into it. Yet they gained some little respect at least from that point. This is, probably, the only point from which respect can be given.
First they they should say that earlier. Second, they should not drop XNA at all. Despite some negative aspects XNA was extremly intuitive and easy to work with. It was a huge success, enormous attention from developers of wide range of expecience, from novice to professionals. Terraria was written in XNA, a 1.5+ million sells title. They don't need even to add support for WinRT. Just a mere bugfixing, support and Visual Studio 2012 integration.
Enough rant. The question is, should you continue to use XNA? It, of course, depends. If you amateur or just started to learn game programming, it doesn't really matter, you can safely continue to write your first games. However, you can try to port your game to MonoGame to be ready for Windows 8. Last option is also to consider for writing your first more or less serious game, which, most probably you want it to evolve and live in future. Professionals can decide for thenselves I guess, but I guess XNA is no longer a valid option for pro game development.
First they they should say that earlier. Second, they should not drop XNA at all. Despite some negative aspects XNA was extremly intuitive and easy to work with. It was a huge success, enormous attention from developers of wide range of expecience, from novice to professionals. Terraria was written in XNA, a 1.5+ million sells title. They don't need even to add support for WinRT. Just a mere bugfixing, support and Visual Studio 2012 integration.
Enough rant. The question is, should you continue to use XNA? It, of course, depends. If you amateur or just started to learn game programming, it doesn't really matter, you can safely continue to write your first games. However, you can try to port your game to MonoGame to be ready for Windows 8. Last option is also to consider for writing your first more or less serious game, which, most probably you want it to evolve and live in future. Professionals can decide for thenselves I guess, but I guess XNA is no longer a valid option for pro game development.
Subscribe to:
Posts (Atom)