Wednesday

add xml to xmldocument

     
static string module = @"
    <Module>
      <CustomerSortOrder>60</CustomerSortOrder>
      <LinkText_Customer>{0}</LinkText_Customer>
      <LocationId>4291</LocationId>
      <LocationModuleId>26544</LocationModuleId>
      <ModuleId>30</ModuleId>
      <ModuleName>Menu</ModuleName>
      <NavigateUrl>menu.aspx</NavigateUrl>
      <pageId>20</pageId>
      <IsModuleGroup>1</IsModuleGroup>
      <sort_order>1</sort_order>
      <MenuId>{1}</MenuId>
    </Module>
";
        public string AddWeekMenu(string xml2015, string xml2010) {
            string result = xml2015;
            try
            {
                XmlDocument x2015 = new XmlDocument();
                x2015.LoadXml(xml2015);

                //step 1 find menu tag group
                var menutag = x2015.SelectSingleNode("//Group[Group_Name='Menu']");
                //remove Menu text from second list
                menutag.ChildNodes[0].SelectSingleNode("//LinkText_Customer").InnerText = "";

                XmlDocument x2010 = new XmlDocument();
                x2010.LoadXml(xml2010);
                XmlNodeList m2010 = x2010.SelectNodes("//ChildNavigation[moduleid=30]");

                foreach (XmlNode item in m2010)
                {
                    //append menu links from 2010
                    AppendMenuLink(x2015, menutag, item.SelectSingleNode("ChildLinkText").InnerText, item.SelectSingleNode("ChildLinkCustomPageID").InnerText);

                }

                //updting menu tag  with correct count 
                menutag.SelectSingleNode("//numModules").InnerText = ""+m2010.Count;
                return x2015.OuterXml;
            }
            catch (Exception ex)
            {
                LogException(ex);
            }

            return result;
        }

Tuesday

Game servers sources

sources of lineage 2
java: bitbucket.org/…​com/l2jserver/?at=develop

go: github.com/mikesaidani/l2go

а WOW
github.com/mangoszero/server

handlebars.js subtemplate example


step1.create subtemplate
<script id="nutri" type="text/x-handlebars">
    <p>
     This is subtemplate in Handelbars
     </p>
</script>

step2.register it in javascript

<script type="text/javascript">
    Handlebars.registerPartial('nutri', $('#nutri').html());
</script>

step3. use it into another subtemplate

<script id="package-list-bottom" type="text/x-handlebars-template">
    <div class='po-qty form-el bottom'>        
                <p>
                {{> nutri}}
                </p>
    </div>
</script>

why my app is not popular on appstore?

You finished app uploaded it on appstore and .... nothing happens. You probably was expecting skyrocketing installs and in-app sales but after days,weeks you got some 10,20 installs. And you thinking what is wrong with my app.

The best way to look at this situation is to look at app like art-artifact. Let's say when you have painting picture or sculpture you are not expecting it to look like Rembrant's or Michelangelo's aren't you ? So why it is different in regards of apps ?

Probably because at first look all applications are looking alike and have unified interface and same buttons and UI elements. But the most important things are in details, in iterations between application and user.

The best way to handle this situation is to continue perfecting and creating more apps and make them looks closer to perfect apps every day and learn. As Michelangelo said : "I am still learning."

Monday

c# custom webservice logging and error handling

//step1.declare delagate
public delegate T UnSafeProcedure<T>();

/*step2. add performance and error handling methods */
        public string Concat(params object[] arguments)
        {
            StringBuilder sb = new StringBuilder();
            foreach (var item in arguments)
            {
                sb.AppendFormat("\"{0}\",", item);
            }
            return sb.ToString();
        }

        public T RunSafe<T>(UnSafeProcedure<T> s, params object[] arguments)
        {
            DateTime st = DateTime.Now;
            try
            {
               return  s();
            }
            catch (Exception e1)
            {
                {
                    Debug.Write("Error," + Concat(arguments) + "\r\n" + e1.ToString());
                }
                return default(T);
            }
            finally
            {
                var sec = DateTime.Now.Subtract(st).TotalSeconds;
                if (sec > 20)
                {
                    string tm = ">20sec,start," + st.ToLongTimeString() + ",End," + DateTime.Now.ToLongTimeString();
                    Debug.Write(tm+ Concat(arguments));
                }
            }
        }

/*3.performance counting procedures will looks like:*/

public Receipt VerifyUser(int Id, string username, string password)
{
           return  RunSafe<Receipt>(delegate()
            {
                //internal procedure that needs to be chcked troubleshooted
                using (var service = Instance())
                {
                    return service.VerifyAccount(Id, username, password);
                }

            }, "VerifyUser,facilityId",Id,"username",username,"password",password);
}

how to add vim pandoc integration for markdown files

autocmd BufEnter *.md exe 'noremap <F5> :silent !start c:\tools\pd.bat  % <CR>'

and autorefresh plugin for chrome: so every time I hit F5 on markdown (.md) file I can see compiled html version in chrome

Where pd.bat file is following:

pandoc "%1" -f markdown -t html -s -o "%1.html"

create sign up form for google group

here is javascrip/html code how to do it:

<script type="text/javascript">
   function msgbox() {   alert("An Invatation has been sent to " + _gel("emailconf").value 
+ ". You will have to confirm the email invitation to join and recieve future emails. 
You can opt out of our group at anytime using the Unsubscribe link in the email."); }
</script>

    Sign up with our google group to receive [product] updates or ask questions.
  <form action="http://groups.google.com/group/whiterocksoftware/boxsubscribe" id="formconf" onsubmit="msgbox()">
  Email: <input type=text name=email id="emailconf">
   <input type="submit" value="Subscribe">
</form>

Thursday

rainmeter slideshow skin tutorial

here is skin I used to show images :
 
[Rainmeter]
Update=100000
BackgroundMode=3
SolidColor=0,0,0,255
BackgroundMode=3
BackgroundMargins=0,34,0,14

[MeasureQuote]
Measure=Plugin
Plugin=QuotePlugin
PathName=c:\temp\trig
Subfolders=1
FileFilter=*.jpg;*.png;*.gif

[MeterQuote]
Meter=Image
MeasureName=MeasureQuote
X=0
Y=0
W=200
PreserveAspectRatio=1
LeftMouseUpAction=[!Refresh]

Friday

c# binary deserialize unable to find assembly version=1.0.0.0, culture=neutral, publickeytoken=null

Got error with binary deserialisation : unable to find assembly xxx version=1.0.0.0, culture=neutral, publickeytoken=null 
It requires to have additional SerializationBinder class .
Here is whole workable storage class:

using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System;
using System.Runtime.Serialization;
using System.Reflection;

public static  class Storage {

    public const string ConfigurationName = "dev.settings";
    public static string SettingFileName
    {
        get
        {
            return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ConfigurationName);
        }
    }

    public static  void Save(cProfile gh)
    {
        FileStream writeStream = new FileStream(SettingFileName, FileMode.Create);
        BinaryFormatter formatter = new BinaryFormatter();
        formatter.Serialize(writeStream, gh);
        writeStream.Close();
    }


    public static cProfile  Load() {
        cProfile ret= new cProfile();

        Manager.getInstance().RunSafe (delegate()
        {
            if (File.Exists(SettingFileName))
            {
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Binder = new PreMergeToMergedDeserializationBinder();

                FileStream readStream = new FileStream(SettingFileName, FileMode.Open);
                ret = (cProfile)formatter.Deserialize(readStream);
                readStream.Close();
            }
        });
        return ret;


    }


    sealed class PreMergeToMergedDeserializationBinder : SerializationBinder
    {
        public override Type BindToType(string assemblyName, string typeName)
        {
            Type typeToDeserialize = null;

            // For each assemblyName/typeName that you want to deserialize to
            // a different type, set typeToDeserialize to the desired type.
            String exeAssembly = Assembly.GetExecutingAssembly().FullName;


            // The following line of code returns the type.
            typeToDeserialize = Type.GetType(String.Format("{0}, {1}",
                typeName, exeAssembly));

            return typeToDeserialize;
        }
    }
}





Thursday

"app_name" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic), "az" (Azerbaijani), "be" (Belarusian), "bg" (Bulgarian), "bn" (Bengali), "bs" (Bosnian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "es-US" (Spanish: United States), "et" (Estonian), "eu" (Basque), "fa" (Persian), "fi" (Finnish), "fr" (French), "fr-CA" (French: Canada), "gl" (Galician), "gu" (Gujarati), "hi" (Hindi), "hr" (Croatian), "hu" (Hungarian), "hy" (Armenian), "in" (Indonesian), "is" (Icelandic), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ka" (Georgian), "kk" (Kazakh), "km" (Khmer), "kn" (Kannada), "ko" (Korean), "ky" (Kyrgyz), "lo" (Lao), "lt" (Lithuanian), "lv" (Latvian), "mk" (Macedonian), "ml" (Malayalam), "mn" (Mongolian), "mr" (Marathi), "ms" (Malay), "my" (Burmese), "nb" (Norwegian Bokm?l), "ne" (Nepali), "nl" (Dutch), "pa" (Punjabi), "pl" (Polish), "pt-BR" (Portuguese: Brazil), "pt-PT" (Portuguese: Portugal), "ro" (Romanian), "ru" (Russian), "si" (Sinhala), "sk" (Slovak), "sl" (Slovenian), "sq" (Albanian), "sr" (Serbian), "sv" (Swedish), "sw" (Swahili), "ta" (Tamil), "te" (Telugu), "th" (Thai), "tl" (Tagalog), "tr" (Turkish), "uk" (Ukrainian), "ur" (Urdu), "uz" (Uzbek), "vi" (Vietnamese), "zh-CN" (Chinese: China), "zh-HK" (Chinese: Hong Kong SAR China), "zh-TW" (Chinese: Taiwan), "zu" (Zulu)

I was gettign this error after running build with apache cordova for visual studio : Severity Code
Severity Code Description Project File Line Suppression State
Error C:\Cordova\SpaceRiddle\SpaceRiddle\platforms\android\res\values\strings.xml:3: Error: "app_name" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic), "az" (Azerbaijani), "be" (Belarusian), "bg" (Bulgarian), "bn" (Bengali), "bs" (Bosnian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "es-US" (Spanish: United States), "et" (Estonian), "eu" (Basque), "fa" (Persian), "fi" (Finnish), "fr" (French), "fr-CA" (French: Canada), "gl" (Galician), "gu" (Gujarati), "hi" (Hindi), "hr" (Croatian), "hu" (Hungarian), "hy" (Armenian), "in" (Indonesian), "is" (Icelandic), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ka" (Georgian), "kk" (Kazakh), "km" (Khmer), "kn" (Kannada), "ko" (Korean), "ky" (Kyrgyz), "lo" (Lao), "lt" (Lithuanian), "lv" (Latvian), "mk" (Macedonian), "ml" (Malayalam), "mn" (Mongolian), "mr" (Marathi), "ms" (Malay), "my" (Burmese), "nb" (Norwegian Bokm?l), "ne" (Nepali), "nl" (Dutch), "pa" (Punjabi), "pl" (Polish), "pt-BR" (Portuguese: Brazil), "pt-PT" (Portuguese: Portugal), "ro" (Romanian), "ru" (Russian), "si" (Sinhala), "sk" (Slovak), "sl" (Slovenian), "sq" (Albanian), "sr" (Serbian), "sv" (Swedish), "sw" (Swahili), "ta" (Tamil), "te" (Telugu), "th" (Thai), "tl" (Tagalog), "tr" (Turkish), "uk" (Ukrainian), "ur" (Urdu), "uz" (Uzbek), "vi" (Vietnamese), "zh-CN" (Chinese: China), "zh-HK" (Chinese: Hong Kong SAR China), "zh-TW" (Chinese: Taiwan), "zu" (Zulu) [MissingTranslation] SpaceRiddle 1



In order to resolve this error I had to update problem file : C:\Cordova\SpaceRiddle\SpaceRiddle\platforms\android\res\values\strings.xml 
with adding translatable="false" so final file looks like :

<?xml version='1.0' encoding='utf-8'?>
<resources>
    <string name="app_name" translatable="false">SpaceRiddle</string>
    <string name="launcher_name" translatable="false">@string/app_name</string>
    <string name="activity_name" translatable="false">@string/launcher_name</string>
</resources>

Monday

Configuring Web for ASP.NET 4.5 failed .

To resolve error:
Configuring Web for ASP.NET 4.5 failed. You must manually configure this site for ASP.NET 4.5 in order for the site to run correctly. ASP.NET 4.0 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.0 in order for your site to run correctly.”

I manually created pool for with 4.5, in order to create it I had to do following:
Because there is no v4.5 shown in the gui, and typically you don't need to manually specify v4.5 since it's an in-place update. However, you can set it explicitly with appcmd like this:
appcmd set apppool /apppool.name: [App Pool Name] /managedRuntimeVersion:v4.5
Appcmd is located in %windir%\System32\inetsrv. 
This helped me to fix an issue with Web Deploy, where it was throwing an ERROR_APPPOOL_VERSION_MISMATCH error after upgrading from v4.0 to v4.5



Sunday

Requested registry access is not allowed Error in webservice or website.



To fix  Requested registry access is not allowed error in webservice or website you need to know name of the event log and here is how to grant access:

Grant permission to create a custom event log
  1. Log on to the computer as an administrator.
  2. Click Start, click Run, type regedit in the Open box, and then click OK. The Registry Editor window appears.
  3. Locate the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog
  1. Right-click Eventlog, and then click Permissions. The Permissions for Eventlog dialog box appears.
  2. Click Advanced. The Advanced Security Settings for Eventlog dialog box appears.
  3. In the Name column, double-click the Users group. The Permission Entry for Eventlog dialog box appears.
  4. Select the Set Value check box, select the Create Subkey check box, and then click OK.
  5. Quit Registry Editor, and then log off from the administrator account.

rainmeter blinking text

Here is instruction how to make blinking text in rainmeter:
1.right click and select  "Edit skin"
2.add following code to template:


[Fade]
Measure=Calc
Formula=Counter% 2 = 1 ? 255 : 0


[MeterSeconds]
Meter=STRING
X=100
Y=50
W=1500
SolidColor=0,0,0,1
StringStyle=Normal
StringAlign=Center
FontColor=255,255,255,[Fade]
FontSize=20
FontFace=#FontName#
AntiAlias=1
Text=CTID
DynamicVariables=1

3.Save tempalate into notepad.
4.Right click and select  "Refresh skin"

Now you have blinking  CTID letters.

Tuesday

Game based on pomodoro technique

Game based on pomodoro technique 
pomodoro technique game

removing E-02 from Excel numbers

this problem can be resolved once per column :
1.highlight the column
2.from ribbon select Data -> Text to Columns -> Fixed length -> Don't create any break lines. Clear any that show up -> Select column data format text -> Finish.
3.Done!

Visual Studio 2015 cordova taco Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space

This was resolved by creating system variable in :
Windows button-> search for "system variables"
Open Environment Variables window
click New... name: _JAVA_OPTIONS, value:  -Xmx1G -Xms1G
this should help

Sunday

Meditation Software

Computer Meditation Software

Many software applications have been created in order to help to achieve meditation technique mastery and become guru in Zen,mindfulness,transcendental meditations. Or for using it in yoga practice.There are following main characteristic these applications can be classified:

  • Learning - Guides and software helping people establish technique.
  • Timers - software for measuring time
  • Soundscape -software for creating sounds
  • Biofeedback Software - software and hardware capable for reading human body characteristics


Name Platform Link Description
Calm Android/IOS https://www.calm.com/ Soundscape app
Insight Timer Android/IOS https://insighttimer.com/ guided meditations, music tracks, talks
Learning Meditation Game Android/PC http://www.whiterocksoftware.com/2015/02/learning-meditation-game.html Learning Meditation game,timer, guide.
Omvana Android/IOS http://www.omvana.com/ guided meditations, inspirational speeches, binaural tracks

Wednesday

split large xml file in c#

      
using Microsoft.XLANGs.BaseTypes;
using MyWebComponents;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;

[Serializable]
public class MasterProductSplitter
{
    public MasterProductSplitter()
    {
    }

    List<string> ops = new List<string>();

    const string schema = "http://schemas.datacontract.org/2004/07/MyWebACPRecords";
    const string RecordTag = "b:getACPMasterRecords_Result";

    public void Dispose()
    {
        Thread.Sleep(5000);//let's wait until all files closes.
        foreach (var s in ops)
        {
            try
            {
                File.Delete(s);
            }
            catch (Exception ex)
            {
                LogError("Error deleting file :", ex);
            }

        }

    }

    public void InitialiseMsg(XLANGMessage message, DateTime RequestTime)
    {
        Initialise((Stream)message[0].RetrieveAs(typeof(Stream)), RequestTime);
    }

    public int Length { get { return ops.Count; } }
    public int Current;

    public const int MaxCount = 1000;

    public void Initialise(Stream ins, DateTime RequestTime)
    {
        Debug.Write("MasterProductSplitter v1.1 started.");
        ins.Seek(0, SeekOrigin.Begin);
        ops = new List<string>();
        Current = 0;

        XmlTextReader doc = new XmlTextReader(ins);
        int count = MaxCount;//getting 1K records 
        XmlDocument outdoc = new XmlDocument();
        var r = outdoc.CreateElement("e");

        while (!doc.EOF)
        {

            if (doc.Name == RecordTag)
            {
                //wrap Records into <l> tag in case we would need to transfer more infor within a Record.
                XmlElement rootNode = outdoc.CreateElement("l");
                rootNode.InnerXml = doc.ReadOuterXml();
                r.AppendChild(rootNode);

                count -= 1;
                if (count < 0)
                {
                    outdoc.AppendChild(r);
                    count = MaxCount;
                    ops.Add(CreateGlobalProductMsg(outdoc, RequestTime));
                    outdoc = new XmlDocument();
                    r = outdoc.CreateElement("e");
                }
            } else {
                doc.Read();
            }
        }

        if (count != MaxCount)
        {
            outdoc.AppendChild(r);
            ops.Add(CreateGlobalProductMsg(outdoc, RequestTime));
        }

        Debug.Write("MasterProductSplitter:parts created:" + this.Length);
        ins.Seek(0, SeekOrigin.End);
    }


    public bool hasData()
    {
        return Current < Length;
    }


    public void LogError(string message, Exception e)
    {
        LogError(message + "" + e.ToString());
    }
    public void LogError(string err)
    {
        Debug.Write("MasterProductSplitter:Error:" + err);
        EventLog.WriteEntry("Biztalk Server", "MasterProductSplitter:Error:" + err, System.Diagnostics.EventLogEntryType.Error, 1);
    }

    public XmlDocument GetPart()
    {
        XmlDocument xmldoc = new XmlDocument();
        try
        {
            StreamReader sr = new StreamReader(ops[Current]);
            xmldoc.Load(sr);
            Current += 1;
        }
        catch (Exception ex)
        {
            Current += 1;//this part is broken , moving to the next part
            LogError("MasterProductSplitter:Error reading part:", ex);
        }

        return xmldoc;
    }

    public static string CreateGlobalProductMsg(XmlDocument globalProductsMessage, DateTime RequestTime)
    {
        string ret = Path.GetTempFileName();
        using (FileStream res = new FileStream(ret, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite, 4096))
        {
            StreamWriter sb = new StreamWriter(res);
            sb.Write("<ns0:MasterProductSync xmlns:ns0=\"http://tempuri.org/\"><ns0:masterProducts><![CDATA[<r RequestTime=\"");
            sb.Write(RequestTime.ToString("s"));
            sb.Write("\">");
            sb.Write(globalProductsMessage.InnerXml);
            sb.Write("</r>]]></ns0:masterProducts></ns0:MasterProductSync>");
            res.Flush();
            sb.Flush();
            sb.Close();
            res.Close();
            Debug.Write("Create file:" + ret);
        }
        return ret;
    }



    /// <summary>
    ///  Copy data from one stream into anoter
    /// </summary>
    /// <param name="input"></param>
    /// <param name="output"></param>
    public void CopyStream(Stream input, Stream output)
    {
        byte[] buffer = new byte[8 * 1024];
        int len;
        while ((len = input.Read(buffer, 0, buffer.Length)) > 0)
        {
            output.Write(buffer, 0, len);
        }
    }



    /// <summary>
    /// Saving Stream Into File
    /// </summary>
    /// <param name="stm"></param>
    /// <param name="filename"></param>
    public static void SaveStreamIntoFile(Stream stm, string filename)
    {
        stm.Seek(0, SeekOrigin.Begin);
        FileStream fileStream = File.Create(filename, (int)stm.Length);
        byte[] bytesInStream = new byte[stm.Length];
        stm.Read(bytesInStream, 0, bytesInStream.Length);
        // Use write method to write to the file specified above
        fileStream.Write(bytesInStream, 0, bytesInStream.Length);
        fileStream.Close();
    }

}
   

delete all duplicates in TSQL but one

     

WITH a as
(
SELECT PeriodId
,StationId
,WeekDay
,WeekCycle
,ProductId
,AssignedDate
,MenuId
,ROW_NUMBER() OVER(PARTITION by PeriodId
                        ,StationId
                        ,WeekDay
                        ,WeekCycle
                        ,ProductId
                        ,AssignedDate
                        ,MenuId ORDER BY PrimawebMenuId desc ) AS duplicateRecCount
FROM MenuProducts
)
--Deleting Duplicate Records
DELETE FROM a
WHERE duplicateRecCount > 1
    

assertive programming.assertion class

Below is assertion class.And here is programming example
 


using System;
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;


 /// <summary>
 ///  Asserion block
 /// </summary>
 [Serializable]
 public class AssertionException : ApplicationException {
 public AssertionException(SerializationInfo info, StreamingContext context) : base(info, context) {}
 public AssertionException() : base() { }

 public AssertionException(string msg) : base(string.Format(msg)) { }




    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="msg"></param>
    /// <param name="obj"></param>
public AssertionException(string msg, params object[] obj) :base(string.Format(msg, obj)) {}
}

    public class Assertions {


        public   void Throw(string message,params string[] objs ){
            Throw(String.Format(message, objs));
        }

        public  void Throw(Exception exception)
        {
            throw exception;
        }

        public  void Throw(string message)
        {
            var x = new AssertionException(message);
            throw (x);
        }


        public  void IsInt(string num, string Message, out int result) {
            if (!int.TryParse(num,out result)) {
                Throw(Message);
            }
        }

        public  void IsTrue(bool evaluation, string format, params string[] objects){
            if (!evaluation){
                Throw(format,objects );
            }
        }

        public  void IsFalse(bool evaluation, string format, params string[] objects){
            if (evaluation) Throw(format, objects);
        }

        public  void IsTrue(bool evaluation,string message){
           if (!evaluation) Throw(message);

        }

        public  void IsTrue(bool evaluation, Exception exception)
        {
            if (!evaluation) Throw(exception);
        }

        public  void NotDBNull(Object evaluation, string message){
            if (evaluation == DBNull.Value){
                Throw(message);
            }
        }

        public  void AllNotDBNull(string message,params object[] evaluation )
        {
            foreach (object o in evaluation) {
                NotDBNull(o,message);
            }
        }

        public  void AllNotDBNullOREmptyString(string message, params object[] evaluation)
        {
            foreach (object o in evaluation)
            {
                NotDBNull(o, message);
                NonEmptyString(o.ToString(), message);
            }
        }

        public  void IsNotNull(Object  evaluation,string message) {
           if (evaluation ==null) {
               Throw(message);
           }
        }


        public  void AllNotNull( string message,params object[] evaluation)
        {
            foreach (object o in evaluation) { IsNotNull(o, message); }
        }


        public  void AllNonEmptyString(string message, params object[] evaluation)
        {
            foreach (object o in evaluation) {
                IsNotNull(o,message);
                NonEmptyString(o.ToString(), message);
            }
        }

        public  void NonEmptyString (string str,string message) {
            if  (!(str!=null && str.Trim().Length >0)) {
                Throw(message);
            }
        }

        public  void RegexMatch(string s, string reg,string message ) {
            Regex rg = new Regex(reg);
            IsTrue(rg.IsMatch(s), message);
        }

        public  void RegexMatchAtLeastWithOne(string s, string[] reg, string message)
        {
            bool matched = false;
            foreach (string rega in reg) {
                Regex rg = new Regex(rega);
                if (rg.IsMatch(s)) {
                    matched = true;
                    break;
                }
            }

            IsTrue(matched, message);

        }



    }

tsql select from xml with xmlns

tsql select from xml with xmlns here is how to do that :
       
declare @document xml ='<TypedPollingResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedPolling/ModifiedProductsGet"><TypedPollingResultSet0><id>2</id><ProductID>M10570</ProductID><OriginalCatalog> Master Recipes HE</OriginalCatalog><Status>0</Status><DateTimeCreated>2014-10-20T11:48:10.373Z</DateTimeCreated></TypedPollingResultSet0><TypedPollingResultSet0><id>1</id><ProductID>M9519</ProductID><OriginalCatalog> Master Recipes HE</OriginalCatalog><Status>0</Status><DateTimeCreated>2014-10-20T11:48:10.373Z</DateTimeCreated></TypedPollingResultSet0></TypedPollingResultSet0>'
;WITH XMLNAMESPACES(DEFAULT 'http://schemas.microsoft.com/Sql/2008/05/TypedPolling/ModifiedProductsGet')
Select T.N.value('id[1]', 'int') as id
from @document.nodes('/TypedPollingResultSet0/TypedPollingResultSet0') as T(N)

mplayer play random file into folder

to shuffle and play random audio files in folder , create following .bat file:

cd C:\Audio\mix\
c:\tools\mplayer\mplayer -quiet -shuffle *


Monday

BizTalk Archive not available or not configured. Timeout error

Here are steps how to resolve BizTalk timeout issue and see tracked messages:

1.purge all tracking data
USE [BizTalkDTADb]
GO
DECLARE              @return_value int
EXEC      @return_value = [dbo].[dtasp_PurgeAllCompletedTrackingData]
SELECT  'Return Value' = @return_value
GO

2.submit  messages to BizTalk

3.After messages are placed run this job on BizTalk server in order to see messages bodies:
TrackedMessages_Copy_BizTalkMsgBoxDb


Thursday

html two image on top of each other

here is source code example:
     
<html>
<head>
  <style type="text/css">
#wrapper {
  margin: 0 auto; background: url(bottom-image.jpg)  no-repeat;
}
#header {
  width:100.00%;
  background: url(top-image.jpg)  no-repeat; ;
  position: absolute;
  top: 100;
  right: 0;
  bottom: 0;
  left: 100;
}
#menu {
  color: #f1f1f1;
}
 </style>
</head>
<body>
<div id="wrapper">
  <div id="header">
    <div id="menu">
      menu will be here
    </div>
  </div>
</div>
</body>
</html>
    

Tuesday

tsql select from xml with xmlns

here is how to do that :
       
declare @document xml ='<TypedPollingResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedPolling/ModifiedProductsGet"><TypedPollingResultSet0><id>2</id><ProductID>M10570</ProductID><OriginalCatalog> Master Recipes HE</OriginalCatalog><Status>0</Status><DateTimeCreated>2014-10-20T11:48:10.373Z</DateTimeCreated></TypedPollingResultSet0><TypedPollingResultSet0><id>1</id><ProductID>M9519</ProductID><OriginalCatalog> Master Recipes HE</OriginalCatalog><Status>0</Status><DateTimeCreated>2014-10-20T11:48:10.373Z</DateTimeCreated></TypedPollingResultSet0></TypedPollingResultSet0>'
;WITH XMLNAMESPACES(DEFAULT 'http://schemas.microsoft.com/Sql/2008/05/TypedPolling/ModifiedProductsGet')
Select T.N.value('id[1]', 'int') as id
from @document.nodes('/TypedPollingResultSet0/TypedPollingResultSet0') as T(N)

make ubuntu business casual

to make ubuntu business casual - make it black remove background: gsettings set org.gnome.desktop.background picture-options ...