زکات علم

زَکاةُ العِلمِ أن تُعَلِّمَهُ عِبادَ اللّه‏ِ امام باقر (ع)
زکات علم

مطالبی در زمینه کامپیوتر و علاقه مندی های شخصی من مطالب این وبلاگ غالبا مطالبی ست که در جای جای اینترنت کتاب یا دانشته های شخصی خودم می باشد که به عنوان مرجعی برای رجوع دوباره در اینجا جمع آوری شده اند .
ehsunitd.ir personal website

پیوندها

۲۹ مطلب در ارديبهشت ۱۳۹۳ ثبت شده است

درود بر همه ی دوستان سون لرنی. حتما برای شما هم پیش اومده که بخواید مثلا عنوان 5 مورد از محبوب ترین مطالب سایت وردپرسیتون رو براساس تعداد بازدید اونها نشون بدید و البته تعداد بازدید هر مطلب رو هم جلوش بنویسید. خب من هم تو این مطلب دقیقا قصد دارم بهتون یاد بدم چطور این کارو انجام بدید.

اولین چیزی که لازم داریم یه تابع هستش که تعداد بازدید مطالب رو ذخیره کنه و یه تابعی که بتونه تعداد بازدید رو نمایش بده. آقای علی محمدی قبلا در این باره مطلبی رو نوشتن و ما از مطلب ایشون برای این کار استفاده میکنم. اگر قبلا مطلبشون رو مطالعه نکردین، اینجا رو بخونید.

حالا اگر میخواید پست ها رو بر اساس تعداد بازدید اونها مرتب کنید، این کارو به راحتی با استفاده از WP_Query میتونید انجام بدید. کوئری حلقه شما میتونه چیزی شبیه این باشه:

  • ehsan gholami

اگر وبسایت وردپرسی دارید حتما با تولبار وردپرس اشنایی دیدید و احتمالا زیاد بکارتون اومده . در گوشه ی این تولبار لوگوی وردپرس قرار داره . برای خلوت تر شدن این منو و برای اینکه لوگوی وردپرس رو از تولبار سایت وردپرسی حذف کنید کافیه از تکه کد کوچکی استفاده کنید . برای این امر کافیه کد زیر رو در فایل functions.php قرار بدید :

function remove_wpLogo_from_adminBar() {
        global $wp_admin_bar;
        $wp_admin_bar->remove_menu('wp-logo');
}
add_action('wp_before_admin_bar_render', 'remove_wpLogo_from_adminBar', 0);

  • ehsan gholami

http://www.hayauni.ir/dashbord/1393/02/22/index.html:id=1454

 

بسم الله الرحمن الرحیم

امام محمد باقر علیه السلام:

چه بسا اشخاصی که از بس خوبی شان را گفتند و مدح شان نمودند، فریب خوردند [و فاسد شدند] و چه بسا افرادی که چون از عیب شان چشم پوشی شد [و مورد انتقاد قرار نگرفتند]، مغرور شدند.

بحارالانوار، چاپ بیروت، ج 75، ص 139

 

امام خمینی رضوان الله تعالی علیه:

نباید ما ها گمان کنیم که هر چه می گوییم و می کنیم, کسی را حق اشکال نیست. اشکال, بلکه تخطئه, یک هدیه الهی است برای رشد انسانها.

صحیفه نور، جلد 20 – صفحه 170

 

  • ehsan gholami

٢۵ ترفند CSS بسیار مفید که باید بدانید

دسته بندی‌ها 

CSS

در این مقاله، ٢۵ ترفند CSS بسیار مفید مطرح شده است که به شما کمک می کند صفحات وب بسیار عالی طراحی کنید. ممکن است شما برخی یا همه ی این ترفند ها را از قبل بلد باشید، با این حال، این می توانید یک مرجع دم دستی برای ترفند های جذاب CSS برای شما باشد که باید بدانید.

این مقاله، ترجمه‌ی آزاد با حذف و اضافات از مقاله‌ی زیر است:
http://webdeveloperplus.com/css/25-incredibly-useful-css-tricks-you-should-know/

١ - تغییر رنگ متن در حالت انتخاب شده

  • ehsan gholami

Write a program to multiply two matrices using thread.

  • ehsan gholami

HTML Link Syntax

The HTML code for a link is simple. It looks like this:

<a href="url">Link text</a>

The href attribute specifies the destination of a link.

Example

<a href="http://www.w3schools.com/">Visit W3Schools</a>

The example below will open the linked document in a new browser window or a new tab:

Example

<a href="http://www.w3schools.com/" target="_blank">Visit W3Schools!</a>
  • ehsan gholami

پیش از هر چیز سرور را بروز رسانی نمایید:

yum update y

port مربوط به ssh را تغییر دهید.

nano /etc/ssh/sshd_config

و عبارت

# port 22

را بصورت زیر تغییر دهید.

port 1423

فراموش نکنید این port را در csf باز کنید!

خط شامل:

Protocol 2,1

را بصورت زیر تنظیم کنید.

Protocol 2

همچنین عبارت GSSAPIAuthentication را بصورت زیر تنظیم نمایید:

GSSAPIAuthentication no

قابلیت Limit Users’ SSH Access را نیز فعال نمایید. با این کار امکان ssh با root بصورت مستقیم وجود ندارد.

ابتدا باید یک group ایجاد نمایید تا user های درون این گروه تنها دسترسی ssh داشته باشند.

groupadd developers

اضافه کردن user جدید در گروه مورد نظر:

useradd -G developers newuser

در صورتی که user قبلا ایجاد شده برای اضفه کردن به گروه خاص از دستور زیر استفاده نمایید:

usermod -a -G developers newuser

در فایل sshd_config در انتهای کد ها باید به group خود اجازه دسترسی ssh را وارد نمایید:

AllowGroups developers

در ادامه باید به user نیز این اجازه را بدهید:

AllowUsers  newuser

در انتها برای جلوگیری از ورود مستقیم با root خط :

PermitRootLogin yes

را بصورت زیر تنظیم نمایید:

PermitRootLogin no

توجه داشته باشید با این تغییر امکان ssh با root وجود نخواهد داشت.

در پایان سرویس sshd را restart نمایید.

service sshd restart
  • ehsan gholami

دو خطای رایج:

404 – Page Not Found :

این پیام خطا زمانی رخ می دهد که صفحه ای که درخواست شده بر روی سرور وجود ندارد. ممکن است به علت اشتباه تایپی این مشکل بوجود آید.

500 – Internal Server Error :

این پیغام خطا زمانی اتفاق می افتد که سرور نتواند یک اسکریپت در حال اجرا را پردازش نماید. این پیام خطا به طور معمول شامل اطلاعات مربوط به خطا در اجرای اسکریپت می شود.

سایر خطاها:

4xx – Client Error :

  • ehsan gholami
/* The ' N - Queens ' / Eight Queens Problem :
Here are my solutions to the N-Queens / 8 queens Problem . There are three solutions here .
1. A solution by simple Backtracking / Recursion . (The only array used in this solution is a 1-d array)
2. A solution to the N-Queens / Eight Queens Problem WITHOUT RECURSION . (Using Stacks )
3. Another recursive function with better ( but vague ) heuristics .
The heuristic was completely my own (as far as I know ) , but a bit arbitrary to some extent .
Anyway , I was glad to see that it produced results pretty quickly uptil N = 70 or so .
( That's on a AMD K-6 Machine with 128 MB Ram. )

IMPORTANT , PLEASE READ ::::
  • ehsan gholami

As an administrator of your own wiki, to edit your own MediaWiki:Sidebar, replace your wiki page's <title> in the title bar with <MediaWiki:Sidebar>. (The editinterface permission needs to be enabled and is enabled for administrators by default; for information on assigning it to other groups, see Manual:User rights.) You may need to use the syntax//yourdomain/yourwiki/index.php?title=MediaWiki:Sidebar&action=edit if you use long URLs.

If you are sure you are logged in with the relevant rights but do not see the edit link, click on the create tab at the top of the page - this will take you to the edit page.

Example sidebar code:

Sidebar example

* navigation
** mainpage|mainpage
** Special:RecentChanges|Recent changes
* new heading
** portal-url|portal
** http://www.mediawiki.org|MediaWiki home

Headings

The navigation bar can be split into sections, each with a heading of its own. The heading for each section is taken from the first-level list element ("navigation" and "new heading" in the example above).

If this text corresponds to the name of an interface message (an existing page of that title in the MediaWiki namespace), then the text of that page is used as a label; otherwise, the header title is used as-is.

Bug: no sidebar is shown in the Nostalgia skin (bug 10794).

Links

Second-level list elements are links ("mainpage|mainpage" in the example above), where the format is:

** target|link text
target
The link target can be the name of an interface message (page in the MediaWiki namespace) or wiki page, or an external link. In either case, the link can be internal, interwiki, or external. In some cases (such as links with the "&" character), an interface message is necessary. The link target cannot be made dependent on the interface language set in the preferences.

Algorithm followed:

  1. Get the target text.
  2. If there is an existing or default interface message with that name, use the content of that message instead of the target text.
  3. If the output from the previous step is a valid URL (beginning with http:// or other URL protocol), the link will point to that URL.
  4. Else, it will treat it as the link target of a wikilink (linking to that page name or interwiki).
  5. In case it would end up linking to '-', the whole entry is removed from the sidebar (that's useful for removing an entry on all languages by changing the message holding the link).

Examples:

  • "** portal-url|portal" uses the text of MediaWiki:Portal-url (which contains "Project:Community portal").
  • "** Special:RecentChanges|Recent changes" links to Special:RecentChanges, since there is no interface message of that name.
  • "** w:Foo|Some interwiki page" links to w:Foo for the same reason.
  • "** http://www.mediawiki.org|MediaWiki home" links to http://www.mediawiki.org for the same reason.

text

The link text can be the name of an interface message (page in the MediaWiki namespace) or plain text.

  • If the link text is the name of an existing or default interface message, the content of that message will be used. MediaWiki will check for localized versions; for example, if the current language is fr (French) and the link text is the interface message "forum", it will check for "forum/fr" before using "forum".
  • Otherwise, the link text is used as the target as-is.
  • Notice that the link text is not optional as in normal wiki links. If the link text is missing, the item is ignored.

Examples:

  • ** Homepage|mainpage uses MediaWiki:Mainpage (which contains "MediaWiki").
  • ** Special:Recentchanges|Recent changes uses "Recent changes", since there is no interface message of that name.

Order of elements

By default, the sidebar consists of elements in this order: navigation, search, toolbox, languages. The order can be changed (in MediaWiki 1.13+) by adding special keywords (SEARCH, TOOLBOX and LANGUAGES) to MediaWiki:Sidebar using the heading syntax. For example, the following code moves the search box to the top of the sidebar:

* SEARCH

* navigation
** mainpage|mainpage
** Special:Recentchanges|Recent changed
* new heading
** portal-url|portal
** http://www.mediawiki.org|MediaWiki home
  • ehsan gholami