C++.zip

How to run shell command by MFC ?

441

Followings are the useful example can run shell command. If you want to launch browser for specific URL,simple run as below:* Note: The above code must be included in the same source.

Binary Search Sample Code

409

This is Binary search that returns a negative one if the number is not found.This code does a bubble sort and then proforms the binary search.

Double Linked List based in C++

799

Below is the double linked list example that based on console.Specially this application use macro by define function provided by ANSI C.It's just like inline function that C++ provides.

Makefile to automate the build process for C++

285

Makefiles are used in C++ projects to automate the build process,especially when the project has multiple source files and dependencies.They define rules specifying how to compile individual source files into object files and then link those object files i...

KMP String Matching Algorithm

676

KMP String Matching Algorithm is well-known algorithm for faster string search.KMP is,as you know,Knuth,Morris,and Pratt.It's complexity is O(n).n is the length of target string and O is big-O notation.Here's the implemented algorithm.

How to load HTML resource on MFC ?

848

I tried to load HTML resource that stored in the application for MFC based application programming. The resource name is IDR_KURAPA_COM_HTML_ROOT.Actually this is very convenient to reduce files for application package.You can load HTML resource as followi...

URL Encode, Decode function for MFC

609

Here's the good example for URL Encoding & Decoding.  Above sample code use CString, so if you want to use it on another type of development environment such as gcc or something like that, you need to add some more stuffs because it may not suppo...

How to search file on certain directory ?

634

In case of finding files on certain directory, you need to use FindFirstFileEx function.Following example shows the example,bool KFindFile(void *findname){    WIN32_FIND_DATA FindFileData;    HANDLE hFind;    CString strSearch...

MFC based World Wide Web HTTP Server Source Code

463

The below attachment is HTTP Server source code that supports CGI. Detail Description: HTTPSVR is an MFC sample that demonstrates the use of MFC and its Windows Sockets (WinSock) classes in implementing a simple World Wide Web HTTP server. HTTPSVR turns an...

Creating and Using a CAsyncSocket Object to use CAsyncSocket

473

Followings are the procedure to send / receive UDP packet by CAsyncSocket.STEP 1. ConstructionConstruct a CAsyncSocket object and use the object to create the underlying SOCKET handle.Creation of a socket follows the MFC pattern of two-stage construction.F...

Fast and Good Keyboard/Mouse Test without the message handler

985

In this short snippet, I will show you a Win32 function that checks whether a button is pressed or not. The good thing is that you don't need to handle the WM_KEYDOWN message. The second advantage is that it is really easy to use and that it can be used ev...

Simple CGI Programming in C

551

Here's the simplest C based CGI example. #include #include int main(void){    char *data;    printf("Content-Type:text / html;xdxa"); / / HTML out start !!    printf("Multiplication results< / TITL...</p> </div> <div class="hc-ad"><ck-ins class="adsbygoogle" ad-style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-2837042411139815" data-ad-slot="5912166641"></ck-ins></div> </article> </div><div class="grid-item"> <article class="hc"> <div class="hc-body"> <h2 class="hc-title"><a href="https://strcpy.com/cplulplus/59/C-CGI-Example-working-on-Apache/">C++ CGI Example working on Apache</a></h2> <div class="hc-meta"><span title="created"><time datetime="2007-08-26T19:55:32Z" data-ts="1188158132" data-fmt="date">Aug 27, 2007</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>491</span></div> <p class="hc-excerpt">In this short howto I will explain how to setup your apache webserver to run any compiled application as an CGI script and show a little example program to explain the main concepts. So why does someone might have the idea to execute an application? There ...</p> </div> <div class="hc-ad"><ck-ins class="adsbygoogle" ad-style="display:inline-block;width:300px;height:90px" data-ad-client="ca-pub-2837042411139815" data-ad-slot="4623658791"></ck-ins></div> </article> </div><div class="grid-item"> <article class="hc"> <div class="hc-media"><a href="https://strcpy.com/aws/570/Media-sharing-service-architecture-in-AWS/"><img style='width:100%;height:auto;' src="https://strcpy.com/img/thumbnail/f1791823_320x170.png" width="320" height="221" alt="Media sharing service architecture in AWS" loading="lazy" decoding="async"></a></div> <div class="hc-body"> <h2 class="hc-title"><a href="https://strcpy.com/aws/570/Media-sharing-service-architecture-in-AWS/">Media sharing service architecture in AWS</a></h2> <div class="hc-meta"><span title="created"><time datetime="2024-10-29T20:51:29Z" data-ts="1730235089" data-fmt="date">Oct 30, 2024</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>10,374</span></div> <p class="hc-excerpt">Media sharing is one of the hottest markets on the Internet. Customers have a staggering appetite for placing photos and videos on social networking sites,and for sharing their media in custom online photo albums.The growing popularity of media sharing mea...</p> </div> </article> </div><div class="grid-item"> <article class="hc"> <div class="hc-body"> <h2 class="hc-title"><a href="https://strcpy.com/python/486/Simple-Web-Server-based-in-Python/">Simple Web Server based in Python</a></h2> <div class="hc-meta"><span title="updated"><time datetime="2024-08-01T20:39:39Z" data-ts="1722544779" data-fmt="date">Aug 02, 2024</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>383</span></div> <p class="hc-excerpt">To deliver content with the simple web server set up using http.server,you can place the content (HTML,CSS,JavaScript files,images,etc.) in the same directory where you run the script.The server will serve files from this directory and its subdirectories.H...</p> </div> <div class="hc-ad"><ck-ins class="adsbygoogle" ad-style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-2837042411139815" data-ad-slot="5912166641"></ck-ins></div> </article> </div><div class="grid-item"> <article class="hc"> <div class="hc-media"><a href="https://strcpy.com/aws/575/Web-Application-Hosting-provides-the-reliable-scal/"><img style='width:100%;height:auto;' src="https://strcpy.com/img/thumbnail/802eb461_320x170.png" width="320" height="358" alt="Web Application Hosting provides the reliable, scalable, secure, and high-performance infrastructure" loading="lazy" decoding="async"></a></div> <div class="hc-body"> <h2 class="hc-title"><a href="https://strcpy.com/aws/575/Web-Application-Hosting-provides-the-reliable-scal/">Web Application Hosting provides the reliable, scalable, secure, and high-performance infrastructure</a></h2> <div class="hc-meta"><span title="updated"><time datetime="2024-10-29T21:16:59Z" data-ts="1730236619" data-fmt="date">Oct 30, 2024</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>10,622</span></div> <p class="hc-excerpt">High available and scalable web hosting can be complex and expensive.Dense peak periods and wild swing in traffic patterns result in low utilization of expensive hardware.Amazon Web Services provides the reliable,scalable,secure,and high-performance infras...</p> </div> <div class="hc-ad"><ck-ins class="adsbygoogle" ad-style="display:inline-block;width:300px;height:90px" data-ad-client="ca-pub-2837042411139815" data-ad-slot="4623658791"></ck-ins></div> </article> </div><div class="grid-item"> <article class="hc"> <div class="hc-media"><a href="https://strcpy.com/aws/573/Synchronous-online-gaming-architecutre-in-AWS-High/"><img style='width:100%;height:auto;' src="https://strcpy.com/img/thumbnail/689b7e22_320x462.png" width="320" height="462" alt="Synchronous online gaming architecutre in AWS - Highly Available, Scalable & Elastic to support Millions of Players" loading="lazy" decoding="async"></a></div> <div class="hc-body"> <h2 class="hc-title"><a href="https://strcpy.com/aws/573/Synchronous-online-gaming-architecutre-in-AWS-High/">Synchronous online gaming architecutre in AWS - Highly Available, Scalable & Elastic to support Millions of Players</a></h2> <div class="hc-meta"><span title="updated"><time datetime="2024-10-29T21:09:31Z" data-ts="1730236171" data-fmt="date">Oct 30, 2024</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>10,425</span></div> <p class="hc-excerpt">The most important part of designing a database architecture for high performance service at large scale is prioritizing data consistency and availability while ensuring scalability and performance.This means choosing the right database model (relational,N...</p> </div> </article> </div><div class="grid-item"> <article class="hc"> <div class="hc-media"><a href="https://strcpy.com/aws/569/Live-streaming-Static-Content-Media-Service-based/"><img style='width:100%;height:auto;' src="https://strcpy.com/img/thumbnail/11916ac9_320x170.png" width="320" height="373" alt="Live streaming / Static Content & Media Service based on AWS" loading="lazy" decoding="async"></a></div> <div class="hc-body"> <h2 class="hc-title"><a href="https://strcpy.com/aws/569/Live-streaming-Static-Content-Media-Service-based/">Live streaming / Static Content & Media Service based on AWS</a></h2> <div class="hc-meta"><span title="updated"><time datetime="2024-10-29T20:48:34Z" data-ts="1730234914" data-fmt="date">Oct 30, 2024</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>10,664</span></div> <p class="hc-excerpt">Amazon's most outstanding video streaming solutions include Amazon CloudFront,a global content delivery network (CDN) for fast and reliable delivery of video content,Amazon Elastic Transcoder,which converts videos into various formats and resolutions for o...</p> </div> </article> </div><div class="grid-item"> <article class="hc"> <div class="hc-media"><a href="https://strcpy.com/aws/557/Content-Distribution-for-VOD-streaming-services-in/"><img style='width:100%;height:auto;' src="https://strcpy.com/img/thumbnail/ce477ab3_320x170.png" width="320" height="170" alt="Content Distribution for VOD streaming services in AWS" loading="lazy" decoding="async"></a></div> <div class="hc-body"> <h2 class="hc-title"><a href="https://strcpy.com/aws/557/Content-Distribution-for-VOD-streaming-services-in/">Content Distribution for VOD streaming services in AWS</a></h2> <div class="hc-meta"><span title="updated"><time datetime="2024-10-29T19:44:29Z" data-ts="1730231069" data-fmt="date">Oct 30, 2024</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>10,363</span></div> <p class="hc-excerpt">The most common content distribution method in the OTT industry is Content Delivery Networks (CDNs).CDNs are vast networks of servers strategically located around the globe,caching content closer to users to reduce latency and improve streaming quality.Thi...</p> </div> </article> </div><div class="grid-item"> <article class="hc"> <div class="hc-media"><a href="https://strcpy.com/engineering/934/Architecting-for-Resilience-AWS-High-Availability/"><img style='width:100%;height:auto;' src="https://strcpy.com/img/thumbnail/e8a11c2d_320x170.png" width="320" height="220" alt="Architecting for Resilience: AWS High Availability Components Including API Gateway" loading="lazy" decoding="async"></a></div> <div class="hc-body"> <h2 class="hc-title"><a href="https://strcpy.com/engineering/934/Architecting-for-Resilience-AWS-High-Availability/">Architecting for Resilience: AWS High Availability Components Including API Gateway</a></h2> <div class="hc-meta"><span title="created"><time datetime="2016-07-09T22:59:56Z" data-ts="1468105196" data-fmt="date">Jul 10, 2016</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>144</span></div> <p class="hc-excerpt">Amazon Web Services offers several key components designed to guarantee high availability through built-in redundancy,automatic scaling,and multi-Availability Zone replication,foremost among them being AWS API Gateway,which manages API traffic across multi...</p> </div> </article> </div><div class="grid-item"> <article class="hc"> <div class="hc-body"> <h2 class="hc-title"><a href="https://strcpy.com/php/219/How-to-get-Referral-URL/">How to get Referral URL ?</a></h2> <div class="hc-meta"><span title="updated"><time datetime="2024-10-28T22:11:27Z" data-ts="1730153487" data-fmt="date">Oct 29, 2024</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>2,084</span></div> <p class="hc-excerpt">Grabs the referring URL - get the HTTP_REFERER and save it to a variable. code snippet: .While not inherently intended for API security,the HTTP_REFERER header can be a valuable tool for implementing an API that restricts access to certain resources based ...</p> </div> </article> </div><div class="grid-item"> <article class="hc"> <div class="hc-body"> <h2 class="hc-title"><a href="https://strcpy.com/web/217/Is-there-URLEncode-function-in-Javascript/">Is there URLEncode function in Javascript ?</a></h2> <div class="hc-meta"><span title="created"><time datetime="2007-10-10T17:48:42Z" data-ts="1192038522" data-fmt="date">Oct 11, 2007</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>396</span></div> <p class="hc-excerpt">EncodeURI() is the answer. and followings are the usage example: <script type="text / javascript"><!--   function MoveTab(txtObj, event)  {     var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; &n...</p></div></article></div><div class="grid-item"><article class="hc"><div class="hc-body"><h2 class="hc-title"><a href="https://strcpy.com/delphi/182/Display-Standard-Windows-Properties-dialog/">Display Standard Windows Properties dialog</a></h2><div class="hc-meta"><span title="updated"><time datetime="2024-10-28T04:24:28Z" data-ts="1730089468" data-fmt="date">Oct 28, 2024</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>1,132</span></div><p class="hc-excerpt">Here's the code that will display the standard Windows Properties dialog for a specified file (object) name.Usage:Here's the function source. </p></div></article></div><div class="grid-item"><article class="hc"><div class="hc-body"><h2 class="hc-title"><a href="https://strcpy.com/cplulplus/70/UDP-Send-and-Receive-Using-CAsyncSocket/">UDP Send and Receive Using CAsyncSocket</a></h2><div class="hc-meta"><span title="updated"><time datetime="2024-11-04T05:38:43Z" data-ts="1730698723" data-fmt="date">Nov 04, 2024</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>1,207</span></div><p class="hc-excerpt">The following is sample code showing use of CAsyncSocket to send and receive UDP packets.I used the ClassWizard to create a class (CUDPSocket) derived from CAsyncSocket.The derived class does little more than override OnReceive.The derived class is used in...</p></div></article></div><div class="grid-item"><article class="hc"><div class="hc-body"><h2 class="hc-title"><a href="https://strcpy.com/cplulplus/58/Simple-C-CGI-working-on-Apache/">Simple C# CGI working on Apache</a></h2><div class="hc-meta"><span title="updated"><time datetime="2024-11-04T05:03:01Z" data-ts="1730696581" data-fmt="date">Nov 04, 2024</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>488</span></div><p class="hc-excerpt">Simple program to demonstarte the power of c# on the Net.This program require web server e.g(java web server ,apache etc).Hello.cs.Compile the class Hello.cs.This will give u a exe file i.e Hello.exe.Put this file in the server's cgi-bin directory.for e.g ...</p></div></article></div><div class="grid-item"><article class="hc"><div class="hc-body"><h2 class="hc-title"><a href="https://strcpy.com/cplulplus/57/How-to-send-binary-data-through-C-CGI-app/">How to send binary data through C# CGI app?</a></h2><div class="hc-meta"><span title="created"><time datetime="2007-08-26T19:05:37Z" data-ts="1188155137" data-fmt="date">Aug 27, 2007</time></span><span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5C6.5 5 2.7 9.3 1.5 12c1.2 2.7 5 7 10.5 7s9.3-4.3 10.5-7C21.3 9.3 17.5 5 12 5zm0 11.5A4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 0 1 0 9zm0-7a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/></svg>999</span></div><p class="hc-excerpt">Following example implemented binary data downloading. If you are using Apache and wanna test it just put the EXE in the cgi-bin folder under Apache's directory.Also note that the parameters are static just for this example.</p></div></article></div></div></div><script>function doSearch(){var kw = document.getElementById("search_keyword").value.trim();if (kw.length<2) alert("Too short search keyword!");else window.self.location = "/search/" + encodeURIComponent(kw) + "/";}</script> <div class="hc-search"> <input type="text" class="tw-input" id="search_keyword" value="C++" placeholder="Search keyword" onkeydown="if (event.key==='Enter') { doSearch(); }"> <button type="button" class="tw-btn tw-btn-primary" onClick="javascript:doSearch();">Search</button> </div> </div> <br> <br> <div id="menu"><table bgcolor="black" width="100%"> <tr width=100%><td style="margin:5px;padding:5px;"><span id="menu2_1" style="margin:5px;padding:5px;"><a href="https://strcpy.com/notice/416/strcpycom-Renewal/"><font color='yellow'><nobr>About Super Coder's Page</nobr></font></a></span>  <span id="menu2_2" style="margin:5px;padding:5px;"><a href="/privacy_policy/"><font color='yellow'><nobr>Privacy Policy</nobr></font></a></span></font></td> </tr></table></div> <script> var g_masonry = null; var g_masonry_observer = null; function masonry_grid_update() { var grid = document.querySelector( ".grid" ); if (!grid || typeof Masonry === "undefined") return; /* first call builds the layout; later calls (e.g. after ads load) pick up added cards and re-stack */ if (!g_masonry) g_masonry = new Masonry( grid, {"itemSelector":".grid-item","gutter":3,"fitWidth":true,"percentPosition":false} ); else { g_masonry.reloadItems(); g_masonry.layout(); } /* re-stack whenever a card changes height (lazy images, ads, embedded videos) */ if (!window.ResizeObserver) return; if (!g_masonry_observer) { var timer = null; g_masonry_observer = new ResizeObserver( function() { clearTimeout( timer ); timer = setTimeout( function() { if (g_masonry) g_masonry.layout(); }, 60 ); }); } grid.querySelectorAll( ".grid-item" ).forEach( function(node) { g_masonry_observer.observe( node ); } ); } /* Masonry may load with defer (TCKTAILWIND defer_scripts option): then build the grid once the page is parsed */ if (typeof Masonry !== "undefined") masonry_grid_update(); else document.addEventListener( "DOMContentLoaded", masonry_grid_update ); window.addEventListener( "load", function() { if (g_masonry) g_masonry.layout(); } ); </script> </body> <script>var g_ck_ad_refresh_duration = 25000;var g_ck_ad_initial_refresh_duration = 20000;function adjustContainerWidth(container) {var windowWidth = window.innerWidth || document.documentElement.clientWidth;var containerWidth = parseInt(container.style.width) || parseInt(window.getComputedStyle(container).width);if (containerWidth > windowWidth) {container.style.width = (windowWidth - 6) + "px";}}function createAdSense(container) {var adSenseAd = document.createElement('ins');adSenseAd.className = 'adsbygoogle';adSenseAd.style.cssText = container.getAttribute('ad-style');adjustContainerWidth(container);adSenseAd.setAttribute('data-ad-client', container.getAttribute('data-ad-client'));adSenseAd.setAttribute('data-ad-slot', container.getAttribute('data-ad-slot'));var adSenseScript = document.createElement('script');adSenseScript.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';adSenseScript.async = true;adSenseScript.crossorigin = 'anonymous';container.innerHTML = '';container.appendChild(adSenseAd);container.appendChild(adSenseScript);var pushScript = document.createElement('script');pushScript.innerHTML = '(adsbygoogle = window.adsbygoogle || []).push({});';container.appendChild(pushScript);}</script><script>var _cur_ad_pos = 0;var _ad_elements = null;var _ad_elements_len = 0;function isVisible(element){const rect = element.getBoundingClientRect();return (rect.width > 0 &&rect.height > 0 &&rect.top >= 0 &&rect.left >= 0 &&rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&rect.right <= (window.innerWidth || document.documentElement.clientWidth));}function refreshAdSense(){if (_ad_elements){if (document.visibilityState === "visible"){for (var i = 0; i < _ad_elements_len; i++){if ( isVisible( _ad_elements[i] ) ) createAdSense(_ad_elements[i]);}}setTimeout( refreshAdSense, g_ck_ad_refresh_duration );}if (typeof masonry_grid_update === 'function') setTimeout(masonry_grid_update, 500);}function loadAdSense0(){_ad_elements = document.querySelectorAll('[class="adsbygoogle"]');if (_ad_elements){_ad_elements_len = _ad_elements.length;for (var i = 0; i < _ad_elements_len; i++){createAdSense(_ad_elements[i]);}}setTimeout( refreshAdSense, g_ck_ad_initial_refresh_duration );if (typeof masonry_grid_update === 'function') setTimeout( masonry_grid_update, 500);}setTimeout(loadAdSense0, 500);</script> </html>