na tha kuch to khuda tha, kuch na hota to khuda hota duboya mujhko hone ne, na hota main to kya hota
hua jab ghum se yu bebas, to ghum kya sar ke katne ka na hota agar juda tan se, to jaano par dhara hota
huyi muddat ke gaalib mar gaya par yaad aata hai wo har ek baat per kahna ke yu hota to kya hota
na tha kuch to khuda tha, kuch na hota to khuda hota duboya mujhko hone ne, na hota main to kya hota
نہ تھا کچھ تو خدا تھا, کچھ نہ ہوتا تو خدا ہوتا ڈبویا مجھکو ہونے نے, نہ ہوتا میں تو کیا ہوتا
ہوا جب گھوم سے یوں بےبس, تو گھوم کیا سر کے کاٹنے نہ ہوتا اگر جدا تن سے, تو جانو پر دہرا ہوتا
ہویی مدّت کے گالب مر گیا پر یاد آتا ہے وہ ہر ایک بات پر کہنا کے یوں ہوتا تو کیا ہوتا
نہ تھا کچھ تو خدا تھا, کچھ نہ ہوتا تو خدا ہوتا ڈبویا مجھکو ہونے نے, نہ ہوتا میں تو کیا ہوتا
न था कुछ तो ख़ुदा था, कुछ न होता तो ख़ुदा होता डुबोया मुझ को होने ने, न होता मैं तो क्या होता
हुआ जो ग़म से यूँ बेहिस तो ग़म क्या सर के कटने का न होता गर जुदा तन से तो जानूं पर धरा होता
हुई मुद्दत के ग़ालिब मर गया पर याद आता है वह हर एक बात पर यह कहना के यूँ होता तो क्या होता
न था कुछ तो ख़ुदा था, कुछ न होता तो ख़ुदा होता डुबोया मुझ को होने ने, न होता मैं तो क्या होता
-- Diwan-E-Ghalib by Mirza Ghalib
na tha kuch to khuda tha | نہ تھا کچھ تو خدا تھا | न था कुछ तो ख़ुदा था
DELHI METRO FARE RULES
In Delhi Metro two types of tickets are available to make your journey.
Travel Card
- A completely Automatic Fare Collection system, which automatically credit fare amount from your Travel Card on the basis of Entry and Exit from Automatic Fare Collection (AFC) gate.It is the most convenient for frequent commuters. The minimum amount payable at the time of purchase of a new card would be Rs 150/- including refundable security of Rs. 50/-. Subsequent recharge of the card can be done at Customer Care Centers of any station with a minimum value of Rs. 200/- and up to Rs. 2000/-.
How to use your Smart Card/ Tourist Card/ Travel Card?
For entry, exhibit your travel card at the entry gate for the flaps to open.
For exit, exhibit your travel card at the exit gates for the flap to open. While exiting, commuters may note that fare is deducted from the card. If not, contact the Customer Care Operator to avoid inconvenience at later stage.
Token
- Commuters can purchase single journey tokens from Ticket counters of all Stations and from TVMs of selected stations.
- Journey is permitted for one way only.
- Tokens are valid only for the day of its purchase.
- Minimum Fare is Rs. 10/- and maximum is Rs. 60/- (fares are subject to revision from time to time), (Rs 80/- including Rapid Metro).
- A passenger can refund an unused token within 60 minutes of its issue at the same station.
How to use your Token?
For entry, hold your token close to the machine for the gates to open.
For exit, drop the token into the machine.
What are the maximum permissible time limit allowed to commuters for stay inside the Metro System?
- The maximum permissible time limit of stay have been rationalised according to the length of journey of the commuter. The maximum permissible time is divided into three separate time zones according to the following arrangement.
- The maximum period to stay within paid area for entry/exit from same station is defined as 20 minutes.
- A penalty of Rs 10 per extra hour (maximum Rs 50 as per DMRC business rules) will be imposed (as per existing business rules) for any breach of the time limit from 1st February-2016 onwards.
Fare Structure on Kilometers.
Fare Structure
|
||||
KM
|
KM
|
Weekdays
|
NH and Weekend
|
|
0
|
2.001
|
10
|
10
|
|
2.001
|
5.001
|
20
|
10
|
|
5.001
|
12.001
|
30
|
20
|
|
12.001
|
21.001
|
40
|
30
|
|
21.001
|
32.001
|
50
|
40
|
|
32.001
|
500.001
|
60
|
50
|
*NH: National Holiday
*Weekend: Saturday and Sunday
*KM: Kilometers
Concept of ordered set
Any set S with a relation, say less than equal(<=) to is
said to be ordered if for any two elements X and Y of S, either X<= Y or Y
<= X is true. Then we may also say (S, <=) is an ordered set.
We know given two integer, say N1 and N2, we can always say
whether N1<=N2 and N2 <=N1. Similarly if you are given two rational
numbers or the real numbers, say N1 and N2, then it is always possible to tell whether
N1 <= N2 or N2 <= N1.
Pattern of ordered set: An ordered set of numbers or
objects; the order helps you predict what will come next, because this order follow a pattern unit to generate a set/list.
Pattern unit: The
part of a pattern that repeats.
Who was the first to recognize United states of America?
Reorganization of the United States by the Kingdom of Morocco.
On 20th December 1777, Kingdom of Morocco under the rule of Mohammed ben Abdallah (King Mohammed III) was the first nation that officially recognize the independence of the United States. [1] [2] [3] [4]
Reorganization of United States by the State of Mysore.
Tipu Sultan, the Sultan of Mysore was supporting people of America against Britishers during the American war of Independence. Tipu Sultan was also the first ruler from India who was against British colonialism in the name of their trade.[6]Reorganization of the United States by the State of France.
On February 6, 1778, France recognize United States as an independent state. Statue of Liberty is a gift of Independence from France to America. [6] [7]References:
1. Relation of Morocco with United States of America2. https://books.google.co.in/books
3. Why Morocco matters to the USA?
4. Morocco is the first country to recognize the USA
A journey in a Bus in New Delhi.
On 8th December 2017 on Friday I was returning to
home from office. I boarded in a Bus which is almost full, there is no room for
more passengers, which we call in Hindi “khacha
khach bhara hai”. Somehow I boarded into it and take stand at gate only,
since we can’t move inside because there is no space in bus. It seems every
person is stitching with each other. Then I put my hand inside my pocket and
bring a 100 Rupees note and ask conductor to issue a ticket for me. He gave me
ticket and my remaining money.
People are struggling to even keep their self-standing with
comfort, and due to high suffocation inside the bus people are also struggling
to breath, since bus was air condition and there is no window for fresh air from
outside. And bus driver only switch on
the fans instead of air conditioning. One boy call Mr. Conductor for AC and
below is the beginning:
Boy: Garmi bahut ho rahi hai AC chalwa do.
Conductor: Tu khud bhi to bol sakta hai driver se.
Another passengers to Driver: Bhai, AC chala de.
Driver and conductor both ignored the calls and didn’t
switch on the AC.
After 5 minutes…
Another person: “Bhai AC chala de” and keep saying for
multiple times then driver switched on the AC.
Since humidity and suffocation are continuously increasing,
he didn’t feel either Driver switch on the AC or not, then again he
aggressively and loudly call for AC. This time conductor became angry on that
passenger and start telling him bla bla bla ..
Now everyone is silence no body is taking favor to that
person, then I took initiative and told conductor…..
Me: What is your problem? If he had called you to call
driver to switch on the AC then you replied him ask by yourself you can also
speak. And now if that person is calling driver then you are arguing with
him…what you want exactly?
Conductor: Why are you speaking, are you crazy? Have you
mad?
Me: No, I am okay and fine, we have paid for the service and
we are just asking what our service is nothing extra.
Conductor: Can you see how much load this bus have?
Me: Yes I can see, and every busses are in the same
situation, still they keep AC on while running.
Conductor: Most of the people didn’t take ticket.
Me: Go and ask them to take the ticket. This is not my duty
who has taken or not. Shall you want me to go and collect ticket from all
passengers?
Sound from crowd: Leave it man, let it go…don’t worry.
Me: I make myself calm and stop talking, and told nearby people;
if you don’t speak then how you will get you rights. And even if someone
speaking for you are not supporting him/her.
If this situation will remain in our society then soon we
are going to become slave, and there is no doubt in this.
Please speak up we
really need your voice!!!
Falsafa-e-Khudi | اقبال کا فلسفہ خودی
اقبال کا فلسفہ خودی
ہر انسان کی زندگی میں ایک دور ایسا ضرور آتا ہے جب اس کے دل میں ایک قسم کی غیر شعوری خلش پیدا ہوجاتی ہے ایک خلا پیدا ہو جاتی ہے- بہت سے سوالات پیدا ہو جاتے ہیں اور تسلی بخش جواب نہ پا کر کبھی خاموش ہو جاتے ہیں، کبھی زندگی کو تار تار کر جھنجوڑ ڈالتے ہیں- -ان سوالات کی شدّت کسی کے یہاں کم ہوتی ہے کسی کے یہاں زیادہ - کوئی انسان اس سے آسانی سے نجات پا لیتا ہیں ور کوئی زندگی بھر ان سے دامن نہی چھوڑا سکتا-
میری زندگی مے بھی ایک ایسا دور آیا- بیسیوں سوالات دل مے پیدا ہو گئے- اس کائنات کا بنانے والا کون ہے؟ کائنات کیوں بنائی گئی؟ یہ حقیقت ہے یا محض نظر کا دھوکا؟ کائنات مے انسان کی کیا حشیت ہیں؟ انسان اپنے اعمال مے مختا رہے یا مجبور؟ اگر انسان نائب خدا ہے تو اسے گمراہ کرنے کے لئے شیطان کو پیدا کیوں کیا گیا ؟ جنّت ور دوزخ کیا ہے؟ نیکی ور بدی کے کیا معنی ہے؟ بعد ازمرگ کوئی زندگی ہوگی یا نہی ہوگی؟ اگر ہوگی تو اس کی نوعیت کیا ہوگی؟ خالق اور مخلوق کا کیا تعلّق ہے؟ وغیرہ - وغیرہ
لیکن ایک چیز تو یقینی واقعی ہے جس مے شک قطعی نا ممکن ہے - اور وہ خود میرا شک کرنا، سوچنا اور فکر کرنا ہے- یہ تو ایک متضاد بات ہوگی کے جو چیز سوچی جا رہی ہے وہ سوچنے کی حالت مے موجود ہی نا ہو- سوچنے نا شک کرنے کے لئے ایک سوچنے والی، شک کرنے والی ذات ک اھونا ضروری ہے- شک کرنے کے معنی سوچنے اور سوچنے کے معنی ہونے کے ہیں- میں سوچتا ہوں اس لئے میں ہوں- میرے اس سوچنے سے یا شابت ہوتا ہے کے اور کچھ موجود ہو یا نا ہو میری خودی، میری ذات کا وجود تو قطان ہے-
Philosophy of Iqbal, Allama Iqbal, Muhammad Iqbal, Khudi, Philosophy of Khudi.
How to show related posts in blogger with thumbnail view
In this post we are going to show you people hot to show related or relevant posts in your blog (Google blogger) with thumbnail view. I tried my best to make it simple and easy so you can easily add make this changes in your blogger and show related posts to your users.
First we will see how this will appear on your blog. below is the screen shot of its appearance.
Related content thumbnail view |
Now lets start to achieve this and without and delay show the relevant posts to your users so they can easily find the relevant content and also it will make your site more visible in terms of impression.
Step 1: login into Blogger account and select the TEMPLATE option from the left side of menu.
Step 2: On right panel a preview of your blog will appear showing the CUSTOMIZE and EDIT HTML option. Go with EDIT HTML option.
Step 3: A new coding snippet window will appear. Click inside the code window and then go to find option by press Ctrl+F.
Step 4: Search for the text </head>.
Step 5: Copy paste the below code above the tag </head>.
<!--Show related posts in blogger START--><style type='text/css'>#related-posts{float:left;width:auto;}#related-posts a{border-right: 1px dotted #eaeaea;}#related-posts h4{margin-top: 10px;background:none;font:18px Oswald;padding:3px;color:#999999; text-transform:uppercase;}#related-posts .related_img {margin:5px;border:2px solid #f2f2f2;object-fit: cover;width:110px;height:100px;-webkit-border-radius: 5px;-moz-border-radius: 5px; border-radius: 5px; }#related-title {color:#333;text-align:center;text-transform:capitalize;padding: 0px 5px 10px;font-size:12px;width:110px; height: 40px;}</style><script type='text/javascript'>var relatedTitles=new Array();var relatedTitlesNum=0;var relatedUrls=new Array();var thumburl=new Array();function related_results_labels_thumbs(json){for(var i=0;i<json.feed.entry.length;i++){var entry=json.feed.entry[i];relatedTitles[relatedTitlesNum]=entry.title.$t;try{thumburl[relatedTitlesNum]=entry.gform_foot.url}catch(error){s=entry.content.$t;a=s.indexOf("<img");b=s.indexOf("src=\"",a);c=s.indexOf("\"",b+5);d=s.substr(b+5,c-b-5);if((a!=-1)&&(b!=-1)&&(c!=-1)&&(d!="")){thumburl[relatedTitlesNum]=d}else thumburl[relatedTitlesNum]='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMXVhMAH4S67GdSpI7ljQePwVrtxrEwf6DYmQDOh-7AeDNEt_HyREAzEdwnADxo8J_r2ZAcQsrsnk22Hlz3zPW-5U8ckl1MFmXSPPEEYCa5zsuH88CblzRCnAdRzeTFnK0UQ3Pl8Tg_xz6/s1600/no-thumbnail.png'}if(relatedTitles[relatedTitlesNum].length>35)relatedTitles[relatedTitlesNum]=relatedTitles[relatedTitlesNum].substring(0,35)+"...";for(var k=0;k<entry.link.length;k++){if(entry.link[k].rel=='alternate'){relatedUrls[relatedTitlesNum]=entry.link[k].href;relatedTitlesNum++}}}}function removeRelatedDuplicates_thumbs(){var tmp=new Array(0);var tmp2=new Array(0);var tmp3=new Array(0);for(var i=0;i<relatedUrls.length;i++){if(!contains_thumbs(tmp,relatedUrls[i])){tmp.length+=1;tmp[tmp.length-1]=relatedUrls[i];tmp2.length+=1;tmp3.length+=1;tmp2[tmp2.length-1]=relatedTitles[i];tmp3[tmp3.length-1]=thumburl[i]}}relatedTitles=tmp2;relatedUrls=tmp;thumburl=tmp3}function contains_thumbs(a,e){for(var j=0;j<a.length;j++)if(a[j]==e)return true;return false}function printRelatedLabels_thumbs(){for(var i=0;i<relatedUrls.length;i++){if((relatedUrls[i]==currentposturl)||(!(relatedTitles[i]))){relatedUrls.splice(i,1);relatedTitles.splice(i,1);thumburl.splice(i,1);i--}}var r=Math.floor((relatedTitles.length-1)*Math.random());var i=0;if(relatedTitles.length>0)document.write('<h4>'+relatedpoststitle+'</h4>');document.write('<div style="clear: both;"/>');while(i<relatedTitles.length&&i<20&&i<maxresults){document.write('<a style="text-decoration:none;margin:0 4px 10px 0;float:left;');if(i!=0)document.write('"');else document.write('"');document.write(' href="'+relatedUrls[r]+'"><img class="related_img" src="'+thumburl[r]+'"/><br/><div id="related-title">'+relatedTitles[r]+'</div></a>');if(r<relatedTitles.length-1){r++}else{r=0}i++}document.write('</div>');relatedUrls.splice(0,relatedUrls.length);thumburl.splice(0,thumburl.length);relatedTitles.splice(0,relatedTitles.length)}</script>
<!--Show related posts in blogger END-->
Step 6: Again search for the text <div class='post-footer'> and add the below mentioned code before this tag.
<!--Show related posts in blogger START-->
<div id='related-posts'><b:loop values='data:post.labels' var='label'><b:if cond='data:label.isLast != "true"'></b:if><script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels_thumbs&max-results=5"' type='text/javascript'/></b:loop><script type='text/javascript'>var currentposturl="<data:post.url/>";var maxresults=5;var relatedpoststitle="<b>Related Posts:</b>";removeRelatedDuplicates_thumbs();printRelatedLabels_thumbs();</script></div><div class='clear'/><div style="font-size: 9px;float: right; margin: 5px;">
<a style="font-size: 9px; text-decoration: none;" href="http://rashidjorvee.blogspot.in/2017/11/how-to-show-related-posts-in-your.html" rel="nofollow" >Grab this Widget</a></div><!--Show related posts in blogger END-->
Step 7: Code changes has been completed now you save your template from above SAVE TEMPLATE button.
Note: Go for your site and verify the changes and see how many related posts are appearing in your blog.
If you would like to change the number of related posts and its thumbnail view then go to step 6 and change the value for maxresults=5 to number which you wants.
If you face any issue while implementing this change in your blog, please comment your queries, we will definitely help you.
Can a human become God?
Very complicated question for all humans, but very simple
and easy as all well to a person who knows; what are the features of a God? Which
makes him God?
Yes, there is definitely something which compel to human to accept
the existence of God. What are those? Did you ever think? I don’t think most of
the people think on this topic, that’s why philosopher used to say that
religion is a blind faith, and sometimes blindness in religion goes to infinite
without limit which became profitable to false saints. Actually we should study
and investigate to find our real creator as we do before buying any product or
while opting subjects in our study.
Every religion taught us some different aspect to pray our
creator, some people consider a magician as a creator, when they saw some magic
by that magician, some people are praying to Trees, Sun, Moon, Stars, Animal,
Stone, River and Mountain.
But one more interesting thing is that we (human) are the smartest,
best and most noble creation of God, do you ever think why human beings are called
the best creation of God? I will tell you few features which makes us (human)
best in compare to other creation from God.
- Only human have an intelligent and powerful brain and also have will power.
- A human can have dreams to makes his/her life better.
- Only human have skills to survive in any situation.
- Only human have ability to perceive what is right and what is wrong.
- Without taking help from others we (human) can do anything. Nothing is impossible for a human.
Conclusion: Then why human not use his/er intelligent mind
to identify the creator instead of pray and following blindly to anyone or
anything.
We need your view as well on this. Please let us know your
thought in our comment section.
बुढ़ापा
ये तेल भी एक दिन फुक जाएगा ये सांस भी एक दिन रुक जाएगा
बेड़ा पार उसी का है जो सामने रब के झुक जाएगा
कितनी दुनिया गुजर गई और कितनी और भी आएगी
कितनी है मौजूद यहां पर मौत सभी को आएगी
ना चढ़ती जवानी पर घमंड करें एक रोज बुढ़ापा आएगा
चलना फिरना होगा मुश्किल टुकड़ा खाट पर खाएगा
ये हुस्न जवानी बस कुछ दिन के तेरी चमड़ी भी सिलवट पड़ जाएंगे
ये रंग तेरा ढल जाएगा फिर बच्चे तुझे चिढ़ाएंगे
तुझे टाइम पर टुकड़ा मुश्किल से और खुद ही मजे उड़ाएंगे
तू कोई खिदमत इन्हें कहेगा फिर ये तुझे डांटेंगे
तू बैठा खामोश रहेगा माल तेरा यह बाटेंगे
Aadhaar Act 2016 | Aadhar act section 7
Subject:
Notification for the use of the Aadhar under the section 7 of the Aadhaar (targeted delivery of the financial and the other subsidies, benefits and the services) Act, 2016 for targeted delivery of financial and other subsidies, benefit and services funded from there from the consolidated fund of India.
1. The use of Aadhaar is identifier to delivery of the services, benefits and subsidies simplify the Government delivery progresses, bring in good governance, transparency and efficiency, and enables beneficiaries to get their entitlements directly to them in a convenient and the hassle free manner. Aadhar obviated the need for producing the multiple documents to provide the identity, etc.
2. The provision of the Other night has come into effect from 12th of September 2016 and notifications to this effect has been published into the official Gazette. To give effect to the provision of the act, UIDAI has approved the regulation under the Aadhaar act which too have been notified in the official gazette. The copy of the act, rule and regulations made there under are available at the UIDAI website.
3. Section 7 of the act provides:
The Central Government or, as the case may be, the State Government may, for the purpose of establishing identity of an individual as a condition for receipt of a subsidy, benefit or service for which the expenditure is incurred from, or the receipt therefrom forms part of, the Consolidated Fund of India, require that such individual undergo authentication, or furnish proof of possession of Aadhaar number or in the case of an individual to whom no Aadhaar number has been assigned, such individual makes an application for enrolment: Provided that if an Aadhaar number is not assigned to an individual, the individual shall be offered alternate and viable means of identification for delivery of the subsidy, benefit or service.
4. Further, regulation 12 of the Aadhaar enrollment in the update regulations 2016 provides
Any central or state department or agency which requires an individuals to undergo the authentication or furnish proof of possession of the Aadhaar number as a conditions for receipt of any subsidy, benefit or services pursuant to section 7 of the Aadhaar Act, shall ensure enrollment of its beneficiaries who are yet to be enrolled, through the appropriate measure including coordination with registrars and setting up enrollment centers at convenient location for providing enrollment facilities by becoming a registrar itself.
5. Therefore Central Ministries and state governments which plan to use the Aadhaar for the delivery of the services, benefits and the subsidies funded from the consolidated fund of India are required to issue a notification under the section 7 of the act. Section 7 of the act read with regulations 12 of the Aadhaar enrollment and update regulations 2016 is required at the notifications must include all of the following three points:
5.1 The notification cell mention the service, benefits or subsidies funded from the consolidated fund of India, which will require as a conditions precedent a beneficiary applications to undergo the Aadhaar authentication or furnish proof of position of Aadhaar number.
5.2 This notifications shall mention that in case of the applicant does not have the Aadhaar number, he will be required to make an applications for the Aadhar enrollment, if he is entitled to obtain one under the section 3 of the act and the arrangement made by the concerned central ministers or state governments as the case may be to provide the Aadhar enrollment facilities to him. Regulation 12 of the said regulations cast the responsibility of the ministers and their state governments or agencies under their control to facilitate and provider enrollment facilities at convenient location. In case there are no existing enrollment facility nearby, they are required to become UIDAI Registrar so that they can set up enrollment facilities themselves.
UIDAI has already empowered the several Central ministries and state departments or agencies under their jurisdictions to become its registrar and the undertake enrollment of their beneficiaries who are not enrolled for the Aadhaar. UIDAI I will continue to provide all technical as well as financial assistance for Aadhaar generation @ rupees 40 per Aadhaar and @ rupees 27 per Aadhaar generated for the children of the age less than 5 years through tablets computers. In case any ministry, state government department or agency under its control want to become the registrar, is may do so immediately by applying under the regulation 21 of the said the regulations and contact the regional offices of the UIDAI for this purpose.
5.3 The notifications and list the alternate identity documents and the verification methodologies to confirm the Identity of the beneficiary applicant to whom Aadhaar number has not been assigned for delivery of benefits, subsidies, or services, till such time Aadhaar number is assigned.
References:
Cannot make a static reference to the non-static method
Cannot make a static reference to the non-static method display(String) from the type RunAndTest.
We cannot access or call a non static method or variable from a static method or main method(which is also a static method) of a class. Since non-static method and variables belongs to the instance of the class and we call them instance variable and method, but static method and variable are directly belongs to class which we called member variable and method.
We can access a non-static variable and method in static method only using the instance of the class. But if you want to access any non-static variable and method in non-static method of the same class then we can access them without instance of the class.
As soon as our program loaded into memory at the same time all static variable, method and block get loaded in the memory as well, and JVM will maintain only single copy of those static thing through all over the class. And all non-static components will get loaded into the memory when we create instance of that class that why we called them instance variable/method, and when you create another instance of that class then a new and separate memory will be get allocated for all those variables and methods for that instance.
In case if you will write a code to access a non-static member in static method without instance of that class then compiler will through the error "Cannot make a static reference to the non-static method".
Below is a code sample which you could just copy and paste in your IDE and understand the concept of this static and non-static.
We cannot access or call a non static method or variable from a static method or main method(which is also a static method) of a class. Since non-static method and variables belongs to the instance of the class and we call them instance variable and method, but static method and variable are directly belongs to class which we called member variable and method.
We can access a non-static variable and method in static method only using the instance of the class. But if you want to access any non-static variable and method in non-static method of the same class then we can access them without instance of the class.
Why we can not access?
As soon as our program loaded into memory at the same time all static variable, method and block get loaded in the memory as well, and JVM will maintain only single copy of those static thing through all over the class. And all non-static components will get loaded into the memory when we create instance of that class that why we called them instance variable/method, and when you create another instance of that class then a new and separate memory will be get allocated for all those variables and methods for that instance.In case if you will write a code to access a non-static member in static method without instance of that class then compiler will through the error "Cannot make a static reference to the non-static method".
Below is a code sample which you could just copy and paste in your IDE and understand the concept of this static and non-static.
Compilation fail while accessing a non-static method in static method.
package coreJava;
public class RunAndTest {
public static void main(String[] args) {
display("string"); //This line of code will through compile time error "cannot make a static reference to the non-static method display(String) from the type RunAndTest"
}
void display(RunAndTest rt){
System.out.println("Test");
display("sdj");
}
void display(String string){
System.out.println("String method");
}
}
Access a non-static method in static method, with the help of object of the class.
package coreJava;public class RunAndTest { public static void main(String[] args) { RunAndTest rt=new RunAndTest(); rt.display("string");
} void display(RunAndTest rt){ System.out.println("Test"); display("sdj"); } void display(String string){ System.out.println("String method"); }}
How to set property of a bean from external source file using Spring framework
Today in this tutorial we are going to discuss how to set property of a bean from external source file using Spring framework.
As we already know Spring is a very powerful framework to inject the dependency at get the value at run time in the form of beans. But what happen if we don't have value for those beans in our ApplicationContext.xml file and we need to fetch value from some external file or data source and assign those values to beans. We will see these all in a sample example program.
First we will create a java POJO calss "Apple.java" in this class we will create two String variables and their getters and setters. Also we will create a method whoareyou() with return type String.
Below is the code:
Third we will create a xml bean file "AppContextRashid.xml" in which we will to include namespace "xmlns:context="http://www.springframework.org/schema/context" to read the data from external source.
To read the external property or value from file we will provide the location in property placeholder. e.g. <context:property-placeholder location="xmlBeans/myApp.properties"/>
Then in Bean property tag we will assign values from file to POJO class variables. To get the value from properties file we will write "${name of the property}".
e.g. <property name="desc1" value="${def-desc}"></property>
In the above statement we are fetching value for property "def-desc" from .property file and assigning its value to "desc1" variable in Apple class.
As we already know Spring is a very powerful framework to inject the dependency at get the value at run time in the form of beans. But what happen if we don't have value for those beans in our ApplicationContext.xml file and we need to fetch value from some external file or data source and assign those values to beans. We will see these all in a sample example program.
Files used in this example:
- Apple.java
- myApp.properties
- AppContextRashid.xml
- ClassHer.java
First we will create a java POJO calss "Apple.java" in this class we will create two String variables and their getters and setters. Also we will create a method whoareyou() with return type String.
Below is the code:
Second we will create a property file which contains the value for name1 and desc1 variables. to do so we will create a file "myApp.properties" in a xmlBeans package in our source directory which have some values. below is the example file.package rashidtest;public class Apple {String name1, desc1="not yet set";public String getName1() {return name1;}public void setName1(String name1) {this.name1 = name1;}public String getDesc1() {return desc1;}public void setDesc1(String desc1) {this.desc1 = desc1;}public String whoareyou() {String result= name1 + desc1;if(desc1 == null) return name1;else if(name1 == null) return desc1;else return result;}}
def-desc=I am a fruit and my color is Red.def-name=Apple.
Third we will create a xml bean file "AppContextRashid.xml" in which we will to include namespace "xmlns:context="http://www.springframework.org/schema/context" to read the data from external source.
To read the external property or value from file we will provide the location in property placeholder. e.g. <context:property-placeholder location="xmlBeans/myApp.properties"/>
Then in Bean property tag we will assign values from file to POJO class variables. To get the value from properties file we will write "${name of the property}".
e.g. <property name="desc1" value="${def-desc}"></property>
In the above statement we are fetching value for property "def-desc" from .property file and assigning its value to "desc1" variable in Apple class.
Fourth and final we will create a implementer class which have main method, instance of ApplicationContext and inject the value from bean to class using setter injection. to achieve this we will create a java file "ClassHer.java". Below is the complete class.<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd"><context:property-placeholder location="xmlBeans/myApp.properties"/><bean id="apple" class="rashidtest.Apple"><property name="desc1" value="${def-desc}"></property><property name="name1" value="${def-name}"></property></bean></beans>
package rashidtest;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;public class ClassHer {public static void main(String[] args) {ApplicationContext appContext=new ClassPathXmlApplicationContext("rashidtest/AppContextRashid.xml");Apple apple=appContext.getBean("apple", Apple.class);System.out.println("Apple class have property: " +apple.whoareyou());}}
What is Smog and how to prevent from this?
Smog is a type of air pollution. Smog is also used to describe the type of fog which has smoke or soot in it. Smog is a blackish fog formed mainly by a mixture of pollutants in the atmosphere which consists of fine particles and ground level ozone. Smog has smell as well. Smog is basically mixture of gases with dust. Smog increases in atmosphere due to burn the crops, vehicles, industrial plants and heating due to some other source.
Problems which you could face due to Smog?
Smog may cause some critical health problems such as asthma, cough, emphysema, chronic bronchitis and other respiratory problems as well as eye irritation and reduced resistance to colds and lung infections. Also our plants and crops get impacted from this.
How can you protect yourself from Smog attack? What are the prevention to protect yourself from Smog?
If you are a child below the age of 10 and old person above the age of 55 then you should not go outside in open. In case you have to go outside use eye protection(glasses which hide your eyes) and mask which hide your Mouth and Nose. This will became very serious for patients who are suffering from asthma and any other illness related to Breathing.
- Frequently wash your hand and face.
- Eat fresh vegetables and oily foods.
- Wash fruits and vegetable very well before serve.
- Apply mask and glasses.
- Avoid going outside.
- Use air purifier.
What is Sling and why have multiple scripts/renderers for a Component?
Apache Sling is one of the technology stack of AEM/CQ5 CMS on which AEM is built on. Sling is a Web application framework based on REST principles that provides easy
development of content-oriented applications. In general terms we can say Sling is used to resolve the resources or URI in our application. Sling uses a JCR repository, such
as Apache Jackrabbit or Day's CRX, as its data
store.
Sling maps HTTP request URLs to content resources based on the request's path, extension and selectors.
The Resource is one of the central parts of Sling. Extending from JCR, Everything is Content, and Sling assumes that Everything is a Resource.
Sling maps HTTP request URLs to content resources based on the request's path, extension and selectors.
The Resource is one of the central parts of Sling. Extending from JCR, Everything is Content, and Sling assumes that Everything is a Resource.
Apache Sling is included in the
installation of CQ5. Sling has since been contributed to the Apache Software
Foundation - further information can be found at Apache Sling.
Using Apache Sling, the type of
content to be rendered is not the first processing consideration. Instead the
main consideration is whether the URL resolves to a content object for which a
script can then be found to perform the rendering. This provides excellent
support for Web content authors to build
Pages which are easily customized
to their requirements.
The advantages of this
flexibility are apparent in applications with a wide range of different content
elements, or when you need Pages that can be easily customized/viewed
differently.
How sling used to resolve a URL (Resource) in AEM? and How sling works internally?
The following diagram explains
the Sling script resolution. It shows how to get from HTTP request to content
node, from content node to resource type, from resource type to script and what
scripting variables are available.
Sling Resource resolver |
The following diagram explains
all the hidden, but powerful request parameters you can use when dealing with
the SlingPostServlet, the default handler for all POST requests that gives you
endless options for creating, modifying, deleting, copying and moving nodes in
the repository.
We will now see how sling resolve a URL by using the above resolution diagram.
1. Actual URL get divided into the following chunks. e.g. we have a URL " www.rashidjorvee.blogspot.com/blog/post/aboutrashid.print.html/printable?height=400,width=200" and now we will see how sling will resolve my URL.
- Request Method: This information comes in request header.
- Content Path: [/blog/post/aboutrashid]
- Seletor: [print]
- Extension: [html]
- Suffix:
- Query parameter : [height=400,width=200]
2. Sling will go to the requested content path.
3. Then it will check whether that content path or component has property sling:resourceSuperType or sling:resourceType. If request found any of these property in that node then sling request move to that path which is present in the sling:resourceType or sling:resourceSuperType.
sling:resourceType is used to render to script files.
sling:resourceSuperType is used to overload or inherit a existing component.
4. Then render to the path given in resourceType and resourceSuperType property to load the script or inherit the functionality. To resolve this first sling will find the path under apps directory, in case that content path is not available in apps then request will move under libs directory.
5. In this step sling will look for script name and try to match with the exact request URL with requested selector and extension. There is a set of rules which sling follow to match the selector and extension. Following are the rules:
- Folders (i.e. nodes of type nt:folder) take precedence over jsp file names when resolving using selectors, at least for the first selector.
- Only one selector in a file name has any effect - any files with names containing two selectors don't ever get selected, but names of folders can be used to match the selectors in the request.
- Scripts with HTTP method names (e.g.,GET.jsp) is selected as a last resort, (after the default script: jobs.jsp, in this case).
- Scripts with names that include HTTP methods in addition to another selector or extension in a .jsp file name are never selected.
Subscribe to:
Posts (Atom)