Talent without working hard is nothing.
by

The Model-View-Controller is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. Each of these components are built to handle specific development aspects of an application. MVC is one of the most frequently used industry-standard web development framework to create scalable and extensible projects.

MVC Components

 

Model

The Model component corresponds to all the data-related logic that the user works with. This can represent either the data that is being transferred between the View and Controller components or any other business logic-related data. For example, a Customer object will retrieve the customer information from the database, manipulate it and update it data back to the database or use it to render data.

View

The View component is used for all the UI logic of the application. For example, the Customer view will include all the UI components such as text boxes, dropdowns, etc. that the final user interacts with.

Controller

Controllers act as an interface between Model and View components to process all the business logic and incoming requests, manipulate data using the Model component and interact with the Views to render the final output. For example, the Customer controller will handle all the interactions and inputs from the Customer View and update the database using the Customer Model. The same controller will be used to view the Customer data.

Read more..
On
by

مشكله يصادفها الكثير من المطورين و المصممين ايضا في طول النص ان كان عنوان او مقالة .

يوجد حلول كثير , لهذه المشكلة :

يمكنك استخدام JavaScript  او JQuery  اوCSS  وحتى لغات اخرى مثل C# 

سوف نستخدم اليوم CSS  .

قم بانشاء ملف CSS جديد باسم a.css  واضف الكود التالي له : 

 

.truncate{
    display: table;
    table-layout: fixed;
    width: 100%;
    height: 250px;
    white-space: nowrap;
}
 
.truncate> * {
    display: table-cell;
    overflow: hidden;
    text-overflow: ellipsis;
}

 

 

وبنفس المجلد الذي قمت بانشاء الملف السابق فيه , قم بانشاء ملف HTML  جديد  واضف الكود التالي :

 

<!DOCTYPE html>
<html>
<head>
	<title>Rest</title>
	<link rel="stylesheet" type="text/css" href="a.css">
</head>
<body>
<div class="truncate">
    <span>
       It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
    </span>
</div>
</body>
</html>

والناتج سيكون نص مرن مع حجم المتصفح ...

 

Read more..
On
by

 اليوم سوف نتكلم على الفرق بين

 .NET Framework and .NET Core 

ماذا يجب ان تختار عندما تريد تصميم  برنامجك القادم  ؟ 

.NET Framework and .NET Core ?

في هذه المقالة سوف نقارن بعض الفروقات بين هذه المنصات .

 

.NET Ecosystem 

لنقم بمراجعة هيكلية .NET Ecosytem  .

كما تشاهد في الشكل السابق .NET Ecosystm  يملك ثلاثة مكونات رئيسة , وهي :

 .NET Framework, .NET Core, and Xamarin. 

Xamarin 

عندما تريد بناء برنامج خاص بالموبايل (iOS, Android, and Windows Mobile).

بستخدام لغة C#  ,   طبعا Xamrin  هو خيارك .

The .NET Framework 

تدعم Windows and Web applications و UWP   من اجل بناء تطبيقات على نظام ويندوز , بالاضافة إلى ASP.NET MVC  التى تمكننا من انشاء موقع الويب . على منصة >NET Framework  .

 

.NET Core

منصة مفتوحة المصدر و ايضا يمكنها العمل على اكثر من نظام تشغيل Windows, Mac, and Linux.

يمكنك بناء تطبيقات لتعمل على الانظمة السابقة , وايضا تدعم UWP  و ASP.NET Core  .فقط . 

UWP  تستخدم لبناء تطبيقات على Windows 10  . وتطبيقات  Wndows Mobile  .

 

كانت نظره سريعه على الفروقات . 

لكن ماذا نختار ؟

لكل منصه مزايها ,

.NET Framework

ستكون خيار جيد , لانك لا تريد تعلم تقنية جيده , بيئة عمل مستقره , ويمكنك انشاء تطبيقات Windows Forms or WPF

.NET Core

عندما تريد ان يكون تطبيقك يعمل على اكثر من نظام تشغيل , وتعشق منصات المصادر المفتوحة ... والطريق طويله امامك .

 

 

 

 

 

 

Read more..
On
by

You can use this adapter when your data source is a database Cursor. When using SimpleCursorAdapter, you must specify a layout to use for each row in the Cursor and which columns in the Cursor should be inserted into which views of the layout.

For example, if you want to create a list of people's names and phone numbers, you can perform a query that returns a Cursor containing a row for each person and columns for the names and numbers. You then create a string array specifying which columns from the Cursor you want in the layout for each result and an integer array specifying the corresponding views that each column should be placed −

String[] fromColumns = {ContactsContract.Data.DISPLAY_NAME,
   ContactsContract.CommonDataKinds.Phone.NUMBER};
int[] toViews = {R.id.display_name, R.id.phone_number};

When you instantiate the SimpleCursorAdapter, pass the layout to use for each result, the Cursor containing the results, and these two arrays −

SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
   R.layout.person_name_and_number, cursor, fromColumns, toViews, 0);
ListView listView = getListView();
listView.setAdapter(adapter);

The SimpleCursorAdapter then creates a view for each row in the Cursor using the provided layout by inserting each from Columns item into the corresponding toViews view.

Read more..
On
by

Android ListView is a view which groups several items and display them in vertical scrollable list.

The list items are automatically inserted to the list using an Adapter.

 that pulls content from a source such as an array or database.

An adapter actually bridges between UI components and the data source that fill data into UI Component. Adapter holds the data and send the data to adapter view, the view can takes the data from adapter view and shows the data on different views like as spinner, list view, grid view etc.

The ListView and GridView are subclasses of AdapterView and they can be populated by binding them to an Adapter, which retrieves data from an external source and creates a View that represents each data entry.

Android provides several subclasses of Adapter that are useful for retrieving different kinds of data and building views for an AdapterView ( i.e. ListView or GridView). The common adapters are ArrayAdapter,Base Adapter,CursorAdapter, SimpleCursorAdapter,SpinnerAdapter and WrapperListAdapter. We will see separate examples for both the adapters.

ArrayAdapter

You can use this adapter when your data source is an array. By default, ArrayAdapter creates a view for each array item by calling toString() on each item and placing the contents in a TextView. Consider you have an array of strings you want to display in a ListView, initialize a new ArrayAdapter using a constructor to specify the layout for each string and the string array −

ArrayAdapter adapter = new ArrayAdapter<String>(this,R.layout.ListView,StringArray);

Here are arguments for this constructor −

  • First argument this is the application context. Most of the case, keep it this.

  • Second argument will be layout defined in XML file and having TextView for each string in the array.

  • Final argument is an array of strings which will be populated in the text view.

Once you have array adapter created, then simply call setAdapter() on your ListView object as follows −

ListView listView = (ListView) findViewById(R.id.listview);
listView.setAdapter(adapter);

You will define your list view under res/layout directory in an XML file. For our example we are going to using activity_main.xml file.

Example

Following is the example which will take you through simple steps to show how to create your own Android application using ListView. Follow the following steps to modify the Android application we created in Hello World Example chapter −

 

Following is the content of the modified main activity file src/com.example.ListDisplay/ListDisplay.java. This file can include each of the fundamental life cycle methods.

package com.example.ListDisplay;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class ListDisplay extends Activity {
   // Array of strings...
   String[] mobileArray = {"Android","IPhone","WindowsMobile","Blackberry",
      "WebOS","Ubuntu","Windows7","Max OS X"};
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      ArrayAdapter adapter = new ArrayAdapter<String>(this,
         R.layout.activity_listview, mobileArray);
      ListView listView = (ListView) findViewById(R.id.mobile_list);
      listView.setAdapter(adapter);
   }
}

Following will be the content of res/layout/activity_main.xml file −

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:orientation="vertical"
   tools:context=".ListActivity" >
   <ListView
      android:id="@+id/mobile_list"
      android:layout_width="match_parent"
      android:layout_height="wrap_content" >
   </ListView>
</LinearLayout>
Following will be the content of res/values/strings.xml to define two new constants −
<?xml version="1.0" encoding="utf-8"?>
<resources>
   <string name="app_name">ListDisplay</string>
   <string name="action_settings">Settings</string>
</resources>
Following will be the content of res/layout/activity_listview.xml file −
<?xml version="1.0" encoding="utf-8"?>
<!--  Single List Item Design -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/label"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:padding="10dip"
   android:textSize="16dip"
   android:textStyle="bold" >
</TextView>

Let's try to run our modified Hello World! application we just modified. I assume you had created your AVD while doing environment set-up. To run the app from Android studio, open one of your project's activity files and click Run Eclipse Run Icon icon from the tool bar. Android studio installs the app on your AVD and starts it and if everything is fine with your set-up and application, it will display following Emulator window −

 

 

 

Read more..
On