tag:blogger.com,1999:blog-71849669344130352152024-03-06T04:52:00.616+05:45Hem's BlogHemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-7184966934413035215.post-7830696144655147492018-10-04T13:29:00.001+05:452018-10-07T19:31:05.193+05:45Android RecyclerView with LoadMore and MultiView Layout using simple libraryAndroid RecyclerView is one of the toughest topics for the Android beginners.<br />
Many more tutorials related to RecyclerView are found on the internet along with the <a href="https://developer.android.com/guide/topics/ui/layout/recyclerview">Android Developer Blog</a> itself.<br />
<br />
So not writing more about the introduction part, lets go on implementation of RecyclerView with a simple Library called <code>awesomelib2.1.2</code>.<br />
<br />
Add the following line in dependencies part of build.gradle in app directory.<br />
<pre><pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: 1.45; margin-bottom: 16px; overflow-wrap: normal; overflow: auto; padding: 16px;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;">implementation 'com.hereshem.lib:awesomelib:2.1.2'</code></pre>
</pre>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipylRtXKHmyFvRQI7CmyQ5RpfBnWrnW9Tvnh3gW_FAHJPro1AXh6JbaOh8wMrfYEpZCAWujBbDmdyT9OK9hMGumoCy7ZrXYbruexR3Wj_CMAucuVvAMaaGjuvSccwSvzE4Bk-fFy90lqmG/s1600/RecyclerView.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="900" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipylRtXKHmyFvRQI7CmyQ5RpfBnWrnW9Tvnh3gW_FAHJPro1AXh6JbaOh8wMrfYEpZCAWujBbDmdyT9OK9hMGumoCy7ZrXYbruexR3Wj_CMAucuVvAMaaGjuvSccwSvzE4Bk-fFy90lqmG/s640/RecyclerView.png" width="360" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<a name='more'></a><br />
Now we are ready for the code implementation<br />
<h2>
Simple RecyclerView Implementation</h2>
Add RecyclerView in the layout file using the following<br />
<pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: 1.45; margin-bottom: 16px; overflow-wrap: normal; overflow: auto; padding: 16px;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;"><com.hereshem.lib.recycler.MyRecyclerView
android:id="@+id/recycler"
android:layout_height="match_parent"
android:layout_width="match_parent"
app:layoutmanager="LinearLayoutManager" /></code></pre>
Create View Holder extending MyViewHolder from Library with the type of Class to bind them. Here Event class is bounded to the ViewHolder using the following<br />
<pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: 1.45; margin-bottom: 16px; overflow-wrap: normal; overflow: auto; padding: 16px;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;">public static class EVHolder extends MyViewHolder<Events> {
TextView date, title, summary;
public EVHolder(View v) {
super(v);
date = v.findViewById(R.id.date);
title = v.findViewById(R.id.title);
summary = v.findViewById(R.id.summary);
}
@Override
public void bindView(Events e) {
date.setText(e.date);
title.setText(e.title);
summary.setText(e.summary);
}
}</code></pre>
Now we are ready for creating RecyclerView Adapter<br />
<div>
<pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: 1.45; margin-bottom: 16px; overflow-wrap: normal; overflow: auto; padding: 16px;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;">List<Events> items = new ArrayList<>();
MyRecyclerView recycler = findViewById(R.id.recycler);
RecyclerViewAdapter adapter = new RecyclerViewAdapter(this, items, EVHolder.class, R.layout.row_event);
recycler.setAdapter(adapter);</code></pre>
Moreover - adding click listener and load more</div>
<div>
<pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: 1.45; margin-bottom: 16px; overflow-wrap: normal; overflow: auto; padding: 16px;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;">recycler.setOnItemClickListener(new MyRecyclerView.OnItemClickListener() {
@Override
public void onItemClick(int position) {
Toast.makeText(MainActivity.this, "Recycler Item Clicked " + position, Toast.LENGTH_SHORT).show();
}
});
recycler.setOnLoadMoreListener(new MyRecyclerView.OnLoadMoreListener() {
@Override
public void onLoadMore() {
loadData();
}
});
loadData();</code></pre>
That's it, doesn't it seems to be easy?? 😊😊<br />
<br />
<h2>
Multi Layout RecyclerView</h2>
</div>
<div>
Create some more ViewHolders</div>
<div>
<pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: 1.45; margin-bottom: 16px; overflow-wrap: normal; overflow: auto; padding: 16px;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;">public static class TVHolder extends MyViewHolder<String> {
TextView title;
public TVHolder(View v) {
super(v);
title = v.findViewById(R.id.title);
}
@Override
public void bindView(String c) {
title.setText(c);
}
}
public static class DVHolder extends MyViewHolder<Integer> {
TextView title;
public DVHolder(View v) {
super(v);
}
@Override
public void bindView(Integer c) {
}
}</code></pre>
Now define holder with MultiLayoutHolder where the multiple class data type is bounded with their respective ViewHolder and their layouts.</div>
<div>
<pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: 1.45; margin-bottom: 16px; overflow-wrap: normal; overflow: auto; padding: 16px;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;">MultiLayoutHolder holders = new MultiLayoutHolder()
.add(Events.class, EVHolder.class, R.layout.row_event)
.add(String.class, TVHolder.class, R.layout.row_simple)
.add(Integer.class, DVHolder.class, R.layout.row_divider);</code></pre>
Finally create an adapter with simple line of codes<br />
<pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: 1.45; margin-bottom: 16px; overflow-wrap: normal; overflow: auto; padding: 16px;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;">List<Object> items = new ArrayList<>();
MultiLayoutAdapter adapter = new MultiLayoutAdapter(this, items, holders);
recycler.setAdapter(adapter);</code></pre>
</div>
<div>
<div>
With these lines MultiLayout is automatically selected with the type of data added to the items.</div>
<div>
<span style="background-color: #eeeeee;"><b>items.add(new Events(...));</b></span> binds the Event class item with EVHolder and row_event layout.</div>
<div>
<b style="background-color: #eeeeee;">items.add("Hem Shrestha");</b> binds the String with TVHolder and row_simple layout.</div>
<div>
<span style="background-color: #eeeeee;"><b>items.add(26);</b></span> binds Integer item with DVHolder and row_divider layout.</div>
</div>
<div>
<br /></div>
<div>
Visit this <a href="https://github.com/hereshem/Easy-RecyclerView-Library" target="_blank">Github repo</a> for <b>Full Source Code</b> and more implementation examples.</div>
<div>
<br /></div>
<div>
MultiLayout in RecyclerView is very complex task which can be easily implemented using the library as mentioned above.</div>
<div>
<br /></div>
<div>
If you have any comments about the library or want to contribute on it please send a pull request to <a href="https://github.com/hereshem/RecyclerViewWithLoadMoreAndServerRequest" target="_blank">this repository</a>.<br />
<br /></div>
<div>
Happy Coding. !!!</div>
<div>
<br /></div>
Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com0tag:blogger.com,1999:blog-7184966934413035215.post-88825657545521586412018-09-18T15:59:00.003+05:452018-10-04T14:02:55.197+05:45Host your own website for FREE in MeroServer<h2>
Steps for FREE .com.np domain registration</h2>
<ol>
<li>Goto <a href="http://register.com.np/">http://register.com.np/</a></li>
<li>*Choose your domain name</li>
<li>Attach scan copy of citizenship or driving license with the filename as given in instructions</li>
<li>Fill up personal details only (No need to fill company detail)</li>
<li>Set Name Servers - </li>
<ul>
<li>Primary Nameserver - <b>ns1.afraid.org</b></li>
<li>Secondary Nameserver - <b>ns2.afraid.org</b></li>
</ul>
<li>Submit them.</li>
<li>Wait for one working day, a confirmation mail arrives and your domain is registered :)</li>
</ol>
<h4>
<a name='more'></a></h4>
<h4>
*Guidelines for choosing domain name</h4>
<ul>
<li>you can add [namesurname]<namesurname>.com.np as stated in your citizenship or driving license</namesurname></li>
<li>if it exists, change the order [surnamename]<surnamename>.com.np</surnamename></li>
<li>it is great to get [name]<name>.com.np</name></li>
<li>don't use other title or name other than in citizenship or license, otherwise they will be rejected</li>
<li>the manual verification is done by the register.com.np, so the name must match with the documents provided.</li>
<li>.com.np is most obvious and easy to get, but moreover you will find lots of list for the TLD (Top level Domain)</li>
<li>you can also register other TLD which is given <a href="https://register.com.np/np-ccTLDs">here</a> that may need more documents</li>
</ul>
<div>
<h2>
</h2>
<h2>
Steps for getting FREE Hosting</h2>
</div>
<div>
After the domain is registered, lets go to the process of forwarding the domain name to the specific server.<br />
<br /></div>
<div>
As we have kept the Name Server to afraid.org lets get into it.<br />
<a href="http://afraid.org/">Afraid.org</a> is a Free DNS provider (i.e NameServer) that can route your request to any possible server. You can create a multiple subdomain and point each of them to any server for hosting. Basically NameServer parses the domain name and provide the actual ip address to make communication to that server.</div>
<div>
<br /></div>
<div>
So now lets make a free account on afraid.org to redirect our domain names.</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<ol>
<li>Login to Afraid panel <a href="http://freedns.afraid.org/zc.php">http://freedns.afraid.org/zc.php</a></li>
<li>Goto Domain Tab in Left Panel<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTicqlWO5I0ImjIRAIxBDcyATUE3BAZgWdfNhD_bScp2mGz94HhEGqVf2MKW6QzoRqFUBtFKhlfREr-4dYfapwKJPQNXduDcr_JpdsmsMcnKFfH3otOewMwKtFSXltXcCZQ5R2ENy1xgpJ/s1600/domain_afraid.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="298" data-original-width="192" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTicqlWO5I0ImjIRAIxBDcyATUE3BAZgWdfNhD_bScp2mGz94HhEGqVf2MKW6QzoRqFUBtFKhlfREr-4dYfapwKJPQNXduDcr_JpdsmsMcnKFfH3otOewMwKtFSXltXcCZQ5R2ENy1xgpJ/s200/domain_afraid.jpg" width="127" /></a></li>
<li>Click on Add Domain</li>
<li>Write domain name only. eg hemshrestha.com.np (do not use www.)</li>
<li>Again got to Sub-Domain tab from Left Panel</li>
<li>Add the CNAME record pointing www to the Raspberry Pi Server ( pi.hemshrestha.com.np or pi.hem.info.np )</li>
<li>Add the url forwarding of root domain to www.[domain]<yourdomain> as root domain only supports ip address and we don't have them.</yourdomain><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG17RtM5iYAn18cTC26FiBlS0dqOqhpZD63Bm_Pc0PapxDckyU9riDF0Bfe9LucvkPrO4upNiX-xy5V4TvESf1P-F6H2wA5vMG_6VTq6x6ZXRvJ46vmh0Kog9TzNQlDDnxAhLNqQehwgLW/s1600/hemshrestha_domain.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="112" data-original-width="574" height="77" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG17RtM5iYAn18cTC26FiBlS0dqOqhpZD63Bm_Pc0PapxDckyU9riDF0Bfe9LucvkPrO4upNiX-xy5V4TvESf1P-F6H2wA5vMG_6VTq6x6ZXRvJ46vmh0Kog9TzNQlDDnxAhLNqQehwgLW/s400/hemshrestha_domain.jpg" width="400" /></a></li>
<li>Wait for some time to propagate all over world. (may take from some minutes to several hours)</li>
<li>Cheers you are done.</li>
</ol>
<h2>
Final Steps</h2>
After the steps mentioned above, you can browse the website and you will find your default webpage layout displayed in web browser. <br />
And, now we are ready to get hosting server credentials.<br />
<br />
<b>Please forward your email to <a href="mailto:zpanel@hemshrestha.com.np">zpanel@hemshrestha.com.np </a></b>which is obtained from the registrar (to confirm that you have already registered the domain) and you will get a new zpanel account credentials where you can host your site.<br />
<br />
You can know more about this Raspberry Pi Server (<a href="http://pi.hemshrestha.com.np/">MeroServer</a>) from this link <a href="http://pi.hemshrestha.com.np/about.php">http://pi.hemshrestha.com.np/about.php</a><br />
<br />
<br />
Happy Browsing !!<br />
<br />Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com0tag:blogger.com,1999:blog-7184966934413035215.post-64742300886811491762018-09-16T16:18:00.001+05:452018-10-04T14:13:35.278+05:45Host your domain in Github (A Powerful Source Code Repository)<div class="post">
<h1 class="title">
</h1>
<div class="byline">
<small>Posted on September 20th, 2017</small>
by <a href="http://www.hemshrestha.com.np/" target="_blank">Hem</a>
</div>
<div class="entry">
<strong><a href="http://pi.hemshrestha.com.np/">MeroServer</a></strong> is currently down due to the public IP problem related to ISP.
We had setup a raspberry Pi as hosting server which is still up for 24 hours but due to the
IP being private,
it cannot be browsed from the external networks. We are trying to resolve them as much as we
can. <br />
<br />
And currently we are trying to migrate some of our static content in
<a href="https://github.com/" target="_blank">Github (A most powerful code repository)</a>
from which we can directly host our site.
<br />
Currently this site is hosted from <a href="https://github.com/hemshrestha/hemshrestha.github.io" target="_blank">this repo</a>
and following is the steps for hosting the site in Github.
<br />
<h1>
<a name='more'></a>Steps for hosting website in Github</h1>
<ol>
<li>First of all signin to account in Github and create a new repository.</li>
<li>Now, goto the project folder and initialize a repo.
<pre><code>$ git init
</code></pre>
</li>
<li>Add the remote url of created new repository
<pre><code>$ git remote add origin https://github.com/<username>/<repo>
</code></pre>
</li>
<li>Create a file named CNAME and write your custom domain name. For example "beautify.hemshrestha.com.np"
<pre><code>$ echo git.yourdomain.com >> CNAME
</code></pre>
</li>
<li>Add files to repo
<pre><code>$ git add .
</code></pre>
</li>
<li>Commit those addition
<pre><code>$ git commit -m "first commit"
</code></pre>
</li>
<li>Push master branch
<pre><code>$ git push origin master
</code></pre>
</li>
<li>Create a repo named gh-pages (github-pages)
<pre><code>$ git checkout -b gh-pages
</code></pre>
</li>
<li>Push gh-pages branch to github
<pre><code>$ git push origin gh-pages
</code></pre>
</li>
<li>Now the page will be live with the custom domain provided in CNAME file.</li>
</ol>
<h1>
Steps for pointing CNAME from your website</h1>
<ol>
<li>
Login to your Nameserver Account. For example <a href="https://afraid.org/" target="_blank">afraid.org</a>
</li>
<li>
Click on Subdomain tab.
</li>
<li>
Click on add subdomain.
</li>
<li>
Add CNAME record git.yourdomain.com to point github.io. For example beautify.hemshrestha.com.np CNAME github.io
<pre><code>git.yourdomain.com
point CNAME record to
github.io
</code></pre>
</li>
<li>
Save the record and wait for 10 minutes.
</li>
<li>
Browse git.yourdomain.com in the browser and you will see the data pushed in the repo.
</li>
</ol>
<b>See this <a href="https://github.com/hemshrestha/beautifier/tree/gh-pages" target="_blank">repo</a> for example</b><br />
Happy Browsing !!!</div>
</div>
Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com0tag:blogger.com,1999:blog-7184966934413035215.post-85616658239561174912015-01-01T02:26:00.000+05:452018-10-04T14:13:49.161+05:45Happy New Year 2015Its not my idea to write this post at this time, but I was so much inspired to write this post on the starting of a new year 2015.<br />
Everybody have a new charm and new resolution for upcoming days. People try to spent at least first day of a year to enjoy and share the happiness. And So we did.<br />
We had some delicious dinner with non-veg item with some bottles of Vodka and Rum to fight against the cold winter. :P<br />
After I got some hangouts with the trips of those drinks, I had a mood to do something better that can be remembered for a while. So I started collecting my sites and blogs,<br />
I repaired my homepage and filled with the actual content which I was planning many days before.<br />
<br />
Here is full preview of my personal website.<br />
<br />
<a href="http://www.hemshrestha.com.np/">www.hemshrestha.com.np</a><br />
<a name='more'></a><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPv8UL9p3No88teGcD2O-vq24E6YsE0CCbHXH3n6kr_5rIoQirCiO8KUxtfCvxGonJK7vQ_XHEi5vDxY-wk_4v8ReduyXewyfI9ta5LRLjKRe5Vwyx-S38jxZcVzZEUdjqIgmCCU9nW9q7/s1600/Hem-Shrestha.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPv8UL9p3No88teGcD2O-vq24E6YsE0CCbHXH3n6kr_5rIoQirCiO8KUxtfCvxGonJK7vQ_XHEi5vDxY-wk_4v8ReduyXewyfI9ta5LRLjKRe5Vwyx-S38jxZcVzZEUdjqIgmCCU9nW9q7/s1600/Hem-Shrestha.jpg" /></a></div>
<br />
<br />Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com0tag:blogger.com,1999:blog-7184966934413035215.post-24116622393949695772013-12-11T15:09:00.000+05:452013-12-18T14:08:16.999+05:45StartUp with GIT (Source Code Management)<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<b>What is GIT</b><br />
Git /ɡɪt/ is a software for the distributed revision control and source code management (SCM) system.<br />
<br />
<b>Why GIT</b><br />
Every Git working directory is a full-fledged repository with complete history and full version tracking capabilities, not dependent on network access or a central server.<br />
<br />
<b>GIT vs SVN</b><br />
Subversion allows you to check out just a subtree of a repository; Git requires you to clone the entire repository (including history) and create a working copy that mirrors at least a subset of the items under version control.<br />
<br />
<b>Why GIT is named as GIT</b><br />
Random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of "get" may or may not be relevant.<br />
<br />
<a name='more'></a><br />
<b>Where to find GIT</b><br />
You can download GIT from the <a href="http://git-scm.com/downloads">http://git-scm.com/downloads</a><br />
<div>
<br /></div>
<div>
<b>StartUp with GIT</b></div>
<div>
There are also other graphical UI tools available for GIT which make easy in use, although I prefer the Git Bash with command line.</div>
<div>
There is no exact way of using the Git. You can use it in your own way. It just keeps track of modification of your code for which any revision can be performed at any time.</div>
<div>
<br /></div>
<div>
Athough lets go to simple steps for</div>
<div>
<b>Creating New Local Git Reopsitory</b></div>
<div>
<br />
<ol style="text-align: left;">
<li>First of all, go to the project working directory via bash command line. eg. cd</li>
<li>Initialize the repository by typing "git init". The ".git" folder appear in the directory with hidden properties.</li>
<li>Now add all the existing file in the repo for versioning by typing "git add ." (add all files)</li>
<li>Tell that you have comitted the changes and record it with the message by typing "git commit -am <your_message><meaasge>".</meaasge></your_message></li>
<li>You have to set the name and email before comitting changes if it is not configured or if it shows error in step 4 while comitting. Type "git config user.name <user_name><your name="">" and "git config user.email your@email<your email="">"</your></your></user_name></li>
<li>Your local repository is ready. Now you can code safely. And DON'T forget to comit for each changes in your coding logic. You can revise each of them later on at any time.</li>
</ol>
<your-path></your-path></div>
<div>
<br /></div>
<div>
<b>Creating Online Repository</b></div>
<div>
<br />
<ol style="text-align: left;">
<li>You can easily create account in http://github.com . After logging in, click on "Create Repository", provide name and other details of repo and submit it.</li>
<li>You will find a online link of your repository in the page. Copy the link.</li>
<li>Now go to the local repo you have created earlier and type "git remote set-url origin <remote_url><your github.link="">"</your></remote_url></li>
<li>Next pull the data from the remote repo by "git pull origin master". (Username and password is promped at this time)</li>
<li>Again push your data to the server by "git push origin master". (username and password is promped)</li>
<li>Now you can see your data in your github repo.</li>
</ol>
</div>
<div>
<br /></div>
<div>
<b>Cloning Repository</b></div>
<div>
You can easily clone any public project you see in github.com by typing "git clone <remote_url><github_url>". github url is provided in every project page or you can copy the addressbar url directly.</github_url></remote_url></div>
<div>
<br /></div>
<div>
<b>Other Ways</b></div>
<div>
There are plenty of ways and lots of commands for using GIT.</div>
<div>
You can clone, fork, make branches, revert, checkout, stash, set tags, view logs, etc.</div>
<div>
You can get lots of other help and the way for using git. Although you can use GIT in your on way.</div>
<div>
<br /></div>
<div>
<b>Some useful GIT commands</b></div>
<br />
<ul style="text-align: left;">
<li>git init => Initialing new repo</li>
<li>git clone <git_url> => Cloning </li>
<li>git remote add origin https://hereshem@github.com/... => set the origin url for first time</li>
<li>git remote set-url origin https://hereshem@... => change the origin url</li>
<li>git config user.name "Hem Shrestha" => set name identity in the repo</li>
<li>git config user.email "hereshem@gmail.com" => set email identity in repo</li>
<li>git branch -a -l => view all available branches</li>
<li>git checkout <branch_name> => switch to the branch</li>
<li>git status => view changes in source after last commit</li>
<li>git add . => add all the untracked file</li>
<li>git commit -am "message" => commit changes in repo</li>
<li>git pull origin master => pull changes from remote</li>
<li>git push origin master => push changes to remote</li>
</ul>
<br />
<br />
<b>For Server side GIT</b> (Creating bare repository and set the folder and user permissions)<br />
<br />
<ul style="text-align: left;">
<li>git init --bare</li>
<li>sudo chmod -R g+ws *</li>
<li>sudo chgrp -R mygroup *</li>
<li>git repo-config core.sharedRepository true</li>
</ul>
<br />
<br />
<b>Happy Coding!.. ;)</b><br />
<br /></div>
</div>
Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com0tag:blogger.com,1999:blog-7184966934413035215.post-30173741585004187472013-03-11T22:41:00.001+05:452018-10-05T12:52:44.778+05:45My Other C projects<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Sudden after my first project <a href="http://hereshem.blogspot.com/2013/03/my-first-project-calendar.html">calendar</a> on June 2006, I was much more hopeful and generated a lot curiosity about the desktop application. So I suddenly tried to collect some ideas for my hobby product .<br />
<br />
<br />
One friend showed me a amazing trick of the card. He used 21 cards and divided into three subdivision, each of 7 cards. Now we have to remember any one of them and keep in our mind. And we have to do is that to point the group of card which it belong. Now he again keep those cards and again divided into similar kinds of group again, and we have to point the group of that card it belong. On the third iteration, the result is out, showed the card that we have guessed.
I was amazed by these tricks and learned to do the same in card as well as implemented it on the program. <a href="http://hemshrestha.com.np/wp-content/uploads/2013/02/game.exe" target="_blank" title="Card Game ">Check it</a>.<br />
<br />
<img alt="Card Game Implementation in the C Programming" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP_nzqbuL3FU3JcwVPiOorYc4bDiBbuGBUFDye5ZnXLe0N9_j76wWSMpn-U36AhwDS2D9UDd3N_kbiZNRxPv59A6qsYbxJwwQ0Q0_9lzzrv-AE8zPSbpJNPOrpqBq-fswYgkDlCO6jyzv1/s1600/card.jpg" width="100%" /><br />
<br />
<br />
<a name='more'></a><br />
<br />
Similarly, while we were in school, we used to play the game on the paper to know the word we guessed. There is matrix of the alphabets arranged in rows and columns. Just write the number of columns for each letter it belongs until last letter. Now rearrange the matrix and again give the belonging column number of each letters. And the result is out on the second iteration. <a href="http://hemshrestha.com.np/wp-content/uploads/2013/02/NAME.exe" target="_blank" title="Word Guess">Check it</a>.<br />
<br />
<img alt="Simple Word Guess game which we used to play in school life with pen and paper" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKM0Oa7-s_rnthqw7h7YUP3m6m97ebTHio1_dSKQ77yb4NphDBq3BimKlpLRfyJp9y6Y9A5EvoyPuPkYNq8vkU-1cgv7sCs1kj_SHTAbxlkrrOx2Av9x_B5021Sq6u3THBrgB3fTDpCkn2/s1600/word.jpg" width="100%" /><br />
<br />
And one another interesting project is the number to word. I was willing to know how the number in integer value is converted into the words. and I tried to make the converter. used my own logic for conversion :P. <a href="http://hemshrestha.com.np/wp-content/uploads/2013/02/Number-To-Words.exe" target="_blank" title="Number To Words">Check it</a>.<br />
<br />
<img alt="Number to words conversion program" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimTbC8IevUbvfOcyd4NTsQVfnpad4j5clAC6mhmqopl2ac4VgNHSa82h3k3CZB9PMvFD-rX6QG3SWAvI8C65q6JUrEWL6grM18mcBpRp4qEWhVAnv3PAy94L0FZxSyUysE_Jw_VhKcAFL-/s1600/num-to-word.jpg" width="100%" /><br />
<br />
On the practical lab, we have to know the value of each resistor with the value of color rings surrounded on resistor. We should always learn the sequence of those color codes and calculate the value of that resistor. So I made a program to find out the exact value of the resistor in Ohm by entering the color of three color bands of the resistor. <a href="http://hemshrestha.com.np/wp-content/uploads/2013/02/color.exe" target="_blank" title="Color Code">Check it</a>.<br />
<br />
<img alt="Simple program to find the ohmic value of resistor" src="https://hemshrestha.com.np/wp-content/uploads/2013/02/color.jpg" width="500px" /><br />
<br /></div>
Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com0tag:blogger.com,1999:blog-7184966934413035215.post-20785274790858832972013-03-11T22:28:00.000+05:452013-11-25T12:11:39.332+05:45My First Project - Calendar <div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Seems interesting when i remember start of my programming life.<br />
<br />
I had not even touched the computer till on the 3rd semester of IE, when there was lab for the computer basics. When I joined IE College Dharan at 2004, I burrowed Video game Keyboard, same as the computer keyboard from neighbour house to practice typing in my home television on the winter vacation of same year. Later on I was much interested in the new things and imagination. So I tried some ideas into the C programming concept.<br />
<br />
Here I want to discuss about my first project Calendar.
<a href="http://hemshrestha.com.np/wp-content/uploads/2013/02/calendar.exe" target="_blank" title="Calendar">Download</a>
<br />
<br />
Dated on 2006-06-04:<br />
I turned over my auto, to which my school friends had written some memories to it and found new interesting thing about the calendar.<br />
There was series of years and a matrix of rows and columns. And the procedure of finding out the correct monthly calendar was instructed in it. I read it carefully and tried to find out the calendar. Yea! it worked.<br />
But it was totally mathematical and have to go through certain procedures and certain tables. Later on I thought it to implement in the computer to make it work.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjFe-f2u6wsjPIEn8WWviySinmyj2YqYjgmRFX6DrE0HJRGq6848-RyaRrB4A3YP0qbhrmynTiF6oxBKWWaxwpKLK9d_vcbg1KOSTAno1aeB6FmFM9AMhua4bNeOffg8SbCRw4V8vf4eDW/s1600/IMG_20130206_2243471.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Calendar diary page" border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjFe-f2u6wsjPIEn8WWviySinmyj2YqYjgmRFX6DrE0HJRGq6848-RyaRrB4A3YP0qbhrmynTiF6oxBKWWaxwpKLK9d_vcbg1KOSTAno1aeB6FmFM9AMhua4bNeOffg8SbCRw4V8vf4eDW/s640/IMG_20130206_2243471.jpg" width="480" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<a name='more'></a><br /><br />
<br />
We had just studied the C programming in the Third semester, so I want to try it in the C. The assesment was running on and everyone were engaged in the preparation. And now I began to prepare for the calendar "My first Idea".
After I had planned for a whole day, and some rough sketches for the tables and codings, I went to the Abinash's(one of my friend who owned computer) room and started my job.<br />
After regular coding and degugging for nearly 2 hrs, I pressed Ctrl+F9 to run the "Turbo C" IDE. Wow! it really worked!!!!!!! I was so much excited for the result. Cheers!!!<br />
<br />
<br />
The Image of the page
Procedures:
<br />
<ol>
<li>Under Years Find the year you're interested in and note the letter that follows it</li>
<li>Under Months Find the same letter and note which number falls under the month you r looking for.</li>
<li>Under The Seven Calendars, use the calendar which bears the number you have just find.</li>
<li>Number of days in a month is same for every years same month in the english calendar given by,
30 days in September, April, June and November
Rest of all are 31,
leaving February alone i.e 28 days (but 29 days in leap year)</li>
</ol>
<img alt="Calendar" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWIo0WlwnexFc-dylDHzE-rbinYls1WE_NOK5xyKI8M7ai4pudxlcj3t7_W0I67luIKSwYzkP68t59HwOZEkAnogj0soYOz-cRnP7ECi8sxl6io9ZdMrp85SputRKHAsJJRtHiPaX28knv/s1600/calendar1.jpg" width="500px" /><br />
The Snapshot of the application.<br />
<br />
Later on I found that only one line formula is enough for the calendar making program inspite of those matrixes and tables.<br />
<br />
Anyway Enjoyed coding... Cheers!<br />
<br /></div>
Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com0tag:blogger.com,1999:blog-7184966934413035215.post-91095238880803521812011-12-11T16:51:00.002+05:452013-11-12T15:33:37.362+05:45Install Mongodb in Window<div dir="ltr" style="text-align: left;" trbidi="on">
How to install MongoDB in Windows<br />
<br />
1. Download windows version of mongodb from http://mongodb.org<br />
2. Extract Zipped files on "c://mongodb"<br />
<a name='more'></a><br />
3. Goto location from terminal and simply type "mongod" to run server<br />
4. If error occurs then - create folder "d:\mongo\data" and "d:\mongo\data\db"<br />
<pre>mongod --logpath d:\mongo\logs --logappend --dbpath d:\mongo\data --directoryperdb --install</pre>
<br />
If there is still error then<br />
- goto "start" -> type "cmd" -> right click for "cmd" -> select option "run as administrator"<br />
- and then repeat step 4.</div>
Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com0tag:blogger.com,1999:blog-7184966934413035215.post-22998107262837149642011-12-11T16:51:00.001+05:452013-11-12T15:33:55.125+05:45Node.js Server Installation in Window<div dir="ltr" style="text-align: left;" trbidi="on">
<h2>
Run Node server in the windows pc within few steps</h2>
<br />
Step 1. Download the file "node .exe" from <a href="http://nodejs.org/dist/v0.6.0/node.exe">http://nodejs.org/dist/v0.6.0/node.exe</a>. Its just less than 5 Mb<br />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFC1GQDYDTPNIr6zGKHhCC8SDNlsrUypm06GT9BUEY77XoeKsvDXYN-BqIY_DvgFnLSotTo2ZP3KWx5oLGMWCFZTEZn2p7xI01VSj-7bsdYCMmhi8UHkc4sytQEEuAHVSzLpA-p49kcpy_/s1600/download1.jpg" width="550px" /><br />
<br />
<br />
<a name='more'></a>Step 2. Save the file. Lets do it on "e:/node" folder.<br />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmLt2UhOpj0umLWWXXR-F7pfN9eKRO7s4XvpHJ9lrmPMVuJ86FVXEg3Pov1JmgTKDUv3GcKE9ZPx1YXjZemOygJF-GTlNhFMd8-FTGp7nycboCTBUTMIE4WKEC_N-IkzUssy8TkpldUuoy/s1600/folder.jpg" width="500" /><br />
<br />
Step 3. Create a new file -Lets say "server.js" on same location and Add the following Codes<br />
<pre>var http = require('http');
http.createServer(function(req,res){
res.writeHead(200,{'Content-Type':'text/html'});
res.end('
<h1>Hello World!! Your HTML text goes Here</h1>
');
}).listen(8000);
console.log('Server running at http://localhost:8000');</pre>
<br />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl8tbY5FfydVPy0CxtzRwF2KXfBsD9A5sBc5eV5CO07YtNsRD_fg0mU8Jdi3VSMZGq3dnBcCjr1KFxhLm79e1rZv-niQiJutdWySchha4QEcNMBHwBYYzbDB1ofzw_RylkGfC-OevxaGN0/s1600/code.jpg" width="550px" /><br />
<br />
Step 4. Now open the "Command Prompt" and type 'node file_name' i.e "node server.js"<br />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6LHtUBVfbBiZcTvlN0oh5dcnw0PNAALDxAmmolHs6g5Feerw692rIbOFRgH2_xbrPJCiM2nTaEvVYTW7LfY3LM52rPzm8ajxKyioxA88xpkDsttj3sOXVkOD3HxJr5ydvCZdCBf-978Jr/s1600/prompt.jpg" width="550px" /><br />
<br />
step 5. Click on 'Allow access', then Open the browser and type the link <a href="http://localhost:8000/">http://localhost:8000</a><br />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_pwm3hSY_I_GWsOL-a4G_M-cYQDOpv-DWNcJNSgfBgyPX5Sd34uGLLRat8mzQe_mX2JJfEZ_oTwxt4-vEgVGXA-zAP-6o8PYimUQiUMV_AMtIz6e8htU36Z1kRlE_sD_BMLDv1fHFW5hz/s1600/browser.jpg" width="550px" /><br />
<br />
(note: Press Ctrl+C to terminate the server)<br />
Isn't it Easy???<br />
Happy Coding!!!
</div>
Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com0tag:blogger.com,1999:blog-7184966934413035215.post-66596178944076279652011-12-11T16:51:00.000+05:452013-11-12T15:34:09.308+05:45How to install Mongodb on Linux<div dir="ltr" style="text-align: left;" trbidi="on">
MongoDb Install on Linux<br />
<br />
1. Download mongodb from http://mongodb.org<br />
2. Goto folder mongodb using "cd mongodb" from terminal<br />
<a name='more'></a><br />
3. To run the server type<br />
<pre>bin/mongod</pre>
<br />
4. To run the client type<br />
<pre>bin/mongo</pre>
<br />
5. If error occurs on running server then create folder "data" and "data/db" by command line<br />
<pre>sudo mkdir -p /data/db</pre>
<br />
<pre>sudo chown `id -u` /data/db</pre>
</div>
Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com0tag:blogger.com,1999:blog-7184966934413035215.post-17674546197806926682011-12-11T16:43:00.000+05:452013-11-12T15:34:23.714+05:45Node.js on Linux<div dir="ltr" style="text-align: left;" trbidi="on">
The steps for installing node.js on linux<br />
<br />
1. To install the tools needed to build node open a terminal and type the following commands:<br />
<pre>sudo apt-get install g++ curl libssl-dev apache2-utils git-core</pre>
<br />
2. Then checkout the node source:<br />
<pre>git clone git://github.com/ry/node.git</pre>
<br />
or<br />
<pre>git clone git://github.com/joyent/node.git</pre>
<br />
<a name='more'></a><br /><br />
3. Change into the node directory<br />
<pre>cd node</pre>
<br />
4. Configure the compiling process<br />
<pre>./configure</pre>
<br />
5. Compile node.js:<br />
<pre>make</pre>
<br />
6. Install it:<br />
<pre>sudo make install</pre>
<br />
7. Set up a test directory:<br />
<pre>cd ..</pre>
<br />
<pre>mkdir hello_node</pre>
<br />
<pre>cd hello_node</pre>
<br />
8. Make a test server file:<br />
<pre>gedit hello_node.js</pre>
<br />
9. In the file enter the following codes:<br />
<pre>var http = require(‘http’);
http.createServer(function(req,res){
res.writeHead(200,{‘Content-Type’:’text/plain’});
res.end(‘Hello this is node.js\n’);
}).listen(8000,”127.0.0.1”);
console.log(‘Server running at http://127.0.0.1:8000’);</pre>
<br />
10. Save the file and run it by typing<br />
<pre>node hello_node.js</pre>
<br />
11. Now go to the browser and type <a href="http://127.0.0.1:8000/">http://127.0.0.1:8000</a></div>
Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com1tag:blogger.com,1999:blog-7184966934413035215.post-65790814752804348392009-04-27T12:32:00.000+05:452013-11-12T15:34:37.075+05:45A Love Story<div dir="ltr" style="text-align: left;" trbidi="on">
<h1 align="center">
A Love Story </h1>
<h4>
<br /><br />This is a story of a young college girl who passed away 3 months ago in Kathmandu . Her name was Priya. She was hit by a truck.<br /><br />She was working in a call center. She had a boy friend named Shankar.<br />Both of them were true lovers. They always talked on the phone.<br />
<a name='more'></a><br />You would never found her without handphone. In fact she also changed her cell connection from Mero to Namaste mobile, so that both of them can be on the same network, and save on the balance and enjoy happy nights offer. She used to spend half of the day talking with shankar.Priya's family knew about their relationship. . Shankar was very close to Priya's family as well. (Just imagine their love) . Before she passed away she always told her friends 'If I pass away please bury me with my handphone' she also said the same thing to her parents. After her death, people cudnt carry her body, A lot of them tried to do so,but still cant. Everybody had tried to carry the body, the results were the same. Eventually, they called a person known to one of their neighbours, who can speak with the soul of dead person and who was a friend of her father. He took a stick and started speaking to himself slowly. After a few minutes, he said 'this girl misses something here.' Then her friends told that person about her intentions to burn her with her phone.<br />He then opened the grave box and place her phone and sim cards inside the casket. After that they tried to carry the body. It was then moved easily and they then carried her into the van. All of us were shocked. Priya's parents did not inform Shankar that Priya had passed away.. After 2 weeks Shankar called Priya's mom..... Shankar :.....'Aunty, I'm coming home today. Cook something nice for me.<br />Don't tell Priya that I'm coming home today, I wanna surprise her.'<br />Her mother replied..... 'You come home first, I wanna tell you something very important.' After he came, they told him the truth about Priya.Shankar thinks that they were playing a fool. He was laughing and said 'don't try to fool me - tell Priya to come out, i have a gift for her. Please stop this nonsense'. Then they show him the original death certificate to him.They gave him proof to make him believe. (Shankar started to sweat) He said... 'Its not true. We spoke yesterday.. She still calls me.<br /><br />
<br />Shankar was shaking. Suddenly, Shankar's phone rang. 'see this is from Priya, see this....' he showed the phone to priya's family. all of them told him to answer. he talked using the loudspeaker mode. All of them heard his conversation. Loud and clear, no cross lines, no humming. It is the actual voice of Priya & there is no way others could use her sim card since it is nailed inside the grave box<br />They were so shocked and asked for the same person's(who can speak with the soul of deal persons) help again. He brought his Guru to solve this matter. He & his Guru worked for 5 hours. Then they discovered one thing which really shocked them....<br />Nepal Telecom has the best coverage<br />'Where ever you go, our network follows!!!'<br /><b color="red"><br />Don't shout at me . . .. Story avai Banki hai...</b><br />
<br /><br />Shankar was sad but he continue taking with her dead girlfriend although it's hard to hear her voice clearly and he some times can hear other's voice while talking, which is like ghosts are haunting. sometimes he find very hard to contact her coz network is always bg. But he was very happy and can do any thing to listen to her beloved dead girlfriend's voice. few weeks ago he found he is not getting any calls he tries to call her but network was unreachable. so he send balance in her dead girlfriend's phone. again it didn't work.<br /><br />Finally he decide to open her girlfren's grave, and open the grave. her girlfriend's skeleton was there and the phone. he couldn't look at it. but again dare to check the phone. So sad, her girlfriend's phone has battery down due to load shading.<br />
</h4>
<br />
Source : Friends</div>
Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com1tag:blogger.com,1999:blog-7184966934413035215.post-80798902645551179272009-04-02T15:49:00.000+05:452009-04-02T15:53:57.012+05:45My Linkspannel display<br /><br />http://www.woe.onlinehome.de/projekte.htm#laufschrift<br /><br /><br /><span class="postbody">Please, look at<br /><br />http://www.technology.niagarac.on.ca/students/vkennedy/<br />There is a good implementation of a moving led <span style="color: rgb(255, 163, 79);"><b>display</b></span> using PIC uP but the principe used here may be adapted easyly to a 8051. </span>Hemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com0tag:blogger.com,1999:blog-7184966934413035215.post-82226602602189007012009-03-04T16:19:00.000+05:452009-03-04T16:21:49.873+05:45Hello WorldHi EverybodyHemhttp://www.blogger.com/profile/03986261287633770779noreply@blogger.com0