tag:blogger.com,1999:blog-35083922078839569612024-03-18T00:17:39.699-07:00Bhupal Blogs@bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.comBlogger30125tag:blogger.com,1999:blog-3508392207883956961.post-22697586130247841952020-10-12T01:46:00.004-07:002020-11-11T19:07:04.646-08:00Run php script as daemon process with Systemd (AWS EC2)<p>To run PHP script as a daemon service under Linux using Systemd do as below. Best way to make a shell script daemon? With new <a href="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/chap-Managing_Services_with_systemd.html#sect-Managing_Services_with_systemd-Introduction">systemd</a> you can create a service. You must create a file or a <a href="https://stackoverflow.com/q/1951742/3706998">symlink</a> in /etc/systemd/system/, eg. <b>myservice.service</b> and place content like this one, <b>myservice </b>will be the name of the service:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/800px-Tux.svg.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="800" data-original-width="676" height="408" src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/800px-Tux.svg.png" width="432" /></a></div><br /><p><br /></p><p>Create a service unit file:</p><p>Let’s create a file called<b> /etc/systemd/system/myservice.service</b></p><p>[Unit]<br />Description=My PHP service</p><p>[Service]<br />Type=simple<br />Restart=always<br />ExecStart=/usr/bin/php -f /path/to/myservice.php</p><p>[Install]<br />WantedBy=multi-user.target</p>Now, you will be able to start, get status, restart and stop the services using the command<br /><br />systemctl <start|status|restart|stop|enable> <b>myservice</b><div><b><br /></b></div><div><div><b>sudo systemctl enable myservice </b></div><div>- enable for restart after boot</div><div><br /></div><div><div><b>sudo systemctl is-enabled myservice </b></div><div>- check if myservice is enabled for startup</div><div><br /></div></div><div><b>sudo systemctl start </b><b>myservice </b></div><div>- start the service</div><div><br /></div><div><div><b>sudo systemctl restart </b><b>myservice </b></div><div>- restart the service</div><div><br /></div><div><div><b>sudo systemctl status </b><b>myservice </b></div></div><div>- check the status of the service.</div><div><br /></div></div><div><b><br /></b></div><div><b>What is systemd PID file?</b></div><div><br />Can I use this script without creating a PID file? Why do we need a PID file at all? In which case we should use PID file? </div><div><br /></div><div>PIDFile=: If the service type is marked as "forking", this directive is used to set the path of the file that should contain the process ID number of the main child that should be monitored. when Type=forking is in use, then the pid file must be created (with the correct pid) before the parent process exits.</div><div><br /></div><div><div>Actually, the whole point of systemd is to daemonize processes and run them in background for you... By trying to do that yourself, you're just preventing systemd from doing it for you. Which is making your life much harder at the same time... Instead of using Type=forking, simply write your shell script to run in foreground and set up the service to use Type=simple. You don't need any pidfiles then.</div></div><div><br /></div><div>systemd's Type=forking is really there only for legacy programs that only work that way and can't be easily fixed to work in foreground... It's hacky and inefficient. The whole point of systemd (and some of its alternatives, predecessors) is to do the forking and daemonizing itself and let services just worry about doing what they need to do! :-)</div><div><br /></div><div><div><a href="https://superuser.com/questions/1274901/systemd-forking-vs-simple">systemd forking vs simple?</a></div><div><br /></div><div>For Type, there are a few choices: forking, simple, etc.</div><div><br /></div><div><div>When you start the service manually from the command line (without using the nohupprefix command or the & suffix to run it in the background, or in other words, just run the command you would put on the ExecStart= line of the .service file), what happens?</div><div><br /></div><div>a) If the service starts and keeps running, and the prompt does not return until you press Control-C or stop the service in some other way: then <b>Type = simple</b> is the right choice.</div><div><br /></div><div>b) If the prompt returns but the service keeps running in the background (i.e. the service daemonizes itself on its own), then <b>Type = forking</b> is the right choice.</div><div><br /></div><div>Note: many service applications designed to be portable to many Unix-style systems may behave as b) by default, but can be made to work like a) by adding an option (usually described as "don't fork", "keep running in foreground", "don't daemonize" or similar). In that case, if the option has no other side effects, then adding the option and using the a)-type behavior would be preferable for systemd.</div></div><div><br /></div><div><b>Forking systemd service example</b></div><div><br /></div><div><div>[Unit]</div><div>Description=My PHP service</div><div><br /></div><div>[Service]</div><div><b>Type=forking</b></div><div>Restart=always</div><div>RestartSec=1</div><div>User=root</div><div><b>PIDFile=/var/run/myservice.pid</b></div><div>ExecStart=/usr/bin/php -f /path/to/myservice.php</div><div><br /></div><div>[Install]</div><div>WantedBy=multi-user.target</div></div><div><br /></div><div><br /></div><div><br /></div></div></div>@bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com1tag:blogger.com,1999:blog-3508392207883956961.post-32622673137448615912017-08-24T10:07:00.000-07:002017-08-24T10:10:05.880-07:00OKTA API Call with PHP Curl<div dir="ltr" style="text-align: left;" trbidi="on">
<script src="https://gist.github.com/bhu1st/0472c7348f56d746902b044444b909be.js"></script></div>
@bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com1tag:blogger.com,1999:blog-3508392207883956961.post-7601919206210236572013-09-06T06:52:00.000-07:002017-06-22T00:42:23.059-07:00नेपाली नलेख्ने नेपालीहरु<p>संदेश दाजु काठमाडौंको पपुलर स्कूलमा नेपाली पढाउनु हुन्छ l एकपल्ट दाजुले फेसबुक स्टाटस लेखी पोस्ट बटन दाबेर आफ्नो पोस्ट देखिएला भन्दै न्युज फिड हेरिरा बेला माथीबाट लुत्रुक्क एन.एस.ए सर्भिलेन्स सम्बन्धि पोस्ट झरेछ l संदेश दाजुको कम्पारो तात्यो l आफ्ना साथीले हेरुन भनेर लेखेको पोस्ट फेसबूक मार्फत घुमी फिरी कहाँ कहाँ पुग्दो रहेछ अनी त्यसमा अनेक थरिका मेसिनरी प्रोसेसिंग भएर स्टाटस लेख्नेको बारेमा बकाइदा अमेरिकी सरकारी निकाएबाट जासूसी मोनिटरिङ भैरहेको हुदों रैछ l आफ्नो सूचना र गोपनियताको हक खै ? संदेश दाजुले मलाई कल गर्नुभो – "के हो  बाबु यस्तो ? "</p> <p>संदेश दाजु पि.सी.एल. गरेका मान्छे l आफू अंग्रेजीमा अली कमजोर भएको स्विकार्ने मान्छे l अंग्रेजी फाट्ट फुट्ट लेख्ने अनी साधारण अंग्रेजी बुझ्नेका लागि भनेर लेखिएका समाचारहरु कनीकुथी अर्थ लाउन जान्ने l टुटे फुटेको अंग्रेजीमा पोस्ट लेख्दा अनी आफूले लेखेको अंग्रेजी मिठासको प्रसंसा गर्ने फेसबुकका लाइकेहरु देखेर दाजुलाई मजा लाग्दो हो l एक लाइकमा एक मजा हुन्छ अरे l <br /> <br />"अनलाईनमा लेख्ने सबै कुरा नेपालीमा लेख्नु संदेश दाजु - नेपाली भाषा बुझेर अर्थ लाउने जान्ने मेसिनहरु संसारमा अहिले सम्म बनेका छैनन्", मैले सारा नेपाली प्राबिधिक क्षेत्रको ज्ञाताले जसरि कन्फिडेन्स साथ भने l "ए हो त है !" संदेश दाजुले फोन राखे l उनि मेरा गफ चाडै बुज्छन्, खै कसरी हो ? कुनै बेला प्रविधि बिकाश नहुनुले थोरै भएनी डिजिटल सुचना सम्बन्धि आफ्नो गोपनीयताको हक संरक्षण गर्न सक्छ भन्ने अस्थाई निचोड थियो यो हाम्रो कफी गफको l</p> <p>दाजुले त्यो दिन देखी आजसम्म आफ्नो फेसबुकमा अंग्रेजीमा पोस्ट लेखेको मैले देखेको छैन l संदेश दाजुलाई आफ्नो लेखाई माथिको सर्भिलेन्स मन नपर्नुको अनेक कारण होलान, तर म आफ्नो सुझाब त्यो हदसम्म लागू भएको देखेर दुई चार दिन निदाईन l छटपटी यो थिएन कि मैले गलत बोले - बरु यो थियोकी मैले आफूले अनलाईनमा त्यो रुपमा नेपाली भाषामा लेख्ने प्रतिबद्दता कहिलै गर्न सकेको थिएन l नेपाली नबुझ्ने साथीभाइसंग अंग्रेजीमा संचार्नु आफ्नो ठाउँमा छ तर जानी नजानी आफूले नेपाली भाषाको अपहेलना गरेको अनुभव भयो ! नेपाली अक्षरहरुमा लेख्नुलाई नेपाली लेख्नु मान्छु म, व्याकरणको सुद्द्ता हाम्रा मास्टरले राम्रो संग सिकाए जस्तो मान्दिन l</p> <p>म नेपाली भाषा रुचाउने मान्छे l फाट्टफुट्ट आफ्नो भाषामा आफूले छानेका शब्दहरु कोरेर स्पस्ट संग आफ्नो मन मस्तिस्कमा लागेका कुरा बाढ्नुको मजा भोगेको मान्छे l पाँच छ बर्ष अघि नेपाली युनिकोड प्रचलनमा नहुदाँ इन्टरनेटमा बलियो नेपालीपन झल्काउनेगरी आफ्ना वेबसाइट तथा ब्लगको उपस्थिति दर्साउनु सम्भव थिएन l तर अहिले इन्टरनेटमा, कम्प्युटर सफ्टवेयरमा जता ततै नेपाली युनिकोडमा लेख्ने प्रविधिहरु बिकाश भएका छन् l नेपाली संस्था मदन पुरस्कार पुस्तकालय तथा गूगल, माइक्रोसफ्ट जस्ता कम्पनीले नेपाली भाषाको प्रबिधिकरणमा काम गरेका छन् l मदन पुरस्कार तथा गूगलले आ-आफ्नै नेपाली इनपुट मेथड निकालेको छ l माइक्रोसफ्टले बिंग नेपाली अनुबादक निकालेको छ, अनुबाद हास्यास्पद भएपनी प्रयास राम्रो मान्नु पर्छ l सबै आधुनिक इन्टरनेट ब्राउजर हरुले नेपाली भाषामा लेखेका कुरा बिना हिचकिच देखाउन सक्छन l यो बिकाश आफ्नै आँखा अघि हिजो, आज गर्दै हुँदा पनी मैले अनलाईनमा नेपालीमा लेख्ने स्पस्ट प्रेरणा भेटिन l तर आज दुई पल्ट यो बिसयमा सोचेर बस्ने हिम्मत जुटेको छ, प्रेरणा मिलेको छ l</p> <p>हाम्रा बा-आमाले नेपाली भाषामा लेखेको स्पस्ट पढ्न, बुझ्न र बुझाउन सक्नु हुन्छ l तर म बारम्बार आफ्नो मोबाइल, ल्यापटप वा पि.सी. अघि बसेर फटर-फटर अंग्रेजी हेरेको र लेखेको वहाँहरुलाई जमेन l बुझ्न सिक्न चासो नदेखाउनु भएको हैन - बुबाले अंग्रेजी लेखेको लहै-लहै बुझ्नु हुन्छ तर हामीले चलाउने कुनै पनी इलेक्ट्रोनिक डिभाइस नेपालीले चलाउन भनेर बनाइएका छैनन् l नत हामीले चलाउने कुनै सफ्टवेयरको झलक नेपालीमा देखिन्छ l यो भाषाको कुरो हामी दुई चार जनालाई समस्या नहोला l कतिनै छौं र हामी जो इन्टरनेटमा अंग्रेजी बुज्छौ - नेपाली जनसंख्याको दश प्रतीशत ? पन्ध्र प्रतीशत ? आमा सिधा-सिधा भन्नु हुन्छ - यो गाई खाने भाषाले गर्नु गर्यो ! नौ-दश बर्ष अघि सम्म मैले बुझ्दिनथें त्यो के भनेको हो भनेर l आजकल स्पस्ट सुनिन्छ l</p> <p>त्यसो हो भने हामीले गर्ने के त ? सबैलाई अंग्रेजी सिकाउने ? की सबै डिजिटल सुचना नेपालीकरण गर्ने ? ल जे गरम्ला तर त्यो कसले गर्दिने हो ?</p> <p>समस्या हाम्रो हो l समाधानको जिम्मेबारी हामीले लिन सक्नुपर्छ l हामी सफ्टवेयर बनाउनेहरुलाई नेपालीको लागि सफ्टवेयर बनाउन आउदैन l हामी बिदेशीका निम्ति सफ्टवेयर बनाउदा र कोड लेख्दा यति पोख्त भईसकेउँ नेपालीको लागि सफ्टवेयर बनाउनु हाम्रो प्राथमिकतामा पर्दैन l हामी ग्लोबलाइजेसनका कुरा फ्याक्छौं कफी खाँदै, तर आफ्नो भाषा र संस्कार मेटिएको हामीलाई चासो लाग्दैन l हामी कस्ता भने - कुरो बिग्रेपछि ए हो त बिग्रेछ भन्न पोख्त l बेद पुराण लाई कक्षा एक देखी दश सम्मको पाठ्यक्रममा सम-सामयिक तरिकाले परिमार्जन गर्दै पढाएको भए पहिलो एरोप्लेन बनाउने नेपाली हुन्थ्यो होला l हामीले अहिले चचच गर्छौं, सबैले पुराण बिर्सेपछि, अनी पुजा पाठ गर्दा गुरु नभेटे पछी l ग्रन्थ हराउँदा मौलिकता यसरि हराउछ l भाषा बिर्सिदा संस्कार यसरीनै लोप हुनेछ l</p> <p>करिब डेढ बर्ष अघि गूगलको आधिकारिक नेपाल भ्रमणमा गूगलले नेपाली भाषामा चासो राखेको र आन्तरिक रुपमा नेपाली भाषामा काम भईरहेको कुरा गूगलका कर्मचारीले नेपाली प्रविधि क्षत्रसंग बाँडेर गए l हाम्रो भाषामा मल्टीनेसनल कम्पनीले चासो राख्नु हाम्रो लागि गर्बको कुरो थियो l हामी आशे भएम - आश गरेर बसेम l <br /> <br />गूगलले नेपाली भाषालाई सजिलै अंग्रेजीमा र अंग्रेजी भाषालाई नेपालीमा अनुबाद गर्न सक्ने मेसिन ट्रान्सलेटर बनाउन खोजेको थियो l त्यो बन्यो भने नेपाली - अंग्रेजी भाषाको अनुबादलाई आधार बनाएर बिश्वका पैसट्ठी भाषामा लेखेका कुरालाई हामीले एक क्लिक को भरमा नेपालीमा पढ्न सक्छौ l नेपालीमा लेखेका लेखलाई हामीले ती बिश्वका भाषामा सहज रुपमा उल्था गर्न सक्छौ l गूगलले सकेन l कसरी सकोस जब नेपाली र अंग्रेजीमा एउटै अर्थ लाग्ने लेखहरु हामी संग छदै छैनन् l पल्पसा क्याफे जसरि सबै पुस्तक नेपाली र अंग्रेजीमा निस्कने भए ? भाषा अनुबाद गर्न सक्ने मेसिन बनेका छन्, बनेर के गर्नु ? चामल र भुस निकाल्न धान चाहियो नी ? हामी नेपाली प्रविधिमा लाग्नेले नत धान फलाएम न त प्रसस्त नेपाली शब्दहरु नै सिर्जना गर्न सकेम l जसले नेपालीमात्र बुज्छन् र लेख्न रुचाउँछन् उनीहरु प्रविधिको पहुँचमा पुग्दा धेरै ढिलो भइसक्नेछ l यो अवस्थामा गूगलले अनुबादक बनायो भने पनी माइक्रोसफ्ट बिंग को अनुबादक जस्तो जोकको बिषय बन्ने छ l गूगलमा काम गर्ने संसारका सर्वोत्कृष्ट इन्जिनियरहरुले  बनाएको नेपाली इनपुट मेथड प्रयोग गरेर लेखेको लेखहरुलाई उनीहरुलै बनाएको अर्को भाषा डिटेक्टर सफ्टवेयरले हिन्दी लेख भनेर ठोकुवा गर्छ त्यस्तै - अनुबाद पनी हिन्दी टोनमा निकाल्न के बेर ? हामीले हेलचेक्र्याइँ गरेकोले हाम्रो भाषा र हाम्रा कखराको आज मजाक बनेको छ l </p> <p>हामी सफ्टवेयरको झलकलाई म्यानुअल तरिकाले नेपालीमा अनुबाद गर्न लागिपर्छौ l अनी यस्तो अनुबाद गर्छौं त्यो न त सिकारुले सिकेर प्रोफेसनल बन्न सक्ला न त हामी जो अली अली कम्प्युटर जानेका छौं हामीहरुले नै चलाउन सकौंला l भाषा प्रबिधिकरण गर्न हामीसँग शब्द अभाब छ l शब्द अभाब कसरी नहोस जब कम्प्युटरमा लेख्न जान्ने सबैले अंग्रेजीमा लेख्छन ?</p> <p>माइक्रोसफ्टले आफ्नो पपुलर अपरेटिंग सिस्टम नेपाली भाषामा उल्था गर्ने प्रयत्न गर्यो l मेनु लाई पर्दा भनेर लेखेको सफ्टवेयर मैले चलाउन सकिन l इन्टर लाई घुसाउनुहोस् लेख्नेहरु एक पल्ट त पक्का हाँसे होलान l</p> <p>नेपालमै लिनक्स ओपन सोर्स अपरेटिंग सिस्टमको नेपाली अनुबाद नेपालीनक्स बन्यो l त्यो किन बन्यो र अहिले कहाँ छ बनाउनेलाई चाहिँ थाहा होला l काठमाडौं बिश्वबिध्यालयमा दोभासे नाम गरेको नेपाली अंग्रेजी अनुबादक सफ्टवेयरमा गहन रिसर्च र अध्ययन भयो - त्यो पनी शब्द अभाबले अघि बढ्न सकिरहेको छैन l</p> <p>नेपाली शब्द कहाँ छन् त ? यी यहिँ छन्, फेसबुक चलाउने बिसलाख नेपालीमाझ l तर ति नेपालीका सोचहरु अनी बिचारहरु नेपाली शब्दका रुपमा झरेनन l नेपालीको हातहरु कीबोर्डमा चल्दा अंग्रेजी अक्षर झर्छन् l अनी त्यहाँबाट सुरु हुन्छ सम्पूर्ण नेपाली भाषा सम्बन्धि प्राबिधिक कठिनाईहरु l</p> <p>बिसलाख नेपालीले हरेक दिन बिसलाख ओटा वाक्य नेपाली भाषामा लेखे भने एक वर्षमा कति शब्द जम्मा होलान ? अनी कति नयाँ सजिला शब्द जन्मेलान l भाषा मेटिनु भन्दा आगन्तुक शब्दहरु थपिउन बरु l <br /> <br />जुकर्बरले नबुझ्ने भाषा उसको अफिसको फेसबुक वोर्ल्ड मनिटरिङ सफ्टवेयरमा बट्टा बट्टा त नदेखाउला नी? ल्यारी पेज ले विकासशील मुलुक हरुको त्रैमासिक प्रविधि ग्रोथको ट्रेन्ड हेर्दा हुन् l नेपाली अक्षरहरु उनको दृश्यमा पर्ने कहिले ? इभान विलियमले नेपाली बोल्ने मान्छे छन् र भन्दा हुन् l कसरी भनुन - हामी इन्टरनेट चलाउने नेपालीहरुले नेपाली भाषा बिर्सेपछी l</p> <p>अनुवादको नाममा एउटा साधारण नेपालीले सपनामा नी नसोच्ने शब्द बनाएर भासिक रुपमा अप्ठ्यारा नेपाली अनुवादित सफ्टवेयर निकाल्नुको आफ्नै मत होला तर त्यो तरिकाले काम गरेन भन्ने कुरा हामीले भोगेको अवस्था हो l त्यो दोहोरिनु आफ्नै खुट्टामा बन्चरो हान्नु हो l समय पछिल्तिर चल्छ र ? नेपाल प्रविधिमा छिट्टै फड्को मार्दै छ - सुरुबाट सुरु गर्ने अवस्था अब रहेन l</p> <p>नेपाली भाषाको प्राबिधिक बिकाशमा बिर्को लागेको छ l नेपाली इन्जिनियरिङ पढ्ने बिध्यार्थीले आफ्नो लागि प्रोजेक्ट भेट्दैनन, नेपालमा खोजे पो भेटिन्थ्यो, हेरे पो देखिन्थ्यो l नेपाली सफ्टवेयर कम्पनी र नेपाली सफ्टवेयर डेभलपर्सहरुले नेपाली भाषामा सफ्टवेयर बनाउने कहिले ? नेपाली भाषा सम्बन्धि प्रबिधिमा गर्न सक्ने काम धेर-थोर भइरहेको छ तर भएको देखिएन l </p> <p>यो शब्द अभाब हामीले सिर्जना गरेको हो l यसको पूर्ति हामीले गर्नुपर्छ l भाषाको सम्बन्ध संस्कार र राष्ट्रिय एकता संग जोडिएको हुन्छ l बिगत पन्ध्र वर्ष कम्प्युटर साइन्स पढेर मैले नेपाली भाषामा लेख्न बिर्सें l म कुत्तुवा गरेर भन्न सक्छु म संगै पढाई सुरु गर्ने सत्तरी प्रतीशत नेपालीहरुले इन्टरनेटमा नेपाली भाषामा लेख्न रुचाउदैनन l जान्दैनन भन्न खोजेको हैन l</p> <p>सुन्छु, बैज्ञानिक थेसिस अंग्रेजीमा लेख्नु पर्छ l कम्प्युटर चलाउन सिकाउने कुरा अंग्रेजीमा लेख्नु पर्छ l बिदेशीले लेखेको पढेर सिकेर त्यहि कुरो अंग्रेजीमै कपि पेस्ट गर्दा कहाँको मान्छेले गन्ला र ? कमसेकम आफूले पढेर बुझेको कुरो एक दुई हजार नेपाली शब्दमा लेख्दा - अंग्रेजी भाषा अप्ठेरो मान्ने नेपालीहरुलाई त काम लाग्ला ! <br /> <br />फेसबूक को स्टाटस अंग्रेजीमा लेख्नु पर्छ अरे l ट्वीट अंग्रेजीमा नलेखे ट्वीटेको के मजा l यी ढोंग हुन् l आफ्नो भाषालाई जानी जानी रेट्ने यसरि हो l लेखाई भाषामा हुदैन l लेखमा हुन्छ l राम्रो लेख संसारमा हरेक भाषामा अनुवादित हुन्छ l म आफूलाई नेपाली भन्छु भने मैले आफूले कम्प्युटरको किबोर्ड थिचेर नेपाली युनिकोडमा अक्षर झर्दा गर्व गर्न सक्नु पर्छ l जसरि हामीलाई नेपाली भाषामा बोल्न हिचकिच छैन त्यसरी लेख्न पनी हिचकिच हुनु हुन्न l बोलेको कुरो हावामा उड्छ भन्छन - यसरि नेपाली भाषामा लेख्न छाड्ने हो भने - हाम्रो भाषिक अस्तित्व मेटिने छ l हामी नेपाली बोल्ने अंग्रेज हुनेछौं l</p> <p>संदेश दाजुले जस्तो अटोठ गर्न नसके पनी मैले कोशिश गर्नेछु, अबका हरेक दिनहरु जब म लेख्न बस्छु कम्प्युटरमा मैले नेपाली अक्षरहरुमा लेख्ने छु l प्राबिधिक रुपमा र शत प्रतीशत भाषिक सुद्दतामा कन्ट्रीब्युसन गर्न नसके पनी - एउटा लेख्न रुचाउने नेपालीको हैसियतले मैले आफूले सके जति नेपाली शब्द इन्टरनेटमा छर्ने छु l एन. एस. ए. ले नेपाली नबुझुन्जेल - अर्को तिरको मन्द मन शान्ति छँदैछ l</p> <p><em>माइसंसारमा मन परे हरियो मन नपरे रातो भनेको जस्तो यो लेख मन परे फेसबूक, ट्विटर, गूगल प्लस आदिमा सेयर गरिदिनु होला / <br />  <br />(यो पोस्टको ड्राफ्ट हेरिदिने साथी भुवन पोखरेलमा आभार) </em></p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-25925947539458529292013-05-16T06:38:00.000-07:002018-11-27T03:34:05.393-08:00Met the social media personality #fotosoto<div dir="ltr" style="text-align: left;" trbidi="on">
Starting this post i'm going to share some of the moments captured through my camera. Will be using the label #fotosoto so share similar posts. If you know the persons in picture, feel free to add an awesome comment which will delight both of us : )<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-lkOL7IRPgOtY-5U28mDzoDIqQ5OkfRxRrfrrQBtVJ53aD5Rb7OVdGtrdXbcJzYN3R6g_0UClkG5RV3AFAZoBHeXYICAPMZ3cTUfs-DfgVnPR7zm2VO9-PFoA-hYXMsX01cmKFRv8uU_F/s1600/13+-+1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-lkOL7IRPgOtY-5U28mDzoDIqQ5OkfRxRrfrrQBtVJ53aD5Rb7OVdGtrdXbcJzYN3R6g_0UClkG5RV3AFAZoBHeXYICAPMZ3cTUfs-DfgVnPR7zm2VO9-PFoA-hYXMsX01cmKFRv8uU_F/s1600/13+-+1.jpg" width="480" /></a></div>
<br />
The person in this photo is a internet <b><i>spammer</i></b>, yeah people use that term when there is no word coined to describe exceptional online social media presence and management skills, he is the man who ignited interest in me to learn about social media. Glad to meet the one man virality machine who can drive your mid sized website down in a minute.</div>
@bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com1Moscone Center, San Francisco, CA 94103, USA37.784173 -122.4015570000000337.784173 -122.40155700000003 37.784173 -122.40155700000003tag:blogger.com,1999:blog-3508392207883956961.post-55567941664937231872013-04-30T01:02:00.000-07:002017-06-22T00:42:22.966-07:00Social Network Status Updates – Database Schema<div dir="ltr" style="text-align: left;" trbidi="on">Here's a simple database schema which can be used in cases where you want to take user status input. The entities available are users, updates, comments & likes. Additional entities can be added as required. Also, for simple user registration and status updates it will be more than enough. Schema derived by studying popular social networks like Facebook / Twitter / Google+ Status Updates mechanism. The schema uses MySql.<br /> <br /><strong>Schema Diagram:</strong><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEzDcVrKgPe3MhlQNvVvgxqOwu5EGAaaKQXZan7xKHWvXm8qH8cOE4pUa_HzPYYhgmK4VVdWFL-WcT-fljZ1cU0EaBfz3D7trVY1B6CI_6w6C3f3Z6TTXmtks0Hqp8BNtvvc_rFUAzGhB9/s1600-h/updatebox4.png"><img alt="updatebox" border="0" height="818" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2oIQA4tL6qwZnUILlj1dlaVs1UuAeSpAXOBZVmGUUmilvUosDfqO8MAbDhPxPuDMcyh5wY7RQGswZAUb_IV2O2dR-dykOPy5TX1OIfTxjFeSJPOePfciGAdrGVKu2rv7XA6rGjyMWaPzq/?imgmax=800" style="background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="updatebox" width="450" /></a> <br /> <br /><strong>MySQL Create Script:</strong><br />-- phpMyAdmin SQL Dump <br />-- version 3.2.0.1 <br />-- <a href="http://www.phpmyadmin.net/">http://www.phpmyadmin.net</a> <br />-- <br />-- Host: localhost <br />-- Generation Time: Apr 03, 2013 at 09:56 PM <br />-- Server version: 5.1.37 <br />-- PHP Version: 5.3.0<br />SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";<br /><br />/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; <br />/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; <br />/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; <br />/*!40101 SET NAMES utf8 */;<br />-- <br />-- Database: `updatebox` <br />--<br />-- --------------------------------------------------------<br />-- <br />-- Table structure for table `comments` <br />--<br />CREATE TABLE IF NOT EXISTS `comments` ( <br /> `id` int(11) NOT NULL AUTO_INCREMENT, <br /> `text` text CHARACTER SET utf8 NOT NULL, <br /> `created_at` int(11) NOT NULL, <br /> `update_id` int(11) NOT NULL, <br /> `user_id` int(11) NOT NULL, <br /> PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />-- <br />-- Dumping data for table `comments` <br />--<br /><br />-- --------------------------------------------------------<br />-- <br />-- Table structure for table `likes` <br />--<br />CREATE TABLE IF NOT EXISTS `likes` ( <br /> `id` int(11) NOT NULL AUTO_INCREMENT, <br /> `update_id` int(11) NOT NULL, <br /> `created_at` int(11) NOT NULL, <br /> `dislike_user_id` int(11) DEFAULT NULL, <br /> `like_user_id` int(11) DEFAULT NULL, <br /> `comment_id` int(11) DEFAULT NULL, <br /> PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />-- <br />-- Dumping data for table `likes` <br />--<br /><br />-- --------------------------------------------------------<br />-- <br />-- Table structure for table `updates` <br />--<br />CREATE TABLE IF NOT EXISTS `updates` ( <br /> `id` int(11) NOT NULL AUTO_INCREMENT, <br /> `text` text CHARACTER SET utf8 NOT NULL, <br /> `picture` varchar(255) DEFAULT NULL, <br /> `location` varchar(255) DEFAULT NULL, <br /> `created _at` int(11) NOT NULL, <br /> `video` varchar(255) DEFAULT NULL, <br /> `tags` varchar(255) DEFAULT NULL, <br /> `user_id` int(11) NOT NULL, <br /> PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />-- <br />-- Dumping data for table `updates` <br />--<br /><br />-- --------------------------------------------------------<br />-- <br />-- Table structure for table `users` <br />--<br />CREATE TABLE IF NOT EXISTS `users` ( <br /> `id` int(11) NOT NULL AUTO_INCREMENT, <br /> `first_name` varchar(255) NOT NULL, <br /> `mid_name` varchar(255) DEFAULT NULL, <br /> `last_name` varchar(255) NOT NULL, <br /> `username` varchar(255) NOT NULL, <br /> `password` varchar(255) NOT NULL, <br /> `email` varchar(255) NOT NULL, <br /> `address` varchar(255) NOT NULL, <br /> `phone` varchar(255) NOT NULL, <br /> `dob` int(11) NOT NULL, <br /> `about` text NOT NULL, <br /> `user_type` int(11) NOT NULL, <br /> `created_at` int(11) NOT NULL, <br /> PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />-- <br />-- Dumping data for table `users` <br />--<br /><br />/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; <br />/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; <br />/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; </div>@bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-72042611489403498252013-04-27T02:00:00.000-07:002017-06-22T00:42:23.045-07:00Online Shopping System–Database Design<div dir="ltr" style="text-align: left;" trbidi="on">Database design of Online Shopping System. Schema represents minimal information required to store information of a shop and products to sell. Cart information can be stored in session or if wishlist / watchlist is needed, the schema can be simply extended. Enjoy.<br /><br />Entities: <br /><br />users – shop admin, owner and customers <br />products – products to sell <br />categories - category of products. eg. laptops, phones etc <br />orders – customer placed a order <br />order_details – order always won't have a single item. store details here. <br />sales – order is sold. <br />contact – when customers / visitors contact shop owner<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_iJAaV0zi-eYnnacvS-WHlWOPvOBTbmJH-UFcCRHGiQd8xWM8zJu8SD448qQhafsiWqA-6237Xl4YXbExBUaxMs6IjXDfkQqAjauWjafGuZWKa2xAgTfnDg-I4pgKNNpvyewCxTLst9pe/s1600-h/smartshop4.png"><img alt="smartshop" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhVtoLNpSO60xof_d9jo9MxnLLeOccqw5mqd0VWz46sLik6OMdV1RXfnSyejCIaAuN5lmV74liZTKAic_RdkYQFirAM4ZgsPLLYUd5dK_erQ-veTvLIOs6klUure0l1Vefm6JS67WhtAne/?imgmax=800" height="524" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="smartshop" width="450" /></a><br />MySQL Create Script / phpMyAdmin dump:<br />-- phpMyAdmin SQL Dump <br />-- version 3.2.0.1 <br />-- <a href="http://www.phpmyadmin.net/">http://www.phpmyadmin.net</a> <br />-- <br />-- Host: localhost <br />-- Generation Time: Apr 03, 2013 at 07:51 AM <br />-- Server version: 5.1.37 <br />-- PHP Version: 5.3.0<br />SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";<br /><br />/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; <br />/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; <br />/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; <br />/*!40101 SET NAMES utf8 */;<br />-- <br />-- Database: `smartshop` <br />--<br />-- --------------------------------------------------------<br />-- <br />-- Table structure for table `category` <br />--<br />CREATE TABLE IF NOT EXISTS `category` ( <br /> `id` int(11) NOT NULL AUTO_INCREMENT, <br /> `name` varchar(255) NOT NULL, <br /> `details` text NOT NULL, <br /> PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;<br />-- <br />-- Dumping data for table `category` <br />--<br />INSERT INTO `category` (`id`, `name`, `details`) VALUES <br />(1, 'laptops', 'laptops lorem ipsum'), <br />(2, 'phones', 'phones details'), <br />(3, 'tablets', 'tablets details');<br />-- --------------------------------------------------------<br />-- <br />-- Table structure for table `contact` <br />--<br />CREATE TABLE IF NOT EXISTS `contact` ( <br /> `contact_id` int(11) NOT NULL AUTO_INCREMENT, <br /> `firstname` varchar(255) NOT NULL, <br /> `middlename` varchar(255) DEFAULT NULL, <br /> `lastname` varchar(255) NOT NULL, <br /> `emai` varchar(255) NOT NULL, <br /> `message` varchar(255) NOT NULL, <br /> `created_at` int(11) NOT NULL, <br /> PRIMARY KEY (`contact_id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />-- <br />-- Dumping data for table `contact` <br />--<br /><br />-- --------------------------------------------------------<br />-- <br />-- Table structure for table `orders` <br />--<br />CREATE TABLE IF NOT EXISTS `orders` ( <br /> `order_id` int(11) NOT NULL AUTO_INCREMENT, <br /> `user_id` int(11) NOT NULL, <br /> `shiping_address` varchar(255) DEFAULT NULL, <br /> `shiping_date` int(11) DEFAULT NULL, <br /> `shipping_status` varchar(255) DEFAULT NULL, <br /> `created_at` int(11) NOT NULL, <br /> PRIMARY KEY (`order_id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />-- <br />-- Dumping data for table `orders` <br />--<br /><br />-- --------------------------------------------------------<br />-- <br />-- Table structure for table `order_details` <br />--<br />CREATE TABLE IF NOT EXISTS `order_details` ( <br /> `order_details_id` int(11) NOT NULL AUTO_INCREMENT, <br /> `order_id` int(11) NOT NULL, <br /> `product_id` int(11) NOT NULL, <br /> `quantity` int(11) NOT NULL, <br /> PRIMARY KEY (`order_details_id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />-- <br />-- Dumping data for table `order_details` <br />--<br /><br />-- --------------------------------------------------------<br />-- <br />-- Table structure for table `products` <br />--<br />CREATE TABLE IF NOT EXISTS `products` ( <br /> `product_id` int(11) NOT NULL AUTO_INCREMENT, <br /> `name` varchar(255) NOT NULL, <br /> `description` text NOT NULL, <br /> `image` varchar(255) NOT NULL, <br /> `category_id` int(11) NOT NULL, <br /> `quantity` varchar(255) NOT NULL, <br /> `brand` varchar(255) DEFAULT NULL, <br /> `model` varchar(255) DEFAULT NULL, <br /> `configuration` varchar(255) DEFAULT NULL, <br /> `price` varchar(255) NOT NULL, <br /> `featured` int(11) NOT NULL, <br /> `created_at` int(11) NOT NULL, <br /> PRIMARY KEY (`product_id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />-- <br />-- Dumping data for table `products` <br />--<br /><br />-- --------------------------------------------------------<br />-- <br />-- Table structure for table `sales` <br />--<br />CREATE TABLE IF NOT EXISTS `sales` ( <br /> `sales_id` int(11) NOT NULL AUTO_INCREMENT, <br /> `order_id` int(11) NOT NULL, <br /> `sales_amount` int(11) NOT NULL, <br /> `created_at` int(11) NOT NULL, <br /> PRIMARY KEY (`sales_id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />-- <br />-- Dumping data for table `sales` <br />--<br /><br />-- --------------------------------------------------------<br />-- <br />-- Table structure for table `users` <br />--<br />CREATE TABLE IF NOT EXISTS `users` ( <br /> `user_id` int(11) NOT NULL AUTO_INCREMENT, <br /> `firstname` varchar(255) NOT NULL, <br /> `middlename` varchar(255) DEFAULT NULL, <br /> `lastname` varchar(255) NOT NULL, <br /> `email` varchar(255) NOT NULL, <br /> `password` varchar(255) NOT NULL, <br /> `address` varchar(255) NOT NULL, <br /> `phone` varchar(255) NOT NULL, <br /> `type` varchar(255) NOT NULL, <br /> `created_at` int(11) NOT NULL, <br /> PRIMARY KEY (`user_id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;<br />-- <br />-- Dumping data for table `users` <br />--<br /><br />/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; <br />/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; <br />/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; </div>@bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com8tag:blogger.com,1999:blog-3508392207883956961.post-47196332986625891702013-04-26T01:01:00.000-07:002017-06-22T00:42:22.917-07:00Quiz System–Database Schema Design<p>MySQL Database Schema design for quiz system. <br /> <br />Schema Diagram: <br /> <br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7bSCCRidVvZhaeehyX5fuwu2lTfekWfQW5bMdYSbcAlhwQvaUTukkAosOJUJN5BQ6VQgZdD9OltWdkXli3JBpChhTmCR2e0VM4Fc7sOCrVuxbUJxbyYRrF5y-rT4NBtIkDywvC4puFmlP/s1600-h/quiz4.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="quiz" border="0" alt="quiz" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6foRUxZwF7WJ32uethqhNLZbNaQNy3meS_ZsZtPLZQtGNRCnaYrSMUWfHgdLyboINMhnLspN5bwDhEekagnKbj5-JPSN8cN1_MEmBEkewTyxW_qZOwRXxSizfhTUP5qQFzEIyoJBFT1Fo/?imgmax=800" width="450" height="850" /></a></p> <p>MySQL Create Script:</p> <p>-- phpMyAdmin SQL Dump <br />-- version 3.2.0.1 <br />-- <a href="http://www.phpmyadmin.net">http://www.phpmyadmin.net</a> <br />-- <br />-- Host: localhost <br />-- Generation Time: Apr 01, 2013 at 08:27 PM <br />-- Server version: 5.1.37 <br />-- PHP Version: 5.3.0</p> <p>SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";</p> <p> <br />/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; <br />/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; <br />/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; <br />/*!40101 SET NAMES utf8 */;</p> <p>-- <br />-- Database: `quiz` <br />--</p> <p>-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `category` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `category` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) CHARACTER SET utf8 NOT NULL, <br />  `slug` varchar(255) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `category` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `level` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `level` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) NOT NULL, <br />  `slug` varchar(255) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `level` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `questions` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `questions` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `question` text CHARACTER SET utf8 NOT NULL, <br />  `option1` varchar(255) NOT NULL, <br />  `option2` varchar(255) NOT NULL, <br />  `option3` varchar(255) NOT NULL, <br />  `option4` varchar(255) NOT NULL, <br />  `answer` varchar(255) NOT NULL, <br />  `category_id` int(11) NOT NULL, <br />  `level_id` int(11) NOT NULL, <br />  `image` varchar(255) DEFAULT NULL, <br />  `status` int(11) NOT NULL DEFAULT '0', <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `questions` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `score` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `score` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `user_id` int(11) NOT NULL, <br />  `question_id` int(11) NOT NULL, <br />  `category_id` int(11) NOT NULL, <br />  `level_id` int(11) NOT NULL, <br />  `user_answer` varchar(255) NOT NULL, <br />  `is_correct` int(11) NOT NULL, <br />  `points` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `score` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `settings` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `settings` ( <br />  `points_per_question` int(11) NOT NULL, <br />  `site_name` varchar(255) NOT NULL, <br />  `site_slogan` varchar(255) NOT NULL <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1;</p> <p>-- <br />-- Dumping data for table `settings` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `users` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `users` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `username` varchar(255) NOT NULL, <br />  `password` varchar(255) NOT NULL, <br />  `email` varchar(255) NOT NULL, <br />  `created_at` int(11) NOT NULL, <br />  `image` varchar(255) DEFAULT NULL, <br />  `about` text CHARACTER SET utf8, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=73 ;</p> <p>-- <br />-- Dumping data for table `users` <br />--</p> <p> <br />/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; <br />/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; <br />/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; </p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-79390322773109407902013-04-26T01:00:00.000-07:002017-06-22T00:42:23.081-07:00Photo Video Gallery–Database Design<p>Database design for photo video gallery website / app. Enjoy.</p> <p>Schema Diagram:</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghleir2l4_xumsiuxnJk_2NA-_ZdpvW6uNmFcPQAHR9m48VDmKJY0kp30_uSigRQkahzSWBFPKGrNw2raGUdYZ5xdfQK0bqXO4MeyqVguQ3sr-5LWQyuKpXwEBxwWl2RnOL4mJcBh5kosk/s1600-h/pvgallery4.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="pvgallery" border="0" alt="pvgallery" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZjrCUpSdC63XjFW58c2c1KjtvjVmsJaxLAuSSZATraNWV0UmsgedexxGSGWgVSwmCnXNnKMh8H_Sg0k2z-Eb9JYr_v2DxUkzDhnNaJP60fH6spt16-GJsG5zOG807PFyEBdZkfccz8QXz/?imgmax=800" width="450" height="667" /></a> <br />MySQL Create script: <br /> <br /></p> <p>-- phpMyAdmin SQL Dump <br />-- version 3.2.0.1 <br />-- <a href="http://www.phpmyadmin.net">http://www.phpmyadmin.net</a> <br />-- <br />-- Host: localhost <br />-- Generation Time: Apr 03, 2013 at 10:25 PM <br />-- Server version: 5.1.37 <br />-- PHP Version: 5.3.0</p> <p>SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";</p> <p> <br />/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; <br />/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; <br />/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; <br />/*!40101 SET NAMES utf8 */;</p> <p>-- <br />-- Database: `pvgallery` <br />--</p> <p>-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `category` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `category` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) NOT NULL, <br />  `details` text NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `category` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `comments` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `comments` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `media_id` int(11) NOT NULL, <br />  `user_id` int(11) NOT NULL, <br />  `comment_text` text CHARACTER SET utf8 NOT NULL, <br />  `created_at` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `comments` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `media` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `media` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) CHARACTER SET utf8 NOT NULL, <br />  `description` text CHARACTER SET utf8 NOT NULL, <br />  `file` varchar(255) NOT NULL, <br />  `size` int(11) NOT NULL, <br />  `likes` int(11) DEFAULT NULL, <br />  `views` int(11) DEFAULT NULL, <br />  `downloads` int(11) DEFAULT NULL, <br />  `category_id` int(11) DEFAULT NULL, <br />  `user_id` int(11) NOT NULL, <br />  `media_type_id` int(11) NOT NULL, <br />  `created_at` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `media` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `media_type` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `media_type` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) NOT NULL, <br />  `slug` varchar(255) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;</p> <p>-- <br />-- Dumping data for table `media_type` <br />--</p> <p>INSERT INTO `media_type` (`id`, `name`, `slug`) VALUES <br />(1, 'Videos', 'videos'), <br />(2, 'Photos', 'photo'), <br />(3, 'Music', 'music');</p> <p>-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `users` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `users` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `username` varchar(255) NOT NULL, <br />  `password` varchar(255) NOT NULL, <br />  `email` varchar(255) NOT NULL, <br />  `type` int(11) NOT NULL, <br />  `created_at` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `users` <br />--</p> <p> <br />/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; <br />/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; <br />/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; </p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-32570772255205007992013-04-24T00:59:00.000-07:002017-06-22T00:42:22.867-07:00Marksheet Generation System–Database Design<p>Schema for Marksheet Generation System useful for school, colleges and institutes to store student's information, exam marks etc. Extend at your will. <br /> <br />Schema Diagram: <br /> <br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZpQhbKd7IbHYNLkQQjcxVN72AWDy2WspVrQBpP2icfRF7BlLYRvg0kPtS8GEuA2KNtposNTMmS7hd6GHlnM2rZOkT0KG1E1omM24fUGIaQcLGnx7ppQJhFg5zRmTlFkIVTcOVpPnTemn8/s1600-h/online_marksheet4.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="online_marksheet" border="0" alt="online_marksheet" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9zOUd7AOCa8Wn0CTORUkvxQ3rfDKRF9gXG0zi-5mux69BmCiCNFfm32qNlPceYJURlIDeDCI3K5GqnYGYzSzqoIWFWTsvWxQ2bAG_QN2z8H3QtuhXZLQPqSnZxcDaLWezzuG3hrFajGZT/?imgmax=800" width="450" height="489" /></a> <br /> <br />MySQL Create Script phpMyAdminDump:</p> <p>-- phpMyAdmin SQL Dump <br />-- version 3.2.0.1 <br />-- <a href="http://www.phpmyadmin.net">http://www.phpmyadmin.net</a> <br />-- <br />-- Host: localhost <br />-- Generation Time: Apr 02, 2013 at 07:28 PM <br />-- Server version: 5.1.37 <br />-- PHP Version: 5.3.0</p> <p>SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";</p> <p> <br />/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; <br />/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; <br />/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; <br />/*!40101 SET NAMES utf8 */;</p> <p>-- <br />-- Database: `online_marksheet` <br />--</p> <p>-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `faculties` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `faculties` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;</p> <p>-- <br />-- Dumping data for table `faculties` <br />--</p> <p>INSERT INTO `faculties` (`id`, `name`) VALUES <br />(1, 'BSC-CSIT'), <br />(2, 'BBA'), <br />(3, 'BBS');</p> <p>-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `feedback` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `feedback` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) NOT NULL, <br />  `email` int(11) NOT NULL, <br />  `comment` text CHARACTER SET utf8 NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `feedback` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `institutions` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `institutions` ( <br />  `id` int(50) NOT NULL, <br />  `name` varchar(255) NOT NULL, <br />  `address` varchar(255) NOT NULL, <br />  `phone` varchar(255) NOT NULL, <br />  `fax` varchar(255) NOT NULL, <br />  `website` varchar(255) NOT NULL, <br />  `affiliated_to` varchar(255) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1;</p> <p>-- <br />-- Dumping data for table `institutions` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `marks` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `marks` ( <br />  `id` int(11) NOT NULL, <br />  `subject_id` int(11) NOT NULL, <br />  `student_id` int(11) NOT NULL, <br />  `mark_assessment` int(11) NOT NULL, <br />  `mark_semester` int(11) NOT NULL, <br />  `total_marks` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1;</p> <p>-- <br />-- Dumping data for table `marks` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `results` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `results` ( <br />  `id` int(11) NOT NULL, <br />  `student_id` int(11) NOT NULL, <br />  `total_marks` int(11) NOT NULL, <br />  `result` varchar(255) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1;</p> <p>-- <br />-- Dumping data for table `results` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `students` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `students` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `first_name` varchar(255) NOT NULL, <br />  `mid_name` varchar(255) NOT NULL, <br />  `last_name` text NOT NULL, <br />  `symbol_no` varchar(255) NOT NULL, <br />  `date_of_birth` datetime NOT NULL, <br />  `regd_no` varchar(255) NOT NULL, <br />  `faculty_id` varchar(255) NOT NULL, <br />  `year` varchar(255) NOT NULL, <br />  `semester` varchar(255) DEFAULT NULL, <br />  `institutions_id` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `students` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `subjects` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `subjects` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `course_no` varchar(255) NOT NULL, <br />  `course_hours` varchar(255) NOT NULL, <br />  `name` varchar(255) NOT NULL, <br />  `fm_assessment` int(11) NOT NULL, <br />  `fm_semester` int(11) NOT NULL, <br />  `fm_total` int(11) NOT NULL, <br />  `pm_assessment` int(11) NOT NULL, <br />  `pm_semester` int(11) NOT NULL, <br />  `pm_total` int(11) NOT NULL, <br />  `type` varchar(255) NOT NULL COMMENT 'theory or practical', <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `subjects` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `users` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `users` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `username` varchar(222) NOT NULL, <br />  `email` varchar(222) NOT NULL, <br />  `password` varchar(222) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `users` <br />--</p> <p> <br />/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; <br />/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; <br />/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; </p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-30375164543951412142013-04-19T00:57:00.000-07:002017-06-22T00:42:22.814-07:00Simple CMS (Content Management System) – database design<p>Schema design of simple content management system. Schema and tables itself speak about the type of information indented to be stored by the system. <br /> <br />Schema Diagram: <br /> <br /></p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi09rgsdn68Jd_c7PZp84R5Arjx73cDF3eJNBv_URq-4XBZmKUlaC64eAL3QjI7-Qg0qdrqiORSj7jUDYmojQV9qcxl8CvnVXFZFOwxETWdRytgSUfC9jkh9gMZ-KHFOg6fkvJEM10FblfP/s1600-h/cms-v1.04.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="cms-v1.0" border="0" alt="cms-v1.0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOlW0uJn2IFkL9x81yHx8uCgM8JoUpsGedWQsc_sol1G-wpAOMgg4vXfRvXhd9i4cubVcjoJ4IXUUwkASgPj45nMaKratHDGaRudFIYBhVhti3vBezE9ZLoKi0BI7GcWiiQgvET4BtXnXN/?imgmax=800" width="450" height="964" /></a> <br />MySQL Create Script phpMyAdmin dump:</p> <p>-- phpMyAdmin SQL Dump <br />-- version 3.2.0.1 <br />-- <a href="http://www.phpmyadmin.net">http://www.phpmyadmin.net</a> <br />-- <br />-- Host: localhost <br />-- Generation Time: Mar 30, 2013 at 10:20 PM <br />-- Server version: 5.1.37 <br />-- PHP Version: 5.3.0</p> <p>SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";</p> <p> <br />/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; <br />/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; <br />/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; <br />/*!40101 SET NAMES utf8 */;</p> <p>-- <br />-- Database: `cms` <br />--</p> <p>-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `comments` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `comments` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `user_id` int(11) DEFAULT NULL, <br />  `post_id` int(11) NOT NULL, <br />  `author` varchar(255) CHARACTER SET utf8 DEFAULT NULL, <br />  `author_email` varchar(255) CHARACTER SET utf8 DEFAULT NULL, <br />  `author_url` varchar(255) DEFAULT NULL, <br />  `content` text NOT NULL, <br />  `approved` int(11) NOT NULL, <br />  `created_at` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `comments` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `gallery` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `gallery` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) CHARACTER SET utf8 NOT NULL, <br />  `path` varchar(255) NOT NULL, <br />  `caption` varchar(255) CHARACTER SET utf8 NOT NULL, <br />  `status` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `gallery` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `navigations` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `navigations` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `link_text` varchar(255) CHARACTER SET utf8 NOT NULL, <br />  `url` varchar(255) NOT NULL, <br />  `description` varchar(255) CHARACTER SET utf8 NOT NULL, <br />  `group_id` int(11) NOT NULL, <br />  `click_count` int(11) NOT NULL, <br />  `created_at` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `navigations` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `navigation_groups` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `navigation_groups` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) CHARACTER SET utf8 NOT NULL, <br />  `slug` varchar(255) CHARACTER SET utf8 NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `navigation_groups` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `post` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `post` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `user_id` int(11) NOT NULL, <br />  `title` varchar(255) CHARACTER SET utf8 NOT NULL, <br />  `content` text CHARACTER SET utf8 NOT NULL, <br />  `category` int(11) DEFAULT NULL, <br />  `image` varchar(255) DEFAULT NULL, <br />  `created_at` int(11) NOT NULL, <br />  `status` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `post` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `post_categories` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `post_categories` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) CHARACTER SET utf8 NOT NULL, <br />  `slug` varchar(255) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `post_categories` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `settings` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `settings` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `site_name` varchar(255) CHARACTER SET utf8 NOT NULL, <br />  `site_slogan` varchar(255) CHARACTER SET utf8 NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `settings` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `users` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `users` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `username` varchar(255) NOT NULL, <br />  `password` varchar(255) NOT NULL, <br />  `email` varchar(255) NOT NULL, <br />  `created_at` int(11) NOT NULL, <br />  `image` varchar(255) DEFAULT NULL, <br />  `about` text CHARACTER SET utf8, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=73 ;</p> <p>-- <br />-- Dumping data for table `users` <br />--</p> <p> <br />/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; <br />/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; <br />/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; </p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-83698057437424589272013-04-05T00:52:00.000-07:002017-06-22T00:42:23.088-07:00Online Vehicle Ticketing System Database Design Sample<p>Online Bus/Vehicle Ticketing System Database Design Sample – MySQL. With minor modifications or further generalization this database schema can be used to implement any kind of ticket booking system. eg. movie ticket booking system, events/show ticket booking etc.  <br /> <br /><strong>Entities: <br /></strong> <br />users – user details <br />user_type – type of users in system <br />vendors – providers' information, in this case vehicle owner <br />vehicles – particular vehicle information <br />schedules – schedules of vehicles <br />routes – information of vehicle routes <br />vehicle_seats – vehicle seats information <br />tickets – actual ticket booking status etc stored here <br />media – images/videos etc related to particular vehicle stored here. <br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizwY4Np1u5oc_SvgGw0NrTitguHvyR6R4CTJ9bFiD9uIwQ2wH7PtO52_-TD5TE2FqE0MK41sId94Vpa4_-i3m393RTqRo_jpGjrEcBALBPf8fmiSv0fJLVoh7LcHTB_gysOGPMC_1ZZH5W/s1600-h/onlineticket5.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="onlineticket" border="0" alt="onlineticket" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEix0g7DHWUggKBtqY4ovv6YOX71sxHSevncX73EdMRM9DGm-n8ge7QCKeakHIiWBP6WQmUHAjTAFn9l8894IuZT5u2HBTwnjhiqnUd-PN-T0QUs2uLymz051D5ZV0M_Amagvg2E85s9OEcX/?imgmax=800" width="450" height="1301" /></a></p> <p>MySQL Create Script:</p> <p>-- phpMyAdmin SQL Dump <br />-- version 3.2.0.1 <br />-- <a href="http://www.phpmyadmin.net">http://www.phpmyadmin.net</a> <br />-- <br />-- Host: localhost <br />-- Generation Time: Apr 04, 2013 at 10:18 PM <br />-- Server version: 5.1.37 <br />-- PHP Version: 5.3.0</p> <p>SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";</p> <p> <br />/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; <br />/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; <br />/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; <br />/*!40101 SET NAMES utf8 */;</p> <p>-- <br />-- Database: `onlineticket` <br />--</p> <p>-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `media` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `media` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `vehicle_id` int(11) NOT NULL, <br />  `name` varchar(255) NOT NULL, <br />  `path` varchar(255) NOT NULL, <br />  `created_at` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='table for storing images, video etc about vehicles' AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `media` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `routes` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `routes` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `source` varchar(255) NOT NULL, <br />  `destination` varchar(255) NOT NULL, <br />  `distance` varchar(255) NOT NULL, <br />  `travel_time` varchar(255) NOT NULL, <br />  `stops` text NOT NULL, <br />  `fare` varchar(255) NOT NULL, <br />  `other_info` text, <br />  `created_at` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `routes` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `schedules` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `schedules` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `vehicle_id` int(11) NOT NULL, <br />  `departure_time` varchar(255) NOT NULL, <br />  `arrival_time` varchar(255) NOT NULL, <br />  `status` int(11) NOT NULL COMMENT 'schedule confirmed, delayed, cancelled', <br />  `created_at` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `schedules` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `tickets` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `tickets` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `ticket_no` varchar(255) NOT NULL, <br />  `schedule_id` int(11) NOT NULL, <br />  `seat_id` int(11) NOT NULL, <br />  `vehicle_id` int(11) NOT NULL, <br />  `route_id` int(11) NOT NULL, <br />  `user_id` int(11) NOT NULL, <br />  `status` int(11) NOT NULL, <br />  `created_at` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `tickets` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `users` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `users` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `username` varchar(255) NOT NULL, <br />  `password` varchar(255) NOT NULL, <br />  `email` varchar(255) NOT NULL, <br />  `phone` varchar(255) NOT NULL, <br />  `type_id` int(11) NOT NULL, <br />  `created_at` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `users` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `user_type` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `user_type` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) NOT NULL, <br />  `slug` varchar(255) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `user_type` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `vehicles` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `vehicles` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `vendor_id` int(11) NOT NULL, <br />  `name` varchar(255) NOT NULL, <br />  `vehicle_info` text NOT NULL, <br />  `number` varchar(255) NOT NULL, <br />  `seats` int(11) NOT NULL, <br />  `driver` varchar(255) NOT NULL, <br />  `driver_phone` varchar(255) NOT NULL, <br />  `route_id` int(11) NOT NULL, <br />  `created_at` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `vehicles` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `vehicle_seats` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `vehicle_seats` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) NOT NULL, <br />  `description` varchar(255) NOT NULL, <br />  `remark` varchar(255) NOT NULL, <br />  `vehicle_id` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `vehicle_seats` <br />--</p> <p> <br />-- --------------------------------------------------------</p> <p>-- <br />-- Table structure for table `vendors` <br />--</p> <p>CREATE TABLE IF NOT EXISTS `vendors` ( <br />  `id` int(11) NOT NULL AUTO_INCREMENT, <br />  `name` varchar(255) NOT NULL, <br />  `description` text NOT NULL, <br />  `logo` varchar(255) DEFAULT NULL, <br />  `address` varchar(255) NOT NULL, <br />  `phone` varchar(255) NOT NULL, <br />  `email` varchar(255) NOT NULL, <br />  `website` varchar(255) NOT NULL, <br />  `user_id` int(11) NOT NULL, <br />  `created_at` int(11) NOT NULL, <br />  PRIMARY KEY (`id`) <br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;</p> <p>-- <br />-- Dumping data for table `vendors` <br />--</p> <p> <br />/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; <br />/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; <br />/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;</p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com3tag:blogger.com,1999:blog-3508392207883956961.post-70101490747414863522011-11-08T07:47:00.000-08:002017-06-22T00:42:23.029-07:00PyroCMS Themes, Widgets and Modules - for reference.Themes :<br /><br />https://github.com/semicolondevelopers/pyro_theme_artificial_casting<br />https://github.com/semicolondevelopers/pyro_theme_blue_spades<br />https://github.com/semicolondevelopers/pyro_theme_business_time<br />https://github.com/semicolondevelopers/pyro_theme_coffee<br />https://github.com/semicolondevelopers/pyro_theme_eco_design<br />https://github.com/semicolondevelopers/pyro_theme_night_club<br /><br />PyroCMS v1.3.2 Theming Guide for beginners:<br />http://echo.semicolondev.com/2011/11/hot-to-create-pyrocms-v132-theme-step.html<br /><br />PyroCMS Tag Cheat Sheet <br /><br /><br />Widgets<br /><br />https://github.com/semicolondevelopers/pyro_widget_category<br />https://github.com/semicolondevelopers/pyro_widget_login_box<br />https://github.com/semicolondevelopers/pyro_widget_selected_category_posts<br /><br />PyroCMS v1.3.2 Widget creation guide for beginners<br />http://echo.semicolondev.com/2011/11/how-to-create-pyrocms-v132-widgets.html<br /><br />Modules:<br /><br />Hello World Module <br />https://github.com/semicolondevelopers/pyro_module_hello<br /><br />Old 0.9.9.x Forum module upgraded to v1.3.2 <br />https://github.com/semicolondevelopers/pyro_module_forums<br /><br />PyroCMS v1.3.2 & v0.9.9.7 Module Creation guide for beginners:<br />http://bhu1st.blogspot.com/2010/09/hello-world-pyrocms-module.html@bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-86053344683281484172011-11-07T08:31:00.000-08:002017-06-22T00:42:23.095-07:00नेपाली ब्लगरहरुलाई छोटो मीठो सल्लाह<p>Quick SEO tip for Nepali (Unicode) Bloggers</p> <p>Here goes, one quick SEO (Search Engine Optimization) tip for Nepali Bloggers who use Blogger.com to publish their content written in Nepali Unicode. </p> <h3>What I’m talking about ? </h3> <p>Say: your blog post title is “मेरो नेपाल” <br />You publish it. Now blogger gives you one random “url/permalink” to your post which looks something like – <strong>http://yourblog.com/2011/11/blog-post.html. </strong>Why that happens is because blogger.com service is not made in Nepal. Now forget that reasoning since that does makes no sense. </p> <p>Such permalinks suck from SEO perspective, ain’t it ? Blogger left no option to provide an equivalent English permalink/url for our Nepali Unicode blog article. </p> <p>If the post had English/roman title like : Mero Nepal <br />Permalink would have been: <strong>http://yourblog.com//2011/11/mero-nepal.html</strong></p> <p>Do you see problem here ? Yes that’s what I am talking about. Now question is, what if we could provide a meaningful url to our Nepali Unicode post keeping the Unicode title as is ? Obviously, our content would be more search engines friendly. </p> <h3>Solution ?</h3> <p>Solution is so simple that even our grandmother would follow it. Let me describe that in steps. </p> <h4>Step 1: </h4> <p>Write your article in Nepali Unicode.</p> <h4>Step 2: </h4> <p>Give your post a equivalent roman or english title. <br />eg. instead of using “मेरो नेपाल” in blog title use “Mero Nepal” or “My Nepal”</p> <h4>Step 3: </h4> <p>Publish your blog post. <br />that gives us a readable URL in English or roman.</p> <h4>Step 4: </h4> <p>Now edit your blog post’s title – change it back to Nepali Unicode version. <br />use “मेरो नेपाल”  in title of the article now. </p> <h4>Step 5: </h4> <p>Re-publish the edited post. </p> <h4>Step 6:</h4> <p>Enjoy ! Let Google take care of the rest. </p> <h3>Conclusion</h3> <p>Search engines give more priority to the permalink/URL of the post. It makes sense to have a more meaningful, human readable URL to our blog post. It helps our reader to find our content via search engines. </p> <p>If you find this tip useful, please leave a comment to this post or subscribe to my blog. </p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-439716807635339722011-03-29T05:55:00.000-07:002017-06-22T00:42:22.897-07:00Android SDK and AVD Manager slow download problem<div dir="ltr" style="text-align: left;" trbidi="on">I was Installing the Android SDK (<a href="http://developer.android.com/sdk/installing.html">http://developer.android.com/sdk/installing.html</a>) on my Windows XP box.<br /><h3>Problem : Slow download of android SDK platforms ~5kb/s</h3><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFWtvlJkjonETLpJW0nMQpu5MamM0cUZdJ_4p3ID5KrCVR4K0CbTMtxvrtR4uVLJ9W70inl-JXAzGkt6J_JgcAmTaPrTj5hbXgJ-xxWqWWkwYXGKCmIsJC0RonwZ_cUj8PUO24xYSJTXbJ/s1600-h/androidsdkdownload5kbpersecond9.jpg"><img alt="android sdk download ~5kb per second" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgpTzgpw1wF6snB2-rIZL_okQBhxBbV284Y4Aeevq-oFbEx1DHFyd7G4GJi8VK3tvisyDy_8PvOCMlGuavkPagGnnIpKJyMCfGzhBbzA2ciaZwonIFHLwpKq07RpcK3VUGLyViGLzRGLhs/?imgmax=800" height="308" style="border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;" title="android sdk download ~5kb per second" width="430" /></a> <br />Android SDK and AVD Manager Stalling During Download : <a href="http://groups.google.com/group/android-developers/browse_thread/thread/12cd670ed8886256" target="_blank">Google Groups</a> <br />Android sdk download/update failing : <a href="http://stackoverflow.com/questions/2882425/android-sdk-download-update-failing" target="_blank">Stack Overflow</a><br /><h3>How to speed up Android SDK platform download ?</h3><h5>1. Allow download over http : check the option in Settings section of Android SDK and AVD manager. </h5><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXbiksFIomgf8jQO55MGYta3aAcfejzEORoL3JOwEsx98PxGcTPFDih_upNwRRRyq8Yfmo05_yss23-PMCO44XdxSw1vxSyaWK5TOTjGqWE7tzRL7pQUwwvcgixFCeWD2iFpTiYrSws5ER/s1600-h/https6.jpg"><img alt="https" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGz-TMttAo_i1SKX4VFDzkHrvrVcpQmZAkMR7aHhvBQCwAdrs9WHIucHYjNovaQUHxdCzg5Em3-ZM2VzcEqcuN7YRXljOMWAYB4NzjgO2DdjAa_waoi-r53RaGcDIkXNzhv_lMbrI28h8F/?imgmax=800" height="316" style="border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;" title="https" width="440" /></a> <br /><h5>2. Disable/Deactivate your antivirus application.</h5><blockquote>Recommended at : <a href="http://developer.android.com/sdk/adding-components.html" target="_blank">Adding SDK Components</a> page <br /><br /><b>Caution:</b> Before you install SDK components, we recommend that you disable any antivirus software that may be running on your computer. There are cases in which antivirus software on Windows is known to interfere with the installation process, so we suggest you disable your antivirus until installation is complete.</blockquote><br />After allowing download over http and deactivating antivirus, my download speed increased to around 20kb/s. Still not good but better than ~5kb/s <br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicxNOFYPJ3W2LQ4xn-T0InO73RaJMM1N7YgQtaqv6K3z2P5qDJe28HwQbzkeywztqgenpAWU7IyLooWG0kqZNA-IbgAcru_Cl3kolCI4qjXJyhetYNb7B4sysTHj8wIT_SD2dB62O1-dLz/s1600-h/androidsdkdownload20kbpersecond6.jpg"><img alt="android sdk download 20kb per second" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV26Sz_s18hlngNlb5Ahik_M3DcwVeojvmm8wRLPbs5kTNRVgJ85WVizwOCKwuKuiZpkzwAb-MSqcVOlZanVp67P3uissmkLufpZQ3sj76PlNmaJvB-kXNDYkKSBLlKzV42pkBtSySxwUZ/?imgmax=800" height="346" style="border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;" title="android sdk download 20kb per second" width="453" /></a><br /><h5>3. Or you can prefer offline Android SDK component download option :</h5>Stackoverflow: <a href="http://stackoverflow.com/questions/2766713/android-download-the-android-sdk-components-for-offline-install">Download the Android SDK components for offline install</a> <br />(<a href="http://qdevarena.blogspot.com/2010/05/download-android-sdk-standalone-for.html" target="_blank">direct link to post</a> describing offline download procedure)<br /><blockquote><b>Hope this helps save some of your android sdk platforms download time.</b></blockquote><b> </b><br /><b><br /></b><b> After download you can start with following Hello World android tutorials. <br /> </b> <br /><h3>Android Hello world tutorials:</h3>Hello, World – Android developers <br /><a href="http://developer.android.com/resources/tutorials/hello-world.html">http://developer.android.com/resources/tutorials/hello-world.html</a><br />Android Development Tutorial - Gingerbread <br /><a href="http://www.vogella.de/articles/Android/article.html">http://www.vogella.de/articles/Android/article.html</a> <br /><br /><br />Or grab this book:<br /><br /><iframe frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ac&ref=tf_til&ad_type=product_link&tracking_id=bhupsapk-20&marketplace=amazon&region=US&placement=1430266015&asins=1430266015&linkId=IMIVM4ACJVB6UMCV&show_border=true&link_opens_in_new_window=true" style="height: 240px; width: 120px;"></iframe> <br /><br /><br />Cheers!</div>@bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com1tag:blogger.com,1999:blog-3508392207883956961.post-55066493152094050332011-03-07T04:52:00.000-08:002017-06-22T00:42:22.958-07:00PHP Short Tag : Avoid Them<p><a href="http://php.net/manual/en/ini.core.php" target="_blank">PHP Short Tag:</a> </p> <blockquote> <p>it  look like this: </p> <p><?   ?></p> <p><?= $var ?> </p> </blockquote> <blockquote> <p>obvious ones: </p> <p><?php  ?></p> <p><?php echo $var ?>.</p> </blockquote> <p>I downloaded an open source php script, thinking to work it out for my own purpose – but what sucks is - the project uses short tag that my host doesn’t *seems* to provide support for. For the testing purpose i needed to TOGGLE the short tag on/off switch in php.ini</p> <h3>How to enable PHP Short Tag ?</h3> <p>Open your php.ini file in your favorite editor. </p> <p>Here’s what it says in line number 214 through 226 </p> <p>; This directive determines whether or not PHP will recognize code between <br />; <? and ?> tags as PHP source which should be processed as such. It's been <br />; recommended for several years that you not use the short tag "short cut" and <br />; instead to use the full <?php and ?> tag combination. With the wide spread use <br />; of XML and use of these tags by other languages, the server can become easily <br />; confused and end up parsing the wrong code in the wrong context. But because <br />; this short cut has been a feature for such a long time, it's currently still <br />; supported for backwards compatibility, but we recommend you don't use them. <br />; Default Value: On <br />; Development Value: Off <br />; Production Value: Off <br />; <a href="http://php.net/short-open-tag">http://php.net/short-open-tag</a> <br />; short_open_tag = Off <br /></p> <p>Now change the short_open_tag = Off  to (remove semicolon) </p> <blockquote> <p>short_open_tag = On</p> </blockquote> <p>Restart Apache or XAMPP or your WAMPP installation</p> <blockquote> <p>but here’s a big BUT below </p> </blockquote> <p> </p> <h3>Why you should avoid using PHP Short Tag ? </h3> <p><a href="http://stackoverflow.com/questions/3561423/php-short-open-tag-problem" target="_blank">Stackoverflow</a> : Answer </p> <p>Normally you write PHP like so: <?php PHP CODE HERE ?>. However if *allow_short_tags* directive is enabled you're able to use: <? PHP CODE HERE ?>. Also sort tags provides extra syntax: <?= $var ?> which is equal to <?php echo $var ?>.</p> <p>Short tags might seem cool but they're not. They causes only more problems. Oh... and IIRC they'll be removed from PHP6.</p> <p><a href="http://stackoverflow.com/questions/200640/are-php-short-tags-acceptable-to-use" target="_blank">Stackoverflow</a>: Answer</p> <p>They're not recommended because it's a PITA if you ever have to move your code to a server where it's not supported (and you can't enable it). As you say, lots of shared hosts do support shorttags but "lots" isn't all of them. If you want to share your scripts, it's best to use the full syntax.</p> <p>I agree that <? and <?= are easier on programmers than <?php and <?php echo but it is possible to do a bulk find-and-replace as long as you use the same form each time (and don't chuck in spaces (eg: <? php or <? =)</p> <p>I don't buy readability as a reason at all. Most serious developers have the option of syntax highlighting available to them</p> <p> </p> <h3>Use it if : </h3> <ul> <li>you own a server and don’t care whether shared server support short tag or not</li> <li>you don’t care what community says</li> <li>you don’t want to Open Source your code later <br /></li> </ul> <h4><em><?php</em></h4> <blockquote> <p><em>/*</em></p> <p><em>Oh please, don’t ask another question on stackoverflow about how to disable PHP Short Tag.</em></p> <p><em>Rather you may want to write a parser that will loop through your 500+ php source code files and replace this Pain In The Ass PHP Short Tag to Normal PHP tag and share us the link. </em><a href="http://stackoverflow.com/questions/684587/batch-script-to-replace-php-short-open-tags-with-php" target="_blank"><em>Here’s hint.</em></a></p> <p>*/</p> </blockquote> <h4><em>?></em></h4> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-88845823348543070252011-03-06T03:43:00.000-08:002017-06-22T00:42:23.124-07:00Wordpress Themes / Templates - Useful Codes<p>Here are few fairly basic but handy wordpress codes that a wordpress theme or template developer/designers could use as reference. i personally use these a lot while working with wordpress. </p> <p> </p> <h3>Wordpress Site Name:</h3> <p><?php bloginfo('name'); ?></p> <p> </p> <h3>Wordpress Site Description:</h3> <p><?php bloginfo('description'); ?> </p> <p> </p> <h3>Wordopress: Home Page Link:</h3> <br /> <p><a href="<?php get_option('home'); ?>">Home</a></p> <br />or <br /><a href="<?php bloginfo('url'); ?>">Home</a> </p> <p> </p> <h3>Wordpress : Navigation – Display List of Pages in <li></h3> <p><?php wp_list_pages('title_li=&depth=1&exclude=2,7'); ?></p> <p> </p> <h3>Wordpress Theme/Template Path:</h3> <p><link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('template_url');?>/css/screen.css" /></p> <p> </p> <h3>Wordpress : Inside The Loop </h3> <p><?php the_permalink() ?> <br /><?php the_title_attribute(); ?> <br />Post time: <?php the_time('F jS, Y') ?> <br />Post Author: <?php the_author() ?> <br />Post Content: <?php the_content('Read the rest of this entry &raquo;'); ?> <br />Post Tags: <?php the_tags('Tags: ', ', ', '<br />'); ?> <br />Post Category: <?php the_category(', ') ?> <br />Post Edit Link: <?php edit_post_link('Edit', '', ' | '); ?></p> <p> </p> <h3>Wordpress: Display Specific Page/Post Content </h3> <p><strong>display specific  page content with page name</strong></p> <p><?php query_posts('pagename=pname'); //pname = your page name?> <br /><?php while (have_posts()) : the_post(); ?> <br /><h3><?php the_title(); ?></h3> <br /><p> <br /><?php the_content() ?> <br /></p>     <br /><?php endwhile; ?></p> <p> <strong><strong>display specific  page content with </strong>using page_id </strong></p> <p><?php query_posts('page_id=1'); //put page id of Home or Stations  in your case?> <br /><?php while (have_posts()) : the_post(); ?> <br /><h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1> <br /><p> <br /><?php <br />the_content('Read the rest of this entry &raquo;') <br />?> <br /></p> <br /><?php endwhile; ?></p> <p><strong><strong>display specific  post content </strong>using post id </strong></p> <p><?php <br />// retrieve one post with an ID of 5 <br />query_posts( 'p=5' ); <br />// set $more to 0 in order to only get the first part of the post <br />global $more; <br />$more = 0; <br />// the Loop <br />while (have_posts()) : the_post(); <br /> the_content( 'Read the full post »' ); <br />endwhile; <br />?></p> <p> </p> <h3>Wordpress : Get Custom Value</h3> <p><?php <br />$cvalArr = get_post_custom_values("custom-val");    <br /> $cval = $cvalArr[0];      <br />echo $cval <br />?></p> <p> </p> <h3>Wordpress : Display X Latest Post from Category Y</h3> <p><?php query_posts('posts_per_page=5&cat=2'); <br />//post_per_page = number of post to grab <br />//cat = 2 –> from category 2, find your category id from admin <br />?> <br /><?php while ( have_posts() ) : the_post(); ?> <br /><?php //the_title(); ?> <br /><?php the_excerpt(); ?> <br /><a href="<?php the_permalink(); ?>" title="Read full view of <br /><?php the_title_attribute(); ?>">Read more</a> <br /><?php endwhile; wp_reset_query(); ?></p> <p>i am thinking to put series of posts live describing wordpress development, let’s see.</p> <p><strong>Refs: Codex, Wordpress <br /> <br /><a href="http://codex.wordpress.org/Function_Reference/query_posts">http://codex.wordpress.org/Function_Reference/query_posts</a> <br /><a href="http://codex.wordpress.org/Function_Reference/WP_Query">http://codex.wordpress.org/Function_Reference/WP_Query</a></strong></p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-86428646958227277132011-02-04T00:44:00.000-08:002017-06-22T00:42:23.108-07:00Hello World – Ruby on Rails<p>None of tutorials i found around web helped me get straight to the <a href="http://rubyonrails.org" target="_blank">Ruby on Rails</a> development environment in Windows. that’s why i thought would sum up how i setup rails in my Windows XP Professional box. </p> <p>Yet, this was amusing (from Ruby on Rails <a href="http://guides.rubyonrails.org/getting_started.html" target="_blank">Getting Started Guide</a>) </p> <blockquote> <p>If you’re working on Windows, you should be aware that the vast majority of Rails development is done in Unix environments. While Ruby and Rails themselves install easily using for example <a href="http://rubyinstaller.org/">Ruby Installer</a>, the supporting ecosystem often assumes you are able to build C-based rubygems and work in a command window. If at all possible, we suggest that you install a Linux virtual machine and use that for Rails development, instead of using Windows.</p> </blockquote> <h1></h1> <p></p> <p>Let’s start.</p> <h3>1. Rails Development Environment Prerequisites/Setup</h3> <p>you should have following things installed before you can ride on Rails <br /> <br />- Install Ruby Language <br />- RubyGems Packaging System <br />- A working installation of the SQLite3 Database. you can setup other databases later.</p> <blockquote> <p>Ruby Installer bundles all ruby development environment within one click setup file. Download the <strong>latest version</strong> of Ruby Installer from this page: <a href="http://rubyinstaller.org/downloads/">http://rubyinstaller.org/downloads/</a></p> </blockquote> <p>i downloaded : <a href="http://rubyforge.org/frs/download.php/73722/rubyinstaller-1.9.2-p136.exe">Ruby 1.9.2-p136</a> <br /> <br />it installs Ruby, Ruby Gems etc.. in your selected drive. don’t forget to check the “Environment path tick mark” during installation, that helps later. <br /> <br />Check installed components going to the program listing in Start Menu-> All Programs</p> <blockquote> <p> add the Ruby Installation path to the SYSTEM or USER PATH eg path.  C:\Ruby192></p> </blockquote> <p> </p> <h3>2. Verify the Ruby and RubyGems Installation </h3> <p>Go to Command Prompt  (Run->CMD)</p> <blockquote> <p>Verify your environment variables i.e PATH is setup correctly otherwise we may run into problems.</p> </blockquote> <p>Type following commands:</p> <blockquote> <p>ruby –v  </p> </blockquote> <p>should give you ruby version</p> <p>and </p> <blockquote> <p>gem –v </p> </blockquote> <p>should give you gem version</p> <p>in my case: <br />ruby version : 1.9.2 <br />gem version: 1.5.0 </p> <p>if you didn't get these numbers, update gem, execute following command</p> <blockquote> <pre>gem update --system</pre><br /></blockquote><br /><br /><p>takes few minutes to update your gem package.</p><br /><br /><h3>3. Now Setup Rails </h3><br /><br /><p>execute the following command in command line </p><br /><br /><blockquote><br /> <p>gem install rails</p><br /></blockquote><br /><br /><p>it will install rails, takes few minutes. you can take a cup of coffee while rails gets completely installed. </p><br /><br /><p>check rails version after installation: </p><br /><br /><blockquote><br /> <p>rails –v</p><br /></blockquote><br /><br /><p>gives you rails installation version. a long number looks scary.</p><br /><br /><h3>4. Setup Sqlite3 database</h3><br /><br /><p>execute following command:</p><br /><br /><blockquote><br /> <p>gem install sqlite3-ruby</p><br /></blockquote><br /><br /><p>the installed sqlite3 gem requires sqlite3.dll file. you need to download, copy/cut/whatever –then- paste the sqlite3.dll file to your Ruby or system path. </p><br /><br /><p>Go to Sqlite download page <a href="http://www.sqlite.org/download.html">http://www.sqlite.org/download.html</a>  <br />Scroll down to “Precompiled Binaries For Windows”<br /><br /> <br />Download the “This ZIP archive that contains a DLL for the SQLite library version <strong>3.x.y</strong>”</p><br /><br /><p>Extract the zip, copy the sqlite3.dll  to system PATH<br /> <br /><br /><br /> <br />That’s it.</p><br /><br /><h3>5. Create your first Rails application : The New Hello World “Ruby on Rails”</h3><br /><br /><p>create a special folder somewhere in you hard disk dedicated to rails project. <br /> <br />eg. D:\web\rails <br /><br /> <br /><br /><br /> <br />Change working directory to that path. execute following command:</p><br /><br /><blockquote><br /> <p>rails new <a href="bit.ly/thenewhelloworld" target="_blank">the_new_hello_world</a></p><br /></blockquote><br /><br /><p>the_new_hello_world <—this is the name of the web app we are going to create. name it whatever you like. </p><br /><br /><p>if everything went fine, rails will create a “web app template” folder in your current directory i.e the_new_hello_world directory with bunch of files/folders, yes they suck.</p><br /><br /><h3>6. Run the development web server </h3><br /><br /><p>execute following command:</p><br /><br /><blockquote><br /> <p>rails server</p><br /></blockquote><br /><br /><p>hurray! your development web server will be now running : <a title="http://localhost:3000/" href="http://localhost:3000/">http://localhost:3000/</a><br /><br /> <br /><br /><br /> <br />Go to that page at <a title="http://localhost:3000/" href="http://localhost:3000/">http://localhost:3000/</a> . It is there to welcome you to Rails, follow the instruction under Getting Started Section.</p><br /><br /><p>1. Use “<strong>rails generate”</strong> to create your models and controllers<br /><br /> <br />2. Set up default route and remove or raname the config/routes.rb file<br /><br /> <br />3. Create your database<br /><br /> <br /><br /><br /> <br />Continue reading the Getting Started Guide after successfully  setting up the rails environment.  <a href="http://guides.rubyonrails.org/getting_started.html">http://guides.rubyonrails.org/getting_started.html</a></p><br /><br /><h1 align="center"><br /> <br />Congratulations!!!</h1><br /><br /><h4 align="center">you are now riding on rails. where are you going?</h4><br /><br /><p><br /> <br />Mention me if it didn’t work for you. i might help.<br /><br /> <br />Cheers.</p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com1tag:blogger.com,1999:blog-3508392207883956961.post-63696719240040807802011-01-14T01:13:00.000-08:002017-06-22T00:42:22.994-07:007th National ICT Student & Youth Conference – My Paper Abstract<p><strong>Event</strong></p> <p><strong>7th National ICT Student & Youth Conference <br /></strong>Date: 15th January 2011, (Saturday) <br />Venue: Local Development training Center, Jawlakhel, Lalitpur <br />Time: 9:00 A.M – 4:00 pm</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6FM2cepHWxeiVBoCV-eDJEcfUFgl8PTKryuEABsUymTOkDV81rxF3qZFr4R_2uhTXL_e4QmBXz0xmn0VrtLDQk98rPprbgRr2Uctqj3B3mQwE-AQn-wv62Da4Ry7YuZqsILAAyNtDzTHq/s1600-h/banner%5B8%5D.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="banner" border="0" alt="banner" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSG9yaov7qZeJdhkJWdLO5N6J-mP4rrhwffKgQswd4X-0oDdVp1MSl0PCUL0j1SFUF51CC7HssxO2oUkB6ZnZtMKyW2Rt7IFwZ_DyEGD5c-h9QFGtTIvJWk-PSRBnmNuzJwnyU48NElV9H/?imgmax=800" width="364" height="207" /></a> </p> <p><strong>Organized By:</strong></p> <p align="center"><strong><a href="http://itsn.org.np/" target="_blank">Information technology Society, Nepal (ITSN)</a></strong></p> <p><strong>Conference Theme:</strong></p> <p align="center">Youths on collaborative development </p> <p align="left"><strong>Conference Tracks:</strong></p> <p align="center">Recent Trends in IT for Rural Developments <br />Smart Data Policy <br />IT Security <br />Electronic Document Management <br />Future Information Technology <br />Information & Multimedia Technology <br />Cyber-cultures <br />Knowledge Discovery <br />E-Democracy, E-Participation and E-voting <br />Security & Cryptography <br />Digital Enterprise <br />E-Tourism for 2011 <br />Impact of social network over Youth</p> <p align="left"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMNLjDb4nwtr3HBu41-s-Vj11l-kXEWWPNGyxwrKezIkKopyaM-5ezOiEK5MR1DPJPZpwOWKjoQsGT0bUz4i61pIAtV4avN-CumM2riOw2drguP_P7DghUCIQuainLfY0BoYihMiQUXs6A/s1600-h/tracks%5B6%5D.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="tracks" border="0" alt="tracks" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6Yy6e7Dk2I5e90Texwrc2_kxErKIGV1Ii_pZrbasBVirI8HjEPY11hPTXIyn4NZL5xR5z3nDcKOLzyTjiwBvUEHiGGhmlO5Yz99KkIKh2jKkBHiLaFxMKiXoEsGPZbTzwY0oWlWIg_jCj/?imgmax=800" width="388" height="570" /></a> </p> <p align="left"> </p> <p align="left">I’ve always been a community and collaboration admirer. at present i work as software developer and there are few tools and concepts that we use daily to facilitate collaborative development. To share this idea, and expecting participation of college students in group software development in future i am going to present a paper titled “Collaborative Software Development – how Nepali youths could do it?”. </p> <p align="left">i will be talking about using Open Source and free collaboration tools available online and how we can use them to make our day to day software development tasks easier</p> <p align="left"><strong>My Paper Abstract: </strong></p> <p>Title: </p> <p>        <strong>Collaborative Software Development, <br />        how Nepali youths could do it ?</strong></p> <p>Estimated Time:  20 Minutes for presentation <br /> <br /><strong>Update: This paper was created collaborating with </strong><a href="http://twitter.com/bibekraj" target="_blank"><strong>@bibekraj</strong></a><strong> . we used Google Docs Presentation as collaboration tool.</strong></p> <p>Abstract: </p> <p>Collaboration is working together on site or off site,  in which two or more people work together convinced around a common goal. </p> <p>In collaborative software development, a small sized team of developers or larger community of developers work together using specific source code control methods to facilitate the code sharing and combine working environment. </p> <p>In foreign countries (US/UK) software development has flourished so much that they are leading the software development industry as a whole. The clue for this success is nothing more that community effort or to say collaborative contribution by a lot of developers who live in those countries. Whereas in Nepal, a youth gets introduced to collaborative development only after attempting few job interviews or looking through job vacancies. Knowledge of collaborative working is so essential that, the chances are odd you would be hired without its practical working knowledge. Further, knowledge of basic collaborative development tools will give each individual the opportunity to explore the whole Open Source World of software development. </p> <p>The popular Open Source Software hosting platforms like, Google Code hosting, Github, SourceForge.Net are so rich in their user base (users who are developers or coders) and project base that any guy with few knowledge of writing "Hello World" codes in languages like C, C++, PHP, C#, Python, Ruby can get to see the actual code behind stable releases of larger Open Source projects. This gives a developer an opportunity to see how "the code" works in real world. How can she write better codes. What are best practices in software development. Obviously, if she can, she would contribute back to the project itself. </p> <p>This paper, exploring the "7th National ICT Student & Youth Conference"  - Youths on collaborative development theme will try to introduce basic collaboration concepts, tools and how can we use them to get into Collaborative Software Development on personal team or community based teams to the college students of Nepal. </p> <p><strong>About Me: <br /> <br /></strong>at present i work as software developer at Semicolon Developers, <br />and working on ITS – Nepal as Second Vice President. </p> <p>(I will attach the presentation here after conference, most probably tomorrow eve, stay tuned) </p> <p>The Conference is Open to all Nepali professionals, youths and college students. Be in conference hall on time (around 9am) and we would go through all the registration process. </p> <p>Location (ref: Ghanshyam):</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbF7hCcEhQuIPV8GWm5P1ccwIOkAUaXtdSHh253Invs2YDcIyr51ie6FEWdqsC-ZWoRNiNSl9WN2dmYhTDulJHdEZdb4GrzlXpi2y5hOkMllz3irEG_tArNtApxFKXu9ku96bmsWvxLDVJ/s1600-h/location%5B7%5D.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="location" border="0" alt="location" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0H2MeP4L00T7GNQQwa4R3M9tJrB5QS0px2QOEUfPNgVpFnL_b5-ofQSH7BJCzM44lURJ9yEbeNvaDDp5FZLJJHlYs_mCHHYVuoFgkiR8KaVMXi8rf4jdmU1OeE4pDn60Y0tMv3W4UFfKa/?imgmax=800" width="406" height="363" /></a> </p> <p>Hope to meet you there. </p> <p><strong>Update: <br /> <br /></strong>Here’s the slide i presented today. <br /> <br /><a href="http://bit.ly/collabnepalslide" target="_blank">Download as PPT</a> <br /><a href="http://bit.ly/collabnepalpdf" target="_blank">Download as PDF</a> <br /></p> <p> <object id="doc_581409553633434" name="doc_581409553633434" height="600" width="450" type="application/x-shockwave-flash" data="http://d1.scribdassets.com/ScribdViewer.swf" style="outline:none;" > <param name="movie" value="http://d1.scribdassets.com/ScribdViewer.swf"> <param name="wmode" value="opaque"> <param name="bgcolor" value="#ffffff"> <param name="allowFullScreen" value="true"> <param name="allowScriptAccess" value="always"> <param name="FlashVars" value="document_id=46912793&access_key=key-2345mlf4ilg159jpnq9u&page=1&viewMode=slideshow"> <embed id="doc_581409553633434" name="doc_581409553633434" src="http://d1.scribdassets.com/ScribdViewer.swf?document_id=46912793&access_key=key-2345mlf4ilg159jpnq9u&page=1&viewMode=slideshow" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="600" width="450" wmode="opaque" bgcolor="#ffffff"></embed> </object></p> <p>happy to know after presentation that participants liked it :) </p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com3tag:blogger.com,1999:blog-3508392207883956961.post-63991543627053942762010-09-25T15:03:00.000-07:002017-06-22T00:42:23.000-07:00Hello World - PyroCMS Module<div dir="ltr" style="text-align: left;" trbidi="on">/*---------------------------------------------------------------------------------------------<br />Update 10/16/2011:<br /><br />This tutorial has been here for older version (< 1.0.x) of PyroCMS. Latest Stable PyroCMS release is v1.3.2<br />Please download and use following tutorial files which are for PyroCMS 1.3.2:<br /><br /><a href="https://sites.google.com/site/bhupalshares/PyroCMS1.3.2moduledevelopment-update.pdf?attredirects=0&d=1">PyroCMS Hello World Module tutorial pdf for v1.3.2</a><br /><a href="https://sites.google.com/site/bhupalshares/pyrocms_1.3.2_helloworld_module.zip?attredirects=0&d=1">Download Sample Hello World Module PyroCMS 1.3.2</a><br /><br />Pyro <a href="http://pyrocms.com/docs/manuals/developers/creating-custom-modules">docs</a> have been significantly improved over the year. You can refer it too. If you need developers to work on your PyroCMS project you can contact us here - <a href="http://semicolondev.com/contact">Semicolon Developers</a>.<br /><br />(Many thanks to <a href="http://www.assessyourskillsonline.com/">Alan Martin</a> from South Africa who forwarded me these updates.)<br /><br />---------------------------------------------------------------------------------------------*/<br /><blockquote>PyroCMS <a href="http://pyrocms.com/" target="_blank">Version: 0.0.9.9.x</a> </blockquote>What’s here: <br />------------------------------------------------------------ <br />PyroCMS Module – Folder Location? <br />PyroCMS Module – Files Required & Folder Structure? <br />PyroCMS Module – Frontend/Backend Snapshot (of what we are going to build) <br />PyroCMS Module – Coding the Hello World module with full MVC implementation <br />Why "<![CDATA MySql stuffs ]]>" required to be in correct format in details.xml ? <br />Hello world module Code <br />Summary <br />----------------------------------------------------------<br />With this text, I assume your familiarity with PyroCMS folder structure and theming, and you are testing on xampp. I would explain how to make PyroCMS Module with very basic concepts from Codeigniter and PyroCMS. Do double check what i have highlight here, you may get errors installing/running the module we create, otherwise. <br />PyroCMS is good, but its documentation is not enough/not clear. I mean, once you know stuffs, its very easy to understand things at one shot, but it is rarely the case with beginners, that’s why i thought i would put the example on it. <br /><blockquote>Don’t copy-paste the code from the example below rather <a href="http://github.com/bhu1st/php-practice/tree/master/pyrocms_modules/helloworld/" target="_blank">download source code from github</a>, in copy pasting you might face quotes errors. mysql query might not work.</blockquote><br /><h3>PyroCMS Module – Folder Location?</h3><strong>PyroCMS Core Modules</strong><br /><blockquote>…..xampp\htdocs\pyrocms\application\modules\pages</blockquote><strong>”pages”</strong> is pyrocms core module that handles the pyroCMS page element <br /><br /><strong>Custom Modules / Third Party Module / we are creating one now <br /><br /></strong>Custom Modules are placed under projectname\third_party\modules folder<br /><blockquote>xampp\htdocs\pyrocms\third_party\modules\helloworld</blockquote>pyrocms – our project name <br />helloworld – the module we are going to create. <br />Remember Core and Third Party modules and their directories.<br /><h3>PyroCMS Module – Files Required?</h3>PyroCMS requires at least a details.xml and one controller inside the module-name folder to be a module. I will explain file requirements for different types of module creation. Filenames and folders, are understood easily if you know Codeigniter MVC conventions. If you are not familiar with CI and trying to build PyroCMS module, still its easy to grasp the folder structure with one easy attempt like this. You can have following folders inside a custom module folder - config, controllers, helpers, libraries, models, views, js, css, img. <br />1. helloworld\details.xml <br />-> its basic structure is explained in detail below <br />-> this file contains module name, description, version etc.. and some useful configuration options that help PyroCMS understand our new module. Say Hello! Introduce your module here.<br />2. helloworld\controllers\helloworld.php<br />-> the name of the controller (file name & class name) keep them same as module name<br />-> If you need module just for front end and nothing required in backend, you’d need at least one controller, and extend the controller class from Public_Controller.<br />-> if you need to access these module from backend (like CRUD interface in backend), you’ll need a controller class helloworld\controllers\admin.php which would extent Admin_Controller<br /><blockquote>When i write a file name like helloworld\controllers\helloworld.php i expect, you have created a helloworl.php controller inside controllers folder inside our helloworld module. </blockquote>3. helloworld\views\helloworld.php <br />-> view file which would be used for displaying data from module controller<br />->If you don’t need to access database for your module these 3 files will suffice your need for creating module, otherwise you need model class too. Take your time to understand the folder structure.<br />-> if you thought to put backend admin controllers in setp 2 above, then think about placing its views too. <br /><br />let’s place some view files as for admin side in a views\admin folder for easy structure: <br /><br />helloworld\views\admin\index.php <br />-> pass data to this view from admin controller <br />helloworld\views\admin\sidebar.php <br />-> sidebar partial that’s shown in left sidebar of the default backend theme. <br />-> partial is just few tags and php codes together. think of it as general “view file” . For eg. the box in the sidebar of other modules you see while browsing in admin. <br />4. helloworld\models\helloworld_m.php <br /><br />So when we require database access or to implement business logic, we create models :<br />helloworld_m.php <— this is a convention of underscore m, model class name would be Helloworld_m . You can create more model files as per your need. <br />Don’t forget to place these file on respective Models/Views/Controllers folder according the folder structure in the figure (at end of this section below) <br />1. helloworld\details.xml <br />2. helloworld\controllers\helloworld.php <br /> ----> helloworld\controllers\admin.php [controller for admin interface] <br />3. helloworld\views\view_file.php <br /> -------> helloworld\views\admin\index.php –> admin main view <br /> ------> helloworld\views\admin\sidebar.php –> admin sidebar partial <br />4. helloworld\models\helloworld_m.php<br />If your module is complex, you end with more files, that’s okay. <br /><blockquote>PyroCMS module file/folder structure is MVC, just bundled within a module folder. That’s what makes PyroCMS HMVC ( Hierarchical Model View Controller). PyroCMS is codeigniter based, if you know codeigniter <a href="http://net.tutsplus.com/tutorials/php/hvmc-an-introduction-and-application/" target="_blank">you have an option to understand HMVC and build your own CMS</a> ;) Good Luck.</blockquote><br />Here’s the PyroCMS helloworld module folder structure:<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih-SMArsviQ05oVF00jnZqV1ir1VMVdTfoPU8XKPKcgfA3Hsv2ERcwzoPpWdV2Fx7PQt7AL7G4zqkOo4wglpO43ZSVgUj0wGWRZZ6_YgFAWVanpoXiHKLA9-PRBYODjLNS-EbYzw7C4gJb/s1600-h/module_structure%5B5%5D.png"><img alt="module_structure" border="0" height="276" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5KLOLNyuhkynxqH4C59TvpWO4k4XZY5GFsabvKKQl2VojB54hK1NMcZTs9rGxRlZZblEwhgv9FZbpaY0q0txYGjjA7sd4AmLJwvrGT6kS8CbOicUmiICvusLCwaQQae_8nlizKcdCQ80d/?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="module_structure" width="419" /></a> <br /><h3>PyroCMS Module – Frontend/Backend Snapshot</h3>Let’s have a look at what our module will look in front-end and backend <br /><br /><strong>Frontend: <h1><?php echo $msg; ?></h1></strong> that’s it <br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4ThnMWMxNkv5LfyoSj1vQ90o8rHJBxKWSvbjuxFng0faXpyUGmO4IpPKxfpqE09BzNw4QKdNcINbcihlt-KUijvhozPwLcM2SHkz_slQmIy40Xj5_BWXFC0X3BFvXwwvDbfcReG2yzkTe/s1600-h/front%5B9%5D.png"><img alt="front" border="0" height="149" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhovP4N7BoVOe6VcYlZRU8mDbNEy0d6bCoEvKJTXstJ28cA3biuNHScOXqWDwVX4VSa_gGzPkVyLo-4ARk-xVXpkIdkQ3WkTj0hFdOi3OhG-GRFEwqF5NNGnEZL4QOdY88_V3M5LdgO7b4P/?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="front" width="329" /></a> <br />(to see a module in action, we’d after installing helloworld module link one header navigation to our module) <br /><br />Section of what you see when you add new navigation link: <br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjca0sKGSukPsHECgt0ljvDiAFWaAQaI8AbSduQ7S5FN88WgZw6O0loLjleT_81WM_wNbeAiQrOW1LkJ52xUAjq6rPxHr_4pFBM-Oa9p_FEo-xwFBZPXsHEAUEEp8ksAF0GOXTb-K_jzzb_/s1600-h/link_module%5B4%5D.png"><img alt="link_module" border="0" height="142" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBbHbr7k5JQkkdMeOX9rKNxMkwiy8bsFfT9qSM-qpROfCQ6RL6iCKeugsMNZ-8HRershJuVDeK9aaJyNOv2v-o88eiVm5HV-2jU2imklwhaGA9qujLY2UtXplM1hZShTyFKfQaOBDyUrKv/?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="link_module" width="336" /></a> <br />Backend: <br /><br />Module installed and listed in the Admin –> Modules-> Third party Section (we don’t create view for this listing, PyroCMS automatically lists our new module there if successfully installed, information is taken from details.xml)<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2R5ClfEzXyid3lM7-3tEDb3o7x317hnvXwARGETQyV6f7Qset2NQyXdhbbb_R8BaPPKTTnNB_48eNmSgAfrqdGBsu1Woli1kWu28YJbo1NuVdzGThGCRNUInaFzkvGI8AisxRhLAWcAga/s1600-h/modulelist%5B15%5D.png"><img alt="modulelist" border="0" height="250" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5UwCdQblqjWyLrvcuqZr7cAnrDGGUjrVIoRRPdPiajV7bzQ87DHbBncWYVh1fgc19VS9feIw1S8DxhfRQ_-38ne3TX2eJ6qjBnDAuPivUZWnSsi6RlSyf1C6PWvZR3Yjd4tF4C-jiIF0Y/?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="modulelist" width="428" /></a> <br />We have – index.php and sidebar.php for admin side view, <br />when we build template from these two view that will look as below on the admin side.<br />Hello World Module Page on admin side: <br /> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivcuHT262otWtfLi_XpwmCbjE_WfrjqvX49okGQfMoD_0FqdOiSN8BlaaaIuaGBe9jJRvoNjNCI5Ivay6TjIknteDUkK3_O88ibgiBUBKx6XvLYnvCAkut1V_Hm-c_9Fggqb-F-IU7sg_K/s1600-h/admin%5B10%5D.png"><img alt="admin" border="0" height="334" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicQGiC65YsavhISfjov-twnMqxY5X7YgLhDyOFDUCpOMrVF7FYm_ZdUUYtkl46G-WgKdbE_w_FCvd62QE8zFqnqTUNxq68bQvrO27JWSXJi64Loth6kKEDrw-wlNAmwwcTfTMXWxmi5s18/?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="admin" width="415" /></a> <br />noticed the – left sidebar? main content? helloworld link on the admin navigation, link to hello world module in the dropdown modules list ? <br /><h3>PyroCMS Module – Coding the module </h3>The code is just for illustration purpose. My idea is to help you create and install your own custom module. <br /><br />1. helloworld\details.xml <br />2. helloworld\controllers\helloworld.php <br /> a. ----> helloworld\controllers\admin.php [controller for admin interface] <br />3. helloworld\views\view_file.php <br /> a. -------> helloworld\views\admin\index.php –> admin main view <br /> b. ------> helloworld\views\admin\sidebar.php –> admin sidebar partial <br />4. helloworld\models\helloworld_m.php<br />we’ll create 1 (details.xml) + 2 (controllers) + 3 (views) + 1 (model file) = 7 files in total and respective folders Models\Views\Controllers and place them inside MVC folder structure. <br /><br /><h4>1. helloworld\details.xml </h4><strong>A. basic file / when no backend and MySQL required: <br /></strong> <br />-> When we don’t need custom table for our module in database or when we are just working on PyroCMS tables to access data, we can have a minimal details.xml as follows.<br /><?xml version="1.0" encoding="UTF-8"?> <br /><module version="0.1"> <br /> <name> <br /> <en>Helloworld</en> <br /> </name> <br /> <description> <br /> <en>Displays Hello World! Message to user</en> <br /> </description> <br /> <skip_xss>1</skip_xss> <br /> <is_frontend>1</is_frontend> <br /> <is_backend>0</is_backend> <br /> <is_backend_menu>0</is_backend_menu> <br /></module> <br /><br />where: <br /><name> & <description> will help list the module in admin->modules->third party modules list. <br /><skip_xss>1</skip_xss> – skip_xss true <br /><is_frontend>1</is_frontend> - front end of the module exists <is_backend>0</is_backend> - module has no backend support <br /><is_backend_menu>0</is_backend_menu> - module will not be listed in backend admin navigation<br /><strong>B. Advanced file / when backend of module exists and our module will have its own database table to operate:</strong><br /><?xml version="1.0" encoding="UTF-8"?> <br /><module version="0.1"> <br /> <name> <br /> <en>Helloworld</en> <br /> </name> <br /> <description> <br /> <en>Displays Hello World! Message to user</en> <br /> </description> <br /> <skip_xss>1</skip_xss> <br /> <is_frontend>1</is_frontend> <br /> <is_backend>1</is_backend> <br /> <is_backend_menu>1</is_backend_menu> <br /> <controllers> <br /> <controller name="admin"> <br /> <method>index</method> <br /> </controller> <br /> </controllers> <br /> <install> <br /><![CDATA[ <br />DROP TABLE IF EXISTS hello_world; <br />-- command split -- <br />CREATE TABLE hello_world ( <br />`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , <br />`msg` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL <br />) ENGINE = MYISAM ; <br />-- command split -- <br />INSERT INTO `hello_world` (`id`,`msg`) <br />VALUES (NULL , 'hello world from PyroCMS module, from db'), <br />(NULL , 'Greetings from @bhu1st'); <br />]]> <br /> </install> <br /><uninstall> <br /><![CDATA[ <br /> DROP TABLE IF EXISTS hello_world; <br />]]> <br /></uninstall> <br /></module><br /><strong>Did you see the changes??</strong> <br /><blockquote>is_backend set to one. i.e module accessible in backend. If database table are used just for storing information and no backend access required this can be set to zero. </blockquote><strong><is_backend>1</is_backend></strong> - we are going to build module backend accessible <br /><strong> <is_backend_menu>1</is_backend_menu></strong> - module will be listed in admin side navigation menu <br /><br /><blockquote>Name of the admin controller and its methods</blockquote><br />We add code below when we create module that have backend interface. <br /><controller name=”admin”> tells we are going to create a <br />helloworld\controllers\admin.php - controller <br />The controller that will extend Admin_Controller and we would have one method named index in it.<br /><strong> <controllers> <br /> <controller name="admin"> <br /> <method>index</method> <br /> </controller> <br /></controllers> <br /></strong><br /><blockquote>MySQL Queries required at module install time </blockquote>Before explaining this i want you to remember that details.xml file is a XML document. <br />Let me explain, What is this "<b><![CDATA MySql stuffs </b><b>]]></b>" doing here?<br /><div align="center"><br /><strong>Everything inside a CDATA section is ignored by the XML parser, but will be used by PyroCMS module install routine. </strong></div>XML Document Parser will parse all <element></element> but, characters inside the "<b><![CDATA ----------- </b><b>]]></b>" are not parsed by XML parsers and they are taken as raw string of characters. So the advantage is we keep our required MySQL queries inside it, as normal storage. At XML document parse time (module installation), the content between <install></install> is taken, split by the separator -- command split -- and executed over the PyroCMS database that we setup in PyroCMS installation process. <br />Remember: <br />a. Include your MySQL queries inside "<b><![CDATA” & “ </b><b>]]></b>" <br />b. Separate each MySQL query by the separator <br /> -- command split -- <br />c. the CDATA end marker <b> “ </b><b>]]></b>" cannot contain spaces or line breaks before it. Just place it before </install> as <br /><br />]]> <br /></install> <br /><br />d. last query doesn’t need the -- command split -- separator <br />e. CDATA can not be nested <br /><br />So the code below contains two queries, clear to see: <br /><br /><install> <br /><![CDATA[ <br />DROP TABLE IF EXISTS hello_world; <br />-- command split -- <br />CREATE TABLE hello_world ( <br />`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , <br />`msg` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL <br />) ENGINE = MYISAM ; <br />-- command split -- <br />INSERT INTO `hello_world` (`id`,`msg`) <br />VALUES (NULL , 'hello world from PyroCMS module, from db'), <br />(NULL , 'Greetings from @bhu1st'); <br />]]> <br /></install> <br />In this CDATA section, we first drop the table “hello_world” if exists in database, then we create and insert some data in the hello_world table. That’s it. Our table is created and populated with the supplied data, if module installation went fine, you should be able to see the hello_world table in PyroCMS database you setup before. <br /><blockquote>MySQL Queries required at module uninstall time </blockquote> <uninstall> <br /><![CDATA[ <br /> DROP TABLE IF EXISTS hello_world; <br />]]> <br /></uninstall> <br />If you grasped the CDATA concept, only thing that concerns us in <uninstall></uninstall> code is the MySQL query “DROP TABLE IF EXISTS hello_world;”, yup, this will be triggered when you uninstall the module. That’s fine. Tables created during install time will be deleted. <br /><br /><strong>C. When your module is just accessed in backend, like Newsletter module etc.. <br /><br /> </strong><is_frontend>0</is_frontend> <br /><is_backend>1</is_backend> <br /><is_backend_menu>0</is_backend_menu><br />refer code above with these settings for full details.xml code.. <br /><h4>2. helloworld\controllers\helloworld.php</h4>Code/comment explains itself, you may refer above sections too.<br /><?php if (!defined('BASEPATH')) exit('No direct script access allowed'); <br />/* <br />|------------------------------------- <br />| Publich Controller of our module <br />|------------------------------------- <br />| accessed from front end <br />| <br />| extends Public_Controller <br />*/ <br />class Helloworld extends Public_Controller <br />{ <br /> function __construct() <br /> { <br /> parent::Public_Controller(); <br /> } <br /> function index() <br /> { <br /> //load model <br /> $this->load->model('helloworld_m'); <br /> //get message from model <br /> $message = $this->helloworld_m->getHelloMsg(); <br /> //pass message and build template <br /> $this->data->msg = $message; <br /> $this->template->build('helloworld', $this->data); <br /> } <br />}<br /><h4>2. a. helloworld\controllers\admin.php [controller for admin interface]</h4>The controller file name “admin.php” since we specified so in our details.xml <br /><br /><strong> <controllers> <br /> <controller name="admin"> <br /> <method>index</method> <br /> </controller> <br /></controllers> <br /><br /></strong>The Code:<br /><?php if (!defined('BASEPATH')) exit('No direct script access allowed'); <br />/* <br />|------------------------------------- <br />| Admin Controller of our module <br />|------------------------------------- <br />| accessed from back end <br />| extends Admin_Controller <br />| <br />*/ <br />class Admin extends Admin_Controller <br />{ <br /> public function __construct() <br /> { <br /> parent::Admin_Controller(); <br /> //load model <br /> $this->load->model('helloworld_m'); <br /> //set views/admin/sidebar as 'sidebar' partial, <br /> //that is to be shown on Sidebar section of backend <br /> $this->template->set_partial('sidebar', 'admin/sidebar'); <br /> } <br /> //Show Helloworld message to admin <br /> function index() <br /> { <br /> //function triggred when we click on the module name in backend in the menu <br /> //get message from model <br /> $message = $this->helloworld_m->getHelloMsg(); <br /> //pass message and build template <br /> $this->data->msg = $message; <br /> $this->template->build('admin/index', $this->data); <br /> } <br />} <br />?><br /><h4>3. helloworld\views\view_file.php</h4><h1><?php echo $msg; ?></h1><br /><br /><h4>3.a. helloworld\views\admin\index.php - admin main view <br /></h4>Hi, <br /><br/> <br/> <br /><h2><?php echo $msg; ?></h2><br /><br /><h4>3.b, helloworld\views\admin\sidebar.php –> admin sidebar partial</h4>see how it is set as sidebar partial in constructor of our Admin controller <strong>2. a. helloworld\controllers\admin.php <br /><br /></strong> $this->template->set_partial('sidebar', 'admin/sidebar'); <br /><br />this view file would contain following html: <br /><div class="box"> <br /> <h3>About Me</h3> <br /> <div class="box-container"> <br /> Bhupal Sapkota<br/> <br /> Kathmandu, Nepal<br/> <br /> </div> <br /></div><br />i’ve put a little bit info about me, never mind. Put any <html> or Pyro stuff you like there. <br /><h4>4. helloworld\models\helloworld_m.php – our model class</h4><?php if (!defined('BASEPATH')) exit('No direct script access allowed'); <br />/* <br />|------------------------------------- <br />| Model Class of our module <br />|------------------------------------- <br />| for database access <br />| <br />*/ <br />class Helloworld_m extends Model <br />{ <br /> function __construct() <br /> { <br /> parent::Model(); <br /> } <br /> function getHelloMsg() <br /> { <br /> //get hello_world table <br /> $query = $this->db->get('hello_world'); <br /> //if module successfully installed and data exists in table, grab it, return it <br /> if($query->num_rows() > 0){ <br /> $result = $query->row_array(); <br /> return $result['msg']; <br /> }else { //otherwise return simple hello message <br /> return "Hello world from PyroCMS Module!"; <br /> } <br /> } <br />} <br />?><br /><h3><br /></h3><h3>Install Helloworld Module</h3>->Download code from <a href="http://github.com/bhu1st/php-practice/tree/master/pyrocms_modules/helloworld/" target="_blank">Helloworld PyroCMS Module in Github</a> <br /><br />zip your module, and upload it from the Modules –> Third party section, Upload link<br />If your MySQL queries had no problems, you’d see hello_world table added in PyroCMS database. Helloworld module will be listed in admin navigation, modules list, in third party section. <br /><h3>When you uninstall </h3>module gets deleted from third_party\modules\ folder. think of having a backup before uninstall. <br /><h3>Module In Action </h3>Access module from Admin Navigation menu or type this in browser: <br /><br />Backend:<br /><blockquote>http://localhost/<strong>projectname</strong>/admin/<strong>modulename</strong></blockquote><br /> <a href="http://localhost/pyrocms/admin/helloworld">http://localhost/pyrocms/admin/helloworld</a><br />Frontend: <br />Assign one frontend navigation link to point our helloworld module <br /><blockquote>http://localhost/<strong>projectname</strong>/<strong>modulename</strong></blockquote> <a href="http://localhost/pyrocms//helloworld" title="http://localhost/shabda/index.php/helloworld">http://localhost/pyrocms//helloworld</a><br /><h3>Output Check </h3>I have added validation in our model Helloworld_m, <br />function getHelloMsg() <br /> { <br /> //get hello_world table <br /> $query = $this->db->get('hello_world'); <br /> //if module successfully installed and data exists in table, grab it, return it <br /> if($query->num_rows() > 0){ <br /> $result = $query->row_array(); <br /> return $result['msg']; <br /> }else { //otherwise return simple hello message <br /> return "Hello world from PyroCMS Module!"; <br /> } <br /> } <br />If SQL executed successfully during module install, the $msg in view renders <strong>“hello world from PyroCMS module, from db”</strong> otherwise "<strong>Hello world from PyroCMS Module!</strong>"; <br /><br /><h3>Conclusion </h3>1. follow the file/folder structures and naming conventions. <br />2. Understand the module creation requirement and accordingly settings in details.xml <br />3. CDATA section of the details.xml needs to carefully saved. Check your queries in database before saving them in CDATA section. <br />4. Upload your module to install it. [ remember to upload zip file, zip file name same as module name ] <br />[helloworld.zip] or [yourmodule.zip] <br />5. If upload failed, delete raw upload from third_party modules folder, database column if any, check your settings, check queries again, zip it, and re-upload. <br />5. If still couldn’t install it: <br />--> i think you now understand the module creation flow <br />--> insert few queries in database [details.xml] <br />-> add your module settings in modules table in database [details.xml] <br />-> don’t wait for any other documentation ;) the kickass CMS, created over the kickass framework is really easy to grasp in one shot back tracing, 2-3 hours max <br />-> hack it use it. contribute back if any. <br />-> if you are familiar with Codeigniter and not with <a href="http://net.tutsplus.com/tutorials/php/hvmc-an-introduction-and-application/" target="_blank">HMVC</a> <------ read </div>@bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-4732205393084827802010-09-03T11:57:00.000-07:002017-06-22T00:42:22.924-07:00Lorem Ipsum को कथा<p>Do you design, be it graphics or web design? or any other form of design type settings? Have you ever used Lorem Ipsum? What is your experience using Lorem Ipsum when designing for Nepali Unicode content?   </p> <blockquote> <p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p> </blockquote> <p>You might have guessed till now, i am talking about the dummy text, yes Lorem Ipsum is a placeholder text, or filler or dummy text, that designers throughout the world use when working on  visual designs, web designs, any typographic work. If you are not familiar with Lorem Ipsum, i guess you are not in design. I might be wrong though, you should use it. Here is the reason why below.</p> <p>Visit any site from <a href="http://www.freecsstemplates.org/" target="_blank">Free Css Templates</a> or search google for CSS layout, Photoshop design layouts or any sample design content of your interest  - you will end up with a nicely done design and Lorem Ipsum used as placeholder text. </p> <p>If you like to know more about Lorem Ipsum, it’s history refer <a href="http://en.wikipedia.org/wiki/Lorem_ipsum" target="_blank">this wiki article</a> or <a href="http://www.lipsum.com" target="_blank">www.lipsum.com</a> can be handy for you when working on designs and need a quick copy/paste version  of Lorem Ipsum.  We can find many Lorem Ipsum text generators that can give random latin text mixed up in paragraphs that can be sample content for us when designing web layouts.  </p> <p>If you use Ms-word try typing following text in there to produce random lorem ipsum text </p> <p align="center"> <br />=lorem(i) </p> <p>where,  i = natural number , genarates i paragraphs of random text</p> <p align="center">= lorem (i, j )</p> <p>where i,j are natural number, where i = number of paragraphs and j = number of sentences per paragraph </p> <h1> </h1> <h1>Why Lorem Ipsum ? <br /></h1> <p>Here’s a excerpt from wiki: </p> <blockquote> <p>Even though using "lorem ipsum" often arouses curiosity because of its resemblance to classical Latin, it is not intended to have meaning. Where text is visible in a document, people tend to focus on the textual content rather than upon overall presentation, so publishers use <i>lorem ipsum</i> when displaying a typeface or design elements and page layout in order to direct the focus to the publication style and not the meaning of the text</p> </blockquote> <p>Hope the idea is clear. It would always be better to use neutral content when presenting designs to our clients. That way we can, direct their focus on the look and feel of the design rather than on the sample content. Further, that sample content can be offensive sometimes. </p> <p>i am working on a Nepal web site design, where i need all contents to be in unicode version. Traditional true type font would not render correct on every browser but thanks to unicode that we now can freely write नेपाली/Nepali anywhere in web and worry less about whether it will render correctly on the browsing end or not. </p> <p>Here  i faced a problem, i was designing all sort of layouts for the site with Lorem Ipsum text, when design got ready and verified by my client (i convinced them all the text would be in Nepali in final version). Then, i started replacing dummy text with some Nepali unicode content! Huh, wtf? Did you know, the layout was all rendering <br />badly. All my effort for fixing the font size, margins, paddings – oh my, now i have to change them all to fit my Nepali unicode content. That was a complete waste of time.</p> <p>Here’s a snapshot from sample <a href="http://www.freecsstemplates.org/" target="_blank">free css template</a>:  just for illustration <br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk2PPUaMbU4mz6FXO6IQ8ZUHS6A2ZpqYE_V9GcyjMWgqlux946VCGOdWeLAlBrBjUlXTUHU5FL1a-PRf58Qm4CX33yBpNHmU5jkCy5JK0V1XKNn3G2V2i_pdp_vBSIXp96dskQYz0GQvTo/s1600-h/original%5B10%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="original" border="0" alt="original" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIexKgptE1jJfIwzxPAGljR_eNeA9QSKbk8f5lwjJW3glWkjAhwGSIYHz09J34Z5zsci6RrZlZ0qb9E-eQViAH5GOG5pTBMM3X4V0cYLTPJ1MN_V_FsTYPRQu8ovdVNWxGs73ConCWN0nI/?imgmax=800" width="418" height="340" /></a> </p> <p>Noticed the font size 3em there in the <h1> style rule? See how nicely the “Welcome to my website” fit in the layout??  Below is the snapshot when i tried changing content  <br />to Nepali unicode. </p> <p> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8BKZsCERN15G_BFsPUDD4v92QRMguz9Tv88LpVw83ruE-bkLMbLmM_pidofQp0W9FAtMUOKp2i9b_Dh0vGXJ90FmGXbFT0FQJF92YMZ-RE8xWu7cLF5psVyThXaVBawJxxVZKlG6h2qP1/s1600-h/before0%5B4%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="before0" border="0" alt="before0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn6V-Owuce-2mI9WATWnigT7uvIqixjZgCm1L0akVTVa2hsP7rQLzAibRnchOAyTIgVXLUYlOh-LyBJUPEXcgUWDDZ2VIEr3VBDNGrBH2nzuBzarAQHzYySybeGxqOW5eWwzwVTcBqTmOl/?imgmax=800" width="407" height="340" /></a> </p> <p>Can you see the <strong>font-size:3em</strong> on Firebug inspect? Hope you can. But with this style rule our content looks a bit tangled, and not fitting nicely in the overall layout. And below i tried playing with different font size to fit the content: here’s the snapshot</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhww3fEdaff8ReJ6z_3Agizs4ljFI1j7uqpHc2FqVQZCREl_Pev2Sy-GzdbgBTUXIR8AzJFKBfBOujrc8HmSJ0CD2Q_tD7P3cz2dnixUoojB31pBhhzezuVy5kgR_7VbhtXb5Tvq1uFqbr8/s1600-h/after0%5B5%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="after0" border="0" alt="after0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi56cagWKq64kMM-LkdjUtfc4T45quhQRnznOjVGgikAqyJL9uXgbJyjMchNamWs8T7plRGsoqUZbtGdPTD7f5Ks7gM1gIA9S1MAHzfAPq_z5X2-dYHh1OnLxfSC8Wus68ehFd_x8k1jsqV/?imgmax=800" width="374" height="304" /></a> </p> <p>I went on replacing contents and changing css rules to fit my new content. I think, the scenario has always been like it when any of we worked on such projects. You might say that, the length of the text has destroyed the layout, yeah a sort of that too is responsible for the destroyed layout but i have here something more to say.  </p> <h1>Lorem Ipsum = ? </h1> <p>Wiki says, </p> <blockquote> <p>A close English translation for Lorem Ipsum might be "pain itself" (<b>dolorem</b> = pain, grief, misery, suffering; <b>ipsum</b> = itself) . </p> <p> </p> </blockquote> <p>If we want to say it in Nepali – it would translate as : दुख आफैमा </p> <p></p> <p></p> <p></p> <p>Below are two paragraphs that are mostly used as lorem ipsum text, which is in latin. The text is derived from <a href="http://en.wikipedia.org/wiki/Cicero" target="_blank">Ciero’s</a><strong> <i>De finibus bonorum et malorum</i> (<i>On the Ends of Goods and Evils</i>, or  <i>[About] The Purposes of Good and Evil</i> )</strong>; Ciero was a Roman Philosopher/(106 BC) of the time.</p> <p>The original version (with the excerpted items highlighted –which we are using now). Read the text in bold and you’ll catch the Lorem Ipsum dolor sit.. flow which sounds familiar, ain’t it?</p> <p><a href="http://la.wikisource.org/wiki/De_finibus_bonorum_et_malorum/Liber_Primus" target="_blank">Section 32/33 of the Book</a></p> <p><dd> <div align="left">[32] Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui do<b>lorem ipsum</b>, quia <b>dolor sit amet, consectetur, adipisci[ng]</b> v<b>elit, sed</b> quia non numquam <b>[do] eius mod</b>i <b>tempor</b>a<b>inci[di]dunt, ut labore et dolore magna</b>m <b>aliquam</b> quaerat voluptatem. <b>Ut enim ad minim</b>a <b>veniam, quis nostru</b>m <b>exercitation</b>em <b>ullam co</b>rporis suscipit <b>labori</b>o<b>s</b>am, <b>nisi ut aliquid ex ea commod</b>i <b>consequat</b>ur? <b>Quis aute</b>m vel eum <b>iure reprehenderit,</b> qui <b>in</b> ea <b>voluptate velit esse</b>, quam nihil molestiae <b>c</b>onsequatur, vel <b>illum</b>, qui <b>dolore</b>m<b>eu</b>m <b>fugiat</b>, quo voluptas <b>nulla pariatur</b>? </div> </dd><dd>[33] At vero eos et accusamus et iusto odio dignissimos ducimus, qui blanditiis praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias <b>exceptur</b>i <b>sint, obcaecat</b>i <b>cupiditat</b>e <b>non pro</b>v<b>ident</b>, similique <b>sunt in culpa</b>, <b>qui officia deserunt mollit</b>ia <b>anim</b>i, <b>id est laborum</b> et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio, cumque nihil impedit, quo minus id, quod maxime placeat, facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat..</dd></p> <p>Below is the english translated version of the original latin text:</p> <p>H. Rackham's 1914 translation (with major source of Lorem Ipsum in bold)</p> <dl><dd>[32] But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. <b>Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?</b></dd><dd><strong></strong></dd><dd>[33] On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.</dd></dl> <h1>Lorem Ispum for Nepali Desigs?</h1> <p>Like the development or design situations i mentioned above, what if we had any standard dummy text to be used ? This was just what i thought for the moment when i suddenly realized that  i need to replace all those sample Lorem Ipsum content with something that looks random unicode nepali content. So sad, we don’t have one!</p> <p>I have argued above that, content to be used as placeholder text shouldn’t have any sensible meaning. But it was my curiosity that led me to go through what is their behind the Lorem Ipsum text.  I ended up with my own interpreted, Nepali version of Lorem Ipsum or say दुख आफैमा version.</p> <p>i don’t understand latin, neither <a href="http://translate.google.com" target="_blank">google translate</a> helped here, with reference to the English version, Oxford Dictionary and our Nepali Shabdakosh, and few other English-Nepali/Nepali-English dictionaries, below is what i ended up in:</p> <p>Closely look at the original text in latin – section [32], the Lorem ipsum passage starts at:  <i></i></p> <p><em>Neque porro quisquam est qui do<b>lorem ipsum</b> quia <b>dolor sit amet, consectetur, adipisci</b> v<b>elit</b> </em></p> <p><em>Which would mean: <br /> <br />"Neither is there anyone who loves grief itself since it is grief and thus wants to obtain it"</em></p> <p><em>or  in Nepali </em></p> <p><em>को नै छ र यहाँ जो दुख आफैमा मन पराउछ, किनकि यो दुख हो, त्यसैले त उ यसलाई पाउन चाहन्छ</em> </p> <p>Translation to [32]</p> <p><em>तर मैले तपाइहरु सबैलाई भन्नैपर्छ, कसरि अबुद्धियुक्त तरिकाले सुख लाई बद्ख्वाई गर्ने अनि दुखलाई प्रसंशा गर्ने सोचको जन्म भयो, साथै म तपाइलाई यो प्रणालीको इतिबृति दिनेछु र सत्यको खोजि गर्ने महान खोजिकर्ता, मानब सुखको प्रमुख निर्माणकर्ताको सच्चा दर्शनहरुको बर्णन गर्नेछु | कोहिपनि सुखलाई यत्तिकै अस्विकार गर्दैन, मन पराउदैन वा नकार्दैन, किनकि त्यो सुख हो, तर किनकि उ तर्कसंगत ढंगमा सुखको खोजि गर्न जान्दैन अनि अत्यन्त दुखदायी परिणाम भोग्न पुग्छ | त्यसरीनै, कोहिपनि त्यस्तो छैन जो दुख आफैमा मन पराउछ, खोज्छ वा चाहन्छ, किनकि त्यो दुख हो, तर किनकि कहिलेकाही त्यस्ता परिस्थितिहरु देखापर्छन जसमा कडा परिश्रम र दुखमा नै उ कुनै अपार सुख प्राप्ति गर्छ | एउटा सानो उदाहरण लिनुपर्दा, हामीमध्य कति छौं जो निरन्तर कठिन शारीरिक कसरत गर्न तत्पर हुन्छौ, यसबाट केहि फाइदा लिने बाहेकको अरु कुनै कारणमा ? तर कोसंग के अधिकार छ, त्यस्तो मान्छेको गल्ति औल्याउने जो त्यो सुख छान्छ जसमा कस्टदायी परिणाम छैनन ? अथवा त्यस्तो मान्छेको जो त्यो दुख त्याग्छ जसमा कुनै सुखदायी परिणाम छैन ?</em></p> <p>Translation to [33]</p> <p><em>अर्कोतिर, हामी नैतिक रुपमै बद्ख्वाई गर्छौ र मन पराउदैनौ, त्यस्ता व्यक्तिहरु जो कुनै क्षणिक सुखको बान्कीहरुको हर्ष र आस्चर्यमा छलिएका अनि अनैतिक भएका, इच्छाहरुमा यति अन्धो भएका कि, उनीहरु पछी आउने दुख र अप्ठेरो देख्न सक्दैनन; र उत्तिकै दोष तिनीहरुमा पनि जान्छ जो कमजोर संकल्पको कारण आफ्नो कर्तब्यमा असफल हुन्छन, यो कडा परिश्रम र दुखले पूर्णरुपमा संकुचित हुनु भन्नु जस्तै हो | यी मामलाहरु छुट्याउन एकदम सरल र सहज छन | कुनै फुर्सद को समयमा, जब हाम्रो इच्छाशक्ति स्वछंद हुन्छ र जब हामी आफुले उत्कर्षमा गर्न चाहेको केसैले प्रतिबन्ध गर्दैन, सपूर्ण सुख स्वागत गरिनुपर्छ र सपूर्ण दुख त्यागिनुपर्छ | तर केहि खास परिस्थितिहरु र कर्तब्य को परिबन्धहरु अथवा ब्यबसायिक दायित्वहरुमा, धेरैजसो यस्तो लाग्छ कि सुखहरु छाडिनुपर्छ अनि झिजोलाग्दो कुराहरु स्विकारिनुपर्छ | बुद्दिमान मानिस त्यसैले यस्ता मामलामा छनोट को यो सिद्धान्तमा अडिग हुन्छ : उ सुखहरु त्याग्छ ता की अरु ठुला सुखहरु सुरक्षित गर्न सकोस, वा उ दुखहरु सहन्छ ता की अरु नराम्रा दुखहरु भोग्न नपरोस | </em></p> <p>Wow! What the insight. I nodded, Lorem Ipsum is the secret to pleasures and pains in life. On completing this translation and re-reading actually felt like happiness and sadness are mere the choices in life, the idea is we should know how and when to choose one. We have to choose both, but circumstances matter!</p> <p>But, still, after going through the two paragraphs overnight, i was in confusion how to interpret the first line: </p> <p>"Neither is there anyone who loves grief itself since it is grief and thus wants to obtain it"</p> <p>As</p> <p> <em>को नै छ र यहाँ जो दुख आफैमा मन पराउछ, किनकि यो दुख हो, त्यसैले त उ यसलाई पाउन चाहन्छ</em> </p> <p>i chatted with my gurus, discussed with my colleagues and I skyped with my friends about how can we interpret the meaning. We had some discussions: </p> <p>Here are some lines my friends shared when i asked for the interpretation: <br /><em> - दुखलाई माया गर्ने कोहि छैन, किन कि त्यो दुख हो, तर दुख चाहिन्छ <br />- कहिले काहीँ दुख पनि रमाइलो बनिदिन्छ</em></p> <p>The meaning of the line sounds more profound when we read it like: </p> <p><em>बुद्दिमान मानिस सुखहरु त्याग्छ ता की अरु ठुला सुखहरु सुरक्षित गर्न सकोस, वा उ दुखहरु सहन्छ ता की अरु नराम्रा दुखहरु भोग्न नपरोस,  …… को नै छ र यहाँ जो दुख आफैमा मन पराउछ, किनकि यो दुख हो, त्यसैले त उ यसलाई पाउन चाहन्छ | </em></p> <p>Here is how the CSS template that i was playing around for the illustration, ended up filled with this translated Nepali text as a sample/placeholder:  <a href="http://bit.ly/nepsum">http://bit.ly/nepsum</a></p> <p>I concluded the experience as,  we need to find some Lorem Ipsum text that preserves the uniqueness and beauty our language, that encourages our designs on our own. </p> <p>If you are now reading this line, i guess, you are, please do share some words about the post and also i would love to hear your views on better translation. </p> <p>References: <br /> <br />- The template is used from <a href="http://www.freecsstemplates.org/">http://www.freecsstemplates.org/</a> <br />- Lipsum Web site : <a href="http://www.lipsum.com/">http://www.lipsum.com/</a> <br />- Wiki Article about Lorem Ipsum: <a href="http://en.wikipedia.org/wiki/Lorem_ipsum">http://en.wikipedia.org/wiki/Lorem_ipsum</a> <br />- <a href="http://www.dictionary.com.np">http://www.dictionary.com.np</a> <br />- <a href="http://www.nepalisabdakos.com/">http://www.nepalisabdakos.com/</a> <br />- Project I am involved in : <a href="http://shabdasamyojan.com/" target="_blank">Shabdasamyojan</a></p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-39701838646103832822010-08-12T10:08:00.000-07:002017-06-22T00:42:22.885-07:00Nepal In - PHP Arrays<p align="justify"> What is Nepal in PHP Arrays - Project ? <br />  <br /> Are you a PHP developer in Nepal ? or do you use MySQL in your projects. How many of you have easier access to the places & cities of Nepal in simpler arrays, that can be taken for reference and used. </p> <p align="justify">I am currently involved in a project named <a href="http://www.gharbeti.com" target="_blank">Gharbeti.com</a> (get updates <a href="http://twitter.com/gharbeti" target="_blank">here</a> ) and got in situation where i need to use the places in Kathmandu to implement the site theme. Gharbeti.com – The Rentals Solutions In Kathmandu. </p> <p align="justify">I was searching through web, searching for some arrays of places, cities, districts headquarters etc. But i was not lucky enough to find them. Instead i thought i would search for places and list them as PHP Arrays or MySQL tables. This <a href="http://en.wikipedia.org/wiki/Districts_of_Nepal" target="_blank">wiki page</a> was handy though. <br /> <br />There is a project named <a href="http://github.com/debuggable/php_arrays" target="_blank">PHP Arrays</a> in Github -  I was solely inspired by this project. But, limiting myself to my country i decided to list resources related to Nepal in PHP arrays. This was how all it begun. </p> <p align="justify"> What is included in this project till now: <br /> <br /> 1. Places In Kathmandu - PHP Array & MySQL table <br /> -> listing of most popular places in Kathmandu. <br />    -places_in_kathmandu.php <br />    -places_in_kathmandu.sql    </p> <p align="justify"> <br /> 2. 14 Zones & 75 districts of Nepal <br />    -> 14 Zones (Anchals), 75 (Districts/Headquarters) <br />     -14_zones_75_districts_of_nepal.php</p> <p align="justify"> <br /> 3. 75 Districts of Nepal and their Latitude & Longitude values. <br />    -> 75_districts_latitude_longitude.php <br />    -> If you want to calculate Latitude Longitude values by yourself: <a href="http://leaveurdream.blogspot.com/2010/05/find-distance-between-two-cities-using.html" target="_blank">here's a little snippet using Google Maps API</a> that we can loop through by yourself. <br /> <br />        $country = "Nepal"; <br />        $city = "Kathmandu"; <br />        $addEncoded = urlencode($country).",+".urlencode($city); <br />        $geoCode = file_get_contents("<a href="http://maps.google.com/maps/api/geocode/json?address="">http://maps.google.com/maps/api/geocode/json?address="</a>.$addEncoded."&sensor=false");                    <br />        $response = json_decode($geoCode); <br />        $lat = $response->results[0]->geometry->location->lat; <br />        $lng = $response->results[0]->geometry->location->lng;</p> <p align="justify"> <br />    -> Pick up any latitude, longitude pair and try browsing in the following link format: <br />        This link should bring out Map for <a href=" http://maps.google.com/maps?q=27.529131,84.3542049" target="_blank">Chitwan district</a></p> <p align="justify"> </p> <p>Do you want to contribute to this Project? <br /> <br />Use the <a href="http://github.com/bhu1st/nepal_in_php_arrays" target="_blank">github repo url</a>, clone a local copy or fork it, add files and push the changes. </p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-37212326008558585262010-05-05T08:40:00.000-07:002017-06-22T00:42:22.879-07:00CodeIgniter Helpers – How to write your own?<div dir="ltr" style="text-align: left;" trbidi="on">Find yourself again and again doing CI or are you just getting started in to your next big project ? Get this book by Rob Foster. This is an easy-to-follow guide consisting of a number of projects that enable you to develop full-featured applications at a fast pace. <a href="http://www.amazon.com/gp/product/1783287098/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1783287098&linkCode=as2&tag=bhupsapk-20&linkId=EBSN42CCEC3Q6FVW" rel="nofollow">CodeIgniter Web Application Blueprints</a><img alt="" border="0" src="http://ir-na.amazon-adsystem.com/e/ir?t=bhupal-20&l=as2&o=1&a=1783287098" height="1" style="border: none !important; margin: 0px !important;" width="1" /> <br /><br />What is here:<br /> -> What is a codeigniter helper? an example<br /> -> Creating your own codeigniter helper, create a helper which will have a function to Check Ajax requests<br /> -> Accessing sessions/models from within Helpers<br /> -> A tip on how to load codeigniter models from within another model.<br /><br /><a href="http://codeigniter.com/user_guide/general/helpers.html" target="_blank">From CI site</a><br /><blockquote>Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular category. There are <dfn>URL Helpers</dfn>, that assist in creating links, there are <dfn>Form Helpers</dfn> that help you create form elements, <dfn>Text Helpers </dfn>perform various text formatting routines, <dfn>Cookie Helpers</dfn> set and read cookies, <dfn>File Helpers</dfn> help you deal with files, etc.<br /><br />A helper can be loaded anywhere within your controller functions (or even within your View files, although that's not a good practice), as long as you load it before you use it.</blockquote>Let me give you and example: <br /><blockquote>in controller, model or view you have to first load the helper you want to use with following line: <br /><b>$this->load->helper('<var>name</var>');</b><br />where ‘<b>name</b>’ === is helper file residing in ===> application/helpers/<b>name_helper.php</b> (custom helper if exists)<br />or system/helpers/<b>name_helper.php</b> (bundled with codeigniter)<br /><br />‘<b>name</b>’ is the name you want for your helper, then a _ (underscore) & <b>helper.php, </b>the codeigniter’s way.</blockquote><div align="left">if you want to look at a sample: go check system/helpers folder, they come bundled with codeigniter. Here’s a snippet from: <b>system/helpers/url_helper.php</b></div><blockquote><div align="left"><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');<br /><br />if ( ! function_exists('site_url'))<br />{<br /> function site_url($uri = '') <br /> {<br /> $CI =& get_instance();<br /> //every time you need to use codeigniter system libraries or functions or model you’d do this through the get_instance<br /> return $CI->config->site_url($uri); <br /> }<br />}</div></blockquote><div align="left">Remember, when you used this site_url() function?? okay what you did was: </div><div align="left">loaded the helper at your controller construction or where ever you needed using, <b>$this->load->helper('<var>url</var>');</b>and simply <b>echo site_url(); </b>or like that.<b> </b></div><div align="left"><b><br />How to write your own helper : Check Ajax Request using Codeigniter Helper</b><br />Yesterday, while going through my current project, I was calling lots of controller actions with jQuery <a href="http://bhu1st.blogspot.com/search/label/Hello%20AJAX" target="_blank">Ajax</a> and i was in need to check whether the call/request is made through Ajax or not in the controllers. Since i needed a way to use this facility in lots of controllers, i thought helpers would come handy here. </div>Rather than just copy/pasting the same lines of code in every controllers or at times you may need to use same functions in models & views too, it is good practice to make this function have some separate space in helpers (but not a good practice to load helper in views, see above, from CI site). So you should be clear at first whether your function need a place in helper or not??? Ask yourself and decide for your work, if the frequency of your function call is going to be maximum, sure create a new helper or <a href="http://codeigniter.com/user_guide/general/helpers.html" target="_blank">extend existing one</a>. I decided to create one in my case. <br />Okay let’s make our Ajax request checker?? isAjax() function, residing in <b>useful</b> helper. When i Googled around for checking Ajax request i found a three line snippet here <a href="http://snipplr.com/view/1060/check-for-ajax-request/" target="_blank">CHECK FOR AJAX REQUEST</a>, i’ll will be implementing this for our purpose here. It goes like this: <br /><blockquote>function isAjax() {<br />return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && <br />($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'));<br />}</blockquote><b>The Helper:</b> <br /><blockquote>system/application/helpers/<b>useful_helper.php</b><br /><?php if (!defined('BASEPATH')) exit('No direct script access allowed');<br />//secure your snippet from external access<br />function isAjax() { <br /> return ( isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'); <br /> }<br />?></blockquote><b>Using in Controller: </b>application/controllers/<b>somecontroller.php</b> <br /><blockquote>function submit_form(){<br />//function you call when you submit your form through Ajax. <br />$this->load->helper('useful'); //load our just defined helper <br />if(isAjax()){<br /> echo ‘The request is made throug ajax. success!’ ;<br /> //do your stuffs<br /> exit;</blockquote><blockquote> } </blockquote><blockquote>}</blockquote> <br /><b>Accessing session/models from within Helpers</b><br /><blockquote><?php if (!defined('BASEPATH')) exit('No direct script access allowed');<br /> function isAjax() { <br /> return ( isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'); <br /> }<br /> function check_login(){ <br /> //$userId = $this->session->userdata('userid); this line will not work here <<-----<br /> // you'd access your session variables through get_instance() as below<br /> $CI =& get_instance();<br /> //now session access through this instance <br /> $userId = $CI->session->userdata('userid); <br /> if ($userid < 0 ) {<br /> return 0; //user not logged in <br /> }<br /> else {<br /> return 1; user session exists, must be logged in <br /> }<br /> }<br /> function hello_model_world(){ <br /> //or if you decided to load & use you models here<br /> //$this->load->model('Hello_model'); <---- this will not work too. <br /> //use as <br /> $CI =& get_instance(); //first get instance<br /> $CI->load->model('Hello_model'); //then load model through instance. <br /> //and calling a model function <br /> $data = $CI->Hello_model->display_this(‘hello world!’);<br /> //assuming your model returns capitalizing the initial letters of the words<br /> return $data; //will give Hello World! <br /> }<br />?></blockquote>Now, you can easily load your helper in controllers & models and use it as regular helpers.<br /><b><br />Extra tip about loading codeigniter model from another models:</b><br />You see how handy the <b>$CI =& get_instance();</b> is in helpers. okay, let me add a quick tips talking about this, what if at times you needed to find out a way to load another models in your current model?? Ok here’s the solution: <br /><blockquote><?php <br />class Test_model extends Model { <br />function Test_model()<br /> {<br /> //Call the Model constructor<br /> parent::Model();<br /> } <br />function do_something(){<br />//you wanted to load another model called <b>Hello_model</b> here in this function in this model class<br />//it’s okay <br />//use <br /> $CI =& get_instance(); //first get instance<br /> $CI->load->model('Hello_model'); //then load model <br /> $data = $CI->Hello_model->display_this(‘hello world!’); //call functions<br /> //do anything with this $data <br />}<br />}<br />?><br /><br /><br /></blockquote>Happy Coding. <br />Regards<br /><br /><br /></div>@bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0tag:blogger.com,1999:blog-3508392207883956961.post-161543652846250212010-05-03T11:12:00.000-07:002017-06-22T00:42:22.628-07:00Hello World – CodeIgniter Model – A Simple Bookmark Manager<p>Continued from <a href="http://bhu1st.blogspot.com/2010/03/hello-world-codeigniter.html" target="_blank">Hello World – CodeIgniter!</a> </p> <p>I’ve been a bit busy with my development works. Talking about codeigniter,i will discuss today on how we can use it to access MySql database, insert data into tables, retrieve and display them, at times delete them. We’ll create a very simple Bookmark Manager App (just for the sake of understanding models in codeigniter, i’ve added code over the <a href="http://bhu1st.blogspot.com/2010/03/hello-world-codeigniter.html" target="_blank">last article</a> ) </p> <p> <strong>what we’ll do today</strong> </p> <blockquote> <p align="left">-1. if you don’t have codeigniter yet, download it from <a href="http://codeigniter.com/" target="_blank">ci site</a>. <br>0.rename extracted CodeIgniter zip folder to <strong>ci </strong>&<strong> </strong>add it to your server root - xampp/htdocs or wamp/www folder<br><strong>1.</strong> <strong>Database Design: </strong>create database & table representing our Bookmark Storage requirement & save some configuration setting so that codeigniter recognizes which database we want to work on.<br><strong>2.</strong> <strong>Model: </strong>describe the database accessing logic (called business logic, it’s where the real business goes, your data will be your business & you’ll build logic over this business) – CRUD – create, retrieve, update, delete actions, in Models of the codeigniter<br><strong>3.</strong> <strong>Controller: </strong>use the Controller to access data from the Model & pass them to View so that it can display them. <br><strong>4. View: </strong>Create a simple View with HTML forms, that helps user with CRUD operations<br><strong>5. Test</strong></p></blockquote> <p align="left">1. Create Database named <strong>ci_test </strong>going to <a href="http://localhost/phpMyAdmin">http://localhost/phpMyAdmin</a>, click on this database, there are zero tables yet. copy paste the table structure by going to SQL link. and Go. </p> <blockquote> <p>CREATE TABLE IF NOT EXISTS `bookmarks` (<br> `bookmark_id` int(11) NOT NULL AUTO_INCREMENT,<br> `url` varchar(255) NOT NULL,<br> `description` text NOT NULL,<br> `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,<br> PRIMARY KEY (`bookmark_id`),<br> UNIQUE KEY `url` (`url`)<br>) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;</p></blockquote> <p align="left"><a href="http://localhost/phpMyadmin">http://localhost/phpMyadmin</a> Interface: Create table from SQL </p> <p align="left">You created your database & table. </p> <p align="left">Open <strong>application/config/database.php </strong>and change as followings</p> <blockquote> <p>$db['default']['hostname'] = "localhost"; //hostname<br>$db['default']['username'] = "root"; //default user name in local dev environment<br>$db['default']['password'] = ""; //default password is blank<br>$db['default']['database'] = "ci_test"; //our database <br>$db['default']['dbdriver'] = "mysql"; //we are going to use MySql database</p> <p>leave others as default for now. Now you told codeigniter to use our database in the application we are going to build.</p></blockquote> <p align="left"><strong>2. Defining Model (a PHP class that’ll wrap our relation database model to Object Oriented style)</strong></p> <blockquote> <p align="left">Here <strong>Bookmarks_Model</strong> is a PHP class, file name <strong>bookmarks_model.php </strong>& with some methods inside it inside the Models folder, <br>filename: <strong>Application/Models/bookmarks_model.php<br></strong>the relation between file name & class name is <br>classname = ucfirst($filename) without .php extension ok //first letter uppercase </p> <p align="left">it will look like this </p> <p align="left"> </p> <p align="left"><?php <br>class Bookmarks_model extends Model { </p> <p> var $url = '';<br> var $description = ''; <p> function Bookmarks_model()<br> {<br> // Call the Model constructor<br> parent::Model();<br> }<br> function get_last_ten_entries()<br> {<br> $query = $this->db->get('bookmarks', 10);<br> return $query->result();<br> } <p> function save($u,$d)<br> { <br> $this->url = $u; <br> $this->description = $d; <br> $this->db->insert('bookmarks', $this); <br> }<br> function delete($id)<br> { <br> $this->db->where('bookmark_id', $id);<br> $this->db->delete('bookmarks'); <p> } <p> function update_entry()<br> {<br> $this->url = $_POST['url'];<br> $this->description = $_POST['desc']; <br> $this->db->update('bookmarks', $this, array('bookmarks_id' => $_POST['id']));<br> } <p>}<br>?></p></blockquote> <p align="left"> <strong>3. Inside Controller</strong></p> <p>Here <strong>Hello </strong>is a PHP class, file name <strong>helllo.php </strong>& with some methods inside it inside the controller folder. controller & function inside it are the only way user can interact with our system, that’s why we can say controller has control over the flow of the application, we’ll access this controller later as: <a href="http://localhost/ci/index.php/hello">http://localhost/ci/index.php/hello</a> and each function inside it as – see comment in the code.<br><br>The naming convention for filename & class name is <br>classname = ucfirst($filename) without .php extension<br><strong></strong></p> <p><strong>filename: application/controllers/hello.php</strong> </p> <blockquote> <p><?php <p> class Hello extends Controller {<br> function Hello()<br> { <br> parent::Controller();<br> $this->load->database();//load database library <br> $this->load->model('Bookmarks_model'); //load just defined model<br> } </p> <p> function index($data='') { <br> //accessed from url when typed <a href="http://localhost/ci/index.php/hello">http://localhost/ci/index.php/hello</a><br> $bookmarks=$this->Bookmarks_model->get_last_ten_entries(); <br> //call the function inside model which returns last ten entries<br> $data['bookmarks']=$bookmarks; <br> //create $data array with the values returned from the model function<br> $this->load->view("hello_view",$data);<br> //load the view named hello_view.php passing $data to it. <br> }</p> <p> function save()<br> { <br> //accessed from url when typed <a href="http://localhost/ci/index.php/hello/save">http://localhost/ci/index.php/hello/save</a><br> //retrieve data from the form post method <br> $u=$this->input->post('url'); <br> $d=$this->input->post('desc'); <br> //check for validity<br> if ($u==''&& $d==''){ <br> echo "Invalid, Entry"; <br> }<br> else{ <br> //if valid data, call the function of the model which will save our data<br> //to database <br> $this->Bookmarks_model->save($u,$d); <br> echo "Thanks, Link Added!"; <br> }<br> }<br> function del($id)<br> {<br> //del function is receiving data from URL <br> //accessed from url when typed <a href="http://localhost/ci/index.php/hello/___id___">http://localhost/ci/index.php/hello/___id___</a><br> //___id___ is the promary key of the data <br> //delete data by passing primary key <br> $this->Bookmarks_model->delete($id);<br> echo "Thanks, Link Deleted!"; <br> }<br> }<br>?></p></blockquote> <p align="left"><strong>4. the view <br></strong>no naming convention for a view. build your own but you should make it easier to link your controller action to view memorable. just remember you’ll load (like used to include) views using filename without extension in controller. if you like extension see user guide for more $this->load->view options.</p> <p align="left"><strong>filename: application/views/hello_view.php</strong> </p> <blockquote> <p><h1>Bookmark Manager </h1><br>//simple php for each loop to iterate throug our data<br>//remember $bookmarks was passed from the controller as index of the $data variable, which is accessed here as an array of object. <br>//if you want to view the structure of the $bookmarks array uncomment the line below this.<br>//print_r($bookmarks);<br>//initially the array will be blank, but will show it’s structure after you add some data using the form. <br><br><?php foreach($bookmarks as $b) : ?></p> <p><?php echo $b->description;?><br><br><a target='_blank' href='<?php echo $b->url;?>'><?php echo $b->url;?></a><br><a href='<?php echo base_url() .'hello/del/'. $b->bookmark_id;?>'> Del</a><br><hr><br><?php endforeach; ?><br><br><br><br><br>//html form to help add data to the database</p> <p>//the action of the form is defined as the save method of the hello controller<strong>. <br></strong>// base_url() function gives the root path of this project <br>//defined in application/config/config.php as<br>//<strong>$config['base_url'] = <a href="http://localhost/ci/index.php/">http://localhost/ci/index.php/</a>;</strong></p> <p><form method="post" action="<?php echo base_url() .'hello/save'; ?>"><br>Url:<input type='text' name='url' > <br><br>Description:<input type='text' name='desc' > <br><br><input type="submit" value="Add"><br></form></p></blockquote> <p><strong>5. Now go test the application you just created.</strong> </p> <p> </p> <p><br><strong>Let’s memories</strong> $data<strong> flow in Codeigniter once<br><br></strong>Model – to – Controller – to – View flow i.e.<br>from database to – [ PHP code to/Data Manipulation ] – HTML presentation </p> <blockquote> <p>1. Go through the user guide, remember this, when you see the terms Model, View & Controller – you just keep focused in the PHP Classes inside the folders named Models, Controllers & Views<strong> </strong>within the <strong>system/application</strong> folder of the codeigniter. </p> <p> </p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0vpBp4uOfnEI1UCNHZ3rnmnisvXHTklygk6Z1VMKXDnNcrFzn7ZoJAMgzfwbN9tro1N65d_t_acDmXyUCPs6E9-GXkEXU-jrhU2sXh_Sxa86cbngPnZ4vhvxzV2llGRrKornUXAGPaVw8/s1600-h/cimvc10.jpg"><img title="ci-mvc" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="313" alt="ci-mvc" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTcgRdCjlWeSGk_TOQHdl35PR2FJOMg4NZXRD0keqiJst5sil9pn5scNsqvgWm2oc_Z30zlAk42e_U_R7WrtP6KVitXwuYrqV4l_q9sKjuu2kegkngZbG58nhEtfBV7AD7ATUK91Kovbbm/?imgmax=800" width="699" border="0"></a> </p> <p><strong>Model</strong> – PHP files, each file, each class for each table in database or group as you like, <strong>application/models</strong>, <br><strong>View</strong> – PHP files, each file, presentation for actions(methods/functions) in controller, <strong>application/views</strong><br><strong>Controller</strong> - PHP files, each file, each class that control application flow, <strong>application/controllers<br></strong><br>2. when they say, <strong>build a model for your database</strong>, think that you are going to create PHP files, each for each table.. etc… with a class with some function to access database (using SQL queries or ORM/object relation mapper or plane SQL) & return these data to controller as array or objects like you used to return 0<strong>;</strong> in C/C++ main functions.</p> <p>function get_last_ten_entries()<br> {<br> //codeigniters default ORM activerecord’s way to retrive data<br> //produces sql like -- select * from bookmarks limit 10 <br> $query = $this->db->get('bookmarks', 10);<br> return $query->result();//return data to calling function from controller, returns objects array<br> } </p> <p>3. When they say <strong>access data from the model</strong> – you’ll be calling from controller or view a function inside a codeigniter models php file to retrieve data from the database. like this.</p> <p>//load model like you use to include dbconfig.php or whatever, wherever in controller you need<br>$this->load->model('Bookmarks_model'); <br>//use the function inside it through the loaded model instance<br>$bookmarks=$this->Bookmarks_model->get_last_ten_entries(); //an object array <br><br>data returned from model is stored invariable $bookmarks <br><br>4. when they say, <strong>pass data to the view</strong>, you’ll be using a simple codeigniter function to pass data to a function which is used to load view (php files inside the views folder).</p> <p>why you accessed data in controller? obviously to display or act upon it: so let’s pass it to view that handles our display system, no data manipulation for now.<br><br>//create $data array with the values returned from the model function<br>$data['bookmarks']=$bookmarks; <br><br>//load the view named hello_view.php passing $data to it. <br>$this->load->view("hello_view",$data);<br><br>5. When they say, <strong>design/markup a view?</strong> you are going to add some PHP files in the Views folder, name it as you like but keep the name in order so that it’ll be easier to reference later which controller is calling which view?? </p> <p>//you passed the variable <strong>bookmarks</strong> from step 3(controller), to step 5 (view) in summary just above. now access it & display it. <br><?php <br>foreach($bookmarks as $b) :?> <br>echo $b->description;<br>echo ‘<br>’;<br>echo $b->url;<hr><br>endforeach; <br>?></p></blockquote> <p>Hope this helps you to start out with CodeIgniter, you are ready to explore on your own now. <br>Regards. </p> @bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com2tag:blogger.com,1999:blog-3508392207883956961.post-77924521660110528532010-05-02T10:09:00.000-07:002017-06-22T00:42:23.074-07:00Social Network Database Design Sample - MySQL<div dir="ltr" style="text-align: left;" trbidi="on"><b>what?</b><br />------<br /><table border="0" cellpadding="2" cellspacing="0" style="width: 671px;"><tbody><tr> <td valign="top" width="281">sample database for a social network project – a mysql database schema <br />Database Engine: InnoDB (edit the mwb file if you need to change it to MyISAM or any other.) <br />the aspects of a social network i tried to cover in this database:<br />- user profile <br />- friends<br />- friends list <br />- status updates<br />- thumbs up/down status (these can be easily ported to other entities)<br />- bookmark saving <br />- rss/atom feeds saving <br />- notifications<br />- chat <br />- blog, site level not user level <br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8Kkb1BOX-r1fIxDZJlQoR1S9xF-SkBj5gax-nVbS_-xoYmL3U9QXuP1lBfkx9L_McxlYLGDwWdoYwahNxMvscYjPkXwTY4W7ZEu2SnkpPAu75snlg86nCuzsRKBzXLcNNOyOK0r4_1brP/s1600-h/user%5B18%5D.jpg" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="user" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxNCQbiqohJsxfL_hOQHxOHpGc6sFdmGRQZ2n8lGAdLd1Vg0VCcNHj7n5SSlS7RDoXokEfwkFSAE1MLPGzXezjjbd8NlttwD_Y6hVQfQ1KA8mnfs-fvDViTbvEw3UPFEXGQxb_jFxisPeD/?imgmax=800" height="301" style="border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;" title="user" width="163" /></a><br /><br />- privacy</td> <td valign="top" width="388"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2f8Zyau_M63QxoU5ftquLwsS_wzhD3e9LFK2qJAjQg-GGz4yFV-VllvkP6WjCxbl54_4hy8EL0kFPFot2QJ29ZrsK8r-RAjX1jdO-xVFQRRuCzIsM_vIHhxBFBqdFUBl455lgjAe9ds8F/s1600-h/profile%5B11%5D.jpg"><img alt="profile" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh32kuwq6gmga8RKh3pL6_PoiOtCg0MGuOlCHjsODF2d_bgS1-nvDfffA_SOklZ8LwvKlH6d2nAVBEv2psLbEbZwaJUy8CnveV-jQYLNi4TYYa2GUnA_JbsFgXf3cbPwUizQGnvd-CxolBo/?imgmax=800" height="369" style="border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;" title="profile" width="148" /></a> </td></tr></tbody></table><b>why?</b><br />------<br />you can use these files for beginning a social n/w type projects in PHP/MySQL development environment.<br />when i was doing social network project, i searched here & there for database design of a social network, but what i found in the internet were not useful. they provided a introductory sketch about social network database structure but but as i had a limited time frame for my project, those materials were not useful. i have analyzed most of the basic requirements for a social network database structure, and sharing this with you so that it would save some of your time to start out your project. <br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5AoUz8CjXDzTdZXlqMUKieAI116useLOyZ0y3yw1q4N_rrlbcg4kuk5e_7kk0s3m2XgQQ51nXywZDWe7bvsp9UiH7JUK3pgC6Yx-YD9W7Wbjp_jcqMoTXDbxTHNUW0pqZTDMy3SOpmRAW/s1600-h/status%5B9%5D.jpg"><img align="left" alt="status" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNnrPry2EC8fPSkw1eR_9kXkplU4gKKyxmQOFwgVtXzPkZihMZu-Cg_tLGViY0mvothjXAVWIFVPHFeqG8CUnAJ4xGLFeVtOKei-ybixLEs0nq9zyKyyPVAFjbCj-lyHtxPHaiHHiBTskc/?imgmax=800" height="191" style="border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin-left: 0px; margin-right: 0px;" title="status" width="240" /></a>the database is not completely normalized yet but you can edit it as per your needs. don't waste to much time on what fields should i use for profile or for a status representation, these entity sets in the design will suffice in most of the cases. You can add entities for pictures, video, music sharing or anything you like. Just use the workbench design file. <br /><br /><br /><br /><br /><br /><br />Here are few books i'd recommend if you are willing to dive deep into MySQL and database designs<br /><br />1. Beginning MySQL Database Design and Optimization: From Novice to Professional<img alt="" border="0" src="http://ir-na.amazon-adsystem.com/e/ir?t=bhupal-20&l=as2&o=1&a=1590593324" height="1" style="border: none !important; margin: 0px !important;" width="1" /><br />or<br />2. High Performance MySQL: Optimization, Backups, and Replication<img alt="" border="0" src="http://ir-na.amazon-adsystem.com/e/ir?t=bhupal-20&l=as2&o=1&a=1449314287" height="1" style="border: none !important; margin: 0px !important;" width="1" /> <br /><br />files included<br />-----------------<br />following files are included<br />sns.7.0-.mwb - MySql WorkBench Design <br />sns.7.0.png - exported PNG from MySql workbench<br />sns7.0.sql - exported SQL from MySql Workbench<br />sns.yml - Doctrine Generated schema in YAML <br />you can use the MySQL WorkBench Designer available Open Source at <a href="http://wb.mysql.com/">http://wb.mysql.com</a> & begin with the mwb file, <br />change it for your need, export to sql & use it for your project. <br /><a href="http://dl.dropbox.com/u/1430378/mysql/mysql-social-network-database-for-reference.rar" target="_blank">Download MySQL Social Network Database Design – Sample</a><br /><br />Update 11/14/2011:<br />Many readers have requested how the project ended up in look.<br />So, here goes the slide we presented to Tribhuvan University (with formal details cut out).<br />Thanks for reading this post.<br /><br /><a href="http://www.scribd.com/doc/72540260/TimiHami-a-Nepali-Social-Network" style="-x-system-font: none; display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px auto 6px auto; text-decoration: underline;" title="View TimiHami a Nepali Social Network on Scribd">TimiHami a Nepali Social Network</a><iframe class="scribd_iframe_embed" data-aspect-ratio="1.2938689217759" data-auto-height="true" frameborder="0" height="600" id="doc_71829" scrolling="no" src="http://www.scribd.com/embeds/72540260/content?start_page=1&view_mode=list&access_key=key-1hqua7ajbm3tvtj4b5ac" width="100%"></iframe><script type="text/javascript">(function() { var scribd = document.createElement("script"); scribd.type = "text/javascript"; scribd.async = true; scribd.src = "http://www.scribd.com/javascripts/embed_code/inject.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(scribd, s); })(); </script><br /><br /><br /><br /><br /><br /><br /><br /></div>@bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com10tag:blogger.com,1999:blog-3508392207883956961.post-12730979042466504242010-03-22T11:50:00.000-07:002017-06-22T00:42:22.599-07:00Blogger Post & Comment Feed URLs<div><span class="Apple-style-span" style="font-family:georgia;">Recent Posts RSS feed url </span></div><div><span class="Apple-style-span" style="font-family:georgia;">http://</span><span class="Apple-style-span" style="font-family:georgia;">yourBlogAddress</span><span class="Apple-style-span" style="font-family:georgia;">.blogspot.com/feeds/posts/default </span></div><div><span class="Apple-style-span" style="font-family:georgia;"><br /></span></div><div><span class="Apple-style-span" style="font-family:georgia;">Recent Comments RSS feed url </span></div><div><span class="Apple-style-span" style="font-family:georgia;">http://</span><span class="Apple-style-span" style="font-family:georgia;">yourBlogAddress</span><span class="Apple-style-span" style="font-family:georgia;">.blogspot.com/feeds/comments/default </span></div><div><span class="Apple-style-span" style="font-family:georgia;"><br /></span></div><div><span class="Apple-style-span" style="font-family:georgia;">Label Specific Feed url</span></div><div><span class="Apple-style-span" style="font-family:georgia;">http://</span><span class="Apple-style-span" style="font-family:georgia;">yourBlogAddress</span><span class="Apple-style-span" style="font-family:georgia;">.blogspot.com/posts/comments/default/-/</span><b><span class="Apple-style-span" style="font-family:georgia;">labelname</span></b></div><div><span class="Apple-style-span" style="font-family:georgia;"><br /></span></div><div><span class="Apple-style-span" style="font-family:georgia;">Replace -> yourBlogAddress with your actual blogger address.</span></div><div><span class="Apple-style-span" style="font-family:georgia;">Replace -> labelname with your label</span></div><div><span class="Apple-style-span" style="font-family:georgia;"><br /></span></div><div><span class="Apple-style-span" style="font-family:georgia;">Hope That Helps. </span></div>@bhu1sthttp://www.blogger.com/profile/07735781880731995623noreply@blogger.com0