I read a starter document to deal and understand the caching mechanism in .NET .
especially the page caching but there are some words on the sqldatasource caching too.
here is your link ASP.NET caching basics.
And here another good description ASP.NET 2.0 Caching Features
Enjoy Yaniv
This Blog is first of all memos for me!! From time to time I get exposed to new and cool stuff for developers and architects ,most of the time its a solution for a problem or tips or tricks, so, I would like to track my memos and share it with you, it can save your time and nervous, I hope you will enjoy it - by Yaniv Tzanany.
Search This Blog
Wednesday, October 7, 2009
Tuesday, September 22, 2009
Calling MFC C++ API from C# (e.g. CString& param)
I have a C++ dll that written via MFC, I exposed an API from my dll, for this sample :
HRESULT __declspec( dllexport )RunTest(const CString& strIn, CString& strOut);
now i want to call it from my c# code, so i tried the next decalrtion:
[DllImport("myDLL.dll", CharSet = CharSet.Ansi)]
public static extern int RunTest(ref StringBuilder strIn, ref StringBuilder strOut);
the strings arrived to the c++ dlls , the problem was getting some unexpcted assertion in destructor and operator= of Cstring , any way as you know CString is a Class with buffer in it , and its looks like the marshal didn’t get well in runtime , I get the string but I get crashed from time to time.
so my workaround was as follow , in the C++ dll i created a new API method (wrapper one):
HRESULT __declspec( dllexport )RunTestManaged(LPCTSTR strXmlIn, LPTSTR strXmlOut, int buffCount)
//--------------------------------------------------------------------------
{
CString param1;
RunTest(strXmlIn,param1);
strncpy(strXmlOut,param1,buffCount);
return 0;
}
and in the C# code i created the next import section:
[DllImport("myDLL.dll", CharSet = CharSet.Ansi)]
public static extern int RunTestManaged(String strIn, ref StringBuilder strOut,int strOutBuffCount);
Make sure to allocate enough buffer in the string builder, this way the strIn and the strOut will be transferred perfectly.
Yaniv T
HRESULT __declspec( dllexport )RunTest(const CString& strIn, CString& strOut);
now i want to call it from my c# code, so i tried the next decalrtion:
[DllImport("myDLL.dll", CharSet = CharSet.Ansi)]
public static extern int RunTest(ref StringBuilder strIn, ref StringBuilder strOut);
the strings arrived to the c++ dlls , the problem was getting some unexpcted assertion in destructor and operator= of Cstring , any way as you know CString is a Class with buffer in it , and its looks like the marshal didn’t get well in runtime , I get the string but I get crashed from time to time.
so my workaround was as follow , in the C++ dll i created a new API method (wrapper one):
HRESULT __declspec( dllexport )RunTestManaged(LPCTSTR strXmlIn, LPTSTR strXmlOut, int buffCount)
//--------------------------------------------------------------------------
{
CString param1;
RunTest(strXmlIn,param1);
strncpy(strXmlOut,param1,buffCount);
return 0;
}
and in the C# code i created the next import section:
[DllImport("myDLL.dll", CharSet = CharSet.Ansi)]
public static extern int RunTestManaged(String strIn, ref StringBuilder strOut,int strOutBuffCount);
Make sure to allocate enough buffer in the string builder, this way the strIn and the strOut will be transferred perfectly.
Yaniv T
using MFC dll's on Azure
Hi
I read somewhere that you can not run MFC dlls in the Azure platform , so its is wrong!!!
i managed to use mfc dll that i developed on .... VC++ 6.0 . in the Azure .
Be aware i didnt test MFC dll that developed on visualstudio 2005/2008.
how did i call my 32bit mfc dll from the web_role that runs in 64 bit ???
i created a WCF self host that using named pipe (net.pipe) , and when the web role loaded i run this self host , and from the self host i call to my native library ,via dllimport , the regular way.
When i deploy my package i didn't add any extra dll , its looks like the instance already have the needed library to support my mfc dll.
more than that my dll connect to sql server via odbc(CDatabase, CRecordSet) , so i just needed to change my connection string to point to sql azure ,and boooom i managed to make it work in the Azure too , again no extra dll needed to the package.
some useful links :
Using a 32bit Native DLL in Windows Azure
Executing Native Code in Windows Azure and the Development Environment
MSDN FullTrust Sample
i hope its save you some test time.
Yaniv
I read somewhere that you can not run MFC dlls in the Azure platform , so its is wrong!!!
i managed to use mfc dll that i developed on .... VC++ 6.0 . in the Azure .
Be aware i didnt test MFC dll that developed on visualstudio 2005/2008.
how did i call my 32bit mfc dll from the web_role that runs in 64 bit ???
i created a WCF self host that using named pipe (net.pipe) , and when the web role loaded i run this self host , and from the self host i call to my native library ,via dllimport , the regular way.
When i deploy my package i didn't add any extra dll , its looks like the instance already have the needed library to support my mfc dll.
more than that my dll connect to sql server via odbc(CDatabase, CRecordSet) , so i just needed to change my connection string to point to sql azure ,and boooom i managed to make it work in the Azure too , again no extra dll needed to the package.
some useful links :
Using a 32bit Native DLL in Windows Azure
Executing Native Code in Windows Azure and the Development Environment
MSDN FullTrust Sample
i hope its save you some test time.
Yaniv
Monday, September 21, 2009
Show directory size in UNIX
the next line works perfectly under AIX.
du -gs /var/* | sort
the results will be the directory size sorted under the /var directory.
YanivT
du -gs /var/* | sort
the results will be the directory size sorted under the /var directory.
YanivT
Monday, September 7, 2009
Connect to SQL Azure - starter links
Recently i am dealing with SQL azura , a relational db on the cloud from Microsoft.
here are some starter links to put you in the map:
SQL Azure Database - HOME .
Microsoft SQL Azure FAQ.
you will have to create your account for SQL Azure (CTP this days), after you will get your code you can manage the DB's.
for a complete set of action how to connect to your DB from your preferred tools , i found the next post First Impressions with the New SQL Azure that will give you a good starting way to interact with your cloud db the
Connecting to SQL Azure from SQL Management Studio 2008 can help too if needed.
NOTES:
if you are in the office and you have a firewall , you will have to open it for:
Access type: outbound
Destination port: 1433
Destination IP range: 65.55.*.*
In addition, if your network has a proxy server for accessing the Internet then you need to configure your proxy server to allow outbound 1433 connections and you need to configure your system to use the proxy server.
this from here Firewall Issues.
hope its help you to start your cloud db - i hope its works well.
and of course MSDN link - SQL Azure .
another good blog The latest news and insight from the SQL Azure team.
enjoy
Yaniv
here are some starter links to put you in the map:
SQL Azure Database - HOME .
Microsoft SQL Azure FAQ.
you will have to create your account for SQL Azure (CTP this days), after you will get your code you can manage the DB's.
for a complete set of action how to connect to your DB from your preferred tools , i found the next post First Impressions with the New SQL Azure that will give you a good starting way to interact with your cloud db the
Connecting to SQL Azure from SQL Management Studio 2008 can help too if needed.
NOTES:
if you are in the office and you have a firewall , you will have to open it for:
Access type: outbound
Destination port: 1433
Destination IP range: 65.55.*.*
In addition, if your network has a proxy server for accessing the Internet then you need to configure your proxy server to allow outbound 1433 connections and you need to configure your system to use the proxy server.
this from here Firewall Issues.
hope its help you to start your cloud db - i hope its works well.
and of course MSDN link - SQL Azure .
another good blog The latest news and insight from the SQL Azure team.
enjoy
Yaniv
Monday, August 31, 2009
MQSeries - enable trace
To Enable WebSphere MQ tracing by executing the following command.
On Windows (Win32) systems: strmqtrc -t api -l 5
On Linux systems: strmqtrc -e -t api -l 5
The strmqtrc tool can be found under the bin directory located under the main MQ
installation directory.
To Stop tracing by executing the command below.
On Windows (Win32) systems: endmqtrc
On Linux systems: endmqtrc -a
The WebSphere MQ trace logs can be found under the (MQ_HOME)\trace directory ,(on AIX its under /var/mqm/trace)
and are all the files that end with extension ".TRC"
i just found a good article how to set trace and decode it
Tracing WebSphere MQ
enjoy
YanivT
On Windows (Win32) systems: strmqtrc -t api -l 5
On Linux systems: strmqtrc -e -t api -l 5
The strmqtrc tool can be found under the bin directory located under the main MQ
installation directory.
To Stop tracing by executing the command below.
On Windows (Win32) systems: endmqtrc
On Linux systems: endmqtrc -a
The WebSphere MQ trace logs can be found under the (MQ_HOME)\trace directory ,(on AIX its under /var/mqm/trace)
and are all the files that end with extension ".TRC"
i just found a good article how to set trace and decode it
Tracing WebSphere MQ
enjoy
YanivT
MQSeries commands for queue manager and queues
The next post will show you how to create queue manager and Queues to start working with MQseries product and some tips to work from unix to windows via mqseries.
i hope you will find it useful for you.
enjoy
YanivT
i hope you will find it useful for you.
1. MQ SERIAS SETTING
1.1 Create queue manager
crtmqm MY_QM
1.2 Creating the QUEUEIN and QUEUEOUT queue
strmqm MY_QM ( start the queue manger)
runmqsc MY_QM ( start the MQSeries command for MY_QM )
DEFINE QLOCAL(QUEUEIN) ( the rest is default)
DEFINE QLOCAL(QUEUEOUT) ( the rest is default)
// for setting maximum handles to the qmgr – for BenchMark
alter qmgr maxhands(1500)
1.3 Creating the Channel for MY_QM
runmqsc MY_QM ( start the MQSeries command for MY_QM )
DEFINE CHANNEL(SYSTEM.ADMIN.SVRCONN) CHLTYPE(SVRCONN) MCAUSER(‘mqm’)
End (exit from MQSeries command)
1.4 Setting the maximum user connection – optional
Edit the qm.ini file – for the specific queue manager that you created.
Add to the end:
CHANNELS:
MaxChannels = 200 ; Maximum number of Channels allowed.
MaxActiveChannels = 200 ; Maximum number of Channels allowed to be
; active at any time.
1.5 Mq Serias version 6
After creating the queue in version 6 we have to define permission on the queue manager and the queues .
Run the next commands for the queue manager
setmqaut -m MY_QM -t qmgr -p [username] +all
or
setmqaut -m MY_QM -t qmgr -g [Group Name] +all
Run the next commands for the queues:
setmqaut -m MY_QM -n QUEUEIN -t q -p [username] +all
setmqaut -m MY_QM -n QUEUEOUT -t q -p [username] +all
OR
setmqaut -m MY_QM -n QUEUEOUT -t q -g [Group Name] +all
• On the channel – not sure you can set permission too
setmqaut -m [q mgr] -n [channel name] -t chl -g [group name] +all - on the channel name
1.6 Connection from UNIX to MQ server on windows
If you are running your process under user name e.g. root.
Add an account on the windows where the mq server installed and add the user to the mqm group, restart the queue manager .
This way you can access from UNIX to mqserias on windows platform.
1.7 running the MY_QM MQSeries listener
endmqm –i MY_QM (Shut down MY_QM queue Manager)
strmqm MY_QM ( start the queue manger)
strmqcsv MY_QM (Restart the command queue server after restarting the queue manager)
runmqlsr -t tcp -p 1414 -m MY_QM
enjoy
YanivT
Subscribe to:
Posts (Atom)