Monday, June 8, 2020

As a developer, How to keep up with rapid change in technology


1- focus on the basics and concepts, technology changes just to meet basics better from my POV, as a Software Engineer, I think I am working on the most rapidly changing area in the world, technologies in software are literally changing daily and you will never be able to cope with all that is coming to market, so focus on the basics, learn why technologies evolved, what problems a new technology addressed which was in an old one, why do people adopt a technology / principle and why they abandon other, how politics influence technology (the oracle/google case for example)
2- Learn from others, you will never be able to do everything, so make periodic meetings with your colleagues, managers or subordinates, and discuss with them how each one of you addressed a certain problem
3- Lifelong learning is a must
4- Try to keep a reference for everything you learned and did, especially difficult and repeating problems so that you can come back to it easily after that ... you can also make like a knowledge hub with your colleagues to include the same for all of you

5- Be ready for the change, don’t be rigid, wake up every day with the spirit of “I might be doing / learning something entirely new today”

My Reflections on Self-Assessment tests (Myers-Briggs as an example)

Disclaimer : The mentioned here is a personal opinion


1-    Despite all the warnings before taking the test about telling your real behavior, what you really do rather than what you think yourself are … I think it’s still unavoidable to answer based upon the image you want for yourself rather than the reality, yet it’s still useful because it will reflect some (or a lot of, based on how much objective are you) the truth

2-    The test is somehow showing the extreme result I think, for example, If you are INTJ, the description of the personality given is that for 100%I, 100% N, 100% T and 100% J, for those who get low scores in any (50%), this will not be very relevant, yet it still gives some insights about some properties of your personality

3-    The test is mood-dependent , for example, imagine someone doing this test after a big problem happened for himself due to his poor planning on one issue, and imagine the same person did it after a great success or promotion he got, I think the answers to the questions (and hence the results) will be different, we are still humans

4-    When you take the tests, know more about this character represented in the result (I said the character not you), then you behave in some situations with a different behavior that was expected from this character (ex: got nervous when you were expected –according to the assessment- to be calm), you might start asking yourself, “why did I do that? I ought not to have done it –according to my personality-?” … I don’t like this, I think this made us escape from one kind of stereotyping to another which we created by our hands (this is yourself and this is how you ought to behave), yes we need to follow up on our personal behavior, but we shouldn’t judge our every single action against an expected personality.

5-    The questions are sometimes culture dependent, ex: asking about selecting liberal candidates in elections, asking about some kind of art like music, sculpturing, films and such, these things –and similar- might be seen in America –or the west generally- with different perspective than in the middle-east, India or china for example, I think openness trait should be examined with different set of questions that are not culture-dependent

6-    Still have concern about being restricted to measure only and specifically these 4 aspects of personality and use it to estimate the whole personality. The four aspects are chosen by the test creators for a certain reason and they admitted that there are other (hundreds) of aspects that are present but can’t be included in the test practically, however the 4 aspects are chosen according to a criteria that might not be suitable for you or for the reason you are taking the test

7-    Still I think it’s generally a good thing and helps knowing the strengths and weakness points for oneself

Wednesday, February 7, 2018

JPA query enhancement

As I mentioned in my answer to this question on stackoverflow , I mentioned some useful tips to enhance your hibernate query performance :

1- use @NamedQuery instead of @Query
2- For reporting queries, don't run it inside a transaction
3- You can set the flush mode to COMMIT if you don't need to flush the persistence context before the query runs
4- check the generated query, take it and run it on SQL developer od TOAD, check its cost and run strategy, you can also consult your DBA if you can enhance it with some native DB functions / provcedures , hence use a native query instead of JPQL query
5- if data returning is large, consider making this query a DB view or materialized view and calling it directly
6- make use of query hints to activate a certain index for example, note that indexes may be ignored in case of JPQL
7- you can use native query if the query hint didn't work on JPQL
8- While comparing the query on SQL Developer with that from the code make sure that you are comparing right , the query might run very quickly initially on DB directly but takes loong time to fetch all the data , and you might be comparing this initial short time with the application data fetch time
9- use fetch size hint according to your provider
10- According to my knowledge, you might escape prepared statement if you use native non parametrized query (thus using manual placeholders and replacing values manually) but generally this should be used with care and avoided as much as possible because of SQL injection vulnerabilities and also disallows the DB query engine from as well as the hibernate engine from precompiling the queries

Wednesday, May 25, 2016

Windows 7 or Ubuntu, a developer's POV

When I started ubuntu for my desktop years ago, I had three targets :

1- be familiar with linux, for better tackling with our integration/production servers.
2- better understanding for OS, since you will rely much on the terminal instead of GUI
3- security, no malicious exe on my usb flash will harm my PC

the results -respectively- where :

1- somehow, not much
2- a little, as I was just struggling here and there to find how to make things work
3- Yes yes yes

but I -both as a developer and and an end user- faced many problem, that can be summarized to "productivity killer" and "no easy way to ...."

1- No GIT client as easy and free as tortoise GIT (some friends adviced to settle for GIT bash but I wasn't convinced)

2- If you do any freelancing work, most of your clients will be windows users, so you need to simulate their environments as much as possible.

3- One of my projects where killed because I wasn't able to install a third party mysql library that my code rely on - 4 nights of hard working with no hope- on my client's windows pc, though it was tooooo easy on linux .... may be If I had windows I would have taken another approach

4- One of my odesk clients swindled me and refused to pay for the task because I wasn't able to setup the monitoring client easily -It took me a day later to setup- , so he pretended that the work wasn't done

5-need to easily run exe files that your client provide you.

6-  Difficult to install the driver of the Internet USB driver provided by a local telecom providor

7- go search the internet in order to install any thing

8- No pdf/doc editor provides printingon both sides or booklet printing -AFAIK-

9- No audioplayer provides fast play that I need much to finish lectures and lessons quickly -AFAIK-

So, sadly I decided to switch back to windows and face again the endless trojans, viruses, ad-wares and similar stuff

Tuesday, May 17, 2016

org.apache.lucene.index.IndexNotFoundException: no segments* file found in org.apache.lucene.store.MMapDirectory

I encountered this error while trying to create an empty SOLR index from an existing one .... I started to copy missing files one by one and the error kept appearing but with different file name, It was obviously not the solution ...... the solution was to delete data folder completely so that the core knows that this is a empty index

Monday, May 9, 2016

Error instantiating the Persistence Provider class org.hibernate.ejb.HibernatePersistence of the PersistenceUnit XXX: java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence

I got this exception while trying to deploy an EJB ear that was created with maven to weblogic 12g :

Error instantiating the Persistence Provider class org.hibernate.ejb.HibernatePersistence of the PersistenceUnit XXX : java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence

Note : I am having a certain problem preventing me from putting shared libraries in the lib folder in weblogic

I searched a lot and tried the following :

1- make sure that hibernate-entitymanager jar is included in the ear while deployment
2- put these entries in the persistence.xml file :
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        <property name="hibernate.transaction.manager_lookup_class"
       value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
        <property name="hibernate.show_sql" value="true" />
3- put this in weblogic.xml :
         <prefer-application-packages>
            <package-name>antlr.*</package-name>
        </prefer-application-packages>
        <prefer-application-packages>
            <package-name>org.hibernate.*</package-name>
        </prefer-application-packages>

all these trials didn't solve the problem, I got another EJB ear that is working on weblogic and started the normal process of comparison between working and non-working ears and found the following :

4- the jar inside the ear that holds all the code has MANIFEST.MF inside its META-INF folder that has a Class-Path entry that points to the hibernate jars ..... I tried hard coding this entry and it worked.

5- Next I wanted to generate this entry automatically using maven, so I added the following entry to the pom.xml of the included jar's project :
           
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>

                        <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>


 Now it's deploying fine







Thursday, March 17, 2016

SOLR : Internal Server Error on calling deleteById()

Shifting from local environment to integration environment, my code suddenly started to throw Internal Server Error while calling SolrServer.deleteById(List<String>) , I googled it, found some solutions talking about locking mechanism and thread pool size and similar stuff, but It didn't work, I made a small test case that deletes one part with no threads... It gave the same exception.
I looked at the schema and realized that some one commented out the <uniqueKey>id</uniqueKey> tag ... and that's it :( ....... I just uncommented it again, restarted the solr application and all was ok