Search Results: "Jose Luis Rivas Contreras"

2 September 2012

Jose Luis Rivas Contreras: Finally a workaround for htop drawing issue inside tmux!

I was tired that htop didn t showed up the info as is, and started to google about it. Aparently there s an issue with the drawing stuff for bold and not-bold fonts, and most workarounds consists on making htop showing things on black and white. Then, lazyness came to my mind and used:
TERM=screen htop
Wala! It worked, and showed htop with colors! 12 colors of course, but I don t need more!! So after that I just echoed that line to my ~/.bash_aliases and is pretty much done for a while, at least for me. It works!

30 June 2012

Jose Luis Rivas Contreras: Newer Node.js + NPM installed separately, execvp() error

I got an awfull bug with npm after installing Node.js 0.8.0 and trying to do an npm -g update. The solution was deleting npm from /usr/local and with nave reinstall 0.8.0. After this my npm was working perfectly but that made me loose like 12 hours. (I thought was a bug in an app I m writing, I totally forgot I ran npm -g update.)

3 June 2012

Jose Luis Rivas Contreras: Little CoffeeScript to resize images

I needed to resize about 300 images and couldn t find an easier way to do this than with help of node + CoffeeScript. So here s my script, it requires you to install (via npm) imagemagick and underscore: <script src="https://gist.github.com/2862235.js?file=resize.coffee"></script> Grab it if you want, is under Do Whatever You Want license. As you can see from the shebang (that s the first line of the script, with the #!) I ran it from my command-line, this was not used in a website, although it could without too much modifications (the magic of JavaScript).

28 April 2012

Jose Luis Rivas Contreras: Tracker eating my memory cache

UPDATE I removed tracker, when I rebooted my machine again my memory cache got ~1000M again, and again, and again. I didn t knew it existed until recently, that I saw all my memory was eaten up and suddenly I was using my SWAP instead of my memory, and it was fully loaded. What s my surprise? I have 2G in memory and 1113M of it was cache, and 1G of swap full as well. The worst thing is that I reboot my machine and without starting anything I get 903M of cache full, out of nowhere! I start to track what s the issue, where s the leak, and found that if I killed tracker-store early then my memory stopped being loaded of cache. There s a bug, already reported, it s #612242 and the workaround given is to nuke the database with tracker-control -r. It worked. Now my cache is not full, but since I just did it I don t know if in some days my tracker-cache will be full again and eating all my memory. Just wanted people know there was a work-around at least and you could use your computer again.

12 February 2012

Jose Luis Rivas Contreras: Express Sessions with connect-redis + Socket.IO in CoffeeScript

If you are working with Socket.IO and Express Framework while developing your applications you must know they work together so Socket.IO will listen on the same port that your HTTP/S server and will serve the requests by that way, but Socket.IO doesn t works on the same paradigm where you pass a middleware to the route and you could get authentication on this manner. Instead, you must configure Socket.IO with a global authorization method or a handshake authorization manner. Since in my applications I serve cookies already where I save session info and this is already stored in Redis with help of the module connect-redis then I should be able to get this info onto Socket.IO authorization method and with this allow only to authorized users to get info from my websockets. I found how to do it with the default session-store in-memory from Express, and adapted that so it could work with Redis. Here s the snippet: <script src="https://gist.github.com/1805743.js"> </script><noscript>You don t have JavaScript enabled, check it out at gist.github.com </noscript> Hope anyone can found it useful!

5 November 2011

Jose Luis Rivas Contreras: Polipo and uncachable file

Dear lazyweb, I was searching through the internet what was I doing wrong, I wrote to the polipo-user list but my email got stuck on moderation, and my connection is really shitty (that s why I m using polipo the way I m using it). I have relaxTransparency and mindlesslyCacheVary set to true, but I don t need so aggresive caching in my development stages that are located under *.local and another development subdomain on the net. Already tried setting uncachableFile to /etc/polipo/uncachable and to ~/.polipo-uncachable, according to the web-config thing is properly setted up, but can t get it to recognize it s content. I first thought it was I was writing bad the regex, .*\.local but it does work in the /etc/polipo/forbidden file. Besides, adding complete domains to the uncachable file doesn t works neither. Could someone confirm this or throw me a hand on this? I m using 1.0.4.1-1.1 version which is the last one on unstable repos.

26 October 2011

Jose Luis Rivas Contreras: and issues on vim with $TERM= screen

Because of tmux I run with $TERM= screen instead of my regular rxvt-unicode, but I had a big issue with VIM because of this, it kept writing and F\n and H\n each time I pressed <end> and <home> keys respectively. I finally found the way to solve this, making VIM use $TERM= xterm internally writing this on my ~/.vimrc:
if &term == "screen"
set term=xterm
endif
So, this way, even in my servers without XTerm installed (but ncurses-term) I can use VIM as I m used to.

2 October 2011

Jose Luis Rivas Contreras: Moving from Screen to Tmux

I ve been a long-time user of GNU Screen, as almost every person I know that spend a lot of time in a terminal. I must admit I was happy, I really was. I was used to my workflow with 4 terminals 8 25 and a bunch of screens, with several nested-screens. I used awesome-wm before, so definitely I felt I wasn t using all the space in my laptop screen (my laptop is a ThinkPad X61, so 1024 768 in a 12 inches-screen) but that was OK, after all my workflow was, well, good. Until 2 days ago, I was told to try tmux, in fact, I was told and why are you using screen? use tmux . As a daily-user of Screen my first reaction was I m used to , I can use it as I want , and a lot of excuses for just not trying something new. But then I made a little research (on Google, of course). In about 30 minutes I ended up with a multiplexer working as I wanted and as I never got Screen to work. Finally I was using just a terminal and using all the space available in my tiny-laptop-screen and plus: saving a lot of bandwidth with my permanent SSH connection (a really big plus now that I m living with a capped link to the net with a GSM-modem). I changed the Ctrl-b shortcut to Ctrl-a (b is too far for using it with only one hand), configured so I could use nested tmux es like screen when I push Ctrl-a a, activated visual monitoring and even got to use the tmux s buffer along with my X11 buffer when I press Ctrl-a >!! It s all in my ~/.tmux.conf, use it at will. Later I will make a screencast about using tmux, so more people can get a working tmux easily. ATM, I m even more happy than I was with GNU Screen, so, any other recommendation, people?

13 September 2011

Jose Luis Rivas Contreras: Changing background sync d with jQueryUI Tabs

I love to use jQuery UI plugins. The one I use constantly is Tabs and this time I needed to sync the auto-changing of tab with the background. For this I used an event called tabsshow to trigger my function + the code I wrote yesterday for full-page background with CSS:
/* @author Jose Luis Rivas <joseluis@eserre.com>
*
* @desc swaping full-background pages with jQuery UI's Tabs plugin events.
*/



$(document).ready(function()

$( "#slides" ).bind( "tabsshow", function(event, ui)
var tabattr = $('.ui-state-active').find('a').attr('href');

switch(tabattr)
case '#tab1':
$('img#bg').attr('src', '/img/tab1.jpg');
break;

case '#tab2':
$('img#bg').attr('src', '/img/tab2.jpg');
break;

default:
$('img#bg').attr('src', '/img/tab1.jpg');
break;


);

);
What it does the script? Finds the active-tab identified with the .ui-state-active class and then changes the img tab src attribute according to the href attribute of the active-tab.

12 September 2011

Jose Luis Rivas Contreras: Full-Page Background with CSS with crossbrowser support

I ve been trying to get the perfect full-page background without using JavaScript since a while. I tried with CSS3 but, obviously for IE <9 was a pain in the ass, even for older Firefox' releases. So I decided to go with the plain-CSS option:
<!doctype html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<img id="bg" src="/img/bg.jpg">

<p>Content</p>
</body>
</html>
img#bg
min-width: 100%;
min-height: 100%;

/* Proportionate re-dimension */
width: 100%;
height: auto;

position: fixed; top: 0; left: 0;

z-index: -1;
What does it does? It takes an inline image and uses it as if were a background-image thanks to the z-index: -1 CSS-rule. There are lots of other techniques at CSS-Tricks but none works in every browser as this one in particular. Enjoy.

8 September 2011

Jose Luis Rivas Contreras: Moved from approx to apt-cacher-ng

I have been a long-time user of
approx
, I got used to it and knew how to configure it so all my machines + VMs used the same cache and saved me a lot of bandwidth. But that was when I got a stable connection at >100KiB/s in a daily-basis. Now I m with a mobile connection at <30KiB/s and sometimes is intermittent, so
approx
started giving me a lot of headaches. When
approx
tries to connect a host that can t be resolved its domain name, then gets 404. How does that reflects in the
/pool
? Well, you get a file
touch
d and 0 bytes size. When you try again,
approx
will find the same file with 0 bytes size and will gives you again a 404, even if you can now resolve the name address of that domain. And as I like to use what I know, then I made a workaround: Each time this happened I ran:
# find /var/cache/approx -size 0 xargs rm
So next time I requested a file to
approx
it tried to connect to the host. But I got tired. I installed
apt-cacher-ng
, tweaked a bit
/etc/apt-cacher-ng/acng.conf
so it uses port 9999 and the cache dir redirects to the same cache than
approx
and done.
apt-cacher-ng
returns 503 when it can t connect to the peer, even tries to several repositories with only a line in
/etc/apt/sources.list
in my clients. It makes me happy and keeps saving me a lot more of bandwidth than
approx
.

2 February 2011

Jose Luis Rivas Contreras: No more TweetDeck for me, on AIR

I changed (once again) to awesome and AIR applications doesn t work here. One of the apps I heavily use based on AIR is TweetDeck. So I tried old clients that were once an alternative like HootSuite but not having support for both kind of RTs (Native and Quote) is a pain in the ass. Then I remembered I installed once TweetDeck for Google Chrome on my browser and never give it a chance, because it was not exactly the same as the AIR-based app. Now it only lacks proper relation between followers and no-followers in each account when there are multiple accounts configured. So yesterday was the day to try it, the right day. It even has notification support, and customized by column!

30 January 2011

Jose Luis Rivas Contreras: ThinkPads and Amarok2 Multimedia Keys

I love Amarok, since the beginning. But I have had issues since I moved from awesome (and didn t knew it was coincidence) with my multimedia keys. Today I discovered a script called Gnome Multimedia Keys 2 for Amarok2 and now I got it working again, after trying with Banshee, Rhytmbox, Songbird, Exaile I went back to Amarok :D

23 January 2011

Jose Luis Rivas Contreras: WordPress: URL change and cookies issues

I had a site under alpha.mydomain.tld and when I changed it to www.mydomain.tld I did it trough the Settings of WordPress without changing anything else. I added the new domains to my nginx-configuration without removing the alpha subdomain and I got a lot of issues with WordPress cookies. By e.g., I logged in to /wp-admin, closed that tab and reopened in a while and I got to re-login, even if I set Remember Me . After checking, re-change of URL and things like that I just removed the alpha subdomain from my nginx-configuration and everything got solved. Yes, is stupid, but it happens.

22 January 2011

Jose Luis Rivas Contreras: WordPress: Paginating with query_posts()

I discovered, in not a very amusing way that if you use query_posts() then the variables for paginating with The Loop stop working. Fixing this is easy, just add to paged option on the array the variable $paged, in this way:
query_posts(
    'posts_per_page'    => 15,
    'paged'                 => $paged,
);
Or if you don t use it like this, then:
query_posts('posts_per_page=15&paged=' . $paged);
After this, using posts_nav_link() actually works.

3 January 2011

Jose Luis Rivas Contreras: Dear Lazyweb: Arrange posts on WordPress by weight

I have searched all these days a WordPress plugin that let s me arrange my posts by weight or some kind of score system so I can do something like:
query_posts('category_name='.$current_category.'&posts_per_page=1&min_weight=80&max_weight=100');
Then only shows the last post with a weight between 80 and 100, and so on. Any clue of any plugin that does anything at least similar?

Jose Luis Rivas Contreras: 413: Request Entity Too Large with nginx

I m working on a big site, importing a lot of files to a WordPress installation and started to get a bunch of 413 s. After a little bit of googling I found out what was happening: What needs to be done is on /etc/nginx/nginx.conf write:
http  
    client_max_body_size 20M;
    include       /etc/nginx/mime.types;
    A LOT MORE SETTINGS...
Yes, just add client_max_body_size and restart your webserver. This by default is 1M, so anything beyond this will be refused.

30 December 2010

Jose Luis Rivas Contreras: snipmate.vim snippets

I m a long-time snipmate.vim user and I ve been adding occasionally some snippets to it, and today I want to share it to everyone who may be interested on using them. All of them are CSS3, Javascript and HTML5 related, plus 2 (or something) for PHP+WordPress. Anyway, if any of you use WordPress+PHP and use snippets please, let me know. I m working on WordPress these days and some snippets would help me a lot. You can download my snippets from my github, hope its useful for anyone.

28 December 2010

Jose Luis Rivas Contreras: Follow-up[2]: pino-0.3+librest (and not cmake, at all)

So, after having troubles while trying to compile pino-0.3 it turns out is has nothing to do with cmake, nor with librest not shipping gir files but with vala bindings and incompability between those bindings from rest-0.6 and rest-0.7. So if I really want to compile pino-0.3 I have two options: use rest-0.6 or update rest.vapi for vala and send a patch for pino-0.3 to get a working code with rest-0.7 and it s new vala bindings But there s not enough free time for me this holidays so, maybe next time :-/ Anyway, thanks to all those who helped :)

27 December 2010

Jose Luis Rivas Contreras: Follow-up: pino0.3+cmake (and now librest)

Last night I made some changes to what I made for compiling pino0.3: patched CMakeLists.txt so uses rest-0.7 and rest-extras-0.7 and now the last issue is not a problem anymore, but now the error is that can t found them while compiling (here s in paste.debian if you can t see it nicely formatted):
/usr/bin/cmake -E cmake_progress_report "/tmp/buildd/pino-0.3+hg~20101225/obj-i486-linux-gnu/CMakeFiles" 47
[  2%] Generating src/stream_abstract.c, src/globals.c, src/twitter_favorites_stream.c, src/meta_row.c, src/search_interface.c, src/search_dialog.c, src/text_input.c, src/template.c, src/identica_create_dialog.c, src/updates_cell_renderer.c, src/stream_state.c, src/twitter_stream_mentions.c, src/accounts.c, src/accounts_types.c, src/main.c, src/hig_table.c, src/main_window.c, src/twitter_parser.c, src/twitter_recursive_reply.c, src/utils.c, src/identica_account.c, src/settings.c, src/visual_style.c, src/status_choose_bar.c, src/time_utils.c, src/status_box.c, src/menu_indicator.c, src/account_abstract.c, src/stream_meta.c, src/streams_types.c, src/content_view.c, src/img_cache.c, src/tree_widget.c, src/twitter_stream_public.c, src/icon_with_status_cell_renderer.c, src/account_state.c, src/create_dialog_generic.c, src/twitter_create_dialog.c, src/twitter_stream_abstract.c, src/status.c, src/twitter_stream_home.c, src/twitter_account.c, src/pino_enums.c, src/twitter_stream_search.c
/usr/bin/valac -C -b /tmp/buildd/pino-0.3+hg~20101225 -d /tmp/buildd/pino-0.3+hg~20101225/obj-i486-linux-gnu --pkg=glib-2.0 --pkg=gobject-2.0 --pkg=gtk+-2.0 --pkg=gee-1.0 --pkg=gio-2.0 --pkg=libnotify --pkg=libsoup-2.4 --pkg=libxml-2.0 --pkg=webkit-1.0 --pkg=unique-1.0 --pkg=rest-0.7 --pkg=rest-extras-0.7 --thread -g --save-temps -D LIBINDICATE /tmp/buildd/pino-0.3+hg~20101225/src/stream_abstract.vala /tmp/buildd/pino-0.3+hg~20101225/src/globals.vala /tmp/buildd/pino-0.3+hg~20101225/src/twitter_favorites_stream.vala /tmp/buildd/pino-0.3+hg~20101225/src/meta_row.vala /tmp/buildd/pino-0.3+hg~20101225/src/search_interface.vala /tmp/buildd/pino-0.3+hg~20101225/src/search_dialog.vala /tmp/buildd/pino-0.3+hg~20101225/src/text_input.vala /tmp/buildd/pino-0.3+hg~20101225/src/template.vala /tmp/buildd/pino-0.3+hg~20101225/src/identica_create_dialog.vala /tmp/buildd/pino-0.3+hg~20101225/src/updates_cell_renderer.vala /tmp/buildd/pino-0.3+hg~20101225/src/stream_state.vala /tmp/buildd/pino-0.3+hg~20101225/src/twitter_stream_mentions.vala /tmp/buildd/pino-0.3+hg~20101225/src/accounts.vala /tmp/buildd/pino-0.3+hg~20101225/src/accounts_types.vala /tmp/buildd/pino-0.3+hg~20101225/src/main.vala /tmp/buildd/pino-0.3+hg~20101225/src/hig_table.vala /tmp/buildd/pino-0.3+hg~20101225/src/main_window.vala /tmp/buildd/pino-0.3+hg~20101225/src/twitter_parser.vala /tmp/buildd/pino-0.3+hg~20101225/src/twitter_recursive_reply.vala /tmp/buildd/pino-0.3+hg~20101225/src/utils.vala /tmp/buildd/pino-0.3+hg~20101225/src/identica_account.vala /tmp/buildd/pino-0.3+hg~20101225/src/settings.vala /tmp/buildd/pino-0.3+hg~20101225/src/visual_style.vala /tmp/buildd/pino-0.3+hg~20101225/src/status_choose_bar.vala /tmp/buildd/pino-0.3+hg~20101225/src/time_utils.vala /tmp/buildd/pino-0.3+hg~20101225/src/status_box.vala /tmp/buildd/pino-0.3+hg~20101225/src/menu_indicator.vala /tmp/buildd/pino-0.3+hg~20101225/src/account_abstract.vala /tmp/buildd/pino-0.3+hg~20101225/src/stream_meta.vala /tmp/buildd/pino-0.3+hg~20101225/src/streams_types.vala /tmp/buildd/pino-0.3+hg~20101225/src/content_view.vala /tmp/buildd/pino-0.3+hg~20101225/src/img_cache.vala /tmp/buildd/pino-0.3+hg~20101225/src/tree_widget.vala /tmp/buildd/pino-0.3+hg~20101225/src/twitter_stream_public.vala /tmp/buildd/pino-0.3+hg~20101225/src/icon_with_status_cell_renderer.vala /tmp/buildd/pino-0.3+hg~20101225/src/account_state.vala /tmp/buildd/pino-0.3+hg~20101225/src/create_dialog_generic.vala /tmp/buildd/pino-0.3+hg~20101225/src/twitter_create_dialog.vala /tmp/buildd/pino-0.3+hg~20101225/src/twitter_stream_abstract.vala /tmp/buildd/pino-0.3+hg~20101225/src/status.vala /tmp/buildd/pino-0.3+hg~20101225/src/twitter_stream_home.vala /tmp/buildd/pino-0.3+hg~20101225/src/twitter_account.vala /tmp/buildd/pino-0.3+hg~20101225/src/pino_enums.vala /tmp/buildd/pino-0.3+hg~20101225/src/twitter_stream_search.vala /tmp/buildd/pino-0.3+hg~20101225/src/vapi/config.vapi
error: rest-0.7 not found in specified Vala API directories or GObject-Introspection GIR directories
error: rest-extras-0.7 not found in specified Vala API directories or GObject-Introspection GIR directories
Compilation failed: 2 error(s), 0 warning(s)
make[3]: *** [src/stream_abstract.c] Error 1
make[3]: Leaving directory  /tmp/buildd/pino-0.3+hg~20101225/obj-i486-linux-gnu'
make[2]: *** [CMakeFiles/pino.dir/all] Error 2
make[2]: Leaving directory  /tmp/buildd/pino-0.3+hg~20101225/obj-i486-linux-gnu'
make[1]: *** [all] Error 2
make[1]: Leaving directory  /tmp/buildd/pino-0.3+hg~20101225/obj-i486-linux-gnu'
dh_auto_build: make -j1 returned exit code 2
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
E: Failed autobuilding of package
I: unmounting /var/cache/pbuilder/ccache filesystem
I checked and found out that librest doesn t ships the gir files so downloaded sources for librest and made a patched version that ships gir files (rest and rest-extras) but nothing changed. Any suggests, anyone?

Next.