Friday, February 17, 2012

Delete mkv file from windows

I had a mkv file that I wanted to delete. So I opened the explorater, go to the folder, right click on the file and Delete. But then I have the error (something like that) : you can't delete this file because another process is using it.

Well, but I'm sure no other process is using it !

Problem 
How to delete mkv files ?

Solution
Well, I found this solution on Internet and it's easy. In fact, "explorer.exe" is using the mkv file.

Open a command prompt window (click here for more info).
Go to the folder where the mkv file is (keep the prompt open, we will use it later!). You can use the command "cd myVideos" for example. (click here for more info).

Open the Task Manager by pressing : ctrl + alt +  suppr. (other possibilities)
Choose "start task manager"
Open the "processes" tab
Select "explorer.exe" (be sure sure to select "explorer.exe" !!)
Click on "end process". Your icons and task bar will disapear, but that's ok. (don't close the task manager we will need it later).

Go to the prompt again and delete the file (del video.mkv).

Go to the task manager
Open the "application" tab
Click on "New Task...".
Enter "explorer.exe" (without double quotes!) and click "OK". Then your icons and task bar will appear !

And that's it

Wednesday, February 1, 2012

web2py plugin_wiki tag

In my website, I want the user to be able to add tags to a picture. I'm happy because I can see that there is a plugin in web2py to do that.
Have look here: web2py Plugin but, it said that the plugin tag is kind of deprecated and we have to use the plugin_wiki.
Attention: some of the plugins listed here are old (in particular jqgrid, comments, tagging, modal, dropdow, attachments, latex, flash video and deprecated). Newer versions have been incorporated into plugin_wiki.
So I watched the video explaining how to use the plugin_wiki. But I don't want to create pages using the plugin_wiki, I just want to add tags!

Problem 
How to just add tags to my view file without using the wiki interface ?

Solution 
In fact it's really easy. In the view file just add this : {{=plugin_wiki.widget('tags',table='thumbnail',record_id=thumbnail.id)}}

thumbnail is the name of my table.
thumbnail.id is the id column (as you can guess)

Then, if you want to modify the behaviors you can modify the plugin_wiki controller : controllers/plugin_wiki.py, there is an action for each plugin, so you'll find an action called "tags".
And you can modify the "view" of a tag : view/plugin_wiki/tags.html

That's it !

Saturday, January 21, 2012

Web2py - remove the "delete" check box

In web2py, the form displayed  to update form containing an input file is like this :
name + input text + "browse" button + [file + delete check box]

Problem : how can I remove this "delete" check box ? Because the image is required. If I check the value is not null, it returns false, because the value is empty.

Solution : it's really easy. In your file db.py just add: requires=IS_NOT_EMPTY
Field('data', 'upload',requires=IS_NOT_EMPTY())

And that's it !



Tuesday, November 8, 2011

web2py - add a foreign key to aut_user

I'm still doing my project in web2py, and I wanted to add a foreign key in my auth_user table.

Problem: in the file models/db.py, you first declare the tables auth_* and then the other tables. So if you add your foreign key you'll get an error because the "foreign table" doesn't exist yet.
Example :

auth = Auth(db)
auth.settings.extra_fields['auth_user'] = [Field('myFK', db.foreignTable)]
auth.define_tables() 

db.define_table('foreignTable',Field('name', length=45) )

So I tried to define my foreignTable before settings.extra_fields, but it didn't work either...

Solution :
The only solution I could find was the following :
auth = Auth(db)
auth.settings.extra_fields['auth_user'] = [Field('myFK', integer)]
auth.define_tables() 

db.define_table('foreignTable', Field('name', length=45) )

db.auth_user.myFK.requires = IS_IN_DB(db, 'foreignTable.id', '%(name)s', zero=T('choose one')) 
At first I declare my column as an integer, and after I define my foreignTable. Then I link myFK to my foreignTable.

And that's it!

Thursday, October 13, 2011

How to install web2py on a shared host

I'm working on a project with a friend using web2py
Free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications. Written and programmable in Python.
Official website

Now that we are ready to upload our website, we were looking for good shared host. It was not easy to find a good one. Finally we choose Site5 because it supports Python and the server is in Montreal.

Problem:
how to install web2py on a shared host ?

Solution:
I could find this website : web2py on shared hosting.
I followed the instructions from "Installing web2py".

When you do this, here is the url to see your app :
http://www.mydomain.com/web2py/mySuperApp/default/index

But what we wanted was something like that :
http://www.mydomain.com

So here are the modifications :
- move all the web2py files directly to "public_html".
Before : $HOME/public_html/web2py/web2py.py
After : $HOME/public_html/web2py.py
(it's just an example with web2py.py file, but you should move all the files!)

- edit $HOME/public_html/routes.py, your file should just contains :
routers = dict(
    BASE = dict(
  default_application='mySuperApp',
  domains={'mydomain.com' : 'mySuperApp'},
    ),
) 
*routers is a new feature of web2py. This parameter-based system first appeared in web2py version 1.92.1.
If you want to know which version of web2py you're using, just open the file $HOME/public_html/VERSION
 
And that's it ! Now you can access your application simply by using : www.mydomain.com !

Thursday, July 28, 2011

Adding Syntax Highlighting to Blogger

Problem
How to add syntax highlighting to Blogger ?

Solution
I couldn't find a better way than this website :
http://heisencoder.net/2009/01/adding-syntax-highlighting-to-blogger.html
That helped me a lot !

Android Mini Collectibles

*2011-08-09 The figures that I'm talking about are fake! Please read the comments

Today I'm not going to talk about software problem.
I want to talk about the Android Mini figures. I bought some and I'm not totally satisfied by the finishing.
Of course if you look at the official website (Dyzplastic) it looks very nice. And I think 80% of the time it is nice.
But here are some "bugs" that I could see.

1) Head
As you can see on the picture, there are 2 Reactor, but the one on the left has some strange stain on his head.

2) Paint
This looks like the painting was not done correctly

3) Dirty
This other Albino looks dirty (not as white as the other one)

4) Glue
The box opened by itself from the bottom. Cheap quality glue...


Well, the price of these figures is cheap but I was expecting something better from Google.