2013의 게시물 표시

[MVC]enum type을 DropDownList 로

이미지
[MVC]enum type을 DropDownList 로


publicclassEnumHelper { publicstaticIEnumerable<SelectListItem> ToSelectList(Enum enumValue) { List<SelectListItem> items =newList<SelectListItem>(); items.Add(newSelectListItem() { Selected =true, Text ="--전체--", Value ="" }); var slt = (fromEnum e inEnum.GetValues(enumValue.GetType())  selectnewSelectListItem { Selected =false, Text = e.ToString(), Value = e.ToString() }).ToList(); items.AddRange(slt); return items.AsEnumerable(); } }

@functions{enumtestEnum { a , b , c , d  }        }@Html.DropDownList("drpTest", EnumHelper.ToSelectList(testEnum.a))




오늘의 뉴스

이미지
오늘의 뉴스

현재는 Daum 뉴스 RSS 를 가져와서 해당 기사를 카테고리별로 기사 목록을 보여 줍니다. (Google 뉴스도 나중에 추가 할까 생각중....)
너무 간단한 앱이라 스샷만 준비했습니다.







마켓 URL :  https://play.google.com/store/apps/details?id=com.xwing.util.todaynewsreader
감사합니다.

[C#-MVC] JSONAttribute

C# - JSON Result


publicclassJSONAttribute : ActionFilterAttribute {     publicoverridevoid OnActionExecuted(ActionExecutedContext filterContext)     {         var result = newJsonResult();         result.Data = ((ViewResult)filterContext.Result).Model;         result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;         filterContext.Result = result;     } }//TEST[JSON] publicActionResult GetJson() {      var data = new { x = 10, b = 20, c = 20 };      return View(data); }//Result{"x":10,"b":20,"c":20}

Google Drive Sample Code

Google Drive Sample Code
구글 개발자 페이지 


package com.example.googledrivesample;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Locale;

import android.accounts.AccountManager;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.widget.Toast;

import com.google.api.client.extensions.android.http.AndroidHttp;
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;
import com.google.api.client.http.FileContent;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.drive.Drive;
import com.google.api.services.drive.DriveScopes;
import com.google.api.services.drive.model.File;

public class MainActivity extends Activit…

android cache 사용하기

android cache 사용하기
---------------------------------------------------



import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;

import android.content.Context;
public class CacheStorage {
private static String _cacheFileName = "cache";
private static Context Ctx;

public CacheStorage(Context ctx, String cacheFileName){
if(cacheFileName != null && cacheFileName.length() > 0)
_cacheFileName = cacheFileName;
}

public void setCacheFile(String data) throws IOException{
setCacheFile( _cacheFileName, data);
}

public void setCacheFile(String cacheFileName, String data) throws IOException{

if(cacheFileName == null || cacheFileName.length() < 1) cacheFileName = _cacheFileName;

try {
File cacheDir = Ctx.getCacheDir();
        File cacheFile = new File(cacheDir.getAbsolutePath(), cacheFileName);
        FileOutputStream fos;

fos =…

[java] RSS-뉴스 읽기

다음 뉴스 RSS [ http://media.daum.net/rss/today/primary/all/rss2.xml ]

--------[ source code ]-------------
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;


public class GetRSS {

/**
* @param args
*/
public static void main(String[] args) {
String rssUrl = "http://media.daum.net/rss/today/primary/all/rss2.xml";

try {
parseXml(rssUrl);
} catch (Exception e) {
e.printStackTrace();
}
}



private static void parseXml(String _url) throws Exception{
System.out.println("parse XML");

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(_url);

doc.getDocumentElement().normalize();

NodeList itemNodeList = doc.getElementsByTagName("item");

System.out.println("count :"  + itemNodeList.getLength());
for(int i =0; i < itemNodeList.getLength(); i++…

[java] xml파싱하기

private static void parseXml(String _url) throws Exception{
        System.out.println("parse XML");

        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(_url);

        doc.getDocumentElement().normalize();

        NodeList itemNodeList = doc.getElementsByTagName("item");

        System.out.println("count :"  + itemNodeList.getLength());
        for(int i =0; i < itemNodeList.getLength(); i++){
            Node itemNode = itemNodeList.item(i);

            if(itemNode.getNodeType() == Node.ELEMENT_NODE){
                Element itemElement = (Element)itemNode;

                NodeList titleNodeList = itemElement.getElementsByTagName("title"); 
                Element titleElement = (Element)titleNodeList.item(0); 
                NodeList childTitleNodeList = titleElement.getChildNodes(); 
                System.out.printf("[title : %s]\n"…

가계부 for iPhone

이미지
가계부 for iPhone


android 가계부(가계부2) 에 이어서 iPhone  용 가계부를 publish 했습니다.

https://itunes.apple.com/app/365gagyebu/id593876069?mt=8