Showing posts with label configuration. Show all posts
Showing posts with label configuration. Show all posts

Wednesday, May 6, 2015

ASP.NET Tips: Redirecting all uppercase letter in URL into lowercase URL

For the purpose of SEO, sometimes we need a way to enforce all URL into lowercase. In order to do that in an ASP.NET project, we can add a URL rewrite rules in the web config file inside the system.webserver tag.

Here is the configuration of URL rewrite looks like:

<system.webserver>
    <rewrite>
       <rules>
          <rule name="LowerCaseRuleRedirection" stopProcessing="true">
               <match url="[A-Z]" ignoreCase="false"/>
                <action type="Redirect" url="{ToLower:{URL}}" />
           </rule>
        </rules>
    </rewrite>
</system.webserver>

Please leave a comment if you find my post useful. Happy coding programmers! :)

Tuesday, November 25, 2014

Ubuntu Troubleshoot: Ubuntu can't change display device brightness

After installing my Ubuntu 14.04 all control works fine except for the brightness controller. The brightness button on my keyboard is just fine and able to show the brightness level is changing, but the display brightness is not changing. To fix this I must add a new file named 20-intel.conf in the /usr/share/X11/xorg.conf.d/ directory and enter the below configuration as the content .

Section "Device"
Identifier  "card0"
Driver      "intel"
Option      "Backlight"  "intel_backlight"
BusID       "PCI:0:2:0"EndSection

and now my brightness controller works as I expect.


Sunday, November 23, 2014

Hadoop Tips: Change default namenode and datanode directories

When we start Hadoop in psudo-distributed mode using the sbin/start-all.sh command for the first time, The default directory will be created in /tmp/ directory. The problem arises if you restart your machine the created directories will be deleted and you can't start your hadoop again.

To solve this problem you can change the default directory using configuration file that you can find in your hadoop's etc/hadoop/hdfs-site.xml. Add these configuration properties:

    <!--for namenode-->
    <property>
        <name>dfs.namenode.name.dir</name>
        <value>file:///path/to/your/namenode</value>
    </property>

    <!--for datanode-->
    <property>
        <name>dfs.datanode.data.dir</name>
        <value>file:///path/to/your/datanode/</value>
    </property>

But please make sure, your namenode and datanode directories exist. And don't forget to set the properties value using correct URI (started with file://) format just like in the example. After that you can format your namenode using this command:

$ bin/hdfs namenode -format

and start your hadoop again using:

$ sbin/start-all.sh

If the namenonde or datanode still not working, you can check log files to see the problem.
  
Hope this tips could help you. If you find other problem related to this, please leave a comment below. Cheers! :)

Friday, December 13, 2013

Android Programming Tips : Error Unable to Execute Dex When Run a Project

Today I tried to download open source android project source code from the internet. I use Eclipse as my IDE and tried to import the project to Eclipse. Everything worked fine until I tried to execute and run this project. The IDE quickly told me that there is an error in my project and 2 line of error message in console log as bellow:

[2013-12-13 21:04:48 - Dex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
[2013-12-13 21:04:48 - xxxxxx] Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.

But I couldn't find any error in the source code. So I thought this was a configuration error. And here were the way I solved it :

  1. Right click on your project.
  2. Select Android Tools -> Add Support Library
  3. There was a process running for a while, and then tried to run the project once more, and It worked well. Viola!!
Please comment if you find this tips useful. :D

Finally, C# 9 record, the equivalent of Scala's case class

While C# is a wonderful programming language, there is something that I would like to see to make our life programmer easier. If you are fam...