Programming

You are currently browsing the articles from KomKid.Net matching the category Programming.

Axapta : Posting journal by code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
static void InventJournalCheckPost(Args _args)
{
InventJournalTable      inventJournalTable;
InventJournalCheckPost  journalCheckPost;    
;
ttsbegin;
inventJournalTable =  InventJournalTable::find("xxx",true);
//Remove Journal "xxx" has not been locked by system
inventJournalTable.SystemBlocked = true;
inventJournalTable.update();

journalCheckPost   =  InventJournalCheckPost::newJournalCheckPost  (JournalCheckPostType::Post,inventJournalTable);
journalCheckPost.run();

inventJournalTable.SystemBlocked = false;
inventJournalTable.update();
ttscommit;
}

Written by Komkid on February 11th, 2010 with no comments.
Read more articles on Axapta and Programming.

Squid : Custom error page

blocked
หน้าตาสำหรับแสดงผลกรณีมี error ของ squid เช่น กรณีถูกบล็อก(ERR_ACCESS_DENIED) แก้ไขได้ที่ /usr/share/squod/errors/
โดยสามารถใช้ Variable ได้ด้วย ดังนี้

%B URL with FTP %2f hack
%c Squid error code
%d seconds elapsed since request received (not yet implemented)
%e errno
%E strerror()
%f FTP request line
%F FTP reply line
%g FTP server message
%h cache hostname
%H server host name
%i client IP address
%I server IP address
%L contents of err_html_text config option
%M Request Method
%m Error message returned by external auth helper
%p URL port
%P Protocol
%R Full HTTP Request
%S squid default signature
%s caching proxy software with version
%t local time
%T UTC
%U URL without password
%u URL with password (Squid-2.5 and later only)
%w cachemgr email address
%z dns server error message

ตัวอย่าง ERR_ACCESS_DENIED

1
2
3
4
5
6
7
8
9
10
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF8">
<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
</HEAD><BODY bgcolor="#000000">
 <div align="center">
  <img src="http://intranet.sci.com/sci/blocked.jpg" border="0" alt="Access dinied">
  </div>
<br>
<div align="center">Web นี้ถูก block ในช่วงเวลา 8:00-12:00 น. และ 13:00-17:40 น. หากมีความจำเป็นต้องใช้งาน กรุณาแจ้ง งทส.</div>

Written by Komkid on January 28th, 2010 with no comments.
Read more articles on Admin and Networking and Programming and Ubuntu.

JavaScript : 1 Form 2 Target

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
        <script type="text/javascript">
         <!--
         function submitView()
         {
           myform = document.form1;
           myform.target="_blank";
           myform.action="view.php";
           myform.submit();
           return false;
         }
         
        function submitEdit()
         {
           myform = document.form1;
           myform.target="_blank";
           myform.action="edit.php";
           myform.submit();
           return false;
         }
 
         //-->
         </script>
1
2
3
4
<form name="form1" method="post">
<input type="submit" name="SubmitV" value="- View -" onclick="submitView();">
<input type="submit" name="SubmitE" value="- Edit -" onclick="submitEdit();">
</form>

Written by Komkid on January 27th, 2010 with no comments.
Read more articles on JavaScript and Programming.

Logon Script : Map Network Drive

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
' MapNetworkDrive.vbs
' VBScript to map a network drive to a UNC Path.
' Author Guy Thomas http://computerperformance.co.uk/
' Version 2.3 - September 2005
' -----------------------------------------------------------------'
Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath
strDriveLetter = "P:"
strRemotePath = "\\server2\public_data"
 
' Purpose of script to create a network object. (objNetwork)
' Then to apply the MapNetworkDrive method.  Result J: drive
Set objNetwork = CreateObject("WScript.Network")
 
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
WScript.Quit
 
' End of Example VBScript.

Written by Komkid on January 27th, 2010 with no comments.
Read more articles on Admin and Networking and Programming.

Axapta : Detecting Type of Variable

1
2
3
4
5
6
7
8
9
10
11
12
13
static void typeDetect(Args _args)
{
DictType    dictType;
;

print "This ID is the TypeId, not the EDT ID - ", typeId(ItemId);
print "This ID is what we need - ", typeId2ExtendedTypeId(typeId(ItemId));
print "This ID is wrong - ", new DictType(typeId(ItemId)).id();
dictType = new DictType(typeId2ExtendedTypeId(typeId(ItemId)));
print "This ID is correct - ", dictType.id();
print dictType.name();
pause;
}

Written by Komkid on December 15th, 2009 with no comments.
Read more articles on Axapta and Programming.

« Older articles

No newer articles