The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    ArrowInvalid
Message:      JSON parse error: Missing a closing quotation mark in string. in row 903
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
                  dataset = json.load(f)
                File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
                  return loads(fp.read(),
                File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
                  return _default_decoder.decode(s)
                File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
                  raise JSONDecodeError("Extra data", s, end)
              json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 731)
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
                  for _, table in generator:
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
                  raise e
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
                  pa_table = paj.read_json(
                File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
                File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
                File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
              pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 903
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
                  parquet_operations = convert_to_parquet(builder)
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
                  builder.download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
                  self._download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
                  self._prepare_split(split_generator, **prepare_split_kwargs)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

text
string
meta
dict
public class Dog { int size; String name; void bark(int numOfBarks) { for(int x=0; x<numOfBarks; x++) { System.out.println("Number of Barks: " + numOfBarks); System.out.println("Ruff!"); } } }
{ "content_hash": "cc0716a60635a00f6e1dd8969e623fda", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 55, "avg_line_length": 13.533333333333333, "alnum_prop": 0.645320197044335, "repo_name": "ZincOBrien/demo", "id": "9171c0aab64c504d7eae61e3eb396c1c1d5d326a", "size": "203", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Java Docs/src/Dog.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "47199" } ] }
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Drawing; namespace Effekseer.GUI.Dock { public class FileBrowser : DockPanel { public string CurrentPath { get; private set; } string addressText = string.Empty; bool addressEditing = false; bool addressActivated = false; List<FileItem> items = new List<FileItem>(); int selectedIndex = -1; string menuOpenFile; string menuShowInFileManager; string menuImportFromPackage; string menuExportToPackage; FileSystemWatcher directoryWatcher = new FileSystemWatcher(); bool shouldUpdateFileList = true; const string OptionMenuPopupId = "###FileBrowserOptionMenu"; const string ContextMenuPopupId = "###FileBrowserContextMenu"; public FileBrowser() { Label = Icons.PanelFileBrowser + Resources.GetString("FileBrowser") + "###FileVeiwer"; DocPage = "fileviewer.html"; TabToolTip = Resources.GetString("FileBrowser"); menuOpenFile = Resources.GetString("FileBrowser_OpenFile"); if (swig.GUIManager.IsMacOSX()) { menuShowInFileManager = Resources.GetString("FileBrowser_ShowInFinder"); } else { menuShowInFileManager = Resources.GetString("FileBrowser_ShowInExplorer"); } menuImportFromPackage = Resources.GetString("FileBrowser_ImportFromPackage"); menuExportToPackage = Resources.GetString("FileBrowser_ExportToPackage"); directoryWatcher.Changed += (o, e) => { shouldUpdateFileList = true; }; directoryWatcher.Renamed += (o, e) => { shouldUpdateFileList = true; }; directoryWatcher.Deleted += (o, e) => { shouldUpdateFileList = true; }; directoryWatcher.Created += (o, e) => { shouldUpdateFileList = true; }; UpdateFileListWithProjectPath(Core.Root.GetFullPath()); Core.OnAfterLoad += OnAfterLoad; Core.OnAfterNew += OnAfterLoad; Core.OnAfterSave += OnAfterSave; } public override void OnDisposed() { Core.OnAfterLoad -= OnAfterLoad; Core.OnAfterNew -= OnAfterLoad; Core.OnAfterSave -= OnAfterSave; } protected override void UpdateInternal() { var regionSize = Manager.NativeManager.GetContentRegionAvail(); float dpiScale = Manager.DpiScale; var spacing = Manager.NativeManager.GetStyleVar2(swig.ImGuiStyleVarFlags.ItemSpacing); Manager.NativeManager.PushItemWidth(-1); // Address bar UpdateAddressBar(dpiScale, regionSize, spacing); Manager.NativeManager.Separator(); // Display all files UpdateFileView(dpiScale, regionSize, spacing); Manager.NativeManager.PopItemWidth(); UpdateKeyNavication(); if (shouldUpdateFileList) { UpdateFileList(); shouldUpdateFileList = false; } } protected override void UpdateToolbar() { } void UpdateAddressBar(float dpiScale, swig.Vec2 regionSize, swig.Vec2 spacing) { float buttonWidth = Manager.NativeManager.GetTextLineHeight() + Manager.NativeManager.GetStyleVar2(swig.ImGuiStyleVarFlags.FramePadding).X * 2; // Back directory if (Manager.NativeManager.Button("↑", buttonWidth) && !String.IsNullOrEmpty(CurrentPath)) { UpdateFileListWithProjectPath(CurrentPath); } Manager.NativeManager.SameLine(); // Display current directory if (addressActivated || addressEditing) { Manager.NativeManager.PushItemWidth(regionSize.X - buttonWidth * 3 - spacing.X * 3); if (addressActivated) { Manager.NativeManager.SetKeyboardFocusHere(); addressEditing = true; addressActivated = false; } if (Manager.NativeManager.InputText("###AddressText", addressText)) { addressText = Manager.NativeManager.GetInputTextResult(); UpdateFileList(addressText); } if (Manager.NativeManager.IsItemDeactivated()) { addressEditing = false; addressText = CurrentPath; } Manager.NativeManager.PopItemWidth(); } else { string label = Path.GetFileName(CurrentPath) + "###AddressButton"; if (Manager.NativeManager.Button(label, regionSize.X - buttonWidth * 3 - spacing.X * 3)) { addressActivated = true; } } Manager.NativeManager.SameLine(); if (Manager.NativeManager.Button(Icons.NavMenu, buttonWidth)) { Manager.NativeManager.OpenPopup(OptionMenuPopupId); } UpdateOptionMenu(); Manager.NativeManager.SameLine(); if (Manager.NativeManager.Button("?", buttonWidth)) { Commands.ShowURL(DocURL); } if (BindableComponent.Functions.CanShowTip()) { Manager.NativeManager.SetTooltip(Resources.GetString("Panel_Help_Desc")); } } void UpdateOptionMenu() { float fontSize = Manager.NativeManager.GetTextLineHeight(); Manager.NativeManager.SetNextWindowSize(fontSize * 20, 0.0f, swig.Cond.Always); if (Manager.NativeManager.BeginPopup(OptionMenuPopupId)) { var viewMode = Core.Option.FileBrowserViewMode.GetValue(); Manager.NativeManager.PushItemWidth(fontSize * 8); // View Mode setting string comboLabel = MultiLanguageTextProvider.GetText("Options_FileBrowserViewMode_Name"); string comboSelectedLabel = MultiLanguageTextProvider.GetText("FileBrowser_ViewMode_" + Core.Option.FileBrowserViewMode.GetValue().ToString() + "_Name"); if (Manager.NativeManager.BeginCombo(comboLabel, comboSelectedLabel, swig.ComboFlags.None)) { string iconViewLabel = MultiLanguageTextProvider.GetText("FileBrowser_ViewMode_" + Data.OptionValues.FileViewMode.IconView.ToString() + "_Name"); if (Manager.NativeManager.Selectable(iconViewLabel, viewMode == Data.OptionValues.FileViewMode.IconView)) { Core.Option.FileBrowserViewMode.SetValueDirectly(Data.OptionValues.FileViewMode.IconView); } string listViewLabel = MultiLanguageTextProvider.GetText("FileBrowser_ViewMode_" + Data.OptionValues.FileViewMode.ListView.ToString() + "_Name"); if (Manager.NativeManager.Selectable(listViewLabel, viewMode == Data.OptionValues.FileViewMode.ListView)) { Core.Option.FileBrowserViewMode.SetValueDirectly(Data.OptionValues.FileViewMode.ListView); } Manager.NativeManager.EndCombo(); } // Icon size setting if (viewMode == Data.OptionValues.FileViewMode.IconView) { int[] val = new int[1] { Core.Option.FileBrowserIconSize.GetValue() }; if (Manager.NativeManager.DragInt(MultiLanguageTextProvider.GetText("Options_FileBrowserIconSize_Name"), val, 1, 32, 512, "%d")) { Core.Option.FileBrowserIconSize.SetValueDirectly(val[0]); } } Manager.NativeManager.PopItemWidth(); Manager.NativeManager.EndPopup(); } } void UpdateFileView(float dpiScale, swig.Vec2 regionSize, swig.Vec2 spacing) { var viewMode = Core.Option.FileBrowserViewMode.GetValue(); float iconSize = Core.Option.FileBrowserIconSize.GetValue(); int contentCountX = 1; if (viewMode == Data.OptionValues.FileViewMode.IconView) { contentCountX = (int)((regionSize.X + spacing.X * 2) / (iconSize + spacing.X)); if (contentCountX <= 0) contentCountX = 1; } for (int i = 0; i < items.Count; i++) { var item = items[i]; if (i != 0 && i % contentCountX != 0) { Manager.NativeManager.SameLine(); } item.DrawPosX = Manager.NativeManager.GetCursorPosX(); item.DrawPosY = Manager.NativeManager.GetCursorPosY(); string idstr = "###FileContent_" + i; string label = Path.GetFileName(item.FilePath); bool selected = false; if (viewMode == Data.OptionValues.FileViewMode.IconView) { selected = Manager.NativeManager.SelectableContent(idstr, label, item.Selected, item.IconImage, iconSize, iconSize, swig.SelectableFlags.AllowDoubleClick); } else if (viewMode == Data.OptionValues.FileViewMode.ListView) { selected = Manager.NativeManager.Selectable(item.IconStr + label + idstr, item.Selected, swig.SelectableFlags.AllowDoubleClick); } if (Manager.NativeManager.IsItemHovered(0.5f)) { float tooltipBaseSize = dpiScale * 96.0f; Manager.NativeManager.SetNextWindowSize(tooltipBaseSize * 3.0f, 0.0f, swig.Cond.Always); Manager.NativeManager.BeginTooltip(); Manager.NativeManager.Text("Name: " + item.FileName); if (item.Type != FileType.Other) { Manager.NativeManager.Text("Type: " + item.Type); } if (item.FileSize > 0) { Manager.NativeManager.Text("Size: " + item.FileSizeStr); } if (item.Type == FileType.Texture) { Manager.NativeManager.Text("Format: " + item.ImageSizeStr); } // Fullpath Manager.NativeManager.TextWrapped(item.FilePath); Manager.NativeManager.EndTooltip(); } item.ItemID = Manager.NativeManager.GetItemID(); if (selected) { if (Manager.NativeManager.IsCtrlKeyDown()) { item.Selected = !item.Selected; } else if (Manager.NativeManager.IsShiftKeyDown() && selectedIndex >= 0) { int min = Math.Min(selectedIndex, i); int max = Math.Max(selectedIndex, i); for (int j = min; j <= max; j++) { items[j].Selected = true; } } else { ResetSelected(); item.Selected = true; } selectedIndex = i; if (Manager.NativeManager.IsMouseDoubleClicked(0) || Manager.NativeManager.IsKeyDown(Manager.NativeManager.GetKeyIndex(swig.Key.Enter))) { OnFilePicked(); } } if (Manager.NativeManager.IsItemClicked(1)) { if (!item.Selected) { ResetSelected(); item.Selected = true; } selectedIndex = i; Manager.NativeManager.OpenPopup(ContextMenuPopupId); } // D&D if (item.Type != FileType.Directory) { DragAndDrops.UpdateFileSrc(item.FilePath, item.Type, () => { float imageSize = dpiScale * 96.0f; Manager.NativeManager.ImageData(item.IconImage, imageSize, imageSize); Manager.NativeManager.PushTextWrapPos(imageSize); Manager.NativeManager.Text(item.FileName); Manager.NativeManager.PopTextWrapPos(); }); } if (viewMode == Data.OptionValues.FileViewMode.ListView) { if (item.Type == FileType.Texture && item.IconImage != null) { Manager.NativeManager.SameLine(); Manager.NativeManager.SetCursorPosX(item.DrawPosX); float listIconSize = Manager.NativeManager.GetTextLineHeight(); Manager.NativeManager.ImageData(item.IconImage, listIconSize, listIconSize); } } } UpdateContextMenu(); if (!Manager.NativeManager.IsPopupOpen(ContextMenuPopupId) && !Manager.NativeManager.IsAnyItemActive() && Manager.NativeManager.IsMouseClicked(0, false)) { ResetSelected(); } } void UpdateContextMenu() { // File Context Menu if (Manager.NativeManager.BeginPopup(ContextMenuPopupId)) { if (Manager.NativeManager.MenuItem(menuOpenFile)) { OnFilePicked(); } if (Manager.NativeManager.MenuItem(menuShowInFileManager)) { ShowInFileManager(); } Manager.NativeManager.Separator(); if (Manager.NativeManager.MenuItem(menuImportFromPackage)) { if (!string.IsNullOrEmpty(CurrentPath)) { Commands.ImportPackage(null, CurrentPath); } } if (Manager.NativeManager.MenuItem(menuExportToPackage)) { var files = items .Where(it => it.Selected && Path.GetExtension(it.FilePath) == ".efkefc") .Select(it => it.FilePath) .ToArray(); if (files.Length > 0) { Commands.ExportPackage(null, files); } } Manager.NativeManager.EndPopup(); } } void UpdateKeyNavication() { if (Manager.NativeManager.IsWindowFocused() && !Manager.NativeManager.IsAnyItemActive()) { // Back directory (BS shortcut key) if (Manager.NativeManager.IsKeyPressed(Manager.NativeManager.GetKeyIndex(swig.Key.Backspace)) && !string.IsNullOrEmpty(CurrentPath)) { UpdateFileListWithProjectPath(CurrentPath); } // Find item by input key string inputChars = Manager.NativeManager.GetInputCharacters().ToLower(); if (inputChars.Length > 0) { char navChar = inputChars[0]; List<FileItem> hits = items.FindAll(item => Path.GetFileName(item.FilePath).ToLower().IndexOf(navChar) == 0); if (hits.Count > 0) { int hitIndex = items.IndexOf(hits[0]); int lastIndex = selectedIndex; ResetSelected(); if (lastIndex >= 0 && hits.Contains(items[lastIndex])) { selectedIndex = lastIndex + 1; if (selectedIndex - hitIndex >= hits.Count) { selectedIndex = hitIndex; } } else { selectedIndex = hitIndex; } // Set focus FileItem item = items[selectedIndex]; item.Selected = true; Manager.NativeManager.SetFocusID(item.ItemID); // Scroll to navigation item float relX = item.DrawPosX - Manager.NativeManager.GetScrollX(); float relY = item.DrawPosY - Manager.NativeManager.GetScrollY(); switch (Core.Option.FileBrowserViewMode.GetValue()) { case Data.OptionValues.FileViewMode.IconView: Manager.NativeManager.ScrollToRect( new swig.Vec2(relX, relY), new swig.Vec2(relX, relY + Core.Option.FileBrowserIconSize.GetValue())); break; case Data.OptionValues.FileViewMode.ListView: Manager.NativeManager.ScrollToRect( new swig.Vec2(relX, relY), new swig.Vec2(relX, relY + Manager.NativeManager.GetTextLineHeightWithSpacing())); break; } } } } } void OnAfterLoad(object sender, EventArgs e) { UpdateFileListWithProjectPath(Core.Root.GetFullPath()); } void OnAfterSave(object sender, EventArgs e) { if (string.IsNullOrEmpty(CurrentPath)) { UpdateFileListWithProjectPath(Core.Root.GetFullPath()); } } void UpdateFileListWithProjectPath(string path) { if (string.IsNullOrEmpty(path)) return; string dirPath = string.Empty; try { dirPath = Path.GetDirectoryName(path); } catch (Exception) { return; } UpdateFileList(dirPath); } /// <summary> /// A file in the list /// </summary> public class FileItem { public string FileName { get; private set; } public string FilePath { get; private set; } public long FileSize { get; private set; } public FileType Type { get; private set; } public string IconStr { get; private set; } public swig.ReloadableImage IconImage { get; private set; } public bool Selected { get; set; } public int ItemID { get; set; } public float DrawPosX { get; set; } public float DrawPosY { get; set; } public FileItem(string fileName, string filePath, FileType type, long fileSize, string iconStr, swig.ReloadableImage iconImage) { FileName = fileName; FilePath = filePath; Type = type; FileSize = fileSize; IconStr = iconStr; IconImage = iconImage; } public string FileSizeStr { get { if (FileSize >= 1024 * 1024) { return string.Format("{0:.##} MB", FileSize / 1024.0 / 1024.0); } else if (FileSize >= 1024) { return string.Format("{0:.##} KB", FileSize / 1024.0); } else { return string.Format("{0} B", FileSize); } } } public string ImageSizeStr { get { if (IconImage == null) return null; return string.Format("{0} x {1}", IconImage.GetWidth(), IconImage.GetHeight()); } } } /// <summary> /// Update list /// </summary> private void UpdateFileList(string path = null) { if (path == null) { path = CurrentPath; } if (!Directory.Exists(path)) { return; } path = Path.GetFullPath(path); if (path.EndsWith(Path.DirectorySeparatorChar.ToString())) { path = path.Substring(0, path.Length - 1); } ResetSelected(); CurrentPath = path; if (!addressEditing) { addressText = path; } items.Clear(); // add directories foreach (string dirPath in Directory.EnumerateDirectories(path)) { try { items.Add(CreateFileItem(dirPath, true)); } catch (Exception e) { // Skip directory } } // add files foreach (string filePath in Directory.EnumerateFiles(path)) { try { items.Add(CreateFileItem(filePath, false)); } catch (Exception e) { // Skip file } } directoryWatcher.Path = path; directoryWatcher.EnableRaisingEvents = true; } private FileItem CreateFileItem(string filePath, bool isDirectory) { FileType type = FileType.Other; string iconStr = Icons.FileOther; swig.ReloadableImage iconImage = Images.Icons["FileOther128"]; long fileSize = -1; if (isDirectory) { type = FileType.Directory; iconStr = Icons.FileDirectory; iconImage = Images.Icons["FileFolder128"]; } else { var fileInfo = new FileInfo(filePath); fileSize = fileInfo.Length; switch (Path.GetExtension(filePath).ToLower()) { case ".efkproj": case ".efkefc": type = FileType.Effect; iconStr = Icons.FileEfkefc; iconImage = Images.Icons["FileEfkefc128"]; break; case ".png": type = FileType.Texture; iconStr = Icons.Empty; // Always show thumbnail iconImage = Images.Load(Manager.HardwareDevice.GraphicsDevice, filePath); break; case ".wav": type = FileType.Sound; iconStr = Icons.FileSound; iconImage = Images.Icons["FileSound128"]; break; case ".efkmodel": case ".fbx": case ".mqo": type = FileType.Model; iconStr = Icons.FileModel; iconImage = Images.Icons["FileModel128"]; break; case ".efkmat": type = FileType.Material; iconStr = Icons.FileEfkmat; iconImage = Images.Icons["FileEfkmat128"]; break; case ".efkcurve": type = FileType.Curve; iconStr = Icons.PanelFCurve; iconImage = Images.Icons["FileCurve128"]; break; } } return new FileItem(Path.GetFileName(filePath), filePath, type, fileSize, iconStr, iconImage); } private void ResetSelected() { selectedIndex = -1; for (int i = 0; i < items.Count; i++) { items[i].Selected = false; } } private void OnFilePicked() { if (items.Count == 0) { return; } if (selectedIndex == -1) return; var fileItem = items[selectedIndex]; if (fileItem.Type == FileType.Effect) { // efkproj is opened internal function Commands.Open(fileItem.FilePath); } else if (fileItem.Type == FileType.Material) { // execute external material editor if (Process.MaterialEditor.Run()) { Process.MaterialEditor.OpenOrCreateMaterial(fileItem.FilePath); } } else if (fileItem.Type == FileType.Directory) { // move directory UpdateFileList(fileItem.FilePath); } else { try { // open process System.Diagnostics.Process.Start(fileItem.FilePath); } catch (Exception) { } } } private void ShowInFileManager() { if (items.Count == 0) { return; } if (selectedIndex == -1) return; var fileItem = items[selectedIndex]; try { string dirPath = Directory.Exists(fileItem.FilePath) ? fileItem.FilePath : Path.GetDirectoryName(fileItem.FilePath); if (swig.GUIManager.IsMacOSX()) { System.Diagnostics.Process.Start("open", dirPath); } else { System.Diagnostics.Process.Start(dirPath); } } catch (Exception) { } } } }
{ "content_hash": "db8a9ac4db32cc724176d82fbb99ece3", "timestamp": "", "source": "github", "line_count": 762, "max_line_length": 157, "avg_line_length": 25.61286089238845, "alnum_prop": 0.6613208997284419, "repo_name": "effekseer/Effekseer", "id": "8e8bd4492235448cec0d3218470bff1e141a9ee6", "size": "19519", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Dev/Editor/EffekseerCoreGUI/GUI/Dock/FileBrowser.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "31004" }, { "name": "C", "bytes": "2906155" }, { "name": "C#", "bytes": "1833372" }, { "name": "C++", "bytes": "4042188" }, { "name": "CMake", "bytes": "101152" }, { "name": "Dockerfile", "bytes": "1075" }, { "name": "GLSL", "bytes": "215212" }, { "name": "HLSL", "bytes": "980762" }, { "name": "HTML", "bytes": "2753" }, { "name": "JavaScript", "bytes": "6147" }, { "name": "Objective-C", "bytes": "17847" }, { "name": "Objective-C++", "bytes": "13682" }, { "name": "Python", "bytes": "47026" }, { "name": "SWIG", "bytes": "13524" }, { "name": "Shell", "bytes": "11492" } ] }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SQLite; namespace MundlTransit.WP8.Data.Reference { [Table("OgdSteige")] public class OgdSteig { // We use the OGD-provided STEIG_ID as primary key [PrimaryKey] public int Id { get; set; } [Indexed(Name = "FKLinienId")] public int FK_LinienId { get; set; } [Indexed(Name = "FKHaltestellenId")] public int FK_HaltestellenId { get; set; } public string Richtung { get; set; } public int Reihenfolge { get; set; } public string RblNummer { get; set; } public string Bereich { get; set; } public string Name { get; set; } public double Latitude { get; set; } public double Longitude { get; set; } public string Stand { get; set; } } }
{ "content_hash": "18a371874ca4a65c8c2e01e8ab5fef03", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 58, "avg_line_length": 28.806451612903224, "alnum_prop": 0.6125419932810751, "repo_name": "christophwille/viennarealtime", "id": "ff4c2216512d1d4c79145bdc77e6ae6d0867f997", "size": "895", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Source/MundlTransit.WP8.Data/Reference/OgdSteig.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "506655" }, { "name": "C++", "bytes": "16375" } ] }
""" Created on Fri Jun 05 09:36:14 2015 @author: LLP-admin """ import pandas as pd #import extract_filter #########HELPER FUNCTIONS############## def extract_filter(filter_path): """Given a path to the weka's filter file, return a list of selected features.""" with open(filter_path) as f: lnum = 0 for line in f: lnum += 1 #pointer to the next line to read if line.strip().startswith('Selected attributes:'): print "next line to read: ",lnum break features = [] for line in f: #keep reading from where we stopped (from 'break' point) if len(line.strip()) != 0: features.append(line.strip()) features.append('class') return features ############################################ ############################################ ############################################ ############################################ def apply_filter(rfilename): """Given the filename in one fixed directory, apply the filter (that selects the best features) and get only the data under the selected features.""" dirname = 'C:/cygwin64/home/LLP-admin/GUI4ML/token-experiment-dataset/' # rfilename = 'features_0' # rfilename = raw_input('Enter the filename (without .csv): ') read_path = dirname + rfilename + '.csv' df = pd.read_csv(read_path, sep ='\t') ##Get the list of features to use filter_name = 'cfs_filter' filter_path = 'C:/cygwin64/home/LLP-admin/GUI4ML/filters/' selected_features = extract_filter(filter_path + filter_name) #print selected_features # ###Select ony the 'good' columns selected_df = df[selected_features] ##Write the filtered dataframe as a csv out_dirname = dirname +'filtered/' ofilename = rfilename + '_' + filter_name write_path = out_dirname + ofilename + '.csv' selected_df.to_csv(write_path, index = False) name_list = ['features_'+ str(i) for i in range(0,6)] apply_filter('features') for f in name_list: apply_filter(f)
{ "content_hash": "d002e139ccc530bf615c9902156981c2", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 99, "avg_line_length": 34.25806451612903, "alnum_prop": 0.5574387947269304, "repo_name": "cocoaaa/ml_gesture", "id": "b9c2feb005d16abfb197834b72d9ae50bd709873", "size": "2148", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "preprocess.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "102462" } ] }
<?xml version="1.0" encoding="UTF-8"?> <recipeml version="0.5"> <recipe> <head> <title>Baked Beef and Vegetable Soup</title> <categories> <cat>Meats</cat> <cat>Microwave</cat> <cat>Soups/stews</cat></categories> <yield>6</yield></head> <ingredients> <ing> <amt> <qty>4</qty> <unit>pounds</unit></amt> <item>Short ribs of beef</item></ing> <ing> <amt> <qty>1</qty> <unit/></amt> <item>Onion skin on studded with 2 cloves</item></ing> <ing> <amt> <qty>3</qty> <unit>cloves</unit></amt> <item>Garlic peeled and lightly crushed</item></ing> <ing> <amt> <qty>4</qty> <unit/></amt> <item>Whole black peppercorns</item></ing> <ing> <amt> <qty>4</qty> <unit>cups</unit></amt> <item>Beef broth</item></ing> <ing> <amt> <qty>3</qty> <unit>small</unit></amt> <item>Leeks roots trimmed and 1 inch of green left on cut into 1/4 x 2 inch julienne strips well washed</item></ing> <ing> <amt> <qty>3</qty> <unit/></amt> <item>Carrots cut into 1/4 x 2 inch julienne strips</item></ing> <ing> <amt> <qty>3</qty> <unit/></amt> <item>Celery ribs cut into 1/4 x 2 inch julienne strips</item></ing> <ing> <amt> <qty>8</qty> <unit/></amt> <item>White mushroom caps cut into thin slices</item></ing> <ing> <amt> <qty>2</qty> <unit>cups</unit></amt> <item>Shaped pasta cooked until just tender</item></ing> <ing> <amt> <qty/> <unit/></amt> <item>Salt and fresh ground black pepper to taste</item></ing> <ing> <amt> <qty>2</qty> <unit>tablespoons</unit></amt> <item>Chopped dill</item></ing> <ing> <amt> <qty>2</qty> <unit>tablespoons</unit></amt> <item>Parsley</item></ing></ingredients> <directions> <step> Preheat oven to 350 degrees. Place beef, onion, garlic, peppercorns and broth in an oven-proof casserole. Add water to cover by 1 1/2 inches. Bring to a boil. Cover and bake in the oven about 2 hours, until beef is very tender. Remove meat and cool. Shred from bones, discarding any fat and the bones. COver. Pour broth through a fine mesh strainer into a gravy separator or bowl. Allow to cool. Pour or skim off fat and return defatted broth to the casserole. Add leeks, carrots and celery to casserole. Bring to a boil; reduce heat and simmer, covered, 3 minutes. Add shredded beef to broth with mushrooms, pasta, salt and pepper. Bake, covered, for 5 minutes. Remove from oven and stir in dill and parsley. Serve immediately in deep soup bowls. From Gemini's MASSIVE MealMaster collection at www.synapse.com/~gemini </step></directions></recipe></recipeml>
{ "content_hash": "11a0c901b2d86967dae062c4cc8e9df4", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 124, "avg_line_length": 30.16822429906542, "alnum_prop": 0.5322180916976456, "repo_name": "coogle/coogle-recipes", "id": "d3be460d1e14afc49a3aa643e2ecdfe101fc9312", "size": "3228", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "extras/recipes/Baked_Beef_and_Vegetable_Soup.xml", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Blade", "bytes": "70365" }, { "name": "CSS", "bytes": "2508" }, { "name": "HTML", "bytes": "1294" }, { "name": "JavaScript", "bytes": "1133" }, { "name": "PHP", "bytes": "130922" }, { "name": "Puppet", "bytes": "23814" }, { "name": "SCSS", "bytes": "1015" }, { "name": "Shell", "bytes": "3538" }, { "name": "Vue", "bytes": "559" } ] }
package org.ovirt.engine.extensions.aaa.builtin.kerberosldap.utils.kerberos; import static org.ovirt.engine.extensions.aaa.builtin.kerberosldap.utils.kerberos.InstallerConstants.ERROR_PREFIX; import java.io.IOException; import java.util.List; import javax.security.auth.Subject; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.UnsupportedCallbackException; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; import org.apache.log4j.Logger; import org.ovirt.engine.extensions.aaa.builtin.kerberosldap.utils.ldap.LdapProviderType; /** * Utility to verify Kerberos installation * */ public class KerberosConfigCheck { private LoginContext lc; private final List<String> ldapServers; private String defaultLdapServerPort; private final static Logger log = Logger.getLogger(KerberosConfigCheck.class); public enum Arguments { domains, user, password, jaas_file, jboss_dir, krb5_conf_path, ldapProviderType; } public KerberosConfigCheck(List<String> ldapServers, String defaultLdapServerPort) { this.ldapServers = ldapServers; this.defaultLdapServerPort = defaultLdapServerPort; } public KerberosConfigCheck() { this(null, null); } /** * JAAS callback handler. JAAS uses this class during login - it provides an array of callbacks (including the * NameCallback and PasswordCallback) It is the responsibility of the implementor of CallbackHandler to set the user * name and the password on the relevant call backs. */ private static class KerberosUtilCallbackHandler implements CallbackHandler { private String username; private String password; public KerberosUtilCallbackHandler(String username, String password) { this.username = username; this.password = password; } @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof NameCallback) { NameCallback cb = (NameCallback) callbacks[i]; cb.setName(username); } else if (callbacks[i] instanceof PasswordCallback) { PasswordCallback cb = (PasswordCallback) callbacks[i]; cb.setPassword(password.toCharArray()); } else { throw new UnsupportedCallbackException(callbacks[i]); } } } } public void checkInstallation(String domains, String username, String password, String jaasFile, String krb5ConfFile, StringBuffer userGuid, LdapProviderType ldapProviderType) throws AuthenticationException { String[] domainsList = domains.split(",", -1); String domain = domainsList[0].trim(); String realm = domain.toUpperCase(); validateKerberosInstallation(realm, username, password, jaasFile, krb5ConfFile, userGuid, ldapProviderType); } public void validateKerberosInstallation(String realm, String username, String password, String pathToJAASFile, String pathToKrb5ConfFile, StringBuffer userGuid, LdapProviderType ldapProviderType) throws AuthenticationException { AuthenticationResult authResult = authenticate(realm, username, password, pathToJAASFile, pathToKrb5ConfFile); if (authResult == AuthenticationResult.OK) { // Successful authentication was acehived, no point in searching for // KDcs that use UDP AuthenticationResult actionResult = promptSuccessfulAuthentication(realm, username, userGuid, ldapProviderType); if (actionResult != AuthenticationResult.OK) { throw new AuthenticationException(actionResult); } return; } else { throw new AuthenticationException(authResult); } } private AuthenticationResult promptSuccessfulAuthentication(String realm, String username, StringBuffer userGuid, LdapProviderType ldapProviderType) { AuthenticationResult authResult = AuthenticationResult.OTHER; try { // Executing the code that will perform the LDAP query to get the // user and print its GUID. // A Windows domain is lowercase string of Keberos realm. authResult = (AuthenticationResult) Subject.doAs(lc.getSubject(), new JndiAction(username, realm.toLowerCase(), userGuid, ldapProviderType, ldapServers, defaultLdapServerPort)); } finally { if (lc != null) { try { lc.logout(); } catch (LoginException e) { String formattedMessage = ERROR_PREFIX + " logout failed " + e.getMessage(); System.out.println(formattedMessage); log.error(formattedMessage); } } } return authResult; } private AuthenticationResult authenticate(String realm, String username, String password, String pathToJAASFile, String pathToKrb5File) { // Set the realm to authenticate to and the path to the JAAS file that // will define // that JAAS is using kerberos login module System.setProperty("java.security.krb5.conf", pathToKrb5File); // Get kdcs for the relevant protocol (tcp or udp) and for the given // realm System.setProperty("java.security.auth.login.config", pathToJAASFile); return checkAuthentication(username, password); } private AuthenticationResult checkAuthentication(String username, String password) { AuthenticationResult result = AuthenticationResult.OK; try { lc = new LoginContext("oVirtKerb", new KerberosUtilCallbackHandler(username, password)); lc.login(); log.debug("Check authentication finished successfully "); } catch (LoginException ex) { String resultMessage = ex.getMessage(); String formattedMessage = ERROR_PREFIX + " exception message: " + resultMessage; log.error(formattedMessage); log.debug("", ex); KerberosReturnCodeParser parser = new KerberosReturnCodeParser(); result = parser.parse(resultMessage); if (result != AuthenticationResult.OTHER) { return result; } else { System.out.println(formattedMessage); } } return result; } }
{ "content_hash": "9b82f90a57217726fb8bd17deabce592", "timestamp": "", "source": "github", "line_count": 190, "max_line_length": 120, "avg_line_length": 37.48947368421052, "alnum_prop": 0.6401796995647902, "repo_name": "halober/ovirt-engine", "id": "9557d59f7c59b8c92156a60aa968a093722cdc85", "size": "7123", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extensions/aaa/builtin/kerberosldap/utils/kerberos/KerberosConfigCheck.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "251848" }, { "name": "Java", "bytes": "26541598" }, { "name": "JavaScript", "bytes": "890" }, { "name": "Python", "bytes": "698283" }, { "name": "Shell", "bytes": "105362" }, { "name": "XSLT", "bytes": "54683" } ] }
# Defining a Subject Type Within a Permissions System, a [CheckPermission] call is always made between an object representing the *resource* and an object representing a *subject*: The API call returns whether the *subject* has the specified permission on the *resource*. [CheckPermission]: https://buf.build/authzed/api/docs/main:authzed.api.v1#CheckPermission The choice of how to represent subjects can have large downstream effects on the design of a permissions system. ## Representing users as subjects The most common kind of subjects found within a permissions system are some form of **user**. Users in SpiceDB/Authzed are [modeled as object types], same as resources. [modeled as object types]: https://authzed.com/blog/why-model-users/ Typically, it is users that are accessing your application or service and, therefore, it is for them that the various permissions must be checked. Choosing how to represent a user as a subject in Authzed/SpiceDB is very important, as the wrong choice can cause permissions checks to be incomplete or, in some cases, wrong. ### Using a *stable* external identifier The most common and recommended approach for representing a user as a subject is to use a **stable** identifier for the user as the subject's object ID. For example, if the authentication system used is OIDC and provides a `sub` field, then the object IDs for the users might be the `sub` field: ``` check resource:someresource view user:goog|487306745603273 ``` As the `sub` field is **guaranteed** to be stable for that particular user (if a compliant OIDC implementation), it is safe to use for checking permissions, as there is no risk that the `sub` will somehow represent a different user later. :::note If you have *multiple* authentication provides, then the recommendation is to define a subject type for *each* provider, to ensure a clean namespace: ```zed /** githubuser represents a user from GitHub */ definition githubuser {} /** gitlabuser represents a user from Gitlab */ definition gitlabuser {} ``` ::: ### Using a primary key The second most common approach is to have a representation of the subject in another backing data store, typically a relational database. If such a database exists, and there exists a single row per user, then using the row's primary ID (typically an integer or a UUID) represents another safe ID to use for user: ``` check resource:someresource view user:1337 ``` :::warning If using an auto-generated or auto-incrementing integer, make sure it cannot be reused. Some databases allow various sequences to reuse IDs. ::: ### What about e-mail addresses? :::warning It is typically **not recommended** to use an e-mail address to represent a user as as a subject in Authzed/SpiceDB. ::: This is for a number of reasons: - E-mail addresses are not universally stable and, often times, services allow them to be reused - E-mail addresses are not universally verified and, often times, a caller of the [CheckPermission] may not be *certain* that the user has that e-mail address - Authzed/SpiceDB does not allow for `@` characters within object IDs If you know for **certain** that the e-mail address for a user is both stable and verified, and still wish to use it as the subject ID, then we recommend base64 encoding (with padding removed) the e-mail address to use it within Authzed/SpiceDB. ## Representing anonymous visitors as subjects Some applications allow for *anonymous* access to view (and occasionally, edit) various resources. Representing an anonymous visitor in Authzed/SpiceDB can be done via simply defining another subject type to represent the unauthenticated users: ```zed /** user represents a specific authenticated user */ definition user {} /** anonymoususer represents an unauthenticated user */ definition anonymoususer {} ``` To grant access to anonymous users to a resource, either a single **static** object ID can be used to represent *all* anonymous users (such as `all`) or [wildcards] can be used: ```zed title="document with anonymous user wildcard allowed" definition document { relation reader: user | anonymoususer:* } ``` [wildcards]: /reference/schema-lang#wildcards :::note It is recommended to use *wildcard* with an anonymous user definition if there is ever a need to differentiate between anonymous users based on their object IDs. As an example, an anonymous user of a commenting system might be assigned a unique ID that is stored in their browser's cookies, enabling permission for editing a previously posted comment. ::: ## Representing services as subjects If your permissions checks are between machines or services and other services, it is recommended that the subject type be a representation of that service or its means of providing its identity. For example, you might represent a service directly: ```zed definition service {} definition resource { relation viewer: service } ``` Or via a token it was granted, by use of a reference to a *subject relation*: ```zed definition token {} definition service { relation token: token } definition resource { relation viewer: service#token } ```
{ "content_hash": "a1a272a44c184af148cf915bc014bd05", "timestamp": "", "source": "github", "line_count": 131, "max_line_length": 245, "avg_line_length": 39.404580152671755, "alnum_prop": 0.7710189848895777, "repo_name": "jzelinskie/docs", "id": "036f1abd421cf1119376562c02e3c876c393acc0", "size": "5162", "binary": false, "copies": "1", "ref": "refs/heads/enterprise", "path": "docs/guides/defining-a-subject-type.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Shell", "bytes": "3638" } ] }
package detectores; import colecoes.Digrafos; import java.util.ArrayList; import java.util.Iterator; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Detector para encontrar letras repetidas em um endereço.<br> * Algumas letras repetidas são válidas de estarem presentes em um termo de um endereço, como * por exemplo SS em caSSIA ou RR ou coRRimao.<br> * Fora estes casos, não existe outro dupla de consoantes iguais que são válidas.<br> * Nem todos os casos que esta classe detectar podem ser considerados como válidos, ou seja, * são letras repetidas que denotam problema no endereço.<br> * Existem nomes de origem estrangeira onde 2 consoantes iguais podem ser totalmente válidas, * por exemplo, LL em Giarelli, ou TT em Romanetti, ambos italianos. */ public class DetLetrasRepetidas implements IDetector { private Pattern padrao; private StringBuilder buffer; public DetLetrasRepetidas() { buffer = new StringBuilder(); Digrafos digrafos = new Digrafos(); ArrayList colDigrafos = new ArrayList(digrafos.obtemItems()); Iterator i = colDigrafos.iterator(); while (i.hasNext()) { String digrafo = (String) i.next(); buffer.append("^"); buffer.append(digrafo); buffer.append("|"); } // Define a mascara String mascara = "([" + buffer.toString() + ".])\\1+"; // Compila a expressao padrao = Pattern.compile(mascara, Pattern.CASE_INSENSITIVE); } /** * * @param endereco String a ser classificada * @return Retorna 0 (zero) se o endereço não possui alguma letra repetida mais de 1 vez ou 1 se tem. */ public int analisar(String endereco) { if (endereco==null){ throw new IllegalArgumentException("Endereço não pode ser nulo"); } buffer.setLength(0); Matcher matcher = padrao.matcher(endereco); boolean encontrou = matcher.find(); if (!encontrou) { return 0; } do { if (buffer.length() > 0) { buffer.append(('/')); } buffer.append(matcher.group()); buffer.append('['); buffer.append(matcher.start()); buffer.append(','); buffer.append(matcher.end() - 1); buffer.append(']'); } while (matcher.find()); return 1; } public String obterOcorrencias() { if (buffer.length() == 0) { return null; } return buffer.toString(); } }
{ "content_hash": "2b437b805e32d27071a2fae3f21ca4cc", "timestamp": "", "source": "github", "line_count": 89, "max_line_length": 105, "avg_line_length": 29.337078651685392, "alnum_prop": 0.6058981233243967, "repo_name": "chazgps/EnderecoLimpo", "id": "04feab3695933ceea169600cf0414b0a382f5fe0", "size": "2611", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "EnderecoLimpo/src/detectores/DetLetrasRepetidas.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "117411" } ] }
warning: 'This file is auto generated by `npm run web:inject`, do not edit by hand' examples: - html_entity_decode('Kevin &amp; van Zonneveld') - html_entity_decode('&amp;lt;') estarget: es5 returns: - '''Kevin & van Zonneveld''' - '''&lt;''' dependencies: [] authors: original by: - 'john (https://www.jd-tech.net)' improved by: - 'Kevin van Zonneveld (https://kvz.io)' - marc andreu bugfixed by: - 'Onno Marsman (https://twitter.com/onnomarsman)' - 'Brett Zamir (https://brett-zamir.me)' - Fox revised by: - 'Kevin van Zonneveld (https://kvz.io)' - 'Kevin van Zonneveld (https://kvz.io)' input by: - ger - Ratheous - 'Nick Kolosov (https://sammy.ru)' notes: [] type: function layout: function title: PHP's html_entity_decode in JavaScript description: >- Here’s what our current JavaScript equivalent to <a href="https://php.net/manual/en/function.html-entity-decode.php">PHP's html_entity_decode</a> looks like. function: html_entity_decode category: strings language: php permalink: php/strings/html_entity_decode/ alias: - /functions/php/html_entity_decode/ - /functions/strings/html_entity_decode/ - /php/html_entity_decode/ - /functions/html_entity_decode/ --- {% codeblock lang:javascript %}module.exports = function html_entity_decode (string, quoteStyle) { // eslint-disable-line camelcase // discuss at: https://locutus.io/php/html_entity_decode/ // original by: john (https://www.jd-tech.net) // input by: ger // input by: Ratheous // input by: Nick Kolosov (https://sammy.ru) // improved by: Kevin van Zonneveld (https://kvz.io) // improved by: marc andreu // revised by: Kevin van Zonneveld (https://kvz.io) // revised by: Kevin van Zonneveld (https://kvz.io) // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman) // bugfixed by: Brett Zamir (https://brett-zamir.me) // bugfixed by: Fox // example 1: html_entity_decode('Kevin &amp; van Zonneveld') // returns 1: 'Kevin & van Zonneveld' // example 2: html_entity_decode('&amp;lt;') // returns 2: '&lt;' var getHtmlTranslationTable = require('../strings/get_html_translation_table') var tmpStr = '' var entity = '' var symbol = '' tmpStr = string.toString() var hashMap = getHtmlTranslationTable('HTML_ENTITIES', quoteStyle) if (hashMap === false) { return false } // @todo: &amp; problem // https://locutus.io/php/get_html_translation_table:416#comment_97660 delete (hashMap['&']) hashMap['&'] = '&amp;' for (symbol in hashMap) { entity = hashMap[symbol] tmpStr = tmpStr.split(entity).join(symbol) } tmpStr = tmpStr.split('&#039;').join("'") return tmpStr } {% endcodeblock %}
{ "content_hash": "943928a11e309eba84f0cd8d4bfd5402", "timestamp": "", "source": "github", "line_count": 87, "max_line_length": 131, "avg_line_length": 31.333333333333332, "alnum_prop": 0.6606749816581071, "repo_name": "kvz/phpjs", "id": "f69efb5ddf12ae29935d564438ce54ff99768096", "size": "2732", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "website/source/php/strings/html_entity_decode.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "90197" }, { "name": "HTML", "bytes": "1848217" }, { "name": "JavaScript", "bytes": "10460876" }, { "name": "Makefile", "bytes": "2222" }, { "name": "PHP", "bytes": "441330" }, { "name": "Ruby", "bytes": "111087" } ] }
<?php namespace Laravel\Socialite\Two; use Illuminate\Support\Arr; use GuzzleHttp\ClientInterface; class FacebookProvider extends AbstractProvider implements ProviderInterface { /** * The base Facebook Graph URL. * * @var string */ protected $graphUrl = 'https://graph.facebook.com'; /** * The Graph API version for the request. * * @var string */ protected $version = 'v2.8'; /** * The user fields being requested. * * @var array */ protected $fields = ['name', 'email', 'gender', 'verified', 'link']; /** * The scopes being requested. * * @var array */ protected $scopes = ['email']; /** * Display the dialog in a popup view. * * @var bool */ protected $popup = false; /** * Re-request a declined permission. * * @var bool */ protected $reRequest = false; /** * {@inheritdoc} */ protected function getAuthUrl($state) { return $this->buildAuthUrlFromBase('https://www.facebook.com/'.$this->version.'/dialog/oauth', $state); } /** * {@inheritdoc} */ protected function getTokenUrl() { return $this->graphUrl.'/oauth/access_token'; } /** * {@inheritdoc} */ public function getAccessTokenResponse($code) { $postKey = (version_compare(ClientInterface::VERSION, '6') === 1) ? 'form_params' : 'body'; $response = $this->getHttpClient()->post($this->getTokenUrl(), [ $postKey => $this->getTokenFields($code), ]); $data = []; parse_str($response->getBody(), $data); return Arr::add($data, 'expires_in', Arr::pull($data, 'expires')); } /** * {@inheritdoc} */ protected function getUserByToken($token) { $meUrl = $this->graphUrl.'/'.$this->version.'/me?access_token='.$token.'&fields='.implode(',', $this->fields); if (! empty($this->clientSecret)) { $appSecretProof = hash_hmac('sha256', $token, $this->clientSecret); $meUrl .= '&appsecret_proof='.$appSecretProof; } $response = $this->getHttpClient()->get($meUrl, [ 'headers' => [ 'Accept' => 'application/json', ], ]); return json_decode($response->getBody(), true); } /** * {@inheritdoc} */ protected function mapUserToObject(array $user) { $avatarUrl = $this->graphUrl.'/'.$this->version.'/'.$user['id'].'/picture'; return (new User)->setRaw($user)->map([ 'id' => $user['id'], 'nickname' => null, 'name' => isset($user['name']) ? $user['name'] : null, 'email' => isset($user['email']) ? $user['email'] : null, 'avatar' => $avatarUrl.'?type=normal', 'avatar_original' => $avatarUrl.'?width=1920', 'profileUrl' => isset($user['link']) ? $user['link'] : null, ]); } /** * {@inheritdoc} */ protected function getCodeFields($state = null) { $fields = parent::getCodeFields($state); if ($this->popup) { $fields['display'] = 'popup'; } if ($this->reRequest) { $fields['auth_type'] = 'rerequest'; } return $fields; } /** * Set the user fields to request from Facebook. * * @param array $fields * @return $this */ public function fields(array $fields) { $this->fields = $fields; return $this; } /** * Set the dialog to be displayed as a popup. * * @return $this */ public function asPopup() { $this->popup = true; return $this; } /** * Re-request permissions which were previously declined. * * @return $this */ public function reRequest() { $this->reRequest = true; return $this; } }
{ "content_hash": "6163f23a8e3940f7e381184ec1762bf9", "timestamp": "", "source": "github", "line_count": 177, "max_line_length": 118, "avg_line_length": 22.44632768361582, "alnum_prop": 0.5162345834382079, "repo_name": "pviswanath/New-Cassel-first-code-base", "id": "94915a6ff2e578b9204aa81dcd3f60aae02a123b", "size": "3973", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "vendor/laravel/socialite/src/Two/FacebookProvider.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "553" }, { "name": "CSS", "bytes": "4027" }, { "name": "HTML", "bytes": "67156" }, { "name": "JavaScript", "bytes": "15056" }, { "name": "PHP", "bytes": "162829" } ] }
import React, { Component } from 'react' import PropTypes from 'prop-types' import { ThemeProvider } from 'styled-components' import defaultTheme from './defaultTheme' class NiceUIThemeProvider extends Component { static propTypes = { children: PropTypes.element.isRequired, theme: PropTypes.object, }; static defaultProps = { theme: defaultTheme, }; render() { const { children, theme, ...other } = this.props return <ThemeProvider theme={theme} {...other}>{children}</ThemeProvider> } } export default NiceUIThemeProvider
{ "content_hash": "027cf054eda9e90402f99745cb41499e", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 77, "avg_line_length": 24.391304347826086, "alnum_prop": 0.7112299465240641, "repo_name": "react-ui-components/nice-ui", "id": "488675ec497a9b42317902a807decedd6f63de0c", "size": "570", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Theme/ThemeProvider.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "6882" } ] }
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> <groupId>com.huffingtonpost</groupId> <artifactId>chronos-parent</artifactId> <version>1.0.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>chronos-web</artifactId> <packaging>war</packaging> <scm> <url>https://github.com/aol/chronos</url> <connection>scm:git:git@github.com:aol/chronos.git</connection> <developerConnection>scm:git:git@github.com:aol/chronos.git</developerConnection> <tag>HEAD</tag> </scm> <properties> <spring.version>4.2.4.RELEASE</spring.version> <jackson.version>2.6.5</jackson.version> </properties> <dependencies> <dependency> <groupId>com.huffingtonpost</groupId> <artifactId>chronos-agent</artifactId> <version>${project.version}</version> </dependency> <!-- Spring dependencies --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.5.0</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.5.0</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-joda</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-dbcp2</artifactId> <version>2.1</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-all</artifactId> <version>1.10.8</version> <scope>test</scope> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.15</version> <type>jar</type> <scope>compile</scope> <exclusions> <exclusion> <groupId>javax.jms</groupId> <artifactId>jms</artifactId> </exclusion> <exclusion> <groupId>com.sun.jdmk</groupId> <artifactId>jmxtools</artifactId> </exclusion> <exclusion> <groupId>com.sun.jmx</groupId> <artifactId>jmxri</artifactId> </exclusion> </exclusions> </dependency> </dependencies> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-gpg-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.2</version> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.4</version> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> <webResources> <resource> <directory>${project.basedir}/src/main/resources</directory> <targetPath>/</targetPath> </resource> </webResources> </configuration> </plugin> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <path>/</path> <warSourceDirectory>${project.build.directory}/${project.build.finalName}</warSourceDirectory> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.4.2</version> <executions> <execution> <id>default-copy-resources</id> <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <overwrite>true</overwrite> <outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/</outputDirectory> <resources> <resource> <directory>${project.basedir}/src/main/resources</directory> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> </pluginManagement> </build> </project>
{ "content_hash": "669270b55170c5ef1d594fdbda35276e", "timestamp": "", "source": "github", "line_count": 218, "max_line_length": 201, "avg_line_length": 34.92201834862385, "alnum_prop": 0.5604886378562984, "repo_name": "aol/chronos", "id": "b0596796e9ad8a901e5c4661091d37c533066eca", "size": "7613", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "chronos-web/pom.xml", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "38194" }, { "name": "HTML", "bytes": "877" }, { "name": "Java", "bytes": "218930" }, { "name": "JavaScript", "bytes": "130951" }, { "name": "Shell", "bytes": "242" } ] }
#ifndef DATA_H_INCLUDED #define DATA_H_INCLUDED #include "bool.h" #include "int.h" struct lock; /********************************************************************* ** Buffer *********************************************************************/ typedef struct { void *data; xmlrpc_uint32_t size; xmlrpc_uint32_t staticid; } TBuffer; bool BufferAlloc(TBuffer * const buf, xmlrpc_uint32_t const memsize); bool BufferRealloc(TBuffer * const buf, xmlrpc_uint32_t const memsize); void BufferFree(TBuffer * const buf); /********************************************************************* ** String *********************************************************************/ typedef struct { TBuffer buffer; xmlrpc_uint32_t size; } TString; bool StringAlloc(TString * const stringP); bool StringConcat(TString * const stringP, const char * const string2); bool StringBlockConcat(TString * const stringP, const char * const string2, char ** const ref); void StringFree(TString * const stringP); char * StringData(TString * const stringP); /********************************************************************* ** List *********************************************************************/ typedef struct { void **item; uint16_t size; uint16_t maxsize; bool autofree; } TList; void ListInit(TList * const listP); void ListInitAutoFree(TList * const listP); void ListFree(TList * const listP); void ListFreeItems(TList * const listP); bool ListAdd(TList * const listP, void * const str); void ListRemove(TList * const listP); bool ListAddFromString(TList * const listP, const char * const c); bool ListFindString(TList * const listP, const char * const str, uint16_t * const indexP); typedef struct { char *name,*value; uint16_t hash; } TTableItem; typedef struct { TTableItem *item; uint16_t size,maxsize; } TTable; void TableInit(TTable * const t); void TableFree(TTable * const t); bool TableAdd(TTable * const t, const char * const name, const char * const value); bool TableAddReplace(TTable * const t, const char * const name, const char * const value); bool TableFindIndex(TTable * const t, const char * const name, uint16_t * const index); char * TableFind(TTable * const t, const char * const name); /********************************************************************* ** Pool *********************************************************************/ typedef struct _TPoolZone { char * pos; char * maxpos; struct _TPoolZone * next; struct _TPoolZone * prev; /* char data[0]; Some compilers don't accept this */ char data[1]; } TPoolZone; typedef struct { TPoolZone * firstzone; TPoolZone * currentzone; uint32_t zonesize; struct lock * lockP; } TPool; bool PoolCreate(TPool * const poolP, uint32_t const zonesize); void PoolFree(TPool * const poolP); void * PoolAlloc(TPool * const poolP, uint32_t const size); void PoolReturn(TPool * const poolP, void * const blockP); const char * PoolStrdup(TPool * const poolP, const char * const origString); #endif
{ "content_hash": "191fec7f08c95cc26be8f7101ce519d1", "timestamp": "", "source": "github", "line_count": 179, "max_line_length": 70, "avg_line_length": 19.083798882681563, "alnum_prop": 0.5199063231850117, "repo_name": "hoyin29/XML_RPC", "id": "98a82849fdaadb1c3f3c14db144606dd8ce93150", "size": "3416", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "xmlrpc-c/lib/abyss/src/data.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "2267346" }, { "name": "C++", "bytes": "647550" }, { "name": "Objective-C", "bytes": "572" }, { "name": "Perl", "bytes": "19352" }, { "name": "Racket", "bytes": "545" }, { "name": "Shell", "bytes": "30847" } ] }
package org.kjots.json.content.shared.text; /** * JSON Text Builder. * <p> * Created: 2nd February 2010. * * @author <a href="mailto:kjots@kjots.org">Karl J. Ots &lt;kjots@kjots.org&gt;</a> * @since 1.0 */ public class JsonTextBuilder extends JsonTextGenerator { /** The string builder. */ private final StringBuilder stringBuilder; /** * Construct a new JSON Text Builder. */ public JsonTextBuilder() { this(new StringBuilder()); } /** * Construct a new JSON Text Builder. * * @param stringBuilder The string builder. */ public JsonTextBuilder(StringBuilder stringBuilder) { this.stringBuilder = stringBuilder; } /** * Create a string representation of this object. * * @return The string representation. */ @Override public String toString() { return this.stringBuilder.toString(); } /** * Print the given character. * * @param character The character. */ @Override protected void print(char character) { this.stringBuilder.append(character); } /** * Print the given string. * * @param string The string. */ @Override protected void print(String string) { this.stringBuilder.append(string); } }
{ "content_hash": "380dcbc6dd2f5f7e3fa66b87dc50a206", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 83, "avg_line_length": 20.24590163934426, "alnum_prop": 0.648582995951417, "repo_name": "kjots/json-toolkit", "id": "05fd0307bafc10b9475807c23edd6199951fb9e7", "size": "1854", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "json-content.shared/src/main/java/org/kjots/json/content/shared/text/JsonTextBuilder.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1031715" } ] }
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("05. Book Library")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("05. Book Library")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("24897891-a04f-459a-b3d1-738bb3bcaf54")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
{ "content_hash": "443716355be1383d1b6f3ae0eb9bf9ba", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 84, "avg_line_length": 38.888888888888886, "alnum_prop": 0.745, "repo_name": "Shtereva/Fundamentals-with-CSharp", "id": "4414e746bff2536591973a95bc43bf4e713bf547", "size": "1403", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Objects and Simple Classes/05. Book Library/Properties/AssemblyInfo.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "201" }, { "name": "C#", "bytes": "1263790" }, { "name": "CSS", "bytes": "1026" }, { "name": "HTML", "bytes": "10254" }, { "name": "JavaScript", "bytes": "42472" }, { "name": "PowerShell", "bytes": "264844" } ] }
package diameter import ( "bytes" "io" "net" "time" ) // DialAndServe start diameter connection handling process as initiator. func DialAndServe(c net.Conn) (err error) { state = closed return serve(c) } // ListenAndServe start diameter connection handling process as responder. func ListenAndServe(c net.Conn) (err error) { state = waitCER return serve(c) } func serve(c net.Conn) error { if c == nil { return io.ErrUnexpectedEOF } conn = c if Peer.Host == "" { if names, err := net.LookupAddr(c.RemoteAddr().String()); err == nil { Peer.Host, Peer.Realm, _ = ResolveIdentiry(names[0]) } } go func() { for { m := Message{} conn.SetReadDeadline(time.Time{}) if err := m.UnmarshalFrom(conn); err != nil { break } if m.AppID == 0 && m.Code == 257 && m.FlgR { notify <- eventRcvCER{m} } else if m.AppID == 0 && m.Code == 257 && !m.FlgR { notify <- eventRcvCEA{m} } else if m.AppID == 0 && m.Code == 280 && m.FlgR { notify <- eventRcvDWR{m} } else if m.AppID == 0 && m.Code == 280 && !m.FlgR { notify <- eventRcvDWA{m} } else if m.AppID == 0 && m.Code == 282 && m.FlgR { notify <- eventRcvDPR{m} } else if m.AppID == 0 && m.Code == 282 && !m.FlgR { notify <- eventRcvDPA{m} } else if m.FlgR { notify <- eventRcvReq{m} } else { notify <- eventRcvAns{m} } } notify <- eventPeerDisc{} }() go func() { for req, ok := <-rcvStack; ok; req, ok = <-rcvStack { /* avps := make([]AVP, 0, 10) var err error for rdr := bytes.NewReader(req.AVPs); rdr.Len() != 0; { a := AVP{} if err = a.wrapedUnmarshalFrom(rdr); err != nil { break } avps = append(avps, a) } if iavp, ok := err.(InvalidAVP); ok { notify <- eventSndMsg{req.generateAnswerBy(iavp.Code)} } else { */ var avps []byte var flgE bool if app, ok := applications[req.AppID]; ok { if f, ok := app.handlers[req.Code]; ok && f != nil { flgE, avps = f(req.FlgT, req.AVPs) } } if avps == nil { flgE, avps = DefaultHandler(req) } notify <- eventSndMsg{Message{ FlgR: false, FlgP: req.FlgP, FlgE: flgE, FlgT: false, Code: req.Code, AppID: req.AppID, HbHID: req.HbHID, EtEID: req.EtEID, AVPs: avps}} /* } */ } }() TraceState(shutdown.String(), state.String(), eventInit{}.String(), nil) if state != waitCER { notify <- eventConnect{} } for { event := <-notify old := state TraceState(old.String(), state.String(), event.String(), event.exec()) if _, ok := event.(eventPeerDisc); ok { break } } return nil } // message -> error, avps var DefaultHandler func(Message) (bool, []byte) func init() { DefaultHandler = func(_ Message) (bool, []byte) { buf := new(bytes.Buffer) SetResultCode(UnableToDeliver).MarshalTo(buf) SetOriginHost(Local.Host).MarshalTo(buf) SetOriginRealm(Local.Realm).MarshalTo(buf) return true, buf.Bytes() } } // Send Diameter request func Send(m Message) (bool, []byte) { m.FlgR = true m.FlgE = false m.HbHID = nextHbH() if state != open { m = m.generateAnswerBy(UnableToDeliver) } else if _, ok := applications[m.AppID]; !ok && len(applications) != 0 { m = m.generateAnswerBy(UnableToDeliver) } else { ch := make(chan Message) sndStack[m.HbHID] = ch notify <- eventSndMsg{m} t := time.AfterFunc(WDInterval, func() { notify <- eventRcvAns{m.generateAnswerBy(TooBusy)} }) r, ok := <-ch t.Stop() if !ok { m = m.generateAnswerBy(UnableToDeliver) } else if m.Code != r.Code || m.AppID != r.AppID || m.EtEID != r.EtEID { m = m.generateAnswerBy(UnableToDeliver) } else { m = r } } return m.FlgE, m.AVPs } // Handler handles Diameter message. // Inputs are Retry flag and AVPs of Request, Outputs are Error flag and AVPs of Answer. type Handler func(bool, []byte) (bool, []byte) // Handle registers Diameter request handler for specified command. func Handle(code, appID, venID uint32, h Handler) Handler { if _, ok := applications[appID]; !ok { applications[appID] = application{ venID: venID, handlers: make(map[uint32]func(bool, []byte) (bool, []byte))} } applications[appID].handlers[code] = h return func(r bool, avp []byte) (bool, []byte) { if Router { buf := new(bytes.Buffer) buf.Write(avp) SetRouteRecord(Local.Host).MarshalTo(buf) avp = buf.Bytes() } return Send(Message{ FlgR: true, FlgP: true, FlgE: false, FlgT: r, Code: code, AppID: appID, HbHID: 0, EtEID: nextEtE(), AVPs: avp}) } } // Close stop state machine func Close(cause Enumerated) { if state == open { notify <- eventLock{} for len(rcvStack) != 0 || len(sndStack) != 0 { time.Sleep(time.Millisecond * 100) } } notify <- eventStop{cause} }
{ "content_hash": "8cf56f706cd704799b3d5045b9045eac", "timestamp": "", "source": "github", "line_count": 201, "max_line_length": 88, "avg_line_length": 23.65671641791045, "alnum_prop": 0.6130389064143007, "repo_name": "fkgi/diameter", "id": "d6cffef21256c2d3b20238f012231f9c8991615f", "size": "4755", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "connection.go", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Go", "bytes": "173228" } ] }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_connect_socket_w32spawnl_67b.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-67b.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: connect_socket Read data using a connect socket (client side) * GoodSource: Fixed string * Sinks: w32spawnl * BadSink : execute command with wspawnl * Flow Variant: 67 Data flow: data passed in a struct from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT L"cmd.exe" #define COMMAND_ARG1 L"/c" #define COMMAND_ARG2 L"dir" #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH L"/bin/sh" #define COMMAND_INT L"sh" #define COMMAND_ARG1 L"ls" #define COMMAND_ARG2 L"-la" #define COMMAND_ARG3 data #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else /* NOT _WIN32 */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define IP_ADDRESS "127.0.0.1" #include <process.h> typedef struct _CWE78_OS_Command_Injection__wchar_t_connect_socket_w32spawnl_67_structType { wchar_t * structFirst; } CWE78_OS_Command_Injection__wchar_t_connect_socket_w32spawnl_67_structType; #ifndef OMITBAD void CWE78_OS_Command_Injection__wchar_t_connect_socket_w32spawnl_67b_badSink(CWE78_OS_Command_Injection__wchar_t_connect_socket_w32spawnl_67_structType myStruct) { wchar_t * data = myStruct.structFirst; /* wspawnl - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ _wspawnl(_P_WAIT, COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE78_OS_Command_Injection__wchar_t_connect_socket_w32spawnl_67b_goodG2BSink(CWE78_OS_Command_Injection__wchar_t_connect_socket_w32spawnl_67_structType myStruct) { wchar_t * data = myStruct.structFirst; /* wspawnl - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ _wspawnl(_P_WAIT, COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL); } #endif /* OMITGOOD */
{ "content_hash": "2e5909c907fc05b5792f54a06e42f5bd", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 166, "avg_line_length": 33.25581395348837, "alnum_prop": 0.7202797202797203, "repo_name": "maurer/tiamat", "id": "f3bcb2a4ffab5f02f21d7023335b5101334ccaec", "size": "2860", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "samples/Juliet/testcases/CWE78_OS_Command_Injection/s05/CWE78_OS_Command_Injection__wchar_t_connect_socket_w32spawnl_67b.c", "mode": "33188", "license": "mit", "language": [] }
var common = require('../common.js'); var W = require('_stream_writable'); var D = require('_stream_duplex'); var assert = require('assert'); var util = require('util'); util.inherits(TestWriter, W); function TestWriter() { W.apply(this, arguments); this.buffer = []; this.written = 0; } TestWriter.prototype._write = function(chunk, encoding, cb) { // simulate a small unpredictable latency setTimeout(function() { this.buffer.push(chunk.toString()); this.written += chunk.length; cb(); }.bind(this), Math.floor(Math.random() * 10)); }; var chunks = new Array(50); for (var i = 0; i < chunks.length; i++) { chunks[i] = new Array(i + 1).join('x'); } // tiny node-tap lookalike. var tests = []; var count = 0; function test(name, fn) { count++; tests.push([name, fn]); } function run() { var next = tests.shift(); if (!next) return console.error('ok'); var name = next[0]; var fn = next[1]; console.log('# %s', name); fn({ same: assert.deepEqual, equal: assert.equal, end: function () { count--; run(); } }); } // ensure all tests have run process.on("exit", function () { assert.equal(count, 0); }); process.nextTick(run); test('write fast', function(t) { var tw = new TestWriter({ highWaterMark: 100 }); tw.on('finish', function() { t.same(tw.buffer, chunks, 'got chunks in the right order'); t.end(); }); chunks.forEach(function(chunk) { // screw backpressure. Just buffer it all up. tw.write(chunk); }); tw.end(); }); test('write slow', function(t) { var tw = new TestWriter({ highWaterMark: 100 }); tw.on('finish', function() { t.same(tw.buffer, chunks, 'got chunks in the right order'); t.end(); }); var i = 0; (function W() { tw.write(chunks[i++]); if (i < chunks.length) setTimeout(W, 10); else tw.end(); })(); }); test('write backpressure', function(t) { var tw = new TestWriter({ highWaterMark: 50 }); var drains = 0; tw.on('finish', function() { t.same(tw.buffer, chunks, 'got chunks in the right order'); t.equal(drains, 17); t.end(); }); tw.on('drain', function() { drains++; }); var i = 0; (function W() { do { var ret = tw.write(chunks[i++]); } while (ret !== false && i < chunks.length); if (i < chunks.length) { assert(tw._writableState.length >= 50); tw.once('drain', W); } else { tw.end(); } })(); }); test('write bufferize', function(t) { var tw = new TestWriter({ highWaterMark: 100 }); var encodings = [ 'hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', undefined ]; tw.on('finish', function() { t.same(tw.buffer, chunks, 'got the expected chunks'); }); chunks.forEach(function(chunk, i) { var enc = encodings[ i % encodings.length ]; chunk = new Buffer(chunk); tw.write(chunk.toString(enc), enc); }); t.end(); }); test('write no bufferize', function(t) { var tw = new TestWriter({ highWaterMark: 100, decodeStrings: false }); tw._write = function(chunk, encoding, cb) { assert(typeof chunk === 'string'); chunk = new Buffer(chunk, encoding); return TestWriter.prototype._write.call(this, chunk, encoding, cb); }; var encodings = [ 'hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', undefined ]; tw.on('finish', function() { t.same(tw.buffer, chunks, 'got the expected chunks'); }); chunks.forEach(function(chunk, i) { var enc = encodings[ i % encodings.length ]; chunk = new Buffer(chunk); tw.write(chunk.toString(enc), enc); }); t.end(); }); test('write callbacks', function (t) { var callbacks = chunks.map(function(chunk, i) { return [i, function(er) { callbacks._called[i] = chunk; }]; }).reduce(function(set, x) { set['callback-' + x[0]] = x[1]; return set; }, {}); callbacks._called = []; var tw = new TestWriter({ highWaterMark: 100 }); tw.on('finish', function() { process.nextTick(function() { t.same(tw.buffer, chunks, 'got chunks in the right order'); t.same(callbacks._called, chunks, 'called all callbacks'); t.end(); }); }); chunks.forEach(function(chunk, i) { tw.write(chunk, callbacks['callback-' + i]); }); tw.end(); }); test('end callback', function (t) { var tw = new TestWriter(); tw.end(function () { t.end(); }); }); test('end callback with chunk', function (t) { var tw = new TestWriter(); tw.end(new Buffer('hello world'), function () { t.end(); }); }); test('end callback with chunk and encoding', function (t) { var tw = new TestWriter(); tw.end('hello world', 'ascii', function () { t.end(); }); }); test('end callback after .write() call', function (t) { var tw = new TestWriter(); tw.write(new Buffer('hello world')); tw.end(function () { t.end(); }); }); test('end callback called after write callback', function (t) { var tw = new TestWriter(); var writeCalledback = false; tw.write(new Buffer('hello world'), function() { writeCalledback = true; }); tw.end(function () { t.equal(writeCalledback, true); t.end(); }); }); test('encoding should be ignored for buffers', function(t) { var tw = new W(); var hex = '018b5e9a8f6236ffe30e31baf80d2cf6eb'; tw._write = function(chunk, encoding, cb) { t.equal(chunk.toString('hex'), hex); t.end(); }; var buf = new Buffer(hex, 'hex'); tw.write(buf, 'binary'); }); test('writables are not pipable', function(t) { var w = new W(); w._write = function() {}; var gotError = false; w.on('error', function(er) { gotError = true; }); w.pipe(process.stdout); assert(gotError); t.end(); }); test('duplexes are pipable', function(t) { var d = new D(); d._read = function() {}; d._write = function() {}; var gotError = false; d.on('error', function(er) { gotError = true; }); d.pipe(process.stdout); assert(!gotError); t.end(); }); test('end(chunk) two times is an error', function(t) { var w = new W(); w._write = function() {}; var gotError = false; w.on('error', function(er) { gotError = true; t.equal(er.message, 'write after end'); }); w.end('this is the end'); w.end('and so is this'); process.nextTick(function() { assert(gotError); t.end(); }); }); test('dont end while writing', function(t) { var w = new W(); var wrote = false; w._write = function(chunk, e, cb) { assert(!this.writing); wrote = true; this.writing = true; setTimeout(function() { this.writing = false; cb(); }); }; w.on('finish', function() { assert(wrote); t.end(); }); w.write(Buffer(0)); w.end(); }); test('finish does not come before write cb', function(t) { var w = new W(); var writeCb = false; w._write = function(chunk, e, cb) { setTimeout(function() { writeCb = true; cb(); }, 10); }; w.on('finish', function() { assert(writeCb); t.end(); }); w.write(Buffer(0)); w.end(); }); test('finish does not come before sync _write cb', function(t) { var w = new W(); var writeCb = false; w._write = function(chunk, e, cb) { cb(); }; w.on('finish', function() { assert(writeCb); t.end(); }); w.write(Buffer(0), function(er) { writeCb = true; }); w.end(); }); test('finish is emitted if last chunk is empty', function(t) { var w = new W(); w._write = function(chunk, e, cb) { process.nextTick(cb); }; w.on('finish', function() { t.end(); }); w.write(Buffer(1)); w.end(Buffer(0)); });
{ "content_hash": "fbf4da06a3b3ed010f19344a4f775faa", "timestamp": "", "source": "github", "line_count": 384, "max_line_length": 71, "avg_line_length": 20.526041666666668, "alnum_prop": 0.5626744481096169, "repo_name": "unknownexception/flow-declarations", "id": "3767ce140e77257cba6dcf07bdee3bb0e341a3a9", "size": "9016", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "test/node/test-stream2-writable.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "2283910" }, { "name": "Python", "bytes": "195" }, { "name": "Shell", "bytes": "334" } ] }
A simple Arduino MIDI controller experiment. In the [wiki](https://github.com/alex5imon/MIDI-controller/wiki) you can find step by step how to create a very simple MIDI controller with Arduino UNO. ## Requirements - OSX - [Arduino UNO R3](http://arduino.cc/en/Main/arduinoBoardUno) + latest [Arduino IDE](http://arduino.cc/download_handler.php?f=/arduino-1.6.0-macosx.zip) - Optional: additional hardware (breadboard, buttons, wires...) ## Credits - [Dimitri Diakopoulos](http://www.dimitridiakopoulos.com/hiduino) for his [Hiduino](https://github.com/ddiakopoulos/hiduino) firmware - Arduino for the [MIDI library](https://github.com/FortySevenEffects/arduino_midi_library/releases/download/4.2/Arduino_MIDI_Library_v4.2.zip) ## License This project is licensed under the MIT license.
{ "content_hash": "48a64597855068ecea51cd3fc7729462", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 197, "avg_line_length": 60.69230769230769, "alnum_prop": 0.7718631178707225, "repo_name": "alex5imon/MIDI-controller", "id": "0760fdc09b0f467d64f995f038a0f2b23b04dbf7", "size": "808", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Arduino", "bytes": "1345" } ] }
DCHacks project
{ "content_hash": "68351785c8247ad34e5d95e1bed03e24", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 15, "avg_line_length": 16, "alnum_prop": 0.875, "repo_name": "fwilson42/dchacks2015", "id": "a6876be614181b133a9692b582f39cb622692026", "size": "30", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "6045" }, { "name": "HTML", "bytes": "30379" }, { "name": "JavaScript", "bytes": "41" }, { "name": "Python", "bytes": "38269" } ] }
package org.kuali.rice.krad.data.jpa.eclipselink; import org.apache.commons.lang.StringUtils; import org.eclipse.persistence.config.SessionCustomizer; import org.eclipse.persistence.descriptors.ClassDescriptor; import org.eclipse.persistence.exceptions.DescriptorException; import org.eclipse.persistence.internal.databaseaccess.Accessor; import org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy; import org.eclipse.persistence.internal.sessions.AbstractSession; import org.eclipse.persistence.mappings.DatabaseMapping; import org.eclipse.persistence.sequencing.Sequence; import org.eclipse.persistence.sessions.DatabaseLogin; import org.eclipse.persistence.sessions.JNDIConnector; import org.eclipse.persistence.sessions.Session; import org.kuali.rice.krad.data.jpa.DisableVersioning; import org.kuali.rice.krad.data.jpa.Filter; import org.kuali.rice.krad.data.jpa.FilterGenerator; import org.kuali.rice.krad.data.jpa.FilterGenerators; import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator; import org.kuali.rice.krad.data.jpa.RemoveMapping; import org.kuali.rice.krad.data.jpa.RemoveMappings; import org.kuali.rice.krad.data.platform.MaxValueIncrementerFactory; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; import javax.sql.DataSource; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; /** * EclipseLink Session Customizer which understands {@link org.kuali.rice.krad.data.jpa.PortableSequenceGenerator} * annotations and automatically registers custom EclipseLink Sequences. * * <p> * Since SessionCustomizers are stateless instances, and because concrete * {@link org.eclipse.persistence.sequencing.Sequence} objects must be registered individually with the EclipseLink * session, we lazy generate the Sequence objects using annotation inspection and then register them on each new * session using this customizer. * </p> * * @author Kuali Rice Team (rice.collab@kuali.org) */ public class KradEclipseLinkCustomizer implements SessionCustomizer { private static ConcurrentMap<String, List<Sequence>> sequenceMap = new ConcurrentHashMap<String, List<Sequence>>(8, 0.9f, 1); /* Keyed by the session name determines if the class descriptors have been modified for the current session. */ private static ConcurrentMap<String, Boolean> modDescMap = new ConcurrentHashMap<String, Boolean>(); private static ConcurrentMap<String, List<FilterGenerator>> queryCustomizerMap = new ConcurrentHashMap<String, List<FilterGenerator>>(); /** * {@inheritDoc} */ @Override public void customize(Session session) throws Exception { String sessionName = session.getName(); // double-checked locking on ConcurrentMap List<Sequence> sequences = sequenceMap.get(sessionName); if (sequences == null) { sequences = sequenceMap.putIfAbsent(sessionName, loadSequences(session)); if (sequences == null) { sequences = sequenceMap.get(sessionName); } } loadQueryCustomizers(session); DatabaseLogin login = session.getLogin(); for (Sequence sequence : sequences) { login.addSequence(sequence); } handleDescriptorModifications(session); } /** * Load Query Customizer based on annotations on fields and call customizer to modify descriptor. * * @param session the EclipseLink session. */ protected void loadQueryCustomizers(Session session) { Map<Class, ClassDescriptor> descriptors = session.getDescriptors(); for (Class<?> entityClass : descriptors.keySet()) { for (Field field : entityClass.getDeclaredFields()) { String queryCustEntry = entityClass.getName() + "_" + field.getName(); buildQueryCustomizers(entityClass,field,queryCustEntry); List<FilterGenerator> queryCustomizers = queryCustomizerMap.get(queryCustEntry); if (queryCustomizers != null && !queryCustomizers.isEmpty()) { Filter.customizeField(queryCustomizers, descriptors.get(entityClass), field.getName()); } } } } /** * Build and populate map of QueryCustomizer annotations. * * @param entityClass the type of the entity. * @param field the field to process. * @param key the id to store the customizer under. */ protected void buildQueryCustomizers(Class<?> entityClass,Field field, String key){ FilterGenerators customizers = field.getAnnotation(FilterGenerators.class); List<FilterGenerator> filterGenerators = new ArrayList<FilterGenerator>(); if(customizers != null){ filterGenerators.addAll(Arrays.asList(customizers.value())); } else { FilterGenerator customizer = field.getAnnotation(FilterGenerator.class); if(customizer != null){ filterGenerators.add(customizer); } } for(FilterGenerator customizer : filterGenerators){ List<FilterGenerator> filterCustomizers = queryCustomizerMap.get(key); if (filterCustomizers == null) { filterCustomizers = new ArrayList<FilterGenerator>(); filterCustomizers.add(customizer); queryCustomizerMap.putIfAbsent(key, filterCustomizers); } else { filterCustomizers.add(customizer); queryCustomizerMap.put(key,filterCustomizers); } } } /** * Determines if the class descriptors have been modified for the given session name. * * @param session the current session. */ protected void handleDescriptorModifications(Session session) { String sessionName = session.getName(); // double-checked locking on ConcurrentMap Boolean descModified = modDescMap.get(sessionName); if (descModified == null) { descModified = modDescMap.putIfAbsent(sessionName, Boolean.FALSE); if (descModified == null) { descModified = modDescMap.get(sessionName); } } if (Boolean.FALSE.equals(descModified)) { modDescMap.put(sessionName, Boolean.TRUE); handleDisableVersioning(session); handleRemoveMapping(session); } } /** * Checks class descriptors for {@link @DisableVersioning} annotations at the class level and removes the version * database mapping for optimistic locking. * * @param session the current session. */ protected void handleDisableVersioning(Session session) { Map<Class, ClassDescriptor> descriptors = session.getDescriptors(); if (descriptors == null || descriptors.isEmpty()) { return; } for (ClassDescriptor classDescriptor : descriptors.values()) { if (classDescriptor != null && AnnotationUtils.findAnnotation(classDescriptor.getJavaClass(), DisableVersioning.class) != null) { OptimisticLockingPolicy olPolicy = classDescriptor.getOptimisticLockingPolicy(); if (olPolicy != null) { classDescriptor.setOptimisticLockingPolicy(null); } } } } /** * Checks class descriptors for {@link @RemoveMapping} and {@link RemoveMappings} annotations at the class level * and removes any specified mappings from the ClassDescriptor. * * @param session the current session. */ protected void handleRemoveMapping(Session session) { Map<Class, ClassDescriptor> descriptors = session.getDescriptors(); if (descriptors == null || descriptors.isEmpty()) { return; } for (ClassDescriptor classDescriptor : descriptors.values()) { List<RemoveMapping> removeMappings = scanForRemoveMappings(classDescriptor); if (!removeMappings.isEmpty()) { List<DatabaseMapping> mappingsToRemove = new ArrayList<DatabaseMapping>(); for (RemoveMapping removeMapping : removeMappings) { if (StringUtils.isBlank(removeMapping.name())) { throw DescriptorException.attributeNameNotSpecified(); } DatabaseMapping databaseMapping = classDescriptor.getMappingForAttributeName(removeMapping.name()); if (databaseMapping == null) { throw DescriptorException.mappingForAttributeIsMissing(removeMapping.name(), classDescriptor); } mappingsToRemove.add(databaseMapping); } for (DatabaseMapping mappingToRemove : mappingsToRemove) { classDescriptor.removeMappingForAttributeName(mappingToRemove.getAttributeName()); } } } } /** * Gets any {@link RemoveMapping}s out of the given {@link ClassDescriptor}. * * @param classDescriptor the {@link ClassDescriptor} to scan. * @return a list of {@link RemoveMapping}s from the given {@link ClassDescriptor}. */ protected List<RemoveMapping> scanForRemoveMappings(ClassDescriptor classDescriptor) { List<RemoveMapping> removeMappings = new ArrayList<RemoveMapping>(); RemoveMappings removeMappingsAnnotation = AnnotationUtils.findAnnotation(classDescriptor.getJavaClass(), RemoveMappings.class); if (removeMappingsAnnotation == null) { RemoveMapping removeMappingAnnotation = AnnotationUtils.findAnnotation(classDescriptor.getJavaClass(), RemoveMapping.class); if (removeMappingAnnotation != null) { removeMappings.add(removeMappingAnnotation); } } else { for (RemoveMapping removeMapping : removeMappingsAnnotation.value()) { removeMappings.add(removeMapping); } } return removeMappings; } /** * Gets any {@link Sequence} from the session. * * @param session the current session. * @return a list of {@link Sequence}s. */ protected List<Sequence> loadSequences(Session session) { Map<Class, ClassDescriptor> descriptors = session.getDescriptors(); List<PortableSequenceGenerator> sequenceGenerators = new ArrayList<PortableSequenceGenerator>(); for (Class<?> entityClass : descriptors.keySet()) { PortableSequenceGenerator sequenceGenerator = AnnotationUtils.findAnnotation(entityClass, PortableSequenceGenerator.class); if (sequenceGenerator != null) { sequenceGenerators.add(sequenceGenerator); } loadFieldSequences(entityClass, sequenceGenerators); for (Method method : entityClass.getMethods()) { PortableSequenceGenerator methodSequenceGenerator = method.getAnnotation( PortableSequenceGenerator.class); if (methodSequenceGenerator != null) { sequenceGenerators.add(methodSequenceGenerator); } } } List<Sequence> sequences = new ArrayList<Sequence>(); for (PortableSequenceGenerator sequenceGenerator : sequenceGenerators) { Sequence sequence = new MaxValueIncrementerSequenceWrapper(sequenceGenerator); sequences.add(sequence); } return sequences; } /** * Loads any field-based sequences from the given type. * * @param entityClass the type of the entity. * @param sequenceGenerators the current list of sequence generators. */ protected void loadFieldSequences(Class<?> entityClass, List<PortableSequenceGenerator> sequenceGenerators) { for (Field field : entityClass.getDeclaredFields()) { PortableSequenceGenerator fieldSequenceGenerator = field.getAnnotation(PortableSequenceGenerator.class); if (fieldSequenceGenerator != null) { sequenceGenerators.add(fieldSequenceGenerator); } } // next, walk up and check the super class... if (entityClass.getSuperclass() != null) { loadFieldSequences(entityClass.getSuperclass(), sequenceGenerators); } } /** * Translates our {@link PortableSequenceGenerator} into an EclipseLink {@link Sequence}. */ private static final class MaxValueIncrementerSequenceWrapper extends Sequence { private static final long serialVersionUID = 2375805962996574386L; private final String sequenceName; /** * Creates a sequence wrapper for our {@link PortableSequenceGenerator}. * * @param sequenceGenerator the {@link PortableSequenceGenerator} to process. */ MaxValueIncrementerSequenceWrapper(PortableSequenceGenerator sequenceGenerator) { super(sequenceGenerator.name(), 0); // default sequenceName to the name of the sequence generator if the sequence name was not provided if (StringUtils.isBlank(sequenceGenerator.sequenceName())) { sequenceName = sequenceGenerator.name(); } else { sequenceName = sequenceGenerator.sequenceName(); } } /** * {@inheritDoc} */ @Override public boolean shouldAcquireValueAfterInsert() { return false; } /** * {@inheritDoc} */ @Override public boolean shouldUseTransaction() { return true; } /** * {@inheritDoc} */ @Override public boolean shouldUsePreallocation() { return false; } /** * {@inheritDoc} */ @Override public Object getGeneratedValue(Accessor accessor, AbstractSession writeSession, String seqName) { DataSource dataSource = ((JNDIConnector) writeSession.getLogin().getConnector()).getDataSource(); DataFieldMaxValueIncrementer incrementer = MaxValueIncrementerFactory.getIncrementer(dataSource, sequenceName); return Long.valueOf(incrementer.nextLongValue()); } /** * {@inheritDoc} */ @Override public Vector<?> getGeneratedVector(Accessor accessor, AbstractSession writeSession, String seqName, int size) { // we're not in the business of pre-fetching/allocating ids throw new UnsupportedOperationException(getClass().getName() + " does pre-generate sequence ids"); } /** * {@inheritDoc} */ @Override public void onConnect() {} /** * {@inheritDoc} */ @Override public void onDisconnect() {} /** * {@inheritDoc} */ @Override public MaxValueIncrementerSequenceWrapper clone() { return (MaxValueIncrementerSequenceWrapper) super.clone(); } } }
{ "content_hash": "8aec39c5e2f49b758d0d7c50f1e89265", "timestamp": "", "source": "github", "line_count": 389, "max_line_length": 120, "avg_line_length": 39.9974293059126, "alnum_prop": 0.6515842920496175, "repo_name": "ewestfal/rice-svn2git-test", "id": "126dede4d8166c7bf106bf2d79cbf79f1ff67b74", "size": "16180", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "rice-framework/krad-data/src/main/java/org/kuali/rice/krad/data/jpa/eclipselink/KradEclipseLinkCustomizer.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "793243" }, { "name": "Groovy", "bytes": "2170621" }, { "name": "Java", "bytes": "34445604" }, { "name": "JavaScript", "bytes": "2635300" }, { "name": "PHP", "bytes": "15766" }, { "name": "Shell", "bytes": "10444" }, { "name": "XSLT", "bytes": "107686" } ] }
window.app.directive('tiles', function ($timeout) { return { link: function (scope, element, attrs) { scope.$watch("eventsList", function () { var eventDataList= scope.eventsList; var dateToYMD=function(dateStr) { if(dateStr===null){ var date=new Date() var d = date.getDate(); var m = date.getMonth() + 1; var y = date.getFullYear(); return '' + y + '-' + (m<=9 ? '0' + m : m) + '-' + (d <= 9 ? '0' + d : d); } else{ var a=dateStr.split("T"); var d=a[0].split("-"); var d1 = d[2] var m1 = d[1] var y1 = d[0] return '' + y1 + '-' + m1 + '-' + d1; } } var el = document.getElementById('sample2-grid'), grid = new Tiles.Grid(el); // template is selected by user, not generated so just // return the number of columns in the current template grid.resizeColumns = function() { var d = Tiles.Grid.prototype.resizeColumns.call(this); if(grid.mode==="Small" && grid.getContentWidth() >600){ d++; } return d }; // by default, each tile is an empty div, we'll override creation // to add a tile number to each div grid.createTile = function(tileId) { var tile = new Tiles.Tile(tileId); tile.$el.addClass('tile-block tile-1x1') var displayeventDate=tileId.startDate tile.$el.append('<a href="#!/events/'+tileId._id+'"><div style="background-image: url('+decodeURIComponent(tileId.imageUrl)+')" class="tile-bg rel"><div class="tile-details"><div class="title">'+tileId.title +'</div></div><div class="schedule"><div>Date :'+ dateToYMD(displayeventDate)+ '</div><div>Location:'+tileId.location +'</div></div></div></a>'); return tile; }; $("#header-layout-toggle").addClass('zoom').show(); var $templateButtons = $('#header-layout-toggle .dev-template').on('click', function(e) { // unselect all templates $templateButtons.removeClass("selected"); // select the template we clicked on $(e.target).addClass("selected"); // get the JSON rows for the selection var index = $(e.target).index() grid.mode="1" grid.template=null grid.cellSizeMin=200; $("#header-layout-toggle").removeClass('zoom').removeClass('grid1').removeClass('smart') if(index==0){ grid.templateFactory =Tiles.DynamicTemplates grid.resize() $("#header-layout-toggle").addClass('smart').show() } if(index==1){ grid.templateFactory =Tiles.UniformTemplates grid.resize() $("#header-layout-toggle").addClass('grid1').show() } if(index==2){ grid.templateFactory =Tiles.UniformTemplates grid.mode="Small" grid.resize() $("#header-layout-toggle").addClass('zoom').show() } // alert($('#Eventlist').attr('mydata')) grid.updateTiles(eventDataList); grid.isDirty = true; grid.redraw(true) }); // make the initial selection $('#header-layout-zoom').trigger('click'); var debounce = function(func, wait, immediate) { var timeout; return function() { var context = this, args = arguments; var later = function() { timeout = null; if (!immediate) func.apply(context, args); }; if (immediate && !timeout) func.apply(context, args); clearTimeout(timeout); timeout = setTimeout(later, wait); }; }; // wait until users finishes resizing the browser var debouncedResize = debounce(function() { grid.resize(); grid.redraw(true); }, 200); // when the window resizes, redraw the grid $(window).resize(debouncedResize); }, true); } } }); window.app.directive('ngFrame', function() { return{ restrict: "E", transclude: true, replace:true, compile: function compile(tElement, tAttrs, transclude) { return { pre: function(scope) { transclude(scope, function(clone) { scope.transcluded_content = clone; }); }, post: function(scope, element, attrs){ element.contents().find('body').html(scope.transcluded_content); } }; }, template: "<iframe></iframe>" }; }); window.app.directive('resize-iframe', function() { return { restrict: 'A', link: function ( scope, elm, attrs ) { var container = elm.contentWindow.document.getElementById('ifrm_container'); // Iframe container. Usualy a div. function autoResize(){ ifrmNewHeight = container.offsetHeight; // New height of the document. if(ifrmNewHeight !== ifrmOldHeight) { ifrmOldHeight = ifrmNewHeight + 30; // +30 for no scrollbar. ifrm.style.height= (ifrmNewHeight + 30) + "px"; // Set iframe style. } setTimeout(autoResize, 250); } // First call of autoResize(). autoResize(); } } }); /*window.app.directive('ckEditor', function() { return { require: '?ngModel', link: function(scope, elm, attr, ngModel) { var ck = CKEDITOR.replace(elm[0]); if (!ngModel) return; ck.on('pasteState', function() { scope.$apply(function() { ngModel.$setViewValue(ck.getData()); }); }); ngModel.$render = function(value) { ck.setData(ngModel.$viewValue); }; } }; });*/
{ "content_hash": "e6ae8c2d2d325c5d3deb395152f23c1d", "timestamp": "", "source": "github", "line_count": 199, "max_line_length": 373, "avg_line_length": 35.7035175879397, "alnum_prop": 0.4418015482054891, "repo_name": "rajarv/EventOrganizer", "id": "f05fc17fac118471b94d73321d126c5412cf906a", "size": "7105", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/js/directives.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "177390" }, { "name": "JavaScript", "bytes": "1955624" }, { "name": "PHP", "bytes": "2199" } ] }
import path from 'node:path' import { expect, describe, it, beforeEach, afterEach, vi } from 'vitest' import { remote } from '../../../src/index.js' vi.mock('got') vi.mock('@wdio/repl', () => import(path.join(process.cwd(), '__mocks__', '@wdio/repl'))) vi.mock('@wdio/logger', () => import(path.join(process.cwd(), '__mocks__', '@wdio/logger'))) describe('debug command', () => { let browser: WebdriverIO.Browser beforeEach(async () => { browser = await remote({ baseUrl: 'http://foobar.com', capabilities: { browserName: 'foobar' } }) }) describe('standalone mode', () => { it('should start wdio repl if in standalone mode', async () => { const repl = await browser.debug() as any expect(repl['_startFn']).toBeCalled() }) }) describe('as wdio testrunner', () => { let realProcess: NodeJS.Process beforeEach(() => { realProcess = global.process global.process = { env: { WDIO_WORKER: false } as any, _debugProcess: vi.fn(), _debugEnd: vi.fn(), send: vi.fn(), on: vi.fn() } as any }) it('should send debugger start command to wdio testrunner', () => { global.process.env.WDIO_WORKER_ID = '1' browser.debug() expect(global.process.send).toBeCalledWith({ origin: 'debugger', name: 'start', params: { commandTimeout: 5000, introMessage: 'some intro from mock' } }) // @ts-expect-error internal var expect(global.process._debugProcess).toBeCalledWith(process.pid) }) describe('on testrunner message', () => { let messageHandlerCallback: Function beforeEach(async () => { global.process.env.WDIO_WORKER_ID = '1' browser.debug() messageHandlerCallback = vi.mocked(global.process.on).mock.calls.pop()!.pop() as any }) it('should do nothing if no debugger origin', () => { messageHandlerCallback({ origin: 'foobar' }) messageHandlerCallback({ origin: 'debugger', name: 'foobar' }) }) it('should stop debugging process on stop', () => { messageHandlerCallback({ origin: 'debugger', name: 'stop' }) // @ts-expect-error internal var expect(global.process._debugEnd).toBeCalledWith(process.pid) }) it('should execute repl eval command', () => { messageHandlerCallback({ origin: 'debugger', name: 'eval', content: { cmd: '1+1' } }) }) }) afterEach(() => { global.process = realProcess delete global.process.env.WDIO_WORKER_ID }) }) })
{ "content_hash": "d83d707370f4ff56dc1920fd6c620668", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 100, "avg_line_length": 34.43181818181818, "alnum_prop": 0.501980198019802, "repo_name": "webdriverio/webdriverio", "id": "ec9fbeb8d186bf4a3ac828449858bf67e05e8e24", "size": "3030", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "packages/webdriverio/tests/commands/browser/debug.test.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "25022" }, { "name": "Dockerfile", "bytes": "600" }, { "name": "EJS", "bytes": "31368" }, { "name": "Gherkin", "bytes": "2916" }, { "name": "JavaScript", "bytes": "166511" }, { "name": "Shell", "bytes": "171" }, { "name": "TypeScript", "bytes": "3000925" } ] }
RSpec.describe RuboCop::Cop::Style::RedundantFileExtensionInRequire do subject(:cop) { described_class.new } it 'registers an offense and corrects when requiring filename ending with `.rb`' do expect_offense(<<~RUBY) require 'foo.rb' ^^^^^^^^ Redundant `.rb` file extension detected. require_relative '../foo.rb' ^^^^^^^^^^^ Redundant `.rb` file extension detected. RUBY expect_correction(<<~RUBY) require 'foo' require_relative '../foo' RUBY end it 'does not register an offense when requiring filename ending with `.so`' do expect_no_offenses(<<~RUBY) require 'foo.so' require_relative '../foo.so' RUBY end it 'does not register an offense when requiring filename without an extension' do expect_no_offenses(<<~RUBY) require 'foo' require_relative '../foo' RUBY end it 'does not register an offense when requiring variable as a filename' do expect_no_offenses(<<~RUBY) require name require_relative name RUBY end end
{ "content_hash": "3cd4536b60b0781bab2b95f58b00c3cd", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 85, "avg_line_length": 28.394736842105264, "alnum_prop": 0.6376274328081557, "repo_name": "tdeo/rubocop", "id": "48f5622100ff14c84cb988e0511830074efc91a1", "size": "1110", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "spec/rubocop/cop/style/redundant_file_extension_in_require_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "355" }, { "name": "HTML", "bytes": "7109" }, { "name": "Ruby", "bytes": "4762048" }, { "name": "Shell", "bytes": "75" } ] }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0-beta2) on Mon Mar 19 19:27:08 CST 2007 --> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <TITLE> 类 java.awt.Label.AccessibleAWTLabel 的使用 (Java Platform SE 6) </TITLE><script>var _hmt = _hmt || [];(function() {var hm = document.createElement("script");hm.src = "//hm.baidu.com/hm.js?dd1361ca20a10cc161e72d4bc4fef6df";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm, s);})();</script> <META NAME="date" CONTENT="2007-03-19"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="类 java.awt.Label.AccessibleAWTLabel 的使用 (Java Platform SE 6)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="跳过导航链接"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>概述</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../java/awt/Label.AccessibleAWTLabel.html" title="java.awt 中的类"><FONT CLASS="NavBarFont1"><B>类</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>使用</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> <b>Java<sup><font size=-2>TM</font></sup>&nbsp;Platform<br>Standard&nbsp;Ed. 6</b></EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;上一个&nbsp; &nbsp;下一个</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?java/awt//class-useLabel.AccessibleAWTLabel.html" target="_top"><B>框架</B></A> &nbsp; &nbsp;<A HREF="Label.AccessibleAWTLabel.html" target="_top"><B>无框架</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>所有类</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>所有类</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>类 java.awt.Label.AccessibleAWTLabel<br>的使用</B></H2> </CENTER> 没有 java.awt.Label.AccessibleAWTLabel 的用法 <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="跳过导航链接"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>概述</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../java/awt/Label.AccessibleAWTLabel.html" title="java.awt 中的类"><FONT CLASS="NavBarFont1"><B>类</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>使用</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> <b>Java<sup><font size=-2>TM</font></sup>&nbsp;Platform<br>Standard&nbsp;Ed. 6</b></EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;上一个&nbsp; &nbsp;下一个</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?java/awt//class-useLabel.AccessibleAWTLabel.html" target="_top"><B>框架</B></A> &nbsp; &nbsp;<A HREF="Label.AccessibleAWTLabel.html" target="_top"><B>无框架</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>所有类</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>所有类</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <font size="-1"><a href="http://bugs.sun.com/services/bugreport/index.jsp">提交错误或意见</a><br>有关更多的 API 参考资料和开发人员文档,请参阅 <a href="http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html">Java SE 开发人员文档</a>。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。 <p>版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守<a href="http://java.sun.com/javase/6/docs/legal/license.html">许可证条款</a>。另请参阅<a href="http://java.sun.com/docs/redist.html">文档重新分发政策</a>。</font> </BODY> </HTML>
{ "content_hash": "ce7092a21b36b393baa779547f6d59b4", "timestamp": "", "source": "github", "line_count": 145, "max_line_length": 441, "avg_line_length": 45.19310344827586, "alnum_prop": 0.6307034945826339, "repo_name": "piterlin/piterlin.github.io", "id": "a5f83e228e4bc69d683490b3e76080d934a51d98", "size": "6977", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/jdk6_cn/java/awt/class-use/Label.AccessibleAWTLabel.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "479" }, { "name": "HTML", "bytes": "9480869" }, { "name": "JavaScript", "bytes": "246" } ] }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.12"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Nabu-asr: processors Directory Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Nabu-asr </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.12 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_5a19dd24bd3679bb79d0ed8fbf6eb6c5.html">nabu</a></li><li class="navelem"><a class="el" href="dir_38a0e828cfd915bf1a57174729a2f8cd.html">processing</a></li><li class="navelem"><a class="el" href="dir_e13f2eda408f5edf365c238eb07cf74b.html">processors</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">processors Directory Reference</div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="subdirs"></a> Directories</h2></td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a> Files</h2></td></tr> <tr class="memitem:alignment__processor_8py"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="alignment__processor_8py.html">alignment_processor.py</a></td></tr> <tr class="memdesc:alignment__processor_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">Contains the TextProcesso. <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:audio__processor_8py"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="audio__processor_8py.html">audio_processor.py</a></td></tr> <tr class="memdesc:audio__processor_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">contains the AudioProcessor class <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:binary__processor_8py"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="binary__processor_8py.html">binary_processor.py</a></td></tr> <tr class="memdesc:binary__processor_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">Contains the BinaryProcesso. <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:processor_8py"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="processor_8py.html">processor.py</a></td></tr> <tr class="memdesc:processor_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">contains the Processor class <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:processor__factory_8py"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="processor__factory_8py.html">processor_factory.py</a></td></tr> <tr class="memdesc:processor__factory_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">contains the Processor factory method <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:text__processor_8py"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="text__processor_8py.html">text_processor.py</a></td></tr> <tr class="memdesc:text__processor_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">Contains the TextProcesso. <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:textfile__processor_8py"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="textfile__processor_8py.html">textfile_processor.py</a></td></tr> <tr class="memdesc:textfile__processor_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">Contains the TextFileProcesso. <br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.12 </small></address> </body> </html>
{ "content_hash": "98e028fec4deed5300ff2dae0164f519", "timestamp": "", "source": "github", "line_count": 105, "max_line_length": 307, "avg_line_length": 61.161904761904765, "alnum_prop": 0.6912176891933977, "repo_name": "vrenkens/nabu", "id": "6a6ab3a0e6a134730c265ac32ce3fb0376d83bbd", "size": "6422", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "docs/dir_e13f2eda408f5edf365c238eb07cf74b.html", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "322709" }, { "name": "Shell", "bytes": "5290" } ] }
#ifndef _SYSHOOK_LIST_H_ #define _SYSHOOK_LIST_H_ struct syshook_list_node { struct syshook_list_node *prev; struct syshook_list_node *next; }; typedef struct syshook_list_node syshook_list_node_t; #if defined(SYSHOOK_INTERNAL) || defined(SYSHOOK_ENABLE_LIST_FUNCTIONS) #include <stdbool.h> #include <stddef.h> #define containerof(ptr, type, member) \ ((type *)((unsigned long)(ptr) - offsetof(type, member))) #define LIST_INITIAL_VALUE(list) { &(list), &(list) } #define LIST_INITIAL_CLEARED_VALUE { NULL, NULL } static inline void list_initialize(struct syshook_list_node *list) { list->prev = list->next = list; } static inline void list_clear_node(struct syshook_list_node *item) { item->prev = item->next = 0; } static inline bool list_in_list(struct syshook_list_node *item) { if (item->prev == 0 && item->next == 0) return false; else return true; } static inline void list_add_head(struct syshook_list_node *list, struct syshook_list_node *item) { item->next = list->next; item->prev = list; list->next->prev = item; list->next = item; } #define list_add_after(entry, new_entry) list_add_head(entry, new_entry) static inline void list_add_tail(struct syshook_list_node *list, struct syshook_list_node *item) { item->prev = list->prev; item->next = list; list->prev->next = item; list->prev = item; } #define list_add_before(entry, new_entry) list_add_tail(entry, new_entry) static inline void list_delete(struct syshook_list_node *item) { item->next->prev = item->prev; item->prev->next = item->next; item->prev = item->next = 0; } static inline struct syshook_list_node *list_remove_head(struct syshook_list_node *list) { if (list->next != list) { struct syshook_list_node *item = list->next; list_delete(item); return item; } else { return NULL; } } #define list_remove_head_type(list, type, element) ({\ struct syshook_list_node *__nod = list_remove_head(list);\ type *__t;\ if(__nod)\ __t = containerof(__nod, type, element);\ else\ __t = (type *)0;\ __t;\ }) static inline struct syshook_list_node *list_remove_tail(struct syshook_list_node *list) { if (list->prev != list) { struct syshook_list_node *item = list->prev; list_delete(item); return item; } else { return NULL; } } #define list_remove_tail_type(list, type, element) ({\ struct syshook_list_node *__nod = list_remove_tail(list);\ type *__t;\ if(__nod)\ __t = containerof(__nod, type, element);\ else\ __t = (type *)0;\ __t;\ }) static inline struct syshook_list_node *list_peek_head(struct syshook_list_node *list) { if (list->next != list) { return list->next; } else { return NULL; } } #define list_peek_head_type(list, type, element) ({\ struct syshook_list_node *__nod = list_peek_head(list);\ type *__t;\ if(__nod)\ __t = containerof(__nod, type, element);\ else\ __t = (type *)0;\ __t;\ }) static inline struct syshook_list_node *list_peek_tail(struct syshook_list_node *list) { if (list->prev != list) { return list->prev; } else { return NULL; } } #define list_peek_tail_type(list, type, element) ({\ struct syshook_list_node *__nod = list_peek_tail(list);\ type *__t;\ if(__nod)\ __t = containerof(__nod, type, element);\ else\ __t = (type *)0;\ __t;\ }) static inline struct syshook_list_node *list_prev(struct syshook_list_node *list, struct syshook_list_node *item) { if (item->prev != list) return item->prev; else return NULL; } #define list_prev_type(list, item, type, element) ({\ struct syshook_list_node *__nod = list_prev(list, item);\ type *__t;\ if(__nod)\ __t = containerof(__nod, type, element);\ else\ __t = (type *)0;\ __t;\ }) static inline struct syshook_list_node *list_prev_wrap(struct syshook_list_node *list, struct syshook_list_node *item) { if (item->prev != list) return item->prev; else if (item->prev->prev != list) return item->prev->prev; else return NULL; } #define list_prev_wrap_type(list, item, type, element) ({\ struct syshook_list_node *__nod = list_prev_wrap(list, item);\ type *__t;\ if(__nod)\ __t = containerof(__nod, type, element);\ else\ __t = (type *)0;\ __t;\ }) static inline struct syshook_list_node *list_next(struct syshook_list_node *list, struct syshook_list_node *item) { if (item->next != list) return item->next; else return NULL; } #define list_next_type(list, item, type, element) ({\ struct syshook_list_node *__nod = list_next(list, item);\ type *__t;\ if(__nod)\ __t = containerof(__nod, type, element);\ else\ __t = (type *)0;\ __t;\ }) static inline struct syshook_list_node *list_next_wrap(struct syshook_list_node *list, struct syshook_list_node *item) { if (item->next != list) return item->next; else if (item->next->next != list) return item->next->next; else return NULL; } #define list_next_wrap_type(list, item, type, element) ({\ struct syshook_list_node *__nod = list_next_wrap(list, item);\ type *__t;\ if(__nod)\ __t = containerof(__nod, type, element);\ else\ __t = (type *)0;\ __t;\ }) // iterates over the list, node should be struct syshook_list_node* #define list_for_every(list, node) \ for(node = (list)->next; node != (list); node = node->next) // iterates over the list in a safe way for deletion of current node // node and temp_node should be struct syshook_list_node* #define list_for_every_safe(list, node, temp_node) \ for(node = (list)->next, temp_node = (node)->next;\ node != (list);\ node = temp_node, temp_node = (node)->next) // iterates over the list, entry should be the container structure type * #define list_for_every_entry(list, entry, type, member) \ for((entry) = containerof((list)->next, type, member);\ &(entry)->member != (list);\ (entry) = containerof((entry)->member.next, type, member)) // iterates over the list in a safe way for deletion of current node // entry and temp_entry should be the container structure type * #define list_for_every_entry_safe(list, entry, temp_entry, type, member) \ for(entry = containerof((list)->next, type, member),\ temp_entry = containerof((entry)->member.next, type, member);\ &(entry)->member != (list);\ entry = temp_entry, temp_entry = containerof((temp_entry)->member.next, type, member)) static inline bool list_is_empty(struct syshook_list_node *list) { return (list->next == list) ? true : false; } static inline size_t list_length(struct syshook_list_node *list) { size_t cnt = 0; struct syshook_list_node *node = list; list_for_every(list, node) { cnt++; } return cnt; } #endif // SYSHOOK_INTERNAL #endif // _SYSHOOK_LIST_H_
{ "content_hash": "4be0a683ba8f35b4353fce0b26ac1380", "timestamp": "", "source": "github", "line_count": 266, "max_line_length": 118, "avg_line_length": 26.834586466165412, "alnum_prop": 0.6078733538806388, "repo_name": "efidroid/modules_libsyshook", "id": "9437500275ba971facaaa028d08b0a7889bb326a", "size": "8264", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "include/syshook/list.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "809" }, { "name": "C", "bytes": "90478" }, { "name": "CMake", "bytes": "879" }, { "name": "Python", "bytes": "3219" } ] }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Create a new {@link Industry} instance that uses the given `agent` to * make its HTTP requests to the ESI interface. * * @param agent The agent making actual requests * @returns A Industry API instance */ function makeIndustry(agent) { return new IndustryImpl(agent); } exports.makeIndustry = makeIndustry; class IndustryImpl { constructor(agent) { this.agent = agent; } facilities() { return this.agent.request('get_industry_facilities', undefined); } systemCosts() { return this.agent.request('get_industry_systems', undefined); } } //# sourceMappingURL=industry.js.map
{ "content_hash": "a9435d3f9fb8cfb29dcc0d5d30364d13", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 72, "avg_line_length": 28.48, "alnum_prop": 0.6839887640449438, "repo_name": "lhkbob/eve-swagger-js", "id": "e0f771efeb8f76dabeb1d862784b1eefc5535bd4", "size": "712", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "dist/src/api/universe/industry.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "JavaScript", "bytes": "41647" }, { "name": "TypeScript", "bytes": "600217" } ] }
End of preview.