Friday

free online courses

Широко известный проект Coursera объявил о заключении партнерской программы со следующими университетами:

Курсы охватывают широкий круг вопросов, в том числе компьютерные науки, гуманитарные науки, медицину, биологию, социальные науки, математику, статистику, экономику, финансы, а также многие другие темы. В общей сложности доступно около 40 курсов, 6 из которых планируется начать в следующий понедельник, 23 апреля:

Классы, предлагаемые на Coursera, разработаны для того, чтобы помочь вам освоить материал. Вы сможете смотреть лекции профессоров мирового класса, учиться в своем собственном темпе, проверить и укрепить свои знания с помощью интерактивных упражнений. Регистрируясь в Coursera, вы также присоединяетесь к мировому сообществу тысяч студентов, занимающихся вместе с вами.

Thursday

javascript parse number from string

use parseFloat and parseInt functions like on samples below:

1 parseFloat('1.45kg') // 1.45
2 parseFloat('77.3') // 77.3
3 parseInt('123.45') // 123
4 parseInt('77') // 77
5

vim msbuild

1. create build.bat file for building your project

call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
msbuild c:\myproject\Source\myProject.sln


2.Run following commands in VIM or add to .vimrc
:set makeprg=c:\myproject\Source\build.bat
:set errorformat=\ %#%f(%l\\\,%c):\ %m

3.execute following command to build your project
:make

4.Open output window by
:cope

Tuesday

combobox selectedvalue problem net

When I'm adding new items to combobox like in this post.
There was problem in reading this value on dserver side.
So here is solution how to do this.

string selectedValue = Request.Params[combobox.UniqueId]

Monday

jquery clear dropdown values

use this command to clear dropdown items:

$('#mySelect').empty()

asp.net jquery ajax data webmethod post


1.Code - behind class
  
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using DotNetNuke.Modules.MembershipModule;

namespace VoluntaryShop
{
public partial class jsonhub : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public static string Test()
{
return "OK";
}

[WebMethod]
public static ArrayList MSearchVolunteersbyGroup(int Group)
{
Debug.Write("MSearchVolunteersbyGroup"+Group);
MembershipModuleController c = new MembershipModuleController();
return c.MSearchVolunteersbyGroup(Group);
}
}
}


2.ASPX Page:
   
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="jsonhub.aspx.cs" Inherits="VoluntaryShop.jsonhub" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"> </script>
<script type="text/javascript">
function PageMethod(fn, paramArray, successFn, errorFn) {
var pagePath = window.location.pathname;
//Create list of parameters in the form:
//{"paramName1":"paramValue1","paramName2":"paramValue2"}
var paramList = '';
if (paramArray.length > 0) {
for (var i = 0; i < paramArray.length; i += 2) {
if (paramList.length > 0) paramList += ',';
paramList += '"' + paramArray[i] + '":"' + paramArray[i + 1] + '"';
}
}
paramList = '{' + paramList + '}';
//Call the page method
$.ajax({
type: "POST",
url: pagePath + "/" + fn,
contentType: "application/json; charset=utf-8",
data: paramList,
dataType: "json",
success: successFn,
error: errorFn
})
;
}
</script>

<script type="text/javascript">


function AjaxSucceeded(result) {
alert(result.d);
alert(result.d[0].FirstName);

}
function AjaxFailed(result) {

alert("failed"+result.d);
}

PageMethod("MSearchVolunteersbyGroup", ["Group","1"], AjaxSucceeded, AjaxFailed); //No parameters
</script>


</head>
<body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>

Tuesday

vs2010 the application cannot start

The fix that worked for me is:
Copy the following files from "C:\Program Files\Common Files\Microsoft Shared\MSEnv\" to "c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\"
dte80.olb
dte80a.olb
dte90.olb
dte90a.old
dte100.old

And then register them all in that location and the application now should works as both administrator and as a regular user.

regsvr32 DTE100.OLB
regsvr32 DTE80.OLB
regsvr32 DTE80a.OLB
regsvr32 DTE90a.OLB
regsvr32 DTE90.OLB

Monday

usb readonly win7

If USB device is readonly on your machine for some reason, here is one way how to fix this:
1. Open start menu, in the search bar type REGEDIT and press enter. This will open the registry editor.
2. Navigate to the following path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies
Note: If the registry key StorageDevicePolicies does not exist, you will need to create it manually.

3. Highlight StorageDevicePolicies, and then create a New DWORD (32-bit) Value named as WriteProtect.
4. Double click the key WriteProtect in the right window and set the value to 0 in the Value Data Box and press OK button
5. Restart your computer and try copying files into your USB drives.
No restart was required in my case, but that adding registry key works.

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...