RadioButtonResetAll(sMRNO);
function RadioButtonResetAll(rbDefaultValue) {
var RBID = '<%=rbMRNO.ClientID %>';
var RB1 = document.getElementById(RBID);
var radio = RB1.getElementsByTagName("input");
for (var i = 0; i < radio.length; i++) {
if (radio[i].value == rbDefaultValue) {
radio[i].checked = true;
}
}
<asp:RadioButtonList ID="rbMRNO" runat="server" Width="174px" RepeatDirection="Horizontal" >
<asp:ListItem Value="true">yes</asp:ListItem>
<asp:ListItem Selected="True" Value="false">no</asp:ListItem>
</asp:RadioButtonList>
2015년 10월 30일 금요일
column hide for BoundField
.hiddencol
{
display:none;
}
<asp:BoundField DataField="AUART" SortExpression="AUART" HeaderText="order" ItemStyle-CssClass="hiddencol" HeaderStyle-CssClass="hiddencol">
{
display:none;
}
<asp:BoundField DataField="AUART" SortExpression="AUART" HeaderText="order" ItemStyle-CssClass="hiddencol" HeaderStyle-CssClass="hiddencol">
2015년 10월 29일 목요일
RegisterPostBackControl add & file download for dynamic LinkButton
asp.net
<asp:TemplateField HeaderText="name">
<ItemTemplate><asp:LinkButton ID="lbFildDW" CommandArgument='<%# Bind("DOCBIGO") %>' runat="server" Text='<%# Bind("DOCNAME") %>' OnClick="ExcelDW_Click"></asp:LinkButton> </ItemTemplate>
<itemstyle horizontalalign="Center" Wrap="false"/> <headerstyle Wrap="false"/>
</asp:TemplateField>
c#
protected void egvPopDDSearch_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lnkbtnDetail = (LinkButton)e.Row.FindControl("lbFildDW");
ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkbtnDetail);
}
}
protected void ExcelDW_Click(object sender, EventArgs e)
{
LinkButton btn = (LinkButton)(sender);
string filePath = btn.CommandArgument;
if (File.Exists(HttpContext.Current.Server.MapPath(filePath)))
{
string strFileName = "";
strFileName = System.IO.Path.GetFileName(HttpContext.Current.Server.MapPath(filePath));
strFileName = HttpUtility.UrlEncode(strFileName, new UTF8Encoding()).Replace("+", "%20");
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileName);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.WriteFile(HttpContext.Current.Server.MapPath(filePath));
HttpContext.Current.Response.End();
}
}
<asp:TemplateField HeaderText="name">
<ItemTemplate><asp:LinkButton ID="lbFildDW" CommandArgument='<%# Bind("DOCBIGO") %>' runat="server" Text='<%# Bind("DOCNAME") %>' OnClick="ExcelDW_Click"></asp:LinkButton> </ItemTemplate>
<itemstyle horizontalalign="Center" Wrap="false"/> <headerstyle Wrap="false"/>
</asp:TemplateField>
c#
protected void egvPopDDSearch_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lnkbtnDetail = (LinkButton)e.Row.FindControl("lbFildDW");
ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkbtnDetail);
}
}
protected void ExcelDW_Click(object sender, EventArgs e)
{
LinkButton btn = (LinkButton)(sender);
string filePath = btn.CommandArgument;
if (File.Exists(HttpContext.Current.Server.MapPath(filePath)))
{
string strFileName = "";
strFileName = System.IO.Path.GetFileName(HttpContext.Current.Server.MapPath(filePath));
strFileName = HttpUtility.UrlEncode(strFileName, new UTF8Encoding()).Replace("+", "%20");
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileName);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.WriteFile(HttpContext.Current.Server.MapPath(filePath));
HttpContext.Current.Response.End();
}
}
2015년 10월 28일 수요일
row number add with group by result
SELECT ROW_NUMBER() OVER (ORDER BY NAME DESC) SEQ, NAME FROM TABLE GROUP BY NAME
2015년 10월 26일 월요일
debug for javascript
for crome ( 45.17.2454.18 )
tool : visual studio 2012
function getReturnValue(returnValue) {
debugger; // this
var obj = JSON.parse(returnValue);
var oAUFNR = $('<%= txtAUFNR.ClientID %>');
oAUFNR.value = obj.AUFNR;
}
crome -> tools... -> developer tools
tool : visual studio 2012
function getReturnValue(returnValue) {
debugger; // this
var obj = JSON.parse(returnValue);
var oAUFNR = $('<%= txtAUFNR.ClientID %>');
oAUFNR.value = obj.AUFNR;
}
crome -> tools... -> developer tools
Call Server side method from JavaScript in ASP.NET
http://www.morgantechspace.com/2014/01/Call-Server-Side-function-from-JavaScript-in-ASP-NET.html#ByJQueryajaxWithParameters
javascript for json
https://github.com/douglascrockford/JSON-js
<script type="text/javascript" src="../Resources/Scripts/json2.js"></script>
<script type="text/javascript">
function getReturnValue(returnValue) {
var obj = JSON.parse(returnValue);
var oAUFNR = $('<%= txtAUFNR.ClientID %>');
oAUFNR.value = obj.AUFNR;
}
</script>
<script type="text/javascript" src="../Resources/Scripts/json2.js"></script>
<script type="text/javascript">
function getReturnValue(returnValue) {
var obj = JSON.parse(returnValue);
var oAUFNR = $('<%= txtAUFNR.ClientID %>');
oAUFNR.value = obj.AUFNR;
}
</script>
2015년 10월 15일 목요일
SAP Connector with ASP.NET
requirement
NCo3016_Net20_x86.msi
add reference ( C:\Program Files (x86)\SAP\SAP_DotNetConnector3_Net20_x86 )
sapnco.dll, sapnco_utils.dll
source code for c# with asp.net
DataSet ds = new DataSet("T_DATA");
try
{
RfcDestination rfcDestination = null;
IDestinationConfiguration destinationConfig = null;
string destinationName = "SAP.LogonControl.1";
destinationConfig = new SAPDestinationConfig();
destinationConfig.GetParameters(destinationName);
if (RfcDestinationManager.TryGetDestination(destinationName) == null)
{
RfcDestinationManager.RegisterDestinationConfiguration(destinationConfig);
rfcDestination = RfcDestinationManager.GetDestination(destinationName);
if (rfcDestination != null)
{
rfcDestination.Ping();
}
RfcRepository rfcRepository = rfcDestination.Repository;
IRfcFunction rfcFunction = rfcRepository.CreateFunction("Z_XXXXX_ORDER");
rfcFunction.SetValue("I_AXXXX", sWO);
rfcFunction.Invoke(rfcDestination);
ds.Tables.Add(ConvertToDotNetTable(rfcFunction.GetTable("T_DATA")));
RfcDestinationManager.UnregisterDestinationConfiguration(destinationConfig);
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return ds;
NCo3016_Net20_x86.msi
add reference ( C:\Program Files (x86)\SAP\SAP_DotNetConnector3_Net20_x86 )
sapnco.dll, sapnco_utils.dll
source code for c# with asp.net
DataSet ds = new DataSet("T_DATA");
try
{
RfcDestination rfcDestination = null;
IDestinationConfiguration destinationConfig = null;
string destinationName = "SAP.LogonControl.1";
destinationConfig = new SAPDestinationConfig();
destinationConfig.GetParameters(destinationName);
if (RfcDestinationManager.TryGetDestination(destinationName) == null)
{
RfcDestinationManager.RegisterDestinationConfiguration(destinationConfig);
rfcDestination = RfcDestinationManager.GetDestination(destinationName);
if (rfcDestination != null)
{
rfcDestination.Ping();
}
RfcRepository rfcRepository = rfcDestination.Repository;
IRfcFunction rfcFunction = rfcRepository.CreateFunction("Z_XXXXX_ORDER");
rfcFunction.SetValue("I_AXXXX", sWO);
rfcFunction.Invoke(rfcDestination);
ds.Tables.Add(ConvertToDotNetTable(rfcFunction.GetTable("T_DATA")));
RfcDestinationManager.UnregisterDestinationConfiguration(destinationConfig);
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return ds;
2015년 10월 13일 화요일
dual nic setup for centos
## WAN
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=118.x.x.x
NETMASK=255.0.0.0
GATEWAY=118.x.x.x
DNS1=8.8.8.8
DNS2=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=x:x:x:x:x
NM_CONTROLLED=no
USERCTL=no
## NAT
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.x
NETMASK=255.255.255.0
#GATEWAY=192.168.0.1 # this point
DNS1=8.8.8.8
DNS2=8.8.4.4
DEFROUTE=no # this point
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth1"
HWADDR=x:x:x:x:x
NM_CONTROLLED="no"
USERCTL=no
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=118.x.x.x
NETMASK=255.0.0.0
GATEWAY=118.x.x.x
DNS1=8.8.8.8
DNS2=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=x:x:x:x:x
NM_CONTROLLED=no
USERCTL=no
## NAT
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.x
NETMASK=255.255.255.0
#GATEWAY=192.168.0.1 # this point
DNS1=8.8.8.8
DNS2=8.8.4.4
DEFROUTE=no # this point
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth1"
HWADDR=x:x:x:x:x
NM_CONTROLLED="no"
USERCTL=no
2015년 10월 12일 월요일
sdf file disable
tool >> option >> txt editor >> c/c++ >> advanced >> Always Use Fallback Location >> True
abbreviation
ADAS, Advanced Driver Assistance System
ADPCM, Adaptive Differential Pulse Code Modulation
IMU, Inertial Measurement Unit
FPGA, Field Programmable Gate Arrays
BSP, Board Support Package
EDID, Extended display identification data
HDMI, High Definition Multimedia Interface
DVFS, Dynamic Voltage Frequency Scaling
HDMI, High Definition Multimedia Interface
DVFS, Dynamic Voltage Frequency Scaling
2015년 10월 11일 일요일
mp4 save with ffmpeg
ip cam -> raw data(encoded) -> mp4 save
AVCodec *ce;
AVFormatContext *fc;
AVOutputFormat *of;
AVCodecContext *pcc;
AVStream *pst;
int vi;
AVPacket pkt;
BOOL CCodec_Encoder_h264::FileInit(char *fname, int nWidth, int nHeight)
{
av_register_all();
avcodec_register_all();
of = av_guess_format(0, fname, 0);
fc = avformat_alloc_context();
fc->oformat = of;
strcpy(fc->filename, fname);
pst = avformat_new_stream(fc, 0);
vi = pst->index;
ce = avcodec_find_decoder(CODEC_ID_H264);
pcc = pst->codec;
avcodec_get_context_defaults3(pcc, ce);
pcc->codec_type = AVMEDIA_TYPE_VIDEO;
pcc->codec_id = CODEC_ID_H264;
pcc->profile= FF_PROFILE_H264_BASELINE;
pcc->bit_rate = 1280 * 960 * 2;
pcc->width = nWidth;
pcc->height = nHeight;
pcc->time_base.num = 1;
pcc->time_base.den = 30;
pcc->qcompress = 0.6;
pcc->qmin = 0;
pcc->qmax = 9;
pcc->pix_fmt = PIX_FMT_YUV420P;
pcc->gop_size = 150;
if ( !( fc->oformat->flags & AVFMT_NOFILE ) )
avio_open( &fc->pb, fc->filename, AVIO_FLAG_WRITE );
avformat_write_header(fc, NULL);
m_nFrmCnt = 0;
waitkey = 1;
return TRUE;
}
BOOL CCodec_Encoder_h264::FileAppend(BYTE *pData, int nSize, , DWORD key)
{
AVPacket pkt;
av_init_packet(&pkt);
//pkt.flags |= (0 >= getVopType(pData, nSize )) ? AV_PKT_FLAG_KEY : 0;
pkt.flags |= key;
//pkt.stream_index = m_nFrmCnt++;
pkt.data = (uint8_t*)pData;
pkt.size = nSize;
if ( waitkey )
if ( 0 == ( pkt.flags & AV_PKT_FLAG_KEY ) )
return TRUE;
else
waitkey = 0;
av_write_frame(fc, &pkt);
return TRUE;
}
BOOL CCodec_Encoder_h264::FileClose()
{
av_write_trailer(fc);
if ( fc->oformat && !( fc->oformat->flags & AVFMT_NOFILE ) && fc->pb )
avio_close( fc->pb );
av_free(fc);
return TRUE;
}
AVCodec *ce;
AVFormatContext *fc;
AVOutputFormat *of;
AVCodecContext *pcc;
AVStream *pst;
int vi;
AVPacket pkt;
BOOL CCodec_Encoder_h264::FileInit(char *fname, int nWidth, int nHeight)
{
av_register_all();
avcodec_register_all();
of = av_guess_format(0, fname, 0);
fc = avformat_alloc_context();
fc->oformat = of;
strcpy(fc->filename, fname);
pst = avformat_new_stream(fc, 0);
vi = pst->index;
ce = avcodec_find_decoder(CODEC_ID_H264);
pcc = pst->codec;
avcodec_get_context_defaults3(pcc, ce);
pcc->codec_type = AVMEDIA_TYPE_VIDEO;
pcc->codec_id = CODEC_ID_H264;
pcc->profile= FF_PROFILE_H264_BASELINE;
pcc->bit_rate = 1280 * 960 * 2;
pcc->width = nWidth;
pcc->height = nHeight;
pcc->time_base.num = 1;
pcc->time_base.den = 30;
pcc->qcompress = 0.6;
pcc->qmin = 0;
pcc->qmax = 9;
pcc->pix_fmt = PIX_FMT_YUV420P;
pcc->gop_size = 150;
if ( !( fc->oformat->flags & AVFMT_NOFILE ) )
avio_open( &fc->pb, fc->filename, AVIO_FLAG_WRITE );
avformat_write_header(fc, NULL);
m_nFrmCnt = 0;
waitkey = 1;
return TRUE;
}
BOOL CCodec_Encoder_h264::FileAppend(BYTE *pData, int nSize, , DWORD key)
{
AVPacket pkt;
av_init_packet(&pkt);
//pkt.flags |= (0 >= getVopType(pData, nSize )) ? AV_PKT_FLAG_KEY : 0;
pkt.flags |= key;
//pkt.stream_index = m_nFrmCnt++;
pkt.data = (uint8_t*)pData;
pkt.size = nSize;
if ( waitkey )
if ( 0 == ( pkt.flags & AV_PKT_FLAG_KEY ) )
return TRUE;
else
waitkey = 0;
av_write_frame(fc, &pkt);
return TRUE;
}
BOOL CCodec_Encoder_h264::FileClose()
{
av_write_trailer(fc);
if ( fc->oformat && !( fc->oformat->flags & AVFMT_NOFILE ) && fc->pb )
avio_close( fc->pb );
av_free(fc);
return TRUE;
}
c# Struct Marshal for c++ dll
c++
typedef struct
{
HANDLE aaa;
HWND bbb;
BYTE ccc[2500];
} SStruct, LPSCStruct;
BOOL __stdcall func1(LPSCStruct zzz);
c#
public struct LPSCStruct
{
public int aaa;
public IntPtr bbb;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2500)]
public byte[] ccc;
}
public partial class Form1 : Form /*, IMessageFilter*/
{
[DllImport("test.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto, SetLastError = true)]
[return: MarshalAs(UnmanagedType.I1)]
unsafe extern public static bool func1(IntPtr zzz);
public LPSCStruct sss;
public LPSCStruct rrr;
public IntPtr m_lpstruct;
private void Form1_Load(object sender, EventArgs e)
{
sss = new LPSCStruct();
}
private IntPtr MarshalToPointer(object data)
{
IntPtr buf = Marshal.AllocHGlobal(Marshal.SizeOf(pse));
Marshal.StructureToPtr(data, buf, false);
return buf;
}
private object MarshalToStruct(IntPtr buf, Type t)
{
return Marshal.PtrToStructure(buf, t);
}
private void button1_Click(object sender, EventArgs e)
{
sss.bbb = FindWindow(null, "Form1");
m_lpstruct = MarshalToPointer(sss);
bool bRtn = func1(m_lpstruct);
if (bRtn)
{
rrr = (LPSCStruct)MarshalToStruct(m_lpstruct, typeof(LPSCStruct));
textBox1.AppendText(Encoding.Default.GetString(rrr.ccc));
}
}
typedef struct
{
HANDLE aaa;
HWND bbb;
BYTE ccc[2500];
} SStruct, LPSCStruct;
BOOL __stdcall func1(LPSCStruct zzz);
c#
public struct LPSCStruct
{
public int aaa;
public IntPtr bbb;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2500)]
public byte[] ccc;
}
public partial class Form1 : Form /*, IMessageFilter*/
{
[DllImport("test.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto, SetLastError = true)]
[return: MarshalAs(UnmanagedType.I1)]
unsafe extern public static bool func1(IntPtr zzz);
public LPSCStruct sss;
public LPSCStruct rrr;
public IntPtr m_lpstruct;
private void Form1_Load(object sender, EventArgs e)
{
sss = new LPSCStruct();
}
private IntPtr MarshalToPointer(object data)
{
IntPtr buf = Marshal.AllocHGlobal(Marshal.SizeOf(pse));
Marshal.StructureToPtr(data, buf, false);
return buf;
}
private object MarshalToStruct(IntPtr buf, Type t)
{
return Marshal.PtrToStructure(buf, t);
}
private void button1_Click(object sender, EventArgs e)
{
sss.bbb = FindWindow(null, "Form1");
m_lpstruct = MarshalToPointer(sss);
bool bRtn = func1(m_lpstruct);
if (bRtn)
{
rrr = (LPSCStruct)MarshalToStruct(m_lpstruct, typeof(LPSCStruct));
textBox1.AppendText(Encoding.Default.GetString(rrr.ccc));
}
}
2015년 10월 3일 토요일
2015년 10월 1일 목요일
redirect with post data
public void RedirectWithData(NameValueCollection data, string url)
{
Response.Clear();
Response.Buffer = true;
StringBuilder s = new StringBuilder();
s.Append("<html>");
s.Append("<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head>");
s.AppendFormat("<body onload='document.forms[0].submit()'>");
s.AppendFormat("<form name='form' action='{0}' method='POST'>", url);
foreach (string key in data)
{
s.AppendFormat("<input type='hidden' name='{0}' value='{1}' />", key, data[key].Trim());
}
s.Append("</form></body></html>");
Response.ContentEncoding = System.Text.Encoding.GetEncoding("euc-kr");
Response.Write(s.ToString());
Response.Flush();
Response.End();
}
NameValueCollection tags = new NameValueCollection();
tags.Add("param1", "value1");
tags.Add("param2", "value2");
tags.Add("param3", "value3");
RedirectWithData(tags, "../test/test.aspx");
{
Response.Clear();
Response.Buffer = true;
StringBuilder s = new StringBuilder();
s.Append("<html>");
s.Append("<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head>");
s.AppendFormat("<body onload='document.forms[0].submit()'>");
s.AppendFormat("<form name='form' action='{0}' method='POST'>", url);
foreach (string key in data)
{
s.AppendFormat("<input type='hidden' name='{0}' value='{1}' />", key, data[key].Trim());
}
s.Append("</form></body></html>");
Response.ContentEncoding = System.Text.Encoding.GetEncoding("euc-kr");
Response.Write(s.ToString());
Response.Flush();
Response.End();
}
NameValueCollection tags = new NameValueCollection();
tags.Add("param1", "value1");
tags.Add("param2", "value2");
tags.Add("param3", "value3");
RedirectWithData(tags, "../test/test.aspx");
피드 구독하기:
글 (Atom)