Posts

Android - Pass Parameter to the other activity

Use "intent.putExtra()" to pass the parameter to the next activity. Example: EditText _search_text = (EditText) findViewById(R.id.editTextSearchText);             Intent _intent = new Intent(this, SearchResult.class); _intent.putExtra("search", _search_text.getText().toString().trim()); startActivity(_intent); this.finish(); And on the "onCreate()" function of the receive activity, receive parameter by: Example: String _search_text; Bundle extras = getIntent().getExtras(); if (extras != null) {      _search_text = extras.getString("search"); }

Android - onKeyListener

EditText _search_text = (EditText) findViewById(R.id.editTextSearchText); _search_text Text . setOnKeyListener ( new OnKeyListener () { public boolean onKey ( View v , int keyCode , KeyEvent event ) { if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: this.goToSearchResultPage(); return true; default: break; } } return false; } });

HTML - jquery datepicker wiht .NET

<asp:TextBox ID="TextBoxCloseDate" runat="server" CssClass="textEntry"></asp:TextBox> <script type="text/javascript">      $(document).ready(function () {            $("#<%=TextBoxCloseDate.ClientID %>").datepicker({                   dateFormat: 'dd-mm-yy',                   changeMonth: true,                   changeYear: true,                   showOn: 'button',                   buttonImageOnly: true,            ...

PHP - Set GET/POST Encoding

#This example is convert UTF-8 Unicode to Thai Unicode #GET $input =iconv("UTF-8","TIS-620",$_REQUEST['input_text']);

C# - Entity Framework - GROUP BY/ORDER BY/SELECT WHERE IN

var _inner_query = this.g_db_entity.ACTIVITIES                 .Where(w => (DateTime.Today <= w.ACTIVITY_DATE_TO))                 .GroupBy(g => g.ACTIVITY_DATE_FROM)                 .OrderBy(o => o.Key)                 .Select(s => s.Key)                 .Skip((pageNo - 1) * this.g_page_size)                 .Take(this.g_page_size); LIST<ACTIVITIES> _entity_activity = this.g_db_entity.ACTIVITIES                  .Where(m => _inner_q...

C# - Binary PDF File on Web Broswer via Binary Stream

Your binary PDF File was saved in MSSQL2008 in image data type. Byte[] _binary_document;// you get your binary data from database and assign to this parameter. //Result of binary stream Response.ContentType = "Application/pdf"; Response.AppendHeader("Content-Length", _binary_document.Length.ToString()); Response.BinaryWrite(_binary_document);

C# - Image to Byte Array and vise versa

System.Drawing.Image img = System.Drawing.Image . FromFile ( @"C:\Lenna.jpg" ); byte[] _byte_array = imageToByteArray(img, "jpg");     ------------------------------------------------------   public byte [] imageToByteArray(System.Drawing.Image imageIn , String imageFileType ) {    MemoryStream ms = new MemoryStream();    switch(imageFileType.ToLower()) {   case "gif": imageIn.Save(ms,System.Drawing.Imaging.ImageFormat.Gif); break; case "jpg": case "jpeg":   imageIn . Save ( ms , System . Drawing . Imaging . ImageFormat . Jpeg ); break; }   return ms.ToArray(); }   ------------------------------------------------------   public Image byteArrayToImage( byte [] byteArrayIn) { MemoryStream ms = new MemoryStream(byteArrayIn); Image returnImage = Image.FromStream(ms); return returnImage; }     web reference: http://www.codep...