7 Ocak 2015 Çarşamba

shrinking tables to gain space in database (Oracle Sql Developer)

When you delete rows, the rows may not be physically deleted and you may not get the used space back.  The case is explained in the post: http://laurenthinoul.com/how-to-fix-ora-01654-unable-to-extend-index-in-tablespace/

You can run the following sql to compute statistics :

analyze table   compute statistics;


You can view the statistics as in the picture:



try this sql to shrink:

alter table  enable row movement;
alter table  shrink space;
alter table  disable row movement;

analyze table  compute statistics;
commit;


however, this may give the following error due to the reasons here: http://agstamy.blogspot.it/2009/02/ora-10631-when-trying-to-shrink-table.html

SQL Error: ORA-10631: SHRINK clause should not be specified for this object
 "SHRINK clause should not be specified for this object"
*Cause:    It is incorrect to issue shrink on the object
*Action:   Verify the object name and type and reissue the command

in this case, you may try by removing the indexes, shrinking the table and recreating the indexes.

btw, truncating the table gives you the space back!

27 Kasım 2014 Perşembe

a lucene tip

Retrieving large resultsets with lucene may degrade performance as in here: http://stackoverflow.com/questions/9868419/how-to-get-total-count-in-hibernate-full-text-search 
You can choose to show the first top k results, or you can paginate lucene as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// can get the resultsize easily, so you know how many pages would be..
Integer resultSize = jpaQuery.getResultSize(); 
// I use 1000 as max results, but it depends.. just try to find the optimum.
Integer pageCount = resultSize / MAX_RESULTS + 1;
List<Object[]> rawQueryResultList = new ArrayList<>();
for(int page = 0; page < pageCount; page++) {  
 jpaQuery.setFirstResult(page * MAX_RESULTS);
 jpaQuery.setMaxResults(MAX_RESULTS);
  
 rawQueryResultList.addAll(jpaQuery.getResultList());
}

12 Haziran 2014 Perşembe

book: learning cypher

Cypher is the query language for Neo4j graph databases. In fact, in my thesis about user profiling, i use cypher and  i am plannig to write a post about cypher after publishing my system for evaluation..
http://www.neo4j.org/learn/cypher  provides good information about cypher.
Moreover, i am planning to review the book on http://bit.ly/QZ5Alw ..
i recommend to try graph databases and cypher if you are dealing with connected-data problems.. 

10 Haziran 2014 Salı

bitbucket - checkout by date

At work, we decided to upgrade the system and we did not tag the old version in bitbucket (since we were planning to upgrade definitely).. However, due to some extra work and time restriction the team could not able to achieve the goal and we decided to return back to an old version by date. To do this,
- open SourceTree
- open git with Terminal icon and run the command  git checkout 'master@{2014-04-01}'


- create a branch for the detached head.

https://answers.atlassian.com/questions/245850/how-to-run-a-git-command-as-a-custom-action
http://stackoverflow.com/questions/6990484/git-checkout-by-date
https://answers.atlassian.com/questions/263451/branches-for-commit-git

19 Mayıs 2014 Pazartesi

intro. to developing a Facebook app

In order to evaluate my thesis work, i have to prepare a website with a Connect with Facebook button. I am using Spring social api for Facebook functionality.
You have to enter your mobile phone and get a confirmation code to create a Facebook app from https://developers.facebook.com/ Apps tab. Unfortunately, this was a bit problematic for me, i waited more than an hour to get a confirmation code with sms. After creating a Facebook app, you obtain an app id and app secret. They are important for your application to run successfully. Moreover, in development mode, do not enter any app domain, but add your localhost address as a canvas url as explained in http://stackoverflow.com/questions/4532721/facebook-development-in-localhost.
Now, with the help of the app id and app secret, you are able to write your application..

Edit:
Facebook changed policy this month. The default Graph Api version is 1.0 for Facebook apps created before this month and 2.0 for apps created in this month. The facebook issues are summarized in http://www.nextscripts.com/known-issues/facebook-issues/