W3mentor - w3mentor.com - w3mentor
General Information:
Latest News:
Randomly select element from python list 19 Jul 2013 | 04:36 pm
mylist = ['z', 'y', 'x', 'v', 'u'] from random import choice print choice(mylist)
Use append to merge two lists in python 19 Jul 2013 | 04:34 pm
lista = [1,2,3] listb = [4,5,6] mergedlist =[] for elem in lista: mergedlist.append(elem) for elem in listb: mergedlist.append(elem)
Merge two lists in python 19 Jul 2013 | 04:32 pm
lista = [1,2,3] listb = [4,5,6] list = lista + listb another way to do it would be list = [] list.extend(lista) list.extend(listb) #outcome to expect: list == [1, 2, 3, 4, 5, 6]
Display 5 posts in wordpress using wp_query 19 Jul 2013 | 04:59 am
<?php $myPosts = new WP_Query( 'posts_per_page=5' );while ( $myPosts->have_posts() ) : $myPosts->the_post(); ?> <h2> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </h2> <?php the_excer...
Display post title and content in wordpress theme 19 Jul 2013 | 04:57 am
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <br /> <?php the_content(); endwhile; endif; ?>
Common template tags in wordpress 19 Jul 2013 | 04:56 am
the_permalink() — Displays the URL of your post. the_title() — Displays the title of the post. the_ID() — Displays the unique ID of your post. the_content() — Displays the full content of your post. t...
Simple wordpress data loop 19 Jul 2013 | 04:54 am
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); //show loop content here (template tags, html, etc) endwhile; endif; ?>
connect asynchronously to sql server 28 Mar 2013 | 10:00 pm
readonly string ConnectionString = "Data Source=database_server_name;Initial Catalog=Store;Integrated Security=True"; protected async void ExecuteCommandAsync() { using (SqlConnection con = new SqlC...
Test for websockets support in browser 28 Mar 2013 | 09:40 pm
if (window.WebSocket){ console.log("This browser supports WebSocket!"); } else { console.log("This browser does not support WebSocket."); }
websockets bufferedAmount example 28 Mar 2013 | 09:38 pm
// 10k max buffer size. var THRESHOLD = 10240; // Create a New WebSocket connection var ws = new WebSocket("ws://w3mentor.com"); // Listen for the opening event ws.onopen = function () { // Atte...