/* //---------------------------------------------------------------------------- // Getting list of all files for given directory // Arguments // pszDirectoryPath : Directory path // pszFiles : Fill up file names in it // Return int : No of files found in given directory //----------------------------------------------------------------------------*/ int GetFilesNames(const char *pszDirectoryPath, char **pszFiles) { WIN32_FIND_DATA findFileData; HANDLE hFind = INVALID_HANDLE_VALUE; int nIndex = 0; hFind = FindFirstFile(pszDirectoryPath, &findFileData); if (hFind == INVALID_HANDLE_VALUE) { return 0; } do { if(!(findFileData.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY)) { pszFiles[nIndex] = (char *) calloc(BUFFER_SIZE, sizeof(char)); strcpy(pszFiles[nIndex], findFileData.cFileName); //printf("\n===> %s", pszFiles[nIndex]); nIndex++; } } while(FindNextFile(hFind, &findFileData)); FindClose(hFind); return nIndex; }
Let's share it
Wednesday, 21 May 2014
C / C++ : Getting list of all files for given directory
Labels:
C & C++,
Programming
Friday, 31 August 2012
Track your lost devices like laptops & mobiles
I want to discuss about a system called as PREY
Its let's you to keep track of your expensive devices like
laptos, tabs & mobiles,
It can easily runs with windows, anroid, iOS
How it works if you lost your devices
- Its install into your pc in hidden mode, so thief cannot see it
- From remote location via internet you can send message of theft.
- Application can detect the location
- Sends the screen shots & picture of thief in case of laptop
- You can track the activities
You can find more details about it on http://preyproject.com/
Labels:
Utilities
Thursday, 30 August 2012
How to manage all passwords
Its really too difficult to manage & remember all the login information, if we are not regularly using some web accounts it may happen that after a time either we forgot login name or the password. Some time it also take long time to recollect the login information.
Some of us use same password for all the logins or use some pattern to memorize all the password which is not a good idea.
Recently searched for the same and I found a good tools for that which I have described below
This tool allow us to set a master password & other all our logins are managed.
It gives plug-in for browser, after installing the plug-in when we enter the login information it ask to save the info. once we save the info next we don't need to worry about the login info username & password are automatically inserted & also offer for auto login.
we can use this tool for form filling, Fill the form information in advance and use it when ever required.
One feature about this tool which I liked most is
we can share our password to our friends & that also without showing the password, isn't it COOL
- Combines a web service with a stand-alone program
- Packed with features such as automatically filling in passwords, and accessing your passwords anywhere.
- Internet Explorer 6+, Firefox 2.0+, Chrome 4+, Opera 11+, Safari 5+
- Freeware and also provide premium accounts with other facilities
- Download link, Get free LastPass Premium account
Labels:
Utilities
Thursday, 26 July 2012
C# File copy application, Learning file manipulation [source code attached]
This is a simple file copy application in which you will going know about file handling functions and also some threading concepts available in C#
Overview of application
- Developed in visual studio 2008, language C#
- It's a Windows forms application
- Only one instance can run at a time (using SingleExecution.cs)
- FileCopy.cs contain main logic for program
- Defination.cs is a static class holding the labels used within program
- Download : Source code, Application
Labels:
C#
Thursday, 12 July 2012
Thursday, 31 May 2012
Understanding JPA entities
- A JPA entity is a java class referring to one row of a table
- Each entity has same number fields/properties as in table structure
- It can be with or without relationship
- that is One to one, One to many or many to many
- Consider the following table structure for one to many relationship
- For above table structure two entity will be created
- Categories.java (manage Categories table)
- Products.java (manage product table)
////////////////////////////////////////////////////////////////////// // CATEGORIES package entities; import java.io.Serializable; import javax.persistence.*; import java.util.List; /** * The persistent class for the Categories database table. * */ @Entity @Table(name="Categories") public class Categories implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="CategoryId", unique=true, nullable=false) private String categoryId; @Column(name="CategoryName") private String categoryName; @Column(name="Description", length=50) private String description; //bi-directional many-to-one association to Products @OneToMany(mappedBy="category", cascade={CascadeType.PERSIST, CascadeType.REMOVE}) private Listproducts; public Categories() { } public String getCategoryId() { return this.categoryId; } public void setCategoryId(String categoryId) { this.categoryId = categoryId; } public Object getCategoryName() { return this.categoryName; } public void setCategoryName(String categoryName) { this.categoryName = categoryName; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } public List getProducts() { return this.products; } public void setProducts(List products) { this.products = products; } } ////////////////////////////////////////////////////////////////////// // PRODUCTS package entities; import java.io.Serializable; import javax.persistence.*; /** * The persistent class for the Products database table. * */ @Entity @Table(name="Products") public class Products implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="ProductId", unique=true, nullable=false) private String productId; @Column(name="ProductName", length=50) private String productName; @Column(name="Supplier", length=50) private String supplier; //bi-directional many-to-one association to Categories @ManyToOne @JoinColumn(name="CategoryId") private Categories category; public Products() { } public String getProductId() { return this.productId; } public void setProductId(String productId) { this.productId = productId; } public String getProductName() { return this.productName; } public void setProductName(String productName) { this.productName = productName; } public String getSupplier() { return this.supplier; } public void setSupplier(String supplier) { this.supplier = supplier; } public Categories getCategory() { return this.category; } public void setCategory(Categories category) { this.category = category; } }
- Above two class represent two tables Categories and products
- You need to import javax.persistence.*
- Using above classes & EntityManager we can fetch data from database
- Consider the following code ....
public static void main() { // Creating entity manager to create Db query EntityManagerFactory factory = Persistence.createEntityManagerFactory("WebWithJPA"); javax.persistence.EntityManager em = factory.createEntityManager(); try { // Creating Query using JPQL Query objQuery = em.createQuery("select c from Categories c"); // Getting result set in List ListobjC = (List ) objQuery.getResultList(); // Listing all categories and its related products for (Categories c : objC) { System.out.println("Category Name: " + c.getCategoryName()); for (Products p : c.getProducts()) { System.out.println("* " + p.getProductName()); } } }
Wednesday, 21 December 2011
Java EE Class [com.microsoft.sqlserver.jdbc.SQLServerDriver] not found.
Error description:
- unable to load SQL server drivers
- need to add it in project
How to add it ?? (Ref to Eclipse 3.7.1 indigo)
- download sqljdbc4.jar & sqljdbc.jar
- Add library into Eclipse project
- Right click on project menu -> properties -> Java build path -> Libraries
-> Add External jar
- Add same sqljdbc4.jar file in Deployment Assembly
Right click on project menu -> properties -> Deployment Assembly -> Add
I hope it can be solved !!
- unable to load SQL server drivers
- need to add it in project
How to add it ?? (Ref to Eclipse 3.7.1 indigo)
- download sqljdbc4.jar & sqljdbc.jar
- Add library into Eclipse project
- Right click on project menu -> properties -> Java build path -> Libraries
-> Add External jar
- Add same sqljdbc4.jar file in Deployment Assembly
Right click on project menu -> properties -> Deployment Assembly -> Add
I hope it can be solved !!
Subscribe to:
Posts (Atom)