Senin, 29 Februari 2016

AX : Get Date in AX

 _dt = systemDateGet();
  _tgl = dayOfMth(_dt);
  _bln = mthOfYr(_dt);
  _thn = year(_dt);

Kamis, 25 Februari 2016

Configuration Best Practices for SQL Server Tempdb–Initial Sizing ( copied)

his second part of a three-part article consolidating a number of best practices for configuring SQL Server tempdb focuses on initial sizing and autogrowth for tempdb. You won’t just find prescriptive rules here, but also the background to the recommendations and guidance on how to choose the best configuration for any particular environment. In particular this section covers the following:
Initial sizing and autogrowth of tempdb
A default installation of any SQL Server edition will create a tempdb database with an 8MB data file and a 1MB transaction log file. For a lot of SQL Server installations these file sizes won’t be enough, but they are configured to autogrow by 10% as needed. You can see the properties window for tempdb on a default installation of SQL Server 2012 Developer Edition in Figure 1.
C 08f 016
Figure 1.

Query: Penyebab Besarnya TempDB SQL Server

These operations heavily use tempdb:
  • Repeated create and drop of temporary tables (local or global).
  • Table variables that use tempdb for storage purposes.
  • Work tables associated with CURSORS.
  • Work tables associated with an ORDER BY clause.
  • Work tables associated with an GROUP BY clause.
  • Work files associated with HASH PLANS.
Heavy and significant use of these activities may lead to the contention problems.

Query untuk mengurangi :



use tempdb
go
dbcc DROPCLEANBUFFERS
dbcc FREEPROCCACHE
dbcc FREESYSTEMCACHE('ALL');
dbcc FREESESSIONCACHE;
go
dbcc SHRINKFILE(TEMPDEV,20480);
go
 

Letak Folder Tempdb


C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA

Kamis, 18 Februari 2016

Teknik Blok Data di OFFICE

CARA MEMBLOK DATA
1. Memblok data artinya menandai/memilih sekumpulan data untuk tujuan :
2. Mengcopy sekumpulan data.
3. Memindah sekumpulan data.
4. Menghapus sekumpulan data.
5. Memformat sekumpulan data.
6. Memformat data ( tebal, miring, dan lain-lain 0.
7. Menyisip atau menghapus beberapa kolom sekaligus.
8. Menyisip atau menghapus beberapa baris sekaligus.
9. Menyisip atau menghapus beberapa cell sekaligus.
10. Dan lain-lain……

INSTRUKSI- INSTRUKSI BLOK
Dengan mouse
Klik batang kolom ( Clumn Headers) : Memblok 1 kolom Klik batang baris (Row Headers ) : Memblok 1 baris Klik + seret mouse (drag) : Memblok sekumpulan data (range) Ctrl + klik atau seret : Memblok beberapa range
 

Kamis, 04 Februari 2016

JEASYUI : Jeasyui Modal Form ( ketika buka form yang lain disabled )

     <div id="dlgadepo" class="easyui-dialog" style="width:380px;height:auto;padding:10px 20px"
            closed="true" buttons="#dlgadepo-buttons" data-options="modal:true,iconCls:'icon-save',resizable:true,closable:false">
        <div class="ftitle">Data Depo</div>
        <form id="fmadepo" method="post"  novalidate>


             <div class="fitem">
                <label>KD_Depo</label>
                <input name="KD_Depo" id="KD_Depo"  style="width:200px;" class="easyui-validatebox" required="true">
            </div>
            <div class="fitem">
                <label>Nama_Depo</label>
                <input name="Nama_Depo" id="Nama_Depo"  style="width:200px;" class="easyui-validatebox" required="true">
            </div>
       
            <div class="fitem">
                <label>Alamat</label>
                <input name="Alamat" id="Alamat"  style="width:200px;">
            </div>
            <div class="fitem">
                <label>IsAktif</label>
                <input name="IsAktif" id="IsAktif"  type="checkbox" value="1">
            </div>
       
       
       
        </form>
    </div>
    <div id="dlgadepo-buttons">
    <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveEmpDe()">Save</a>
        <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="
        $.messager.confirm('Confirm', 'Closed without saved?', function(r){
    if (r){
        javascript:$('#dlgadepo').dialog('close')
    }
});
        ">Cancel</a>
    </div>

JEASYUI : menambahkan alert sukses dan error ketika delete data

Function Delete
function DELETEDatacty(){
            var row = $('#resultcustype').datagrid('getSelected');
            if (row){
                row.menumm="<?=$menunameid;?>";
                $.messager.confirm('Confirm','Are you sure you want to remove this data?',function(r){
                    if (r){
                        $.post('<?=site_url() ?>/masterp/hapuscty',{ID:row.CustType_ID,menunameid:row.menumm},function(resultcustype){
                            if (resultcustype.success){

                                $.messager.show({    // show error message
                                    title: 'Success',
                                        //msg: result.errorMsg
                                    msg: resultcustype.success
                                });
                                $('#resultcustype').datagrid('reload');    // reload the user data
                            } else {
                                $.messager.show({    // show error message
                                    title: 'Error',
                                        //msg: result.errorMsg
                                    msg: resultcustype.errorMsg
                                });
                            }
                        },'json');
                    }
                });
            }
        }

Model
function hapuskitcty()
    {
       
        $id = $_REQUEST['ID'];
        $menunameida = $_REQUEST['menunameid'];

if ($this->db->simple_query("DELETE FROM tb_m_custtype WHERE CustType_ID='" . $id . "'"))
{
       $username = $this->session->userdata('username');
  $actionlogg='DELETE';
$ambilget=$id;
$menunameid=$menunameida;
$petunjuk='C';


$this->load->model('san');
$this->san->updatelogz($username,$ambilget,$actionlogg,$menunameid,$petunjuk);

            return json_encode(array('success' => 'Done'));
}
else
{

     $result = array('errorMsg' =>'Data tidak dapat dihapus karena telah bereleasi dengan tabel lain');
        return json_encode($result);
}
          

    }