Enabling remote SQL connections for Server 2008

Here is how to enable remote SQL connections for Server 2008:

Open up SQL Server Configuration Manager

Click on SQL Server Network Configuration
–Enable Named Pipes
–Enable TCP/IP

Protocols for SQLEXPRESS (OR YOUR INSTANCE)
-Double click on TCP/IP

Find the IP addresses with your IP and IP of 127.0.0.1
–TCP Dyanmic Ports (Remove the 0 and leave empty)
–TCP Port 1433

Open up Windows Firewall with Advanced Security
-Click on Inbound Rules
–Create the following rules

SQL
1433 – TCP – Check if you want Domain, Private, and Public Access

SQL
1434 – UDP – Check if you want Domain, Private, and Public Access

Transact-SQL debugger (Used for Visual Studio)
135 – TCP – Check if you want Domain, Private, and Public Access

Lync Server Installation – ERROR_NEED_MAJOR_UPGRADE_USE_IMP_EXP

If you are getting an error like:
Error: Script failed (code “ERROR_NEED_MAJOR_UPGRADE_USE_IMP_EXP”) when installing “CentralMgmtStore” on …

When installing Lync 2010, try dropping the “xds” table from your database and letting it cleanly install:

C:\>sqlcmd -S.\RTC
1> DROP DATABASE xds
2> GO
1> QUIT

How to force all ASP.NET pages to be SSL

Paste the following code into the system.webserver tags in your web.config file.

        <rewrite>
            <rules>
                <clear />
                <rule name="Redirect to https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
                </rule>
            </rules>
        </rewrite>


Setting Static IP in Linux

To setup a static IP in ubuntu, edit your networking settings file.

Here is an example of how to do it:

Open /etc/network/interfaces:

Use these configurations:


auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.0.10
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1

DHCP Address Configuration:


auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

Then restart the service: /etc/init.d/networking restart (Make sure you are running with admin privileges when restarting 🙂 )

How to pass parameters back from intent

Tonight I ran across the issue of, “How do I send a result back to the parent that spawned an intent?”

After finding out that it is nearly impossible to pass instances of objects to the intent, I decided why not send the result back from the spawned intent.

To do something like this, use the following code to spawn the child intent:

//Starting a new Intent
Intent intent = new Intent(getApplicationContext(), whateverClass.class);

// Maybe add a param or two?
intent.putExtra("someParam", paramValue);

// starting new activity
startActivityForResult(intent,SOMEINTEGERSHOULDGOHERE);

When you are done with the intent, use this code to close it.

Intent intent=new Intent();
intent.putExtra("myParam", thiscouldbeastringvariable);
intent.putExtra("mySecondParam", thiscouldbeanintvaraible);
setResult(RESULT_OK, intent);
finish();

Lastly, here is how we process our result given from the child:

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode) {
case (SOMEINTEGERSHOULDGOHERE): // this was the integer you used to spawn the activity previously
if (resultCode == Activity.RESULT_OK) {
// Do whatever you want here.
// data.getStringExtra("ThisGetsOurParamBack");
}
break;
}
}

This is basically how to send data, process it in a new activity/intent, and then spit the results back to the parent.

Pulling Active Directory account info via alias email address

I have been working on a PHP project that interfaces with active directory through LDAP.  I noticed that some accounts weren’t being resolved via email address.  I thought, hmm this is strange…  After a few hours, I finally figured out that the issue was due to an alias email address.  By default, the “mail” attribute only has the main email address listed, so any alias addresses will not be searched upon lookup.

Solution?

Use this query to select an item from AD via its alias email address:

(proxyAddresses=smtp:[email protected])

Generating a SSL Cert with Apache & openSSL

Registering a SSL cert is always kind of a mystery for me. You always have to use a crazy long command line command and the wizard always asks funky questions. Hopefully this tutorial will help clarify the process.

First run the following command:

openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr

And what the command does is it is generating a 256bit SSL certificate. RSA:1024 would generate a 128bit certificate. When the process has finished, you will have yourdomain.key and yourdomain.csr. yourdomain.key should NOT be distributed. This is your key to decrypt your traffic. The CSR should be presented to your CA (certificate authority).

As far as the generation process goes, you will be presented with a few questions:
Country: The two-letter International Organization for Standardization (ISO) format country code for where your organization is legally registered. This would be US for the United States.
State or Province: Name of the state or province where your organization is located. Write out the name in full.
City or Locality: Name of the city where your organization is registered/located. Write out the name in full.
Organization Unit: This may be left blank. However, if you are a company, you may want to put your company nickname here. I.e. Vooba instead of Vooba LLC
Organization: Vooba LLC
Passphrase: Depending on your registrar, you can/can’t use this. If you can’t use it, I recommend finding a different company. Use a strong password here.
Common Name: The fully-qualified domain name (FQDN), or URL, you want to secure. If you are not using a wild-card domain (*.yourdomain.com), use www.yourdomain.com. This will allow www.yourdomain.com and yourdomain.com to be secured. If you only secure yourdomain.com, www.yourdomain.com will be invalid.

Hope this helps and clarifies the process!