Friday, December 6, 2013

Windows 7 Task Scheduler Service Enable

I was struggling to enable my Task Scheduler Service which was appearing as  disabled in my services console
I tried many fixes but finally which worked for me was to scan system files and to fix them automatically by windows utility(sfc.exe) by running Cmd as administrator and by issues the following command.

C:\Windows\System32\sfc /scannow

Monday, April 1, 2013

Setting UP RIAK with Dot Net


Setting Up RIAK

Since RIAK is not available on windows we need to use Linux(Ubuntu ) to  install and use RIAK .

Installing Ubuntu

We want to run Linux in a virtual machine so first thing we will be looking is to install VMware. We can find VMware at the following link to download.
Second step is to get the ISO image for Ubuntu which we can find here
I tried 32 bit version and when everything is downloaded we need to fire VMware and to create a new virtual machine by using downloaded ISO image for Ubuntu.














You can install Ubuntu from a disk, or directly from the ISO file you can download (link below).  This is the simplest method if you’re simply wanting to use Ubuntu in VMware Player.  However, if you do have an Ubuntu disk, then feel free to choose that instead.  Once you’ve selected your install media, VMware Player will automatically detect Ubuntu and will show that it will be installed with Easy Install.  Click next to continue.




















Now enter your name, user name, and password.  All fields are required.

Please note that the username can only have lowercase characters and numbers.

Also, the password must be at least 8 characters long.

Now, choose a name for your virtual machine and where to save it.  Simply click next to accept the defaults.

You can choose how large you want your virtual hard drive to be; the default is 20Gb, but you can choose a different size if you wish.  Please note that the entire 20Gb will not be used up on your hard drive initially.  Ours only took up 3.6Gb with a clean install, but this will increase as you install programs and save files.

And that’s it!  You can review your settings and change them here if you wish, or simply click Finish to start installing Ubuntu!

VMware player will now install Ubuntu without any further input.  The window may show cryptic commands, but don’t worry, as you don’t have to do anything else to install Ubuntu.

During the install, you may be prompted to download and install VMware tools for Linux.  Simply click Download and the tools will automatically download and install, though you may have to approve the UAC prompt.


VMware will continue installing Ubuntu even while the tools are downloading.  Once the install is finished, you will be presented with your Ubuntu login screen.  The full install took about 30 minutes in our test.

Installing RIAK

Once you are done with installation of Ubuntu Next step is to install RIAK .
Since we are using 32 bit version we will look into 32 bit version of RIAK which can be find here http://docs.basho.com/riak/latest/tutorials/installation/Installing-on-Debian-and-Ubuntu/
To begin installation we need to First go to Command line Terminal by pressing  CTRL + ALT + T then we need to provide following commands to start installation of RIAK
wget http://downloads.basho.com.s3-website-us-east-1.amazonaws.com/riak/1.3/1.3.0/ubuntu/lucid/riak_1.3.0-1_i386.deb
sudo dpkg -i riak_1.3.0-1_i386.deb

RIAK is set up by end of this execution.

Update Configurations

Next Step is to update RIAK Configurations so that client can successfully communicate with RIAK
First Stop RIAK server if it is already running by issuing the following command on Terminal
RIAK stop
Then need to move to app.config file to make necessary changes.
In our case aap.config will be placed in /etc/riak folder  we can find it by moving into this folder from FileSystem .
Note:
In order to make changes to a file you need to use root permissions
So first create root user and assign permissions to this user then logout and log in with root user to make changes to app.config file.
Root user can be activated by firing following commands on terminal.
sudo passwd root

and then
sudo sh -c 'echo "greeter-show-manual-login=true" >> /etc/lightdm/lightdm.conf'

Reboot your system and then logged in as root.

Your virtual machine by default will be configured to use auto assignment of ip address make sure to assign it manual so that the clients may not suffer if IP address changes.


Open app.config and change address 127.0.0.1 to the  IP Address of the machine
This setting will be required at following two locations.
{http, [ {"127.0.0.1", 8098 } ]},
Will become
{http, [ {"192.168.112.128", 8098 } ]},
AND
{pb_ip,   "127.0.0.1" },
Will become
{pb_ip,   "192.168.112.128" },
That’s all
Save File Go to Terminal and start your RIAK server with the following command
RIAK Start
And make confirmation of running and listening of server by issue Riak Ping Command it should respond with Pong J

Setting Up Client

Once the Server part is done next is to  use C# to connect with it.
We need to use CorrugatedIron package as a client to our RIAK server we can get it by using Nuget package .
Once this package is installed it will automatically add required references and configurations section in our app.config(Desktop application) or in our web.config(web application) files.
Like below.
  <configSections>
    <section name="riakConfig" type="CorrugatedIron.Config.RiakClusterConfiguration, CorrugatedIron" />
  </configSections>
  <riakConfig nodePollTime="5000" defaultRetryWaitTime="200" defaultRetryCount="3">
    <nodes>
      <node name="dev1" hostAddress="192.168.112.128" pbcPort="8087" restScheme="http" restPort="8098" poolSize="20" />
      <node name="dev2" hostAddress="riak-test" pbcPort="10027" restScheme="http" restPort="10028" poolSize="20" />
      <node name="dev3" hostAddress="riak-test" pbcPort="10037" restScheme="http" restPort="10038" poolSize="20" />
      <node name="dev4" hostAddress="riak-test" pbcPort="10047" restScheme="http" restPort="10048" poolSize="20" />
    </nodes>
  </riakConfig>
We can set up hostaddress and ports in our nodes configuration with the address and ports configured for RIAK server.
Need to import some namespaces as follows
using CorrugatedIron;
using CorrugatedIron.Containers;
using CorrugatedIron.Config;
using CorrugatedIron.Comms;

and can get connected with RIAK as follows
var cluster = RiakCluster.FromConfig("riakConfig");
            var client = cluster.CreateClient();
            RiakResult result = client.Ping();
            MessageBox.Show(result.IsSuccess.ToString());
Try stopping and starting RIAK server to make sure of your connection.











Wednesday, January 30, 2013

Web Developed in which Technology

Find a good place here to know about underlying technology and framework used by any website .
http://builtwith.com

Monday, January 7, 2013

Add multiple ports windows firewall

I was having an issue with adding multiple ports in my windows firewall settings by going into exceptions tab and providing port number , but my requirement was to add multiple ports and that snap in was restricting it.
so i tried the tool WF.msc and added inbound rules for my server and  all went good 

Friday, October 12, 2012

Create Https Request C#

I was writing a client application to communicate with our  server application built on asp.net.
client application worked perfactly with http port but when i tried to connect it to https port which was using a self signed certificate it raises an error
"The remote certificate is invalid according to the validation procedure" so for my debugging purpose i needed to bypass that certificate checking so i tried like that

provide a RemoteCertificateValidationCallback delegate



private static bool ValidateCertificate(object sender,X509Certificate cert,X509Chain chain,SslPolicyErrors polErrors)
        {
            if (Convert.ToBoolean("true"))
            {
                // allow any old dodgy certificate...
                return true;
            }
            else
            {
                return polErrors == SslPolicyErrors.None;
            }
        }

and attach it to ServerCertificateValidationCallback property of ServicePointManager.just before the line where Getting Response from server


ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(ValidateCertificate);
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myRequest.GetResponse();

Also included the following namespaces as well

 System.Security.Cryptography.X509Certificates;
 System.Net.Security;



Monday, September 24, 2012

Resolve Disk Issue on AWS RDS MYSQL

I was having a lot of trouble with my RDS instances running MySql 5.1 with respect to the disk usage ,
they were 40 GB instances and were almost full thought deletion of unused records was taking no effect on the RDS console monitoring screen for the disk space 
there were no binary logs , late query logs , general logs ,every thing was appearing to be good but server was restricting operations on tables due to disk space shortage . 
i tried to delete unused data but what i got that the freeable space is increased by the disk space was having same issues i checked into specific tables for their sized by using query 

SELECT table_name "Table Name",
SUM( data_length + index_length ) / 1024 /
1024 "Table Size in MB",
SUM( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES where table_schema='test-socerwar'
GROUP BY table_NAME
order by data_length desc;


here I found the tables which were having large free able memory and after running the command 

Optimize table  TABLENAME

 for those specific tables , every thing turned to be good for me.
hope it will help others who are new to  MySQL like Me.


Sunday, June 24, 2012

Asp.net Authentication and Authorization in Winodws Applications

i was developping  a web application with asp.net authentication model for a client.
every thing went well but certainly client asked for a desktop version with of course authroization and authentication. both applications were hitting to same database so same authentication model was required for desktop application was required
so by just adding the following configurations in app.config of my desktop application it was possible to use Membership of asp.net authentications in windows appliation
<membership>
    
      <providers>
       
        <remove name="AspNetSqlMembershipProvider"/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web,
           Version=2.0.0.0, Culture=neutral,
           PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="MedBillUtility.Properties.Settings.AFileStorageDBConnectionString" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="3" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
      </providers>
     
    </membership>
but then i realized thought authentication is done but i m still unable to authorization because role manger is not available so to enable role manger so i had to add following section in my app.config as well under System.web
   <roleManager enabled="true">
      <providers>
        <remove name="AspNetSqlRoleProvider"/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web,
           Version=2.0.0.0, Culture=neutral,
           PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="MedBillUtility.Properties.Settings.AFileStorageDBConnectionString" applicationName="/"/>
      </providers>
    </roleManager>
and all worked .