Saturday, November 3, 2018

Python Django error

Image result for django python
When I ran python panel/manage.py startapp APPNAME I got the following error.
"Error: 'APPNAME ' conflicts with the name of an existing Python module and cannot be used as an app name. Please try another name."

When you start an application you are creating an app with name APPNAME within the django project. When you create the project itself, a folder would have been created within the project folder with the same name of the project. So you application name is expected to be different than that project name. 



Create a python django project



django-admin.py startproject testproject
 
This will create a project container within which you can have multiple applications.
 
Creating a python django app 
#Get into the project folder 
cd testproject
 
#Creating an application named 'test' 
python manage.py startapp test
 
If the name of the project and the app are same, then the above mentioned error will appear
 
 
 
  

Saturday, October 11, 2014

Notepad++ and Regular Expressions

Notepad++ had been one of my favorite tool for writing scripts, editing and formatting. Regular expression support that has makes it very powerful tool in analyzing logs, by searching/replacing patters.



1.String that contains a pattern
     abc.*  matches with abc, abcd, abc pqr,See the highlighted text below.


2. Line starting with a string

^abc.* matches with the lines that starts with abc.* . See the highlighted test below.

3. Lines that ends with a particular pattern
abcd$ matches with all the lines that ends with abcd as shown below.

4. Lines that starts and ends with a particular pattern

(a)   ^abcd$ matches with all the lines that has only abcd in it.

(b)  ^a.*g$  matches with all the line that starts with a and ends with g.

 5. Patters with a character that can occur more than once in a pattern
     a+ matches with all the occurrence of a as shown below.








6. Lines that doesn't have a pattern
    Here is an example of searching for a line that doesn't have  apostrophe ( ' ) in it.
    ^(?!.*').*$









7. (Below is the example that shows the search of lines with apostrophe
^.*'.*$

)






8. ^(?!.*(hello)).*$  This selects lines that doesn't have "hello" in it.



9. Replacing all comments starting with // with /* */
Find what: ^\/\/(.*)$
Replace with: /*$1*/

10. Swapping two sides of =
Find what: ^(.*)=(.*)$
Replace with: $2=$1

Friday, October 10, 2014

Fail to load the JNI shared libray

Eclipse was giving this problem when I tried to launch.










To solve this edit eclipse.ini and add '-vm' argument.
-vm 
C:\Program Files\Java\jre7\bin\javaw.exe

The parameter to -vm needs to be on a separate line following the parameter. You will continue to get the same issue otherwise.

Please make sure that the path of javaw.exe is correct.
 




View My Stats

Click here to submit your site to the search engines for free!