text:
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/input.h>
#include <winpr/sysinfo.h>

#include <freerdp/codec/color.h>
#include <freerdp/codec/region.h>
#include <freerdp/log.h>

#include "mac_shadow.h"

#define TAG SERVER_TAG("shadow.mac")

static macShadowSubsystem* g_Subsystem = NULL;

static BOOL mac_shadow_input_synchronize_event(rdpShadowSubsystem* subsystem,
                                               rdpShadowClient* client, UINT32 flags)
{
	if (!subsystem || !client)
		return FALSE;

	return TRUE;
}

static BOOL mac_shadow_input_keyboard_event(rdpShadowSubsystem* subsystem, rdpShadowClient* client,
                                            UINT16 flags, UINT16 code)
{
	DWORD vkcode;
	DWORD keycode;
	BOOL extended;
	CGEventRef kbdEvent;
	CGEventSourceRef source;
	extended = (flags & KBD_FLAGS_EXTENDED) ? TRUE : FALSE;

	if (!subsystem || !client)
		return FALSE;

	if (extended)
		code |= KBDEXT;

	vkcode = GetVirtualKeyCodeFromVirtualScanCode(code, 4);

	if (extended)
		vkcode |= KBDEXT;

	keycode = GetKeycodeFromVirtualKeyCode(vkcode, KEYCODE_TYPE_APPLE);

	if (keycode < 8)
		return TRUE;

	keycode -= 8;
	source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);

	if (flags & KBD_FLAGS_DOWN)
	{
		kbdEvent = CGEventCreateKeyboardEvent(source, (CGKeyCode)keycode, TRUE);
		CGEventPost(kCGHIDEventTap, kbdEvent);
		CFRelease(kbdEvent);
	}
	else if (flags & KBD_FLAGS_RELEASE)
	{
		kbdEvent = CGEventCreateKeyboardEvent(source, (CGKeyCode)keycode, FALSE);
		CGEventPost(kCGHIDEventTap, kbdEvent);
		CFRelease(kbdEvent);
	}

	CFRelease(source);
	return TRUE;
}

static BOOL mac_shadow_input_unicode_keyboard_event(rdpShadowSubsystem* subsystem,
                                                    rdpShadowClient* client, UINT16 flags,
                                                    UINT16 code)
{
	if (!subsystem || !client)
		return FALSE;

	return TRUE;
}

static BOOL mac_shadow_input_mouse_event(rdpShadowSubsystem* subsystem, rdpShadowClient* client,
                                         UINT16 flags, UINT16 x, UINT16 y)
{
	macShadowSubsystem* mac = (macShadowSubsystem*)subsystem;
	UINT32 scrollX = 0;
	UINT32 scrollY = 0;
	CGWheelCount wheelCount = 2;

	if (!subsystem || !client)
		return FALSE;

	if (flags & PTR_FLAGS_WHEEL)
	{
		scrollY = flags & WheelRotationMask;

		if (flags & PTR_FLAGS_WHEEL_NEGATIVE)
		{
			scrollY = -(flags & WheelRotationMask) / 392;
		}
		else
		{
			scrollY = (flags & WheelRotationMask) / 120;
		}

		CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
		CGEventRef scroll = CGEventCreateScrollWheelEvent(source, kCGScrollEventUnitLine,
		                                                  wheelCount, scrollY, scrollX);
		CGEventPost(kCGHIDEventTap, scroll);
		CFRelease(scroll);
		CFRelease(source);
	}
	else
	{
		CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
		CGEventType mouseType = kCGEventNull;
		CGMouseButton mouseButton = kCGMouseButtonLeft;

		if (flags & PTR_FLAGS_MOVE)
		{
			if (mac->mouseDownLeft)
				mouseType = kCGEventLeftMouseDragged;
			else if (mac->mouseDownRight)
				mouseType = kCGEventRightMouseDragged;
			else if (mac->mouseDownOther)
				mouseType = kCGEventOtherMouseDragged;
			else
				mouseType = kCGEventMouseMoved;

			CGEventRef move =
			    CGEventCreateMouseEvent(source, mouseType, CGPointMake(x, y), mouseButton);
			CGEventPost(kCGHIDEventTap, move);
			CFRelease(move);
		}

		if (flags & PTR_FLAGS_BUTTON1)
		{
			mouseButton = kCGMouseButtonLeft;

			if (flags & PTR_FLAGS_DOWN)
			{
				mouseType = kCGEventLeftMouseDown;
				mac->mouseDownLeft = TRUE;
			}
			else
			{
				mouseType = kCGEventLeftMouseUp;
				mac->mouseDownLeft = FALSE;
			}
		}
		else if (flags & PTR_FLAGS_BUTTON2)
		{
			mouseButton = kCGMouseButtonRight;

			if (flags & PTR_FLAGS_DOWN)
			{
				mouseType = kCGEventRightMouseDown;
				mac->mouseDownRight = TRUE;
			}
			else
			{
				mouseType = kCGEventRightMouseUp;
				mac->mouseDownRight = FALSE;
			}
		}
		else if (flags & PTR_FLAGS_BUTTON3)
		{
			mouseButton = kCGMouseButtonCenter;

			if (flags & PTR_FLAGS_DOWN)
			{
				mouseType = kCGEventOtherMouseDown;
				mac->mouseDownOther = TRUE;
			}
			else
			{
				mouseType = kCGEventOtherMouseUp;
				mac->mouseDownOther = FALSE;
			}
		}

		CGEventRef mouseEvent =
		    CGEventCreateMouseEvent(source, mouseType, CGPointMake(x, y), mouseButton);
		CGEventPost(kCGHIDEventTap, mouseEvent);
		CFRelease(mouseEvent);
		CFRelease(source);
	}

	return TRUE;
}

static BOOL mac_shadow_input_extended_mouse_event(rdpShadowSubsystem* subsystem,
                                                  rdpShadowClient* client, UINT16 flags, UINT16 x,
                                                  UINT16 y)
{
	if (!subsystem || !client)
		return FALSE;

	return TRUE;
}

static int mac_shadow_detect_monitors(macShadowSubsystem* subsystem)
{
	size_t wide, high;
	MONITOR_DEF* monitor;
	CGDirectDisplayID displayId;
	displayId = CGMainDisplayID();
	CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displayId);
	subsystem->pixelWidth = CGDisplayModeGetPixelWidth(mode);
	subsystem->pixelHeight = CGDisplayModeGetPixelHeight(mode);
	wide = CGDisplayPixelsWide(displayId);
	high = CGDisplayPixelsHigh(displayId);
	CGDisplayModeRelease(mode);
	subsystem->retina = ((subsystem->pixelWidth / wide) == 2) ? TRUE : FALSE;

	if (subsystem->retina)
	{
		subsystem->width = wide;
		subsystem->height = high;
	}
	else
	{
		subsystem->width = subsystem->pixelWidth;
		subsystem->height = subsystem->pixelHeight;
	}

	subsystem->common.numMonitors = 1;
	monitor = &(subsystem->common.monitors[0]);
	monitor->left = 0;
	monitor->top = 0;
	monitor->right = subsystem->width;
	monitor->bottom = subsystem->height;
	monitor->flags = 1;
	return 1;
}

static int mac_shadow_capture_start(macShadowSubsystem* subsystem)
{
	CGError err;
	err = CGDisplayStreamStart(subsystem->stream);

	if (err != kCGErrorSuccess)
		return -1;

	return 1;
}

static int mac_shadow_capture_stop(macShadowSubsystem* subsystem)
{
	CGError err;
	err = CGDisplayStreamStop(subsystem->stream);

	if (err != kCGErrorSuccess)
		return -1;

	return 1;
}

static int mac_shadow_capture_get_dirty_region(macShadowSubsystem* subsystem)
{
	size_t index;
	size_t numRects;
	const CGRect* rects;
	RECTANGLE_16 invalidRect;
	rdpShadowSurface* surface = subsystem->common.server->surface;
	rects = CGDisplayStreamUpdateGetRects(subsystem->lastUpdate, kCGDisplayStreamUpdateDirtyRects,
	                                      &numRects);

	if (!numRects)
		return -1;

	for (index = 0; index < numRects; index++)
	{
		invalidRect.left = (UINT16)rects[index].origin.x;
		invalidRect.top = (UINT16)rects[index].origin.y;
		invalidRect.right = invalidRect.left + (UINT16)rects[index].size.width;
		invalidRect.bottom = invalidRect.top + (UINT16)rects[index].size.height;

		if (subsystem->retina)
		{
			/* scale invalid rect */
			invalidRect.left /= 2;
			invalidRect.top /= 2;
			invalidRect.right /= 2;
			invalidRect.bottom /= 2;
		}

		region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion), &invalidRect);
	}

	return 0;
}

static int freerdp_image_copy_from_retina(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst,
                                          int nYDst, int nWidth, int nHeight, BYTE* pSrcData,
                                          int nSrcStep, int nXSrc, int nYSrc)
{
	BYTE* pSrcPixel;
	BYTE* pDstPixel;
	int x, y;
	int nSrcPad;
	int nDstPad;
	int srcBitsPerPixel;
	int srcBytesPerPixel;
	int dstBitsPerPixel;
	int dstBytesPerPixel;
	srcBitsPerPixel = 24;
	srcBytesPerPixel = 8;

	if (nSrcStep < 0)
		nSrcStep = srcBytesPerPixel * nWidth;

	dstBitsPerPixel = GetBitsPerPixel(DstFormat);
	dstBytesPerPixel = GetBytesPerPixel(DstFormat);

	if (nDstStep < 0)
		nDstStep = dstBytesPerPixel * nWidth;

	nSrcPad = (nSrcStep - (nWidth * srcBytesPerPixel));
	nDstPad = (nDstStep - (nWidth * dstBytesPerPixel));
	pSrcPixel = &pSrcData[(nYSrc * nSrcStep) + (nXSrc * 4)];
	pDstPixel = &pDstData[(nYDst * nDstStep) + (nXDst * 4)];

	for (y = 0; y < nHeight; y++)
	{
		for (x = 0; x < nWidth; x++)
		{
			UINT32 R, G, B;
			UINT32 color;
			/* simple box filter scaling, could be improved with better algorithm */
			B = pSrcPixel[0] + pSrcPixel[4] + pSrcPixel[nSrcStep + 0] + pSrcPixel[nSrcStep + 4];
			G = pSrcPixel[1] + pSrcPixel[5] + pSrcPixel[nSrcStep + 1] + pSrcPixel[nSrcStep + 5];
			R = pSrcPixel[2] + pSrcPixel[6] + pSrcPixel[nSrcStep + 2] + pSrcPixel[nSrcStep + 6];
			pSrcPixel += 8;
			color = FreeRDPGetColor(DstFormat, R >> 2, G >> 2, B >> 2, 0xFF);
			WriteColor(pDstPixel, DstFormat, color);
			pDstPixel += dstBytesPerPixel;
		}

		pSrcPixel = &pSrcPixel[nSrcPad + nSrcStep];
		pDstPixel = &pDstPixel[nDstPad];
	}

	return 1;
}

static void (^mac_capture_stream_handler)(
    CGDisplayStreamFrameStatus, uint64_t, IOSurfaceRef,
    CGDisplayStreamUpdateRef) = ^(CGDisplayStreamFrameStatus status, uint64_t displayTime,
                                  IOSurfaceRef frameSurface, CGDisplayStreamUpdateRef updateRef) {
  int x, y;
  int count;
  int width;
  int height;
  int nSrcStep;
  BOOL empty;
  BYTE* pSrcData;
  RECTANGLE_16 surfaceRect;
  const RECTANGLE_16* extents;
  macShadowSubsystem* subsystem = g_Subsystem;
  rdpShadowServer* server = subsystem->common.server;
  rdpShadowSurface* surface = server->surface;
  count = ArrayList_Count(server->clients);

  if (count < 1)
	  return;

  EnterCriticalSection(&(surface->lock));
  mac_shadow_capture_get_dirty_region(subsystem);
  surfaceRect.left = 0;
  surfaceRect.top = 0;
  surfaceRect.right = surface->width;
  surfaceRect.bottom = surface->height;
  region16_intersect_rect(&(surface->invalidRegion), &(surface->invalidRegion), &surfaceRect);
  empty = region16_is_empty(&(surface->invalidRegion));
  LeaveCriticalSection(&(surface->lock));

  if (!empty)
  {
	  extents = region16_extents(&(surface->invalidRegion));
	  x = extents->left;
	  y = extents->top;
	  width = extents->right - extents->left;
	  height = extents->bottom - extents->top;
	  IOSurfaceLock(frameSurface, kIOSurfaceLockReadOnly, NULL);
	  pSrcData = (BYTE*)IOSurfaceGetBaseAddress(frameSurface);
	  nSrcStep = (int)IOSurfaceGetBytesPerRow(frameSurface);

	  if (subsystem->retina)
	  {
		  freerdp_image_copy_from_retina(surface->data, surface->format, surface->scanline, x, y,
			                             width, height, pSrcData, nSrcStep, x, y);
	  }
	  else
	  {
		  freerdp_image_copy(surface->data, surface->format, surface->scanline, x, y, width, height,
			                 pSrcData, PIXEL_FORMAT_BGRX32, nSrcStep, x, y, NULL,
			                 FREERDP_FLIP_NONE);
	  }
	  LeaveCriticalSection(&(surface->lock));

	  IOSurfaceUnlock(frameSurface, kIOSurfaceLockReadOnly, NULL);
	  ArrayList_Lock(server->clients);
	  count = ArrayList_Count(server->clients);
	  shadow_subsystem_frame_update(&subsystem->common);

	  if (count == 1)
	  {
		  rdpShadowClient* client;
		  client = (rdpShadowClient*)ArrayList_GetItem(server->clients, 0);

		  if (client)
		  {
			  subsystem->common.captureFrameRate = shadow_encoder_preferred_fps(client->encoder);
		  }
	  }

	  ArrayList_Unlock(server->clients);
	  EnterCriticalSection(&(surface->lock));
	  region16_clear(&(surface->invalidRegion));
	  LeaveCriticalSection(&(surface->lock));
  }

  if (status != kCGDisplayStreamFrameStatusFrameComplete)
  {
	  switch (status)
	  {
		  case kCGDisplayStreamFrameStatusFrameIdle:
			  break;

		  case kCGDisplayStreamFrameStatusStopped:
			  break;

		  case kCGDisplayStreamFrameStatusFrameBlank:
			  break;

		  default:
			  break;
	  }
  }
  else if (!subsystem->lastUpdate)
  {
	  CFRetain(updateRef);
	  subsystem->lastUpdate = updateRef;
  }
  else
  {
	  CGDisplayStreamUpdateRef tmpRef = subsystem->lastUpdate;
	  subsystem->lastUpdate = CGDisplayStreamUpdateCreateMergedUpdate(tmpRef, updateRef);
	  CFRelease(tmpRef);
  }
};

static int mac_shadow_capture_init(macShadowSubsystem* subsystem)
{
	void* keys[2];
	void* values[2];
	CFDictionaryRef opts;
	CGDirectDisplayID displayId;
	displayId = CGMainDisplayID();
	subsystem->captureQueue = dispatch_queue_create("mac.shadow.capture", NULL);
	keys[0] = (void*)kCGDisplayStreamShowCursor;
	values[0] = (void*)kCFBooleanFalse;
	opts = CFDictionaryCreate(kCFAllocatorDefault, (const void**)keys, (const void**)values, 1,
	                          NULL, NULL);
	subsystem->stream = CGDisplayStreamCreateWithDispatchQueue(
	    displayId, subsystem->pixelWidth, subsystem->pixelHeight, 'BGRA', opts,
	    subsystem->captureQueue, mac_capture_stream_handler);
	CFRelease(opts);
	return 1;
}

static int mac_shadow_screen_grab(macShadowSubsystem* subsystem)
{
	return 1;
}

static int mac_shadow_subsystem_process_message(macShadowSubsystem* subsystem, wMessage* message)
{
	rdpShadowServer* server = subsystem->common.server;
	rdpShadowSurface* surface = server->surface;

	switch (message->id)
	{
		case SHADOW_MSG_IN_REFRESH_REQUEST_ID:
			EnterCriticalSection(&(surface->lock));
			shadow_subsystem_frame_update((rdpShadowSubsystem*)subsystem);
			LeaveCriticalSection(&(surface->lock));
			break;

		default:
			WLog_ERR(TAG, "Unknown message id: %" PRIu32 "", message->id);
			break;
	}

	if (message->Free)
		message->Free(message);

	return 1;
}

static DWORD WINAPI mac_shadow_subsystem_thread(LPVOID arg)
{
	macShadowSubsystem* subsystem = (macShadowSubsystem*)arg;
	DWORD status;
	DWORD nCount;
	UINT64 cTime;
	DWORD dwTimeout;
	DWORD dwInterval;
	UINT64 frameTime;
	HANDLE events[32];
	wMessage message;
	wMessagePipe* MsgPipe;
	MsgPipe = subsystem->common.MsgPipe;
	nCount = 0;
	events[nCount++] = MessageQueue_Event(MsgPipe->In);
	subsystem->common.captureFrameRate = 16;
	dwInterval = 1000 / subsystem->common.captureFrameRate;
	frameTime = GetTickCount64() + dwInterval;

	while (1)
	{
		cTime = GetTickCount64();
		dwTimeout = (cTime > frameTime) ? 0 : frameTime - cTime;
		status = WaitForMultipleObjects(nCount, events, FALSE, dwTimeout);

		if (WaitForSingleObject(MessageQueue_Event(MsgPipe->In), 0) == WAIT_OBJECT_0)
		{
			if (MessageQueue_Peek(MsgPipe->In, &message, TRUE))
			{
				if (message.id == WMQ_QUIT)
					break;

				mac_shadow_subsystem_process_message(subsystem, &message);
			}
		}

		if ((status == WAIT_TIMEOUT) || (GetTickCount64() > frameTime))
		{
			mac_shadow_screen_grab(subsystem);
			dwInterval = 1000 / subsystem->common.captureFrameRate;
			frameTime += dwInterval;
		}
	}

	ExitThread(0);
	return 0;
}

static int mac_shadow_enum_monitors(MONITOR_DEF* monitors, int maxMonitors)
{
	int index;
	size_t wide, high;
	int numMonitors = 0;
	MONITOR_DEF* monitor;
	CGDirectDisplayID displayId;
	displayId = CGMainDisplayID();
	CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displayId);
	wide = CGDisplayPixelsWide(displayId);
	high = CGDisplayPixelsHigh(displayId);
	CGDisplayModeRelease(mode);
	index = 0;
	numMonitors = 1;
	monitor = &monitors[index];
	monitor->left = 0;
	monitor->top = 0;
	monitor->right = (int)wide;
	monitor->bottom = (int)high;
	monitor->flags = 1;
	return numMonitors;
}

static int mac_shadow_subsystem_init(macShadowSubsystem* subsystem)
{
	g_Subsystem = subsystem;
	mac_shadow_detect_monitors(subsystem);
	mac_shadow_capture_init(subsystem);
	return 1;
}

static int mac_shadow_subsystem_uninit(macShadowSubsystem* subsystem)
{
	if (!subsystem)
		return -1;

	if (subsystem->lastUpdate)
	{
		CFRelease(subsystem->lastUpdate);
		subsystem->lastUpdate = NULL;
	}

	return 1;
}

static int mac_shadow_subsystem_start(macShadowSubsystem* subsystem)
{
	HANDLE thread;

	if (!subsystem)
		return -1;

	mac_shadow_capture_start(subsystem);

	if (!(thread = CreateThread(NULL, 0, mac_shadow_subsystem_thread, (void*)subsystem, 0, NULL)))
	{
		WLog_ERR(TAG, "Failed to create thread");
		return -1;
	}

	return 1;
}

static int mac_shadow_subsystem_stop(macShadowSubsystem* subsystem)
{
	if (!subsystem)
		return -1;

	return 1;
}

static void mac_shadow_subsystem_free(macShadowSubsystem* subsystem)
{
	if (!subsystem)
		return;

	mac_shadow_subsystem_uninit(subsystem);
	free(subsystem);
}

static macShadowSubsystem* mac_shadow_subsystem_new(void)
{
	macShadowSubsystem* subsystem;
	subsystem = (macShadowSubsystem*)calloc(1, sizeof(macShadowSubsystem));

	if (!subsystem)
		return NULL;

	subsystem->common.SynchronizeEvent = mac_shadow_input_synchronize_event;
	subsystem->common.KeyboardEvent = mac_shadow_input_keyboard_event;
	subsystem->common.UnicodeKeyboardEvent = mac_shadow_input_unicode_keyboard_event;
	subsystem->common.MouseEvent = mac_shadow_input_mouse_event;
	subsystem->common.ExtendedMouseEvent = mac_shadow_input_extended_mouse_event;
	return subsystem;
}

FREERDP_API int Mac_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints)
{
	pEntryPoints->New = (pfnShadowSubsystemNew)mac_shadow_subsystem_new;
	pEntryPoints->Free = (pfnShadowSubsystemFree)mac_shadow_subsystem_free;
	pEntryPoints->Init = (pfnShadowSubsystemInit)mac_shadow_subsystem_init;
	pEntryPoints->Uninit = (pfnShadowSubsystemInit)mac_shadow_subsystem_uninit;
	pEntryPoints->Start = (pfnShadowSubsystemStart)mac_shadow_subsystem_start;
	pEntryPoints->Stop = (pfnShadowSubsystemStop)mac_shadow_subsystem_stop;
	pEntryPoints->EnumMonitors = (pfnShadowEnumMonitors)mac_shadow_enum_monitors;
	return 1;
}


text:
require File.dirname(__FILE__) + '/test_helper'

Test::Unit::TestCase.output_fixture_base = File.dirname(__FILE__)

class GoogleGeneratorExtTest < Test::Unit::TestCase

  def test_global_map_var
    Eschaton.with_global_script do |script|

      script.google_map_script do
        map = Google::Map.new :center => :cape_town, :zoom => 9
      end

      assert_output_fixture "var map;
                             jQuery(document).ready(function() {
                             window.onunload = GUnload;
                             if (GBrowserIsCompatible()) {
                             map_lines = new Array();
                             map = new GMap2(document.getElementById('map'));
                             track_bounds = new GLatLngBounds();
                             map.setCenter(cape_town);
                             map.setZoom(9);
                             last_mouse_location = map.getCenter();
                             function map_mousemove(map){
                             return GEvent.addListener(map, \"mousemove\", function(location) {
                             last_mouse_location = location;
                             });
                             }
                             map_mousemove_event = map_mousemove(map);
                             } else { alert('Your browser be old, it cannot run google maps!');}
                             })", script
    end
  end

  def test_mapping_scripts
    generator = Eschaton.javascript_generator

    generator.google_map_script do

      Google::Scripts.before_map_script do |script|
        script.comment "Before 1"
        script.comment "Before 2"
      end

      Google::Scripts.after_map_script do |script|
        script.comment "After 1"
        script.comment "After 2"
      end

      generator.comment "Map script"
    end

    assert_output_fixture "/* Before 1 */
                           /* Before 2 */
                           jQuery(document).ready(function() {
                           window.onunload = GUnload;
                           if (GBrowserIsCompatible()) {
                           /* Map script */
                           } else { alert('Your browser be old, it cannot run google maps!');}
                           })
                           /* After 1 */
                           /* After 2 */",
                          generator
  end

  def test_google_map_script
    Eschaton.with_global_script do |script|

      assert_output_fixture :google_map_script_no_body, script.record_for_test {
                                                             script.google_map_script {}
                                                           }

      assert_output_fixture :google_map_script_with_body, script.record_for_test {
                                                            script.google_map_script do
                                                              script.comment "This is some test code!"
                                                              script.alert("Hello!")
                                                            end
                                                          }

    end
  end

end

redpajama_set_name: RedPajamaGithub


text:
<?php
/**
 * Created by PhpStorm.
 * User: Kinnngg
 * Date: 02-03-2015
 * Time: 13:16
 */

?>

Anti Cheat

antics_v1 by rapher

The Antics blocks all the cheats in SWAT4 game.

After downloading Antics just put the antics_v1.u in your SYSTEM directory of SWAT4.

        Download Antics

GameSpy v1

GS1 by Serge modified by Kinnngg

The GameSpy vs1 Query package provides GameSpy Query multiprotocol (both UDP and TCP) listen support for SWAT4 servers.
            This Protocol make quering SWAT4 server much easier and also returns more data than GSv2 or AMServerQuery listener.
We Recommend using this in your Server.

The modified version of GSv1 by kinnngg allow query of little bit extra data from server.

Installation:

After downloading this just copy GSv1.u in your SYSTEM directory of SWAT4.

Open Swat4DedicatedServer.ini

Navigate to [Engine.GameEngine]

Comment out or remove the following line if present:
ServerActors = IpDrv.MasterServerUplink

Insert the following line anywhere in the section:
ServerActors = GS1.Listener

Add the following Section at the end of file
[GS1.Listener]
Enabled=True

Restart your server and now it is ready to listen to GameSpy v1 protocol queries on the join port + 1
(e.g. 10481).

It is possible to change query port. Just add Port propery in [GS1.Listener] section with port number. E.g.

                [GS1.Listener]
Enabled=True
Port=10483

                Download GS1.u

Admin Mod Modified

AMMod by GEZ modified by Kinnngg

The Admin Mod make SWAT4 server administration easy by adding lot of Admin commands and Web Admin. It also allow query to Server.

The modified version of AMMod by Kinnngg allow query of little bit extra data from server.

After downloading this just replace this with AMMod.u in your SYSTEM directory of SWAT4.

                Download AMMod.u

Download Mod

download mod by GEZ

The Download Mod allow file download from Servers.

After downloading this just put the downloads.u in your SYSTEM directory of SWAT4.

                Download DownloadMod.u

Voting Mod

SWAT4 Voting & Whois Mod(KMod) by Kinnngg

The Voting & Whois Mod(KMod) allow users to start votes in SWAT4. There are three Vote commands available !vote kick,!vote map & !vote ask

Voting Mod need Julia Mod, Utils Mod and HTTP Mod already present in Server. Dont worry if you don't have.
 We will guide you from beginning!

Follow the Steps as given below:

First of all download the listed files from the link provided!

			Julia.u or Download Julia From GitHub

			Utils.u or Download Utils From GitHub

			HTTP.u or Download HTTP From GitHub

			KMod.u or Download KMod From GitHub

After downloading you may need to extract the compressed file to get the .u file.

			Just put all files i.e, Julia.u , HTTP.u , Utils.u , KMod.u to your System directory of SWAT4 which is mostly

			C:\Program Files\Sierra\SWAT 4\Content\System   or   (Your Swat4 Installation Path)\SWAT 4\Content\System

			Now Open your Swat4DedicatedServer.ini file and find for Section ServerActors and append these lines at last of ServerActors:

			ServerActors=Utils.Package

			ServerActors=HTTP.Package

			ServerActors=Julia.Core

			ServerActors=KMod.Vote

			Now your section it may look like this:

			[Engine.GameEngine]

			.........

			.........

			ServerActors=AMMod.AMGameMod

			ServerActors=Utils.Package

			ServerActors=HTTP.Package

			ServerActors=Julia.Core

			ServerActors=KMod.Vote

			.........

			.........

Now go to the last of Swat4DedicatedServer.ini file and add these sections to it.

			[Julia.Core]

			Enabled=True

			[KMod.Vote]

			Enabled=True

			CanVoteAgainstAdmin=True

			bVoteMapEnabled=True

			OnlyAdminCanStartVote=False

Congrats! You have just installed Voting Mod to your Server. Restart your server once :)


text:
<?php

// $Id$

require_once('../../boot.inc.php');
boot('my_site_adm');

require_once($WSC->get_site_inc_dir().'modules/admin_panel/pages/_menu/menu_item_export/menu_item_export_wp.class.php');

session_start();

global $_MODULES_REGISTER;
$user_auth_config = $_MODULES_REGISTER->get_module_config('admin_user_auth');

$page = new Menu_Item_Export_WP('menu_item_export', $user_auth_config);
$SITE->run($page, new Web_Context);


text:
from __future__ import print_function
import tensorflow.contrib.keras as keras
from tensorflow.contrib.keras.api.keras.models import Sequential
from tensorflow.contrib.keras.api.keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D
from tensorflow.contrib.keras import backend as K
from utils import Progbar, mnist_load_data
try:
    import cPickle as pickle
except ImportError:
    import pickle
import numpy as np
from scipy import ndimage
from scipy.misc import imresize
from os import listdir
import tensorflow as tf
from collections import defaultdict

batch_size = 128
num_classes = 2
epochs = 10

# input image dimensions
img_rows, img_cols = 28, 28

# Artificial tttest
# dir=listdir("dataset-1")[1:]
# x_list=[]
# for i in dir:
#     img=ndimage.imread("dataset-1/"+i,flatten=True)
#     img=imresize(img,size=(28,28))
#     x_list.append(img)

# y_list=[m[-5] for m in dir]

# x_list=np.asarray(x_list)

# the data, shuffled and split between train and tttest sets
(x_train, y_train), (x_test, y_test) = mnist_load_data()
# x_train=x_list[0:8]
# x_test=x_list[8:10]
# y_train=y_list[0:8]
# y_test=y_list[8:10]

if K.image_data_format() == 'channels_first':
    x_train = x_train.reshape(x_train.shape[0], 1, img_rows, img_cols)
    x_test = x_test.reshape(x_test.shape[0], 1, img_rows, img_cols)
    input_shape = (1, img_rows, img_cols)
else:
    x_train = x_train.reshape(x_train.shape[0], img_rows, img_cols, 1)
    x_test = x_test.reshape(x_test.shape[0], img_rows, img_cols, 1)
    input_shape = (img_rows, img_cols, 1)

x_train = x_train.astype('float32')
x_test = x_test.astype('float32')
x_train /= 255
x_test /= 255

# small tttest
x_train=x_train[0::10]
x_test=x_train[0::10]

print('x_train shape:', x_train.shape)
print(x_train.shape[0], 'train samples')
print(x_test.shape[0], 'tttest samples')

# convert class vectors to binary class matrices
# y_train = keras.utils.to_categorical(y_train, num_classes)
# y_test = keras.utils.to_categorical(y_test, num_classes)

modelA = Sequential()
modelA.add(Conv2D(32, kernel_size=(3, 3),
                  activation='relu',
                  input_shape=input_shape))
modelA.add(Conv2D(64, (3, 3), activation='relu'))
modelA.add(MaxPooling2D(pool_size=(2, 2)))
modelA.add(Dropout(0.25))
modelA.add(Flatten())
modelA.add(Dense(128, activation='relu'))
modelA.add(Dropout(0.5))
modelA.add(Dense(1, activation='sigmoid'))

# Let's hack it!
# So AB training in my mind means I will train A first for a few rounds, then I will train B for a few rounds.
# What would be the cost function?

modelB = Sequential()
modelB.add(Conv2D(32, kernel_size=(3, 3),
                  activation='relu',
                  input_shape=input_shape))
modelB.add(Conv2D(64, (3, 3), activation='relu'))
modelB.add(MaxPooling2D(pool_size=(2, 2)))
modelB.add(Dropout(0.25))
modelB.add(Flatten())
modelB.add(Dense(128, activation='relu'))
modelB.add(Dropout(0.5))
modelB.add(Dense(1, activation='sigmoid'))

# binary output for the network.

# Think about how it works.
# A(i) = 1, B(i) = 1. Ideal.
# A(i) = 0, B(i) = 1. Should it be allowed? It's not exactly necessary in the fundamentals. I just need A to lead to B.
# And the reverse is not necessary. However. If this condition is not added to the training, then A might be stuck at 0.
# What about A(i) and B(i) both stuck at 1? B must not be stuck at 1 at all time.
# Well. You should encourage A to be 1 and B to be 0.
# A(i) = 1, B(i) = 0. Falsified. This should incur great cost.
# A(i) = 0, B(i) = 0. Ideal.
# 0,0  A: 0.01  B: 0
# 0,1  A: 0.01  B: 0.01
# 1,0  A: 1     B: 1
# 1,1  A: 0     B: 0.01
# 0.01 refers to the deviation impulse. I don't think it's a good idea to let it be fixed.
# Design a short-term memory. If A has been 0 for the past 10 times, then a cost should be incurred. 0.1
# Same for B = 1.

# The training proceeds as follows:
# Get a batch.
# Run model A and B for binary outputs.
# Refer to the cost table and STM. This training has no correct labels.

B_streak=tf.Variable(0.,name="B_streak")
A_threshold=tf.constant(0.1,name="A_thres")
B_threshold=tf.constant(0.9,name="B_thres")
streak_limit=tf.constant(10.)
stuck_impulse=tf.constant(0.4)

#
# def A_cost(B_pred,A_pred):
#
#     def f1():
#         return tf.subtract(A_pred,B_pred)
#     def f2():
#         return tf.cond(tf.less(A_pred,A_threshold),streakreg_A,0.)
#     def streakreg_A():
#         tf.add(A_streak,1.)
#         return tf.cond(tf.less(streak_limit,A_streak),stuck_impulse,0.)
#     tf.cond(tf.less(B_pred,A_pred),f1,f2)
#
# def A_cost(B_pred,A_pred):
#     return tf.cond(B_pred>A_pred,lambda:1,lambda:2)
#
# # # Pass B_labels as if they are the right ones.
# # def A_cost(B_pred,A_pred):
# #     def streakreg():
# #         A_streak+=1
# #         K.switch(A_streak>10,0.4,0)
# #
# #     K.switch(A_pred>B_pred,A_pred-B_pred,
# #              K.switch(A_pred<0.1,streakreg,0))
#
# def old_A_cost(B_pred,A_pred):
#     # Not sure whether this can be binary function
#     # If falsified
#     if A_pred>B_pred:
#         return A_pred-B_pred
#     # If stuck at zero
#     if A_pred<0.1:
#         global A_streak
#         A_streak+=1
#         if A_streak>10:
#             return 0.4
#     return 0
#

# The gradient of this cost function is none?
def A_cost(B_pred,A_pred):

    def nostreak():
        with tf.variable_scope("A_cost"):
            sess=K.get_session()
            A_streak=tf.get_variable("A_streak",initializer=0.)
            sess.run(tf.assign(A_streak,0.))

            print('A_cost No_streak Reached')
            print(A_streak.eval(session=sess))
            return A_pred-B_pred

    def streak():
        with tf.variable_scope("A_cost",reuse=True):
            sess=K.get_session()
            A_streak=tf.get_variable("A_streak",shape=[])
            new=tf.add(A_streak,1.)
            sess.run(tf.assign(A_streak,new))

            print('A_cost Streak Reached')
            print(A_streak.eval(session=sess))
            return tf.where(tf.less(10.,A_streak),tf.constant(2.),tf.constant(0.),name="select_1")

    print("outerloop")
    return tf.where(tf.less(B_pred,A_pred),nostreak(),
                    tf.where(tf.less(A_pred,0.1),
                             tf.ones_like(A_pred)*streak(),
                             tf.zeros_like(A_pred),name="select_2")
                    ,name="select_3")

# def A_cost(B_pred,A_pred):
#     print(A_pred.get_shape())
#     print(B_pred.get_shape())
#     return tf.where(A_pred<B_pred,A_pred-B_pred,tf.zeros_like(A_pred))

# def B_cost(A_pred,B_pred):
#     return tf.where(tf.less(B_pred,A_pred),B_pred-A_pred,B_pred-A_pred)

# def B_cost(A_pred,B_pred):
#     if A_pred>B_pred:
#         return A_pred-B_pred
#     if B_pred>0.9:
#         global B_streak
#         B_streak+=1
#         if B_streak>10:
#             return 2.
#     return 0

# This cost function is creating too much trouble for me.
# I should look at the loss function they write and see if I can use python methods to
# implement the counter. Just a confidence measure really. Why the fuck is it so hard?

# def B_cost(A_pred,B_pred):
#     def nostreak():
#         with tf.variable_scope("B_cost"):
#             sess=K.get_session()
#             B_streak=tf.get_variable("B_streak",initializer=0.)
#             sess.run(tf.assign(B_streak,0.))
#
#             print('B_cost No_streak Reached')
#             print(B_streak.eval(session=sess))
#
#             return A_pred-B_pred
#
#     def streak():
#         with tf.variable_scope("B_cost",reuse=True):
#
#             sess=K.get_session()
#             B_streak=tf.get_variable("B_streak",shape=[])
#             new=tf.add(B_streak, 1.)
#             sess.run(tf.assign(B_streak, new))
#
#             print('B_cost Streak Reached')
#             print(B_streak.eval(session=sess))
#
#             return tf.where(tf.less(10., B_streak), tf.constant(2.), tf.constant(0.), name="select_1")
#
#     return tf.where(tf.less(B_pred,A_pred),nostreak(),
#                     tf.where(B_pred>0.9,
#                              tf.ones_like(B_pred)*streak(),
#                              tf.zeros_like(B_pred),name="select_2")
#                     ,name="select_3")

# lower bound estimator loss function
def A_loss(B_pred,A_pred):
    diff=A_pred - B_pred
    return (K.mean(K.square(-diff), axis=-1)*tf.nn.relu(-diff)+tf.nn.relu(diff))*1e6

def B_loss(A_pred,B_pred):
    diff=A_pred - B_pred
    return (K.mean(K.square(-diff), axis=-1)*tf.nn.relu(-diff)+tf.nn.relu(diff))*1e6

def A_metric(B_pred,A_pred):
    return K.mean(K.less_equal(K.round(A_pred),K.round(B_pred)), axis=-1)

def B_metric(A_pred,B_pred):
    return K.mean(K.less_equal(K.round(A_pred),K.round(B_pred)), axis=-1)

modelA.compile(loss=A_loss,
               optimizer=keras.optimizers.Adadelta(),
               metrics=[A_metric])

modelB.compile(loss=B_loss,
               optimizer=keras.optimizers.Adadelta(),
               metrics=[B_metric])

tf.global_variables_initializer()

train_history=defaultdict(list)
test_history = defaultdict(list)

for epoch in range(epochs):
    print('Epoch {} of {}'.format(epoch + 1, epochs))

    num_batches = int(x_train.shape[0] / batch_size)
    progress_bar = Progbar(target=num_batches)

    epoch_A_loss = []
    epoch_B_loss = []

    for index in range(num_batches):
        progress_bar.update(index)

        x_batch=x_train[index * batch_size:(index + 1) * batch_size]

        A_output=modelA.predict(x_batch)
        B_output=modelB.predict(x_batch)

        modelA.trainable = True
        modelB.trainable=False
        epoch_A_loss.append(modelA.train_on_batch(x_batch, B_output))
        modelA.trainable=False
        modelB.trainable=True
        epoch_B_loss.append(modelB.train_on_batch(x_batch, A_output))

        # A_cost=K.eval(A_loss(B_output,A_output))
        # print(A_cost)
        #
        # print(epoch_A_loss[-1])
        # print(epoch_B_loss[-1])

    print('\nTesting for epoch {}:'.format(epoch + 1))

    A_train_loss = np.mean(np.array(epoch_A_loss), axis=0)
    B_train_loss = np.mean(np.array(epoch_B_loss), axis=0)
    train_history['A'].append(A_train_loss)
    train_history['B'].append(B_train_loss)

    A_test_pred=modelA.predict(x_test)
    B_test_pred=modelB.predict(x_test)

    # print(A_test_pred,B_test_pred)

    A_test_loss=modelA.evaluate(x_test,B_test_pred)
    B_test_loss=modelB.evaluate(x_test,A_test_pred)

    test_history['A'].append(A_test_loss)
    test_history['B'].append(B_test_loss)

    print('\n{0:<22s} | {1:8s} | {2:15s}'.format(
        'component', 'loss','integrity'))
    print('-' * 65)

    ROW_FMT = '{0:<22s} | {1:<8.2f} | {2:<15.2f}'
    print(ROW_FMT.format('A (train)',
                         *train_history['A'][-1]))
    print(ROW_FMT.format('A (tttest)',
                         *test_history['A'][-1]))
    print(ROW_FMT.format('B (train)',
                         *train_history['B'][-1]))
    print(ROW_FMT.format('B (tttest)',
                         *test_history['B'][-1]))

    modelA.save_weights(
        'params_A_epoch_{0:03d}.hdf5'.format(epoch), True)
    modelB.save_weights(
        'params_B_epoch_{0:03d}.hdf5'.format(epoch), True)

pickle.dump({'train': train_history, 'tttest': test_history},
            open('AB-history.pkl', 'wb'))

    # modelA.fit(x_train, y_train,
#            batch_size=batch_size,
#            epochs=epochs,
#            verbose=1,
#            validation_data=(x_test, y_test))
# score = modelA.evaluate(x_test, y_test, verbose=0)
# print('Test loss:', score[0])
# print('Test accuracy:', score[1])

# Discarded.
# np.var(A_pred)=0.000158158
# np.mean(np.round(A_pred))=0.0
# A consistently outputs 0.49, B consistently outputs 0.51
# Consider batch loss function
# Consider binary classification instead of lower bound estimator


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>Class: Rake::RuleRecursionOverflowError</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />

          Class
          Rake::RuleRecursionOverflowError

            In:

                lib/rake.rb

            Parent:

                StandardError

Error indicating a recursion overflow error in task selection.

Methods

      add_target
      message
      new

Public Class methods

          new(*args)

Public Instance methods

          add_target(target)

          message()

[Validate]


text:
@implementation NSDictionary (ty_Parameters)

- (NSString*)buildParametersString:(BOOL)ordered {
    NSMutableArray* pairs = [NSMutableArray array];

	NSArray* keys = [self allKeys];
    if (ordered) {
        keys = [keys sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
    }
	for (NSString* key in keys) {
		if(![[self objectForKey:key] isKindOfClass:[NSString class]]) {
			continue;
		}

        CFStringRef rv = CFURLCreateStringByAddingPercentEscapes(NULL, (__bridge CFStringRef) [self objectForKey:key], NULL, CFSTR("=,!$&'()*+;@?\n\"<>#\t :/"), kCFStringEncodingUTF8);
        NSString *copyed = [NSString stringWithString:(__bridge NSString *)rv];
        CFRelease(rv);
		[pairs addObject:[NSString stringWithFormat:@"%@=%@", key, copyed]];
	}
	return [pairs componentsJoinedByString:@"&"];
}

- (NSString*)orderedParametersString {
    return [self buildParametersString:YES];
}

- (NSString*)parametersString {
    return [self buildParametersString:NO];
}

@end


text:
package builders.loom.plugin.java;

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Optional;
import java.util.function.Function;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import builders.loom.util.FileUtil;
import builders.loom.util.ResourceFilteringOutputStream;

class CopyFileVisitor extends SimpleFileVisitor<Path> {

    private static final Logger LOG = LoggerFactory.getLogger(CopyFileVisitor.class);

    private final Path targetBasePath;
    private final KeyValueCache cache;
    private final PathMatcher matcher;
    private final Function<String, Optional<String>> propertyResolver;
    private Path sourceBasePath;

    CopyFileVisitor(final Path targetBasePath, final KeyValueCache cache) throws IOException {
        this(targetBasePath, cache, null, null);
    }

    CopyFileVisitor(final Path targetBasePath, final KeyValueCache cache,
                    final String filterGlob,
                    final Function<String, Optional<String>> propertyResolver) throws IOException {

        this.targetBasePath = targetBasePath;
        this.cache = cache;
        this.propertyResolver = propertyResolver;
        Files.createDirectories(targetBasePath);

        matcher = filterGlob != null
            ? FileSystems.getDefault().getPathMatcher("glob:" + filterGlob)
            : path -> false;
    }

    @Override
    public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs)
        throws IOException {

        if (sourceBasePath == null) {
            sourceBasePath = dir;
            return FileVisitResult.CONTINUE;
        }

        final Path destPath = targetBasePath.resolve(sourceBasePath.relativize(dir));
        if (Files.exists(destPath)) {
            if (Files.isDirectory(destPath)) {
                return FileVisitResult.CONTINUE;
            }

            Files.delete(destPath);
        }

        Files.createDirectory(destPath);

        return FileVisitResult.CONTINUE;
    }

    @Override
    public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs)
        throws IOException {

        final long lastModifiedTime = Files.getLastModifiedTime(file).toMillis();

        final Path relativizedFile = sourceBasePath.relativize(file);

        final String cacheKey = relativizedFile.toString();
        final Long cachedMtime = cache.get(cacheKey);
        if (cachedMtime != null && cachedMtime == lastModifiedTime) {
            return FileVisitResult.CONTINUE;
        }

        final Path destPath = targetBasePath.resolve(relativizedFile);

        if (Files.exists(destPath) && Files.isDirectory(destPath)) {
            FileUtil.deleteDirectoryRecursively(destPath, true);
        }

        if (matcher.matches(relativizedFile)) {
            LOG.debug("Copy file {} with resource filtering", file);
            try (final ResourceFilteringOutputStream out = newOut(destPath)) {
                Files.copy(file, out);
            }
        } else {
            LOG.debug("Copy file {} without resource filtering", file);
            Files.copy(file, destPath, StandardCopyOption.REPLACE_EXISTING);

            // don't cache filtered files -- system properties or environment variables may change
            cache.put(cacheKey, lastModifiedTime);
        }

        return FileVisitResult.CONTINUE;
    }

    private ResourceFilteringOutputStream newOut(final Path destPath) throws IOException {
        return new ResourceFilteringOutputStream(new BufferedOutputStream(Files.newOutputStream(
            destPath, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)),
            propertyResolver);
    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>com.hp.hpl.jena.sparql.engine.binding (Apache Jena ARQ)</title>
<meta name="date" content="2014-10-02">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">

com.hp.hpl.jena.sparql.engine.binding

Interfaces

Binding

BindingMap

Classes

Binding0

Binding1

BindingBase

BindingComparator

BindingFactory

BindingFixed

BindingHashMap

BindingInputStream

BindingOutputStream

BindingProject

BindingProjectBase

BindingProjectNamed

BindingRoot

BindingUtils

BindingWrapped


text:
// Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details.
using System;
using System.Collections.Generic;
using EnvDTE;
using EnvDTE80;
using Microsoft.VisualStudio.CommandBars;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using System.Windows.Forms;

namespace Aurora
{
	// Wrapper class around registering other classes to handle the actual commands.
	// Interfaces with visual studio and handles the dispatch.
	public class Plugin
	{
		private DTE2 m_application;
		private OutputWindowPane m_outputPane;
		private IVsProfferCommands3 m_profferCommands;
		private OleMenuCommandService m_oleMenuCommandService;
		private string m_panelName;
		private ImageList m_icons;

		private Dictionary<string, CommandBase> m_commands = new Dictionary<string, CommandBase>();
		private Dictionary<string, Feature> m_features = new Dictionary<string, Feature>();
		private string m_connectPath;
		private object mOptions;

		public OutputWindowPane OutputPane { get { return GetOutputPane(); } }
		public string Prefix { get { return m_connectPath; } }
		public DTE2 App	{ get { return m_application; }	}
		public Commands Commands {	get { return m_application.Commands; }}
		public OleMenuCommandService MenuCommandService { get { return m_oleMenuCommandService; } }
		public IVsProfferCommands3 ProfferCommands { get { return m_profferCommands; } }
		public object Options { get { return mOptions; } set { mOptions = value; } }
		public ImageList Icons { get { return m_icons; } }

		public Plugin(DTE2 application, IVsProfferCommands3 profferCommands, ImageList icons, OleMenuCommandService oleMenuCommandService, string panelName, string connectPath, object options)
		{
			// TODO: This can be figured out from traversing the assembly and locating the Connect class...
			m_connectPath = connectPath;

			m_application = application;
			m_panelName = panelName;
			m_profferCommands = profferCommands;
			m_oleMenuCommandService = oleMenuCommandService;
			mOptions = options;
			m_icons = icons;
		}

		public void AddFeature(Feature feature)
		{
			m_features.Add(feature.Name, feature);
		}

		public void RegisterCommand(string commandName, CommandBase command)
		{
			m_commands.Add(commandName, command);
		}

		public bool CanHandleCommand(string commandName)
		{
			// TODO: Gotta be a better way to do this... std::find anyone?
			foreach(string key in m_commands.Keys)
			{
				if(commandName.EndsWith("." + key))
					return true;
			}

			return false;
		}

		public bool IsCommandEnabled(string commandName)
		{
			foreach(string key in m_commands.Keys)
			{
				if(commandName.EndsWith("." + key))
					return m_commands[key].IsEnabled();
			}

			return false;
		}

		public bool OnCommand(string name)
		{
			// TODO: Gotta be a better way to do this... std::find anyone?
			foreach(string key in m_commands.Keys)
			{
				if(name.EndsWith("." + key))
				{
					m_commands[key].OnCommand();
					return true;
				}
			}

			return false;
		}

		public CommandEvents FindCommandEvents(string commandName)
		{
			CommandEvents events = null;
			try
			{
				Command command = App.DTE.Commands.Item(commandName, -1);
				if(command != null)
					events = App.DTE.Events.get_CommandEvents(command.Guid, command.ID);
			}
			catch
			{
			}
			return events;
		}

		private Command GetCommand(string commandName)
		{
			Commands2 commands = (Commands2)m_application.Commands;

			string fullName = m_connectPath + "." + commandName;

			try
			{
				Command command = commands.Item(fullName, 0);
				return command;
			}
			catch(System.ArgumentException)
			{
				return null;
			}
		}

		private bool IsCommandRegistered(string commandName)
		{
			return GetCommand(commandName) != null;
		}

		public static bool HasCommand(CommandBar commandBar, string caption)
		{
			foreach(CommandBarControl control in commandBar.Controls)
			{
				if(control.Caption == caption)
					return true;
			}
			return false;
		}

		public CommandBar AddCommandBar(string name, MsoBarPosition position)
		{
			CommandBars cmdBars = (Microsoft.VisualStudio.CommandBars.CommandBars)m_application.CommandBars;
			CommandBar existingCmdBar = null;
			try {
				existingCmdBar = cmdBars[name];
			} catch (Exception) {
			}

			if (existingCmdBar != null)
			{
				return existingCmdBar;
			}
			else
			{
				object CmdBarObj;
				int result = ProfferCommands.AddCommandBar(name, (uint)vsCommandBarType.vsCommandBarTypeToolbar, null, 0, out CmdBarObj);
				if (result != Microsoft.VisualStudio.VSConstants.S_OK)
					System.Diagnostics.Debug.WriteLine("Unable to add Nifty command bar - already exists, perhaps?");
				return CmdBarObj as CommandBar;
			}
/*
			CommandBars cmdBars = (Microsoft.VisualStudio.CommandBars.CommandBars)m_application.CommandBars;
			CommandBar bar = null;

			try
			{
				try
				{
					// Create the new CommandBar
					bar = cmdBars.Add(name, position, false, false);
					bar.Visible = true;
				}
				catch(ArgumentException)
				{
					// Try to find an existing CommandBar
					bar = cmdBars[name];
				}
			}
			catch
			{
			}

			return bar;*/
		}

		private OutputWindowPane GetOutputPane()
		{
			if (m_outputPane != null)
				return m_outputPane;
			try
			{
				m_outputPane = AquireOutputPane(m_application, m_panelName);
			}
			catch (Exception)
			{
			}
			return m_outputPane;
		}

		private static OutputWindowPane AquireOutputPane(DTE2 app, string name)
		{
			if("" == name)
				return null;

			OutputWindowPane result = FindOutputPane(app, name);
			if(null != result)
				return result;

			OutputWindow outputWindow = (OutputWindow)app.Windows.Item(Constants.vsWindowKindOutput).Object;
			OutputWindowPanes panes = outputWindow.OutputWindowPanes;
			return panes.Add(name);
		}

		public static OutputWindowPane FindOutputPane(DTE2 app, string name)
		{
			if("" == name)
				return null;

			OutputWindow outputWindow = (OutputWindow)app.Windows.Item(Constants.vsWindowKindOutput).Object;
			OutputWindowPanes panes = outputWindow.OutputWindowPanes;

			foreach(OutputWindowPane pane in panes)
			{
				if(name != pane.Name)
					continue;

				return pane;
			}

			return null;
		}

		public static void AddKeyboardBinding(Command command, string binding)
		{
			command.Bindings = binding;
		}
	}
}


text:
package com.amazonaws.services.appflow.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ListFlowsResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {

    /**
     *

     * The list of flows associated with your account.
     *

     */
    private java.util.List<FlowDefinition> flows;
    /**
     *

     * The pagination token for next page of data.
     *

     */
    private String nextToken;

    /**
     *

     * The list of flows associated with your account.
     *

     *
     * @return The list of flows associated with your account.
     */

    public java.util.List<FlowDefinition> getFlows() {
        return flows;
    }

    /**
     *

     * The list of flows associated with your account.
     *

     *
     * @param flows
     *        The list of flows associated with your account.
     */

    public void setFlows(java.util.Collection<FlowDefinition> flows) {
        if (flows == null) {
            this.flows = null;
            return;
        }

        this.flows = new java.util.ArrayList<FlowDefinition>(flows);
    }

    /**
     *

     * The list of flows associated with your account.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setFlows(java.util.Collection)} or {@link #withFlows(java.util.Collection)} if you want to override the
     * existing values.
     *

     *
     * @param flows
     *        The list of flows associated with your account.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ListFlowsResult withFlows(FlowDefinition... flows) {
        if (this.flows == null) {
            setFlows(new java.util.ArrayList<FlowDefinition>(flows.length));
        }
        for (FlowDefinition ele : flows) {
            this.flows.add(ele);
        }
        return this;
    }

    /**
     *

     * The list of flows associated with your account.
     *

     *
     * @param flows
     *        The list of flows associated with your account.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ListFlowsResult withFlows(java.util.Collection<FlowDefinition> flows) {
        setFlows(flows);
        return this;
    }

    /**
     *

     * The pagination token for next page of data.
     *

     *
     * @param nextToken
     *        The pagination token for next page of data.
     */

    public void setNextToken(String nextToken) {
        this.nextToken = nextToken;
    }

    /**
     *

     * The pagination token for next page of data.
     *

     *
     * @return The pagination token for next page of data.
     */

    public String getNextToken() {
        return this.nextToken;
    }

    /**
     *

     * The pagination token for next page of data.
     *

     *
     * @param nextToken
     *        The pagination token for next page of data.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ListFlowsResult withNextToken(String nextToken) {
        setNextToken(nextToken);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getFlows() != null)
            sb.append("Flows: ").append(getFlows()).append(",");
        if (getNextToken() != null)
            sb.append("NextToken: ").append(getNextToken());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof ListFlowsResult == false)
            return false;
        ListFlowsResult other = (ListFlowsResult) obj;
        if (other.getFlows() == null ^ this.getFlows() == null)
            return false;
        if (other.getFlows() != null && other.getFlows().equals(this.getFlows()) == false)
            return false;
        if (other.getNextToken() == null ^ this.getNextToken() == null)
            return false;
        if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getFlows() == null) ? 0 : getFlows().hashCode());
        hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
        return hashCode;
    }

    @Override
    public ListFlowsResult clone() {
        try {
            return (ListFlowsResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
{-# LANGUAGE TemplateHaskell #-}
module Server.ServerT where

import           Control.Lens      (makeLenses)
import qualified Data.Vector       as V

import qualified Constants
import           Game.EntityStateT
import           QCommon.SizeBufT
import           Types

makeLenses ''ServerT

newServerT :: ServerT
newServerT = ServerT
    { _sState         = 0
    , _sAttractLoop   = False
    , _sLoadGame      = False
    , _sTime          = 0
    , _sFrameNum      = 0
    , _sName          = ""
    , _sModels        = V.replicate Constants.maxModels (Ref (-1))
    , _sConfigStrings = V.replicate Constants.maxConfigStrings ""
    , _sBaselines     = V.replicate Constants.maxEdicts (newEntityStateT Nothing)
    , _sMulticast     = newSizeBufT
    , _sMulticastBuf  = ""
    , _sDemoFile      = Nothing
    , _sTimeDemo      = 0
    }


text:
<resources>
    <string name="app_name">Aplicacion 6</string>
</resources>


text:
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Input;
using Afnor.Silverlight.Toolkit.ViewServices;
using EspaceClient.BackOffice.Domaine;
using EspaceClient.BackOffice.Silverlight.Business.Depots;
using EspaceClient.BackOffice.Silverlight.Business.Interfaces;
using EspaceClient.BackOffice.Silverlight.Business.Loader;
using EspaceClient.BackOffice.Silverlight.ViewModels.Administration.Edition;
using EspaceClient.BackOffice.Silverlight.ViewModels.Administration.Edition.Tabs.Details;
using EspaceClient.BackOffice.Silverlight.ViewModels.Common.Modularity;
using EspaceClient.BackOffice.Silverlight.ViewModels.DtoViewModels;
using EspaceClient.BackOffice.Silverlight.ViewModels.Interfaces.Modularity;
using EspaceClient.BackOffice.Silverlight.ViewModels.Messages;
using EspaceClient.BackOffice.Silverlight.ViewModels.ModelBuilders.Common;
using EspaceClient.BackOffice.Silverlight.ViewModels.ModelBuilders.Common.Modularity;
using EspaceClient.FrontOffice.Domaine;
using EspaceClient.FrontOffice.Infrastructure.Constant;
using nRoute.Components;
using nRoute.Components.Composition;
using OGDC.Silverlight.Toolkit.Debuging;
using OGDC.Silverlight.Toolkit.Services.Services;

namespace EspaceClient.BackOffice.Silverlight.ViewModels.ModelBuilders.Administration.Edition.Details.Implementation
{
    /// <summary>
    ///
    /// </summary>
    [MapResource(typeof(IModelBuilderInformation), InstanceLifetime.Singleton)]
    public class ModelBuilderInformation : ModelBuilderPanelBase, IModelBuilderInformation
    {
        private readonly IResourceWrapper _resourceWrapper;
        private readonly IApplicationContext _applicationContext;
        private readonly ILoaderReferentiel _referentiel;
        private readonly IDepotEntite _entitees;
        private readonly IDepotEdition _edition;
        private readonly IDepotTraductionOM _depotTraductionOM;
        private readonly INotificationViewService _notificationViewService;
        private readonly IMessenging _messengingService;
        private readonly IDepotSociete _societeDepot;

        [ResolveConstructor]
        public ModelBuilderInformation(
            IResourceWrapper resourceWrapper,
            IApplicationContext applicationContext,
            ILoaderReferentiel referentiel,
            IDepotEntite entitees,
            IDepotEdition edition,
            INotificationViewService notificationViewService,
            IMessenging messengingService,
            IDepotTraductionOM depotTraductionOM,
            IDepotSociete societeDepot)
        {
            _resourceWrapper = resourceWrapper;
            _applicationContext = applicationContext;
            _referentiel = referentiel;
            _entitees = entitees;
            _edition = edition;
            _notificationViewService = notificationViewService;
            _messengingService = messengingService;
            _depotTraductionOM = depotTraductionOM;
            _societeDepot = societeDepot;

            CodeActionsGenerales.Add("CancelEdition");
            CodeActionsGenerales.Add("SaveEdition");

        }

        /// <summary>
        ///
        /// </summary>
        public InformationViewModel Build(EditionEntityViewModel editionEntityViewModel)
        {
            var viewModel = new InformationViewModel(_referentiel, _entitees, _messengingService, _edition)
            {
                DropDownToolbarItemCommands = new ObservableCollection<DropDownToolbarItemViewModel>(),
                ToolbarButtonCommands = new ObservableCollection<ToolbarButtonViewModel>(),
                Entity = editionEntityViewModel,
            };

            #region Action Generale

            var typeActionGeneraleToolbar = _applicationContext.TypeActionsGenerales.Where(x => x.Code.Equals(Constants.GetStringValue(ActionsGeneralesType.Toolbar))).FirstOrDefault();
            var typeActionGeneraleVues = _applicationContext.TypeActionsGenerales.Where(x => x.Code.Equals(Constants.GetStringValue(ActionsGeneralesType.Vue))).FirstOrDefault();

            if (typeActionGeneraleToolbar == null || typeActionGeneraleVues == null)
                throw new Exception("Type d'action manquants.");

            foreach (var codeActionsGenerale in CodeActionsGenerales)
            {
                // On récupère les actions correspondants à ce droit.
                var Actions = _applicationContext.ActionsGenerales.Where(x => x.CodeAction.Equals(codeActionsGenerale)).Where(x => x.TypeActionGeneraleID.Equals(typeActionGeneraleToolbar.ID));

                foreach (var Action in Actions)
                {
                    ICommand Command = null;

                    // On associe le traitement grace au CodeAction
                    switch (Action.CodeAction)
                    {
                        case "CancelEdition":
                            Command = new ActionCommand<TabViewModel>(OnRollback);
                            break;
                        case "SaveEdition":
                            Command = new ActionCommand<TabViewModel>(OnSave);
                            break;

                        default:
                            DebugHelper.WriteLine(DebugType.Contact, "[!!!] L'action générale '{0}' n'est pas gérée.", new object[] { Action.CodeAction });
                            break;
                    }

                    // For Testing Ability :
                    // var Translator = new ModelBuilderTranslator(referentiel, _applicationContext);
                    var Translator = ResourceLocator.GetResource<IModelBuilderTranslator>();

                    var ToolbarButton = Translator.Translate(Action, Command);

                    if (ToolbarButton == null)
                        continue;

                    viewModel.ToolbarButtonCommands.Add(ToolbarButton);
                }
            }

            #endregion

            #region Action Specifique

            foreach (var CodeAction in CodeActionsSpecifiques)
            {
                // On récupère les actions correspondants à ce droit.
                var Actions = _applicationContext.ActionsSpecifiques.Where(x => x.CodeAction.Equals(CodeAction));

                foreach (var Action in Actions)
                {
                    ICommand Command = null;

                    // On associe le traitement grace au CodeAction
                    switch (Action.CodeAction)
                    {
                        case "":
                            break;
                        default:
                            DebugHelper.WriteLine(DebugType.Contact, "[!!!] L'action générale '{0}' n'est pas gérée.", new object[] { Action.CodeAction });
                            break;
                    }

                    // For Testing Ability :
                    // var Translator = new ModelBuilderTranslator(referentiel, _applicationContext);
                    var Translator = ResourceLocator.GetResource<IModelBuilderTranslator>();

                    var ToolbarButton = Translator.Translate(Action, Command);

                    if (ToolbarButton == null)
                        continue;

                    viewModel.DropDownToolbarItemCommands.Add(ToolbarButton);
                }
            }

            #endregion

            return viewModel;
        }

        public void OnRollback(TabViewModel viewModel)
        {
            var tabBase = viewModel.ViewModel as TabBase;
            var accordionViewModel = viewModel.ViewModel as IAccordionComposition;
            var accordionItemViewModel = accordionViewModel.SelectedAccordionItem.ViewModel as IAccordionItemComposition<EditionEntityViewModel>;
            var entity = accordionItemViewModel.Entity;

            DebugHelper.WriteLine(DebugType.Contact, "Rollback {0} {1} {2}", new object[] { accordionViewModel, accordionItemViewModel, entity });

            entity.ChangeTracker.Reset();

            tabBase.RefreshTab<EditionEntityViewModel>();
        }

        public void OnSave(TabViewModel viewModel)
        {
            var tabBase = viewModel.ViewModel as TabBase;
            var accordionViewModel = viewModel.ViewModel as IAccordionComposition;
            var accordionItemViewModel = accordionViewModel.SelectedAccordionItem.ViewModel as IAccordionItemComposition<EditionEntityViewModel>;
            var entity = accordionItemViewModel.Entity;

            entity.Edition.NotifyAllCheckError(entity.Edition);

            if (entity.Edition.HasErrors == true)
                return;

            BeginLoading(viewModel);

            var dtoEdition = AutoMapper.Mapper.Map<EditionDtoViewModel, EditionDto>(entity.Edition);

            if (viewModel.IsCreating == false) // dtoEdition.ID >= 1)
            {
                _edition.SaveEdition(dtoEdition,
                     r0 =>
                     {
                         entity.Edition.ID = r0.ID;

                         _notificationViewService.ShowNotification(_resourceWrapper.StringsResourceManager.GetString("SaveCompleted"));

                         _messengingService.Publish<UpdateListMessage>(new UpdateListMessage(TypeUpdateList.RechercheEdition));

                         _messengingService.Publish<UpdateTabMessage>(new UpdateTabMessage(viewModel)
                         {
                             Title = String.Format("{0}", entity.Edition.Description),
                         }, false);

                         EndLoading(viewModel);

                         entity.ChangeTracker.Reset();

                         tabBase.RefreshTab<EditionEntityViewModel>();

                     }, error =>
                     {
                         _messengingService.Publish(new ErrorMessage(error));

                         EndLoading(viewModel);
                     });
            }
            else
            {
                _edition.SaveEdition(dtoEdition,
                 r0 =>
                 {
                     // une fois les trductions crées on les charge
                     _depotTraductionOM.GetTraductionOMByID("Edition", r0.ID, traductionOM =>
                     {
                         viewModel.IsCreating = false;

                         entity.Edition.ID = r0.ID;

                         entity.ListeTraductionOM = new ObservableCollection<TraductionOMDtoViewModel>();

                         foreach (var t in traductionOM)
                             entity.ListeTraductionOM.Add(AutoMapper.Mapper.Map<TraductionOMDto, TraductionOMDtoViewModel>(t));

                         _notificationViewService.ShowNotification(_resourceWrapper.StringsResourceManager.GetString("SaveCompleted"));

                         _messengingService.Publish<UpdateListMessage>(new UpdateListMessage(TypeUpdateList.RechercheEdition));

                         _messengingService.Publish<UpdateTabMessage>(new UpdateTabMessage(viewModel)
                         {
                             Title = String.Format("{0}", entity.Edition.Description),
                             Id = r0.ID
                         }, false);

                         EndLoading(viewModel);

                         entity.ChangeTracker.Reset();

                         tabBase.RefreshTab<EditionEntityViewModel>();

                     }, error =>
                         {
                             _messengingService.Publish(new ErrorMessage(error));

                             _notificationViewService.ShowNotification(_resourceWrapper.StringsResourceManager.GetString("SaveFailed"));

                             EndLoading(viewModel);
                         });

                 }, error =>
                 {
                     _messengingService.Publish(new ErrorMessage(error));

                     _notificationViewService.ShowNotification(_resourceWrapper.StringsResourceManager.GetString("SaveFailed"));

                     EndLoading(viewModel);
                 });
            }
        }
    }
}


text:
{% extends "devhub/base.html" %}

{% set title = _('Author invitation for {addon_name}')|format_html(addon_name=addon.name) %}

{% block title %}
    {{ dev_page_title(title, addon) }}
{% endblock %}

{% block content %}

{{ addon.name }}

    <form method="post" class="item">
        {% csrf_token %}

                {{ _('You have been invited to become an author of {addon_name}.')|format_html(addon_name=addon.name) }}

                {{ _('Accepting the invitation will give you access to edit the add-on, and may show your name in the authors list on the website. ') }}
                {{ _('Click on the Accept button below to confirm you want to be added as an author for {addon_name}.')|format_html(addon_name=addon.name) }}

 <button type="submit" name="accept" value="yes">{{ _('Accept') }}</button> <button class="delete-button" type="submit" name="accept" value="no">{{ _('Decline') }}</button>

    </form>

{% endblock %}


text:
	<form action="<?php echo site_url('finalItem/kenza/update'); ?>" method="POST" data-provide="validation">
		<input type="hidden" name="id" value="<?php echo $id; ?>">
		<input type="hidden" name="AuctionItemId" value="<?php echo $AuctionItemId; ?>">

Data Unit

				<?php
				$divAwal = '
';
				$divTutup = '
';
				for($i = 0; $i < count($formDinamis); $i++){
					if ($i % 2 == 0) echo $divAwal;
					?>

						<label for="<?php echo $formDinamis[$i]['idInput']; ?>" class="col-lg-3 col-sm-12 col-md-12 control-label">
							<?php echo $formDinamis[$i]['namaLabel']; ?>

							<?php echo $formDinamis[$i]['typeInput']; ?>

					<?php
					if ($i%2!=0) echo $divTutup;
				}
				if ($i%2!=0) echo $divTutup;
				?>

Kondisi Unit

				<input type="hidden" value="" id="count_taksasi-1" />

							No
							Eksterior
							Tipe Bagian
							Nama Kerusakan
							Nama Level Kerusakan
							Level Kerusakan
							Keterangan
							Gambar
							Harga

				<input type="hidden" value="" id="count_taksasi-2" />

							No
							Interior
							Tipe Bagian
							Nama Kerusakan
							Nama Level Kerusakan
							Level Kerusakan
							Gambar
							Harga

				<input type="hidden" value="" id="count_taksasi-3" />

							No
							Mesin
							Tipe Bagian
							Nama Kerusakan
							Nama Level Kerusakan
							Level Kerusakan
							Gambar
							Harga

				<input type="hidden" value="" id="count_taksasi-4" />

							No
							Rangka
							Tipe Bagian
							Nama Kerusakan
							Nama Level Kerusakan
							Level Kerusakan
							Gambar
							Harga

					Catatan

						<textarea name="Desc" id="Desc" placeholder="Keterangan" class="form-control required " rows="4"></textarea>

Nilai iCar

					MRP :

						<input type="text" id="mrp_price" name="mrp_price" class="form-control col-sm-12 ttipDatatables text-align-right" title="MRP" value="<?=$iCar['Mrp'];?>" onkeyup="convertToRupiah(this)" onblur="hitung()" required />

				<?php
				$loopDetail = 1;
				foreach($iCarDetail as $keyicd => $icd) {
				?>

						<?php echo $icd['DamageName'];?> :

<?php echo $icd['Evaluation'];?>

<?php echo $icd['EvaluationScore'];?>

						<div class="col-lg-2 col-md-3 col-sm-3 pull-left text-align-right" id="nominal_taksasi-<?=$loopDetail;?>">0

				<?php
					$loopDetail++;
				}
				?>

					Total :

<?php echo $iCar['TotalEvaluationResult'];?>

<?php echo $iCar['TotalEvaluationScore'];?>

					Gtf :

					Faktor Doc :

						<input type="text" id="doc_price" name="doc_price" class="form-control col-sm-12 ttipDatatables text-align-right" title="Faktor Doc" value="<?php echo $iCar['FactorDoc'] !== '' ? $iCar['FactorDoc'] : 0;?>" onkeyup="convertToRupiah(this)" onblur="hitung()" required />

					Time Lag :

						%
						<input type="text" id="lain_price" name="lain_price" value="<?php echo $iCar['FactorLain'] !== '' ? $iCar['FactorLain'] : 0;?>" class="form-control col-sm-3 ttipDatatables text-align-right pull-right" title="Time Lag" maxlength="2" onkeyup="convertToRupiah(this)" onblur="hitung()" required />

					Faktor Lain :

					Harga Akhir :

						<input type="text" id="final_price" name="final_price" class="form-control col-sm-12 ttipDatatables text-align-right" title="Harga Akhir" onkeyup="convertToRupiah(this)" onblur="hitung()" required />

					Range Harga Rekomendasi :

						<input type="text" name="startRec" id="startRec" class="col-lg-3 form-control text-align-right pull-left ttipDatatables" title="Rata Rata Awal" onkeyup="convertToRupiah(this)" value="<?php echo $iCar['StartRecomendation'];?>" required />

-

						<input type="text" name="endRec" id="endRec" class="col-lg-3 form-control text-align-right pull-left ttipDatatables" title="Rata Rata Akhir" onkeyup="convertToRupiah(this)" value="<?php echo $iCar['EndRecomendation'];?>" required />

					Harga Item Terakhir :

						<input type="text" id="final_price_item" name="final_price_item" class="form-control col-sm-12 ttipDatatables text-align-right" title="Harga Item Terakhir" />

Lampiran

						UNIT

							<img src="<?php echo @$iCarImage[0]['ImagePath'] ?>" width="150" />
							Eksterior Depan

							<img src="<?php echo @$iCarImage[1]['ImagePath'] ?>" width="150" />
							Eksterior Kanan

							<img src="<?php echo @$iCarImage[2]['ImagePath'] ?>" width="150" />
							Eksterior Belakang

							<img src="<?php echo @$iCarImage[3]['ImagePath'] ?>" width="150" />
							Eksterior Kiri

							<img src="<?php echo @$iCarImage[4]['ImagePath'] ?>" width="150" />
							Interior Depan

							<img src="<?php echo @$iCarImage[5]['ImagePath'] ?>" width="150" />
							Engine

						DOKUMEN

						Dokumen STNK
						Dokumen BPKB
						Dokumen Invoice
						Dokumen KEUR
						Dokumen FormA

				<button type="submit" class="btn btn-success pull-right ttipDatatables" data-provide="tooltip" title="Simpan" id="saveForm"> Simpan</button>
				<button type="button" class="btn btn-default pull-right ttipDatatables" data-provide="tooltip" title="Batal" onclick="location.href='<?=site_url('finalitem/kenza/lists');?>'">Batal</button>

	</form>


text:
/*	all web pages with Google Charts should include the following
 *	line in the of the web page to load the Google Chart libraries.
 */
google.charts.load('current', {packages: ['corechart','scatter']});

/*	decBin function is to convert (Decimal to Binary) with specify length of the output.
 *	The function take 2 arguments ( dec, length)
 *	dec   : is the decimal number, which need to be convert to binary
 *	length: is the desirable precision
 *	The function convert positive decimal as well as negative decimal
 */
function decBin(dec,length){
	var out = "";
	while(length--)
		out += (dec >> length ) & 1;
	return out;
}

/* checkIndex function is to check if the mobile variable has not run out of range to precArr length. */
function checkIndex(){
	if(mobile < precArr.length){return true;}else{return false;}
}

/* reset function is to reset all the interactive action from user with chart.
 * set the mobile variable to zero index ( the start of precArr )
 */
function reset(){
	mobile = 0;
	xValue = null;
	yValue = null;
	clickIndex = 0;
}

/* getPrecision Function is to create array of the different dimensional to chart.
 * The function has to reset mobile variable to zero, which will point to the start of precArr.
 * The function will be execute onload of the body tag and when a user changes the selected option of a <select> element.
 */
var mobile = 0;
var precArr = [];

function getPrecision(){
	precArr = [];
	mobile  = 0;
	var temp= Math.pow(2, document.getElementById("precision").value);

	while((temp / 16) >= 1){
		temp /= 16;
		precArr.push(temp-1);
	}
	console.log(precArr);
}

// Declare global variable, which will get their value from drawChart function,
// only if the user has interacted with chart ( click on (x,y) ).
var xValue = null;
var yValue = null;

var clickedX = [];
var clickedY = [];
var clickIndex = 0;

/* getBack function provide to the user the previous event of chart.
 * The function provide event points to the appropriate function (current )
 */
function getBack(){
	if(mobile != 0){ mobile -= 1;}else{ mobile = 0;}

	if(clickIndex == 0 || clickIndex == 1){
		xValue= null;
		yValue=null;
		clickIndex = 0;
	}else{
		clickIndex -= 1;
		xValue=clickedX[clickIndex-1];
		yValue=clickedY[clickIndex-1];

	}
	getRequest();
}

/*	getRequest function is to create object of the selected options
 *	and call the appropriate function depending on user request.
 */
function getRequest(){
	var op = document.getElementById("operations").value;
	switch(op){
		case "addition":
			add();
			break;
		case "subtraction":
			sub();
			break;
		case "multiplication":
			mult();
			break;
		case "division":
			divi();
			break;
		default:
			alert('▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n'
				+ 'Something went wrong!\n'
				+ 'Please contact the publisher and let the author know about the bug.\n'
				+ 'amr11682@hotmail.com');
			break;
	}
}

// function to create the simulation of Arithmetics operation ( addition )
function add(){
	var prec  = parseInt(document.getElementById("precision").value);

	var range = Math.pow(2, prec);

	var height= precArr[mobile];
	var width = precArr[mobile];

	var index = 0;
	var rows  = [];

	var f1; // axis data format
	var f2; // axis data format

	var getPixel = function(x, y, height, width, dictX, dictY) {
		var correct = 0;
		var overflow = 0;

		var check = function(x,y) {
			if (x + y < range) { correct += 1; } else { overflow += 1; }
		}
	    check(x, y);
		check(x, y + height);
		check(x + width, y);
	    check(x + width, y + height);
        console.log(x,y,correct, overflow, dictX, dictY, index);
	    if (correct > 0 && overflow == 0) {
	    	// Correct data
			rows[index] = [dictX, dictY, null, null];

		} else if(overflow > 0 && correct == 0) {
			// Overflow data
			rows[index] = [dictX, null, dictY, null];

		} else {
			// Mix data
			rows[index] = [dictX, null, null, dictY];
		}
	}
	var xV;
	var yV;
	if(xValue == null && yValue == null){xV=0; yV=0;}else{xV = xValue; yV = yValue;}
	if(clickIndex > 0){clickedX.push(xV);clickedY.push(yV);}

	var getFormat = function(param){f1 = decBin(param, prec); f2 = decBin(param+height, prec);}
	//var x = 0
	for(var x = xV, i = 0; i < 16; i++, x += width+1){
		getFormat(x);
		var dictX = {v:x, f:'X: '+f1+' - '+f2};
		//var y = 0
		for(var y = yV, j = 0; j < 16; j++, y += height+1){
			getFormat(y);
			var dictY = {v:y, f:'Y: '+f1+' - '+f2};
			getPixel(x, y, height, width, dictX, dictY);
			index += 1;
		}
	}
	drawChart(rows, ['Overflow', 'Mix']);
}

// function to create the simulation of Arithmetics operation ( subtraction )
function sub(){//xValue, yValue){
	var prec  = parseInt(document.getElementById("precision").value);
	// range to iteration (loop)
	var range = Math.pow(2, prec);

	var height= precArr[mobile];
	var width = precArr[mobile];

	var index = 0;
	var rows  = [];

	var f1; // axis data format
	var f2; // axis data format

	var getPixel = function(x, y, height, width, dictX, dictY) {
		var correct = 0;
		var underflow = 0;

		var check = function(x,y) {
			if ((x - y) >=0 && (x - y) < range) { correct += 1; } else { underflow += 1; }
		}
	    check(x, y);
		check(x, y + height);
		check(x + width, y);
	    check(x + width, y + height);
        console.log(x,y,correct, underflow, dictX, dictY, index);
	    if (correct > 0 && underflow == 0) {
	    	// Correct data
			rows[index] = [dictX, dictY, null, null];

		} else if(underflow > 0 && correct == 0) {
			// Overflow data
			rows[index] = [dictX, null, dictY, null];

		} else {
			// Mix data
			rows[index] = [dictX, null, null, dictY];
		}
	}
	var xV;
	var yV;
	if(xValue == null && yValue == null){xV=0; yV=0;}else{xV = xValue; yV = yValue;}
	if(clickIndex > 0){clickedX.push(xV);clickedY.push(yV);}

	var getFormat = function(param){f1 = decBin(param, prec); f2 = decBin(param+height, prec);}
	//var x = 0
	for(var x = xV, i = 0; i < 16; i++, x += width+1){
		getFormat(x);
		var dictX = {v:x, f:'X: '+f1+' - '+f2};
		//var y = 0
		for(var y = yV, j = 0; j < 16; j++, y += height+1){
			getFormat(y);
			var dictY = {v:y, f:'Y: '+f1+' - '+f2};
			getPixel(x, y, height, width, dictX, dictY);
			index += 1;
		}
	}
	drawChart(rows, ['Underflow', 'Mix']);
}

// function to create the simulation of Arithmetics operation ( multiplication )
function mult(){//xValue, yValue){
	var prec  = parseInt(document.getElementById("precision").value);
	// range to iteration (loop)
	var range = Math.pow(2, prec);

	var height= precArr[mobile];
	var width = precArr[mobile];

	var index = 0;
	var rows  = [];

	var f1; // axis data format
	var f2; // axis data format

	var getPixel = function(x, y, height, width, dictX, dictY) {
		var correct = 0;
		var overflow = 0;

		var check = function(x,y) {
			if (x * y < range) { correct += 1; } else { overflow += 1; }
		}
	    check(x, y);
		check(x, y + height);
		check(x + width, y);
	    check(x + width, y + height);
        console.log(x,y,correct, overflow, dictX, dictY, index);
	    if (correct > 0 && overflow == 0) {
	    	// Correct data
			rows[index] = [dictX, dictY, null, null];

		} else if(overflow > 0 && correct == 0) {
			// Overflow data
			rows[index] = [dictX, null, dictY, null];

		} else {
			// Mix data
			rows[index] = [dictX, null, null, dictY];
		}
	}
	var xV;
	var yV;
	if(xValue == null && yValue == null){xV=0; yV=0;}else{xV = xValue; yV = yValue;}
	if(clickIndex > 0){clickedX.push(xV);clickedY.push(yV);}

	var getFormat = function(param){f1 = decBin(param, prec); f2 = decBin(param+height, prec);}

	for(var x = xV, i = 0; i < 16; i++, x += width+1){
		getFormat(x);
		var dictX = {v:x, f:'X: '+f1+' - '+f2};
		//var y = 0
		for(var y = yV, j = 0; j < 16; j++, y += height+1){
			getFormat(y);
			var dictY = {v:y, f:'Y: '+f1+' - '+f2};
			getPixel(x, y, height, width, dictX, dictY);
			index += 1;
		}
	}
	drawChart(rows, ['Overflow', 'Mix']);
}

// function to create the simulation of Arithmetics operation ( division )
function divi(){//xValue, yValue){
	var prec  = parseInt(document.getElementById("precision").value);
	// range to iteration (loop)
	var range = Math.pow(2, prec);

	var height= precArr[mobile];
	var width = precArr[mobile];

	var index = 0;
	var rows  = [];

	var f1; // axis data format
	var f2; // axis data format

	var getPixel = function(x, y, height, width, dictX, dictY) {
		var correct = 0;
		var infi    = 0;
		var Inexpressible = 0;

		var check = function(x,y) {
			if ((x/y) % 1 == 0) { correct += 1; }else if(isNaN(x/y) || !(isFinite(x/y))) { infi += 1;}else{ Inexpressible += 1; }
		}
	    check(x, y);
		check(x, y + height);
		check(x + width, y);
	    check(x + width, y + height);
        console.log(x,y,correct, Inexpressible, infi, dictX, dictY, index);
	    if (correct > 0 && Inexpressible == 0 && infi == 0) {
	    	// Correct data: does (1/3) which is 0.33.. mod 1  equal to zero
			rows[index] = [dictX, dictY, null, null, null];

		} else if(Inexpressible > 0 && correct == 0 && infi == 0) {
			// Inexpressible data
			rows[index] = [dictX, null, dictY, null, null];

		}else if(infi > 0 && correct == 0 && Inexpressible == 0) {
			// check if is NAN eg. 0/0  or is Infinity(not finite)  eg. 1/0 , 1000/0
			rows[index] = [dictX, null, null, dictY, null];

		} else {
			// Mix data
			rows[index] = [dictX, null, null, null, dictY];
		}
	}
	var xV;
	var yV;
	if(xValue == null && yValue == null){xV=0; yV=0;}else{xV = xValue; yV = yValue;}
	if(clickIndex > 0){clickedX.push(xV);clickedY.push(yV);}

	var getFormat = function(param){f1 = decBin(param, prec); f2 = decBin(param+height, prec);}

	for(var x = xV, i = 0; i < 16; i++, x += width+1){
		getFormat(x);
		var dictX = {v:x, f:'X: '+f1+' - '+f2};

		for(var y = yV, j = 0; j < 16; j++, y += height+1){
			getFormat(y);
			var dictY = {v:y, f:'Y: '+f1+' - '+f2};
			getPixel(x, y, height, width, dictX, dictY);
			index += 1;
		}
	}                                 //divide by zero
	drawChart(rows, ['Inexpressible', 'infinity','Mix']);
}

function drawChart(arg1, arg2) {
	// Define the chart to be drawn.
	var data = new google.visualization.DataTable();
	data.addColumn('number', '');
	data.addColumn('number', 'correct');
	if (arg2.length == 3){
		// numbers do not divide evenly  (Inexpressible)
		data.addColumn('number', arg2[0]);
		// divide by zero
		data.addColumn('number', arg2[1]);
		// Mixed
		data.addColumn('number', arg2[2]);
	} else{
		// Overflow or Underflow
		data.addColumn('number', arg2[0]);
		// Mixed
		data.addColumn('number', arg2[1]);
	}

   	data.addRows(arg1);
    var options = {
    	chart: {
    		title: ' Plotting the behaviour of floating point with Basic Arithmetics',
        	//subtitle: 'Based on precision 4 bits'
     	},
     	width: 1150,
     	height: 500,
     	explorer: {
     		actions: ['dragToZoom', 'rightClickToReset'],
        	axis: 'horizontal',
        	keepInBounds: true,
        	maxZoomIn: 4.0
    	},
    };
    var chart = new google.charts.Scatter(document.getElementById('chart_div1'));

    chart.draw(data, google.charts.Scatter.convertOptions(options));

	// Listen for the 'select' event, and call my function selectHandler() when
	// the user selects something on the chart.

    google.visualization.events.addListener(chart, 'select', selectHandler);

    // This function to get the index of the selected element of chart.
	function selectHandler() {

		mobile += 1;

		var selectedItemRow = chart.getSelection()[0].row;
		var selectedItemCol = chart.getSelection()[0].column;

		if (selectedItemRow != null){

			xValue = data.getValue(selectedItemRow, 0);
			yValue = data.getValue(selectedItemRow, selectedItemCol);

			var valid  = checkIndex();

			if(valid){
				clickIndex += 1;
				getRequest();
			}
		}
	};
}