Here is one example of what happens when django ORM can be optimized
Profiling Django Applications: A Journey From 1300 to 2 Queries
Wednesday, February 15, 2012
Sunday, February 12, 2012
EC2 is about 10-20 times more expensive than dedicated hosting.
Quote of the day via ycombinator:
Even if reserved instances save us 22% over 3 years, it still doesn't even come close. Reserved instances also force me to commit to using a certain type of EC2 instance for 3 years with lots of money upfront. Moreover, IO is ridiculously bad on EC2 and there's nothing that can be done about it. Even RAIDing a gazillion EBS volumes together doesn't do much. I'm glad the truth about how expensive EC2 really is is starting to come out. Hopefully it will force them to revise their pricing, or at least offer more processing power for the same price.
I ran some benchmarks a few weeks ago that show how expensive EC2 really is
Agreed. Here's a good relevant blog post by mark maunder challenging the "cloud hype" http://markmaunder.com/2011/10/31/clouded-vision/
Another thing that is overpriced is the memory , here is a quote from the basecamp's next memory cache article (see the comments section)
They have brought 864GB of RAM that looks like below
Even if reserved instances save us 22% over 3 years, it still doesn't even come close. Reserved instances also force me to commit to using a certain type of EC2 instance for 3 years with lots of money upfront. Moreover, IO is ridiculously bad on EC2 and there's nothing that can be done about it. Even RAIDing a gazillion EBS volumes together doesn't do much. I'm glad the truth about how expensive EC2 really is is starting to come out. Hopefully it will force them to revise their pricing, or at least offer more processing power for the same price.
I ran some benchmarks a few weeks ago that show how expensive EC2 really is
Agreed. Here's a good relevant blog post by mark maunder challenging the "cloud hype" http://markmaunder.com/2011/10/31/clouded-vision/
Another thing that is overpriced is the memory , here is a quote from the basecamp's next memory cache article (see the comments section)
They have brought 864GB of RAM that looks like below
Saturday, February 11, 2012
Ati fglrx gpu blacklisted in latest chrome beta on Lubuntu/Ubuntu 11.10 with the fglrx driver
Although it works just fine if i use to ignore the blacklisting
Tested on two systems with the current drivers and quite new gpus
See bellow
Here are the details
:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Graphics Feature Status | |
Canvas: Hardware accelerated | |
HTML Rendering: Hardware accelerated | |
3D CSS: Hardware accelerated | |
WebGL: Hardware accelerated | |
WebGL multisampling: Hardware accelerated | |
Version Information | |
Data exported Sat Feb 11 2012 18:18:10 GMT+0200 (EET) | |
Chrome version 18.0.1025.11 (Official Build 121089) beta | |
Operating system Linux 3.0.0-15-generic | |
Software rendering list version | |
ANGLE revision 950 | |
2D graphics backend Skia | |
Performance Information | |
Graphics 0.0 | |
Gaming 0.0 | |
Overall 0.0 | |
Driver Information | |
Initialization time 187 | |
Vendor Id 0x1002 | |
Device Id 0x68e4 | |
Optimus false | |
Driver vendor ATI / AMD | |
Driver version 8.881 | |
Driver date | |
Pixel shader version 4.10 | |
Vertex shader version 4.10 | |
GL version 4.1 | |
GL_VENDOR ATI Technologies Inc. | |
GL_RENDERER AMD Radeon HD 6300M Series | |
GL_VERSION 4.1.11005 Compatibility Profile Context | |
GL_EXTENSIONS GL_AMDX_debug_output GL_AMDX_vertex_shader_tessellator GL_AMD_conservative_depth GL_AMD_debug_output GL_AMD_depth_clamp_separate GL_AMD_draw_buffers_blend GL_AMD_multi_draw_indirect GL_AMD_name_gen_delete GL_AMD_performance_monitor GL_AMD_pinned_memory GL_AMD_sample_positions GL_AMD_seamless_cubemap_per_texture GL_AMD_shader_stencil_export GL_AMD_shader_trace GL_AMD_texture_cube_map_array GL_AMD_texture_texture4 GL_AMD_transform_feedback3_lines_triangles GL_AMD_vertex_shader_tessellator GL_ARB_ES2_compatibility GL_ARB_blend_func_extended GL_ARB_color_buffer_float GL_ARB_copy_buffer GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_draw_buffers_blend GL_ARB_draw_elements_base_vertex GL_ARB_draw_indirect GL_ARB_draw_instanced GL_ARB_explicit_attrib_location GL_ARB_fragment_coord_conventions GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_shader4 GL_ARB_get_program_binary GL_ARB_gpu_shader5 GL_ARB_gpu_shader_fp64 GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging GL_ARB_instanced_arrays GL_ARB_map_buffer_range GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_occlusion_query2 GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_provoking_vertex GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding GL_ARB_shader_objects GL_ARB_shader_precision GL_ARB_shader_stencil_export GL_ARB_shader_subroutine GL_ARB_shader_texture_lod GL_ARB_shading_language_100 GL_ARB_shadow GL_ARB_shadow_ambient GL_ARB_sync GL_ARB_tessellation_shader GL_ARB_texture_border_clamp GL_ARB_texture_buffer_object GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_compression GL_ARB_texture_compression_bptc GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_cube_map_array GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_gather GL_ARB_texture_mirrored_repeat GL_ARB_texture_multisample GL_ARB_texture_non_power_of_two GL_ARB_texture_query_lod GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_texture_rgb10_a2ui GL_ARB_texture_snorm GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_transpose_matrix GL_ARB_uniform_buffer_object GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_attrib_64bit GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_envmap_bumpmap GL_ATI_fragment_shader GL_ATI_meminfo GL_ATI_separate_stencil GL_ATI_texture_compression_3dc GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_ATI_texture_mirror_once GL_EXT_abgr GL_EXT_bgra GL_EXT_bindable_uniform GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_copy_buffer GL_EXT_copy_texture GL_EXT_direct_state_access GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_histogram GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shader_image_load_store GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_EXT_subtexture GL_EXT_texgen_reflection GL_EXT_texture3D GL_EXT_texture_array GL_EXT_texture_buffer_object GL_EXT_texture_compression_bptc GL_EXT_texture_compression_latc GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_integer GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_shared_exponent GL_EXT_texture_snorm GL_EXT_texture_swizzle GL_EXT_timer_query GL_EXT_transform_feedback GL_EXT_vertex_array GL_EXT_vertex_array_bgra GL_EXT_vertex_attrib_64bit GL_IBM_texture_mirrored_repeat GL_KTX_buffer_region GL_NV_blend_square GL_NV_conditional_render GL_NV_copy_depth_to_color GL_NV_explicit_multisample GL_NV_float_buffer GL_NV_half_float GL_NV_primitive_restart GL_NV_texgen_reflection GL_NV_texture_barrier GL_SGIS_generate_mipmap GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_SUN_multi_draw_arrays GL_WIN_swap_hint WGL_EXT_swap_control | |
Log Messages | |
[2365:2365:383972486:INFO:gpu_child_thread.cc(110)] : gpu_info_collector::CollectGraphicsInfo complete. success = 0 | |
[2365:2365:384532369:ERROR:gl_surface.cc(87)] : Not implemented reached in virtual bool gfx::GLSurface::Resize(const gfx::Size&) | |
[2365:2365:11826905083:ERROR:gl_surface.cc(87)] : Not implemented reached in virtual bool gfx::GLSurface::Resize(const gfx::Size&) | |
[2365:2365:12934507239:ERROR:gl_surface.cc(87)] : Not implemented reached in virtual bool gfx::GLSurface::Resize(const gfx::Size&) | |
[2365:2365:18312494763:ERROR:gl_surface.cc(87)] : Not implemented reached in virtual bool gfx::GLSurface::Resize(const gfx::Size&) | |
[2365:2365:19520843631:ERROR:gl_surface.cc(87)] : Not implemented reached in virtual bool gfx::GLSurface::Resize(const gfx::Size&) |
Wednesday, February 08, 2012
php shell script that will run runs at specific hour with crontab and send emails with the html form extracted content
Here is how to create a daily crontab script that runs at specific hour
gets the web content and then saves the output in a file folder (the form must use a sumbit button with post) and then
it send email with the html file
you need to install php5-cli , php-pear
sudo apt-get install php5-cli php-pear
and then from pear Mail , Mail_Mime http://pear.php.net/package/Mail_Mime/redirected
sudo pear install Mail_Mime
sudo pear install Mail
crontab -l
# m h dom mon dow command
0 1 * * * /home/ubuntu/curl_cron.php
# m h dom mon dow command
0 1 * * * /home/ubuntu/curl_cron.php
cat /home/ubuntu/curl_cron.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
include 'Mail.php'; | |
include 'Mail/mime.php' ; | |
$url = 'https://www.google.com/search?hl=en&gl=us&tbm=nws&btnmeta_news_search=1&q=android&oq=android'; | |
$emails = 'example@example.com'; | |
$path = '/home/ubuntu/'; | |
$today = getdate(); | |
$day= $today["mday"]; | |
$month= $today["mon"]; | |
$year= $today["year"]; | |
// The submitted form data, encoded as query-string-style | |
// name-value pairs | |
$post_body = 'submit=android'; | |
$curl_handle = curl_init ($url); | |
curl_setopt ($curl_handle, CURLOPT_POST, true); | |
curl_setopt ($curl_handle, CURLOPT_POSTFIELDS, $post_body); | |
curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, true); | |
$curl_output = curl_exec ($curl_handle); | |
$file_path = "$path"."curl.out/android-news-$month-$day-$year.html"; | |
$fh = fopen ($file_path,'w'); | |
fwrite($fh,$curl_output); | |
fclose($fh); | |
curl_close ($curl_handle); | |
$text = " Google Android News Update $month-$day-$year"; | |
$crlf = "\n"; | |
$hdrs = array( | |
'From' => 'example@example.com', | |
'Subject' => $text | |
); | |
$mime = new Mail_mime(array('eol' => $crlf)); | |
$mime->setTXTBody($text); | |
$mime->addAttachment($file_path, 'text/html'); | |
$body = $mime->get(); | |
$hdrs = $mime->headers($hdrs); | |
$mail =& Mail::factory('mail'); | |
$mail->send($emails, $hdrs, $body); | |
?> |
Thursday, February 02, 2012
Suhosin is disbled by default in Debian, and soon Ubuntu - i hope
I think is the right aproach
I don't believe in security by obscurity (this random patch it will secure your php ... riiight)
Did i told you that upstream doesn't test suhosin patch when they run the tests ?
And with that patch php core is not the same , there are some bugs that i found related to it (in debian/ubuntu) and it happens only when that invasive patch is applied
Wednesday, February 01, 2012
updating passenger in rails and ubuntu 10.3 lts
I had one issue with an old instalation of passenger and nginx (kernel 2.6.32 doesn't quite deliver signals to the nginx 0.8.x)
I download the current dark passenger
start the nginx wizzard
enter enter enter
and all is installed
Read what is needed to add to nginx config if you do an upgrade
mainly the new passenger path
I download the current dark passenger
wget http://rubyforge.org/frs/download.php/75548/passenger-3.0.11.tar.gz tar -zxvf passenger-3.0.11.tar.gz cd passenger-3.0.11/ rake package sudo su # and make me a sandwitch
cd pkg gem install passenger-3.0.11.gem
start the nginx wizzard
/var/lib/gems/1.8/gems/passenger-3.0.11/bin/passenger-install-nginx-modulechoose (1),(1)
enter enter enter
and all is installed
Read what is needed to add to nginx config if you do an upgrade
mainly the new passenger path
Please edit your Nginx configuration file (probably /opt/nginx/conf/nginx.conf), and set the passenger_root and passenger_ruby configuration options in the 'http' block, like this: http { ... passenger_root /var/lib/gems/1.8/gems/passenger-3.0.11; passenger_ruby /usr/bin/ruby1.8; ... } After you (re)start Nginx, you are ready to deploy any number of Ruby on Rails applications on Nginx. Press ENTER to continue.The END
encoding decoding strings in python3.x
I like to think of encoding of strings in python3 to the analogy of encrypting your plain text into a random stream of bytes
string (plain text) -> encode (encrypt) -> bytes (stream)
bytes (stream) -> decode (decrypt) -> string (plain text)
and the codec you choose is your key (utf-8 ...)
Subscribe to:
Posts (Atom)