row_id
int64
0
48.4k
init_message
stringlengths
1
342k
conversation_hash
stringlengths
32
32
scores
dict
45,982
python start exe process on background in linux
42039f92fce547ac7158a23f1778bec4
{ "intermediate": 0.39683201909065247, "beginner": 0.2809382379055023, "expert": 0.32222980260849 }
45,983
Write me a function to display an alert() in JS if the value of an input is not empty
7e15ec6552d088822766a24ef8a3fe6a
{ "intermediate": 0.5022240281105042, "beginner": 0.2987207770347595, "expert": 0.19905519485473633 }
45,984
How do I add particles.vue3 to the plugins in quasar.config.js
e8e63df10a3939e39590d4493dacb06d
{ "intermediate": 0.4381090998649597, "beginner": 0.27430713176727295, "expert": 0.28758370876312256 }
45,985
defold engine action_id always unknown
ca2e2908a9b4065856844f7b43e972c7
{ "intermediate": 0.2809467911720276, "beginner": 0.336515873670578, "expert": 0.3825373351573944 }
45,986
How do I add things installed with npm install (name), like particles.vue3, to be used as vue plugins using Quasar CLI?
33eee6be2fe2e4865610a5b4d104196a
{ "intermediate": 0.7005318999290466, "beginner": 0.18292748928070068, "expert": 0.11654066294431686 }
45,987
перепиши на lua " angular.module('beamng.apps') .directive('classicSpeedo', [function () { return { template: '<div style="overflow: hidden;"><canvas id="cSpeedo" height="90px"></canvas></div>', replace: true, restrict: 'EA', link: function (scope, element, attrs) { var streams = ['electrics']; StreamsManager.add(streams); scope.$on('$destroy', function () { StreamsManager.remove(streams); }); var canvas = element.find("canvas")[0]; scope.currentTheme = getTheme(); var values = []; scope.$on('streamsUpdate', function (event, streams) { canvas.width = element[0].clientWidth; canvas.height = canvas.width * 3.3333; var w = canvas.width; var h = canvas.height; var scale = w / 200; var speedMs = 0; try { speedMs = streams.electrics.wheelspeed; } catch(e) {} if (isNaN(speedMs)) speedMs = streams.electrics.airspeed; var speedConverted = UiUnits.speed(speedMs); if(speedConverted === null) return; var speedUnits = Math.round(speedConverted.val); var speedStart; //for resetting scale >160 if (speedUnits > 160) { speedStart = 160; } else { speedStart = 0; } var ctx = canvas.getContext('2d'); ctx.scale(scale, scale); ctx.clearRect(0,0,200,65); ctx.fillStyle = scope.currentTheme.background; ctx.fillRect(0, 0, 200, 65); if (speedStart === 0){ ctx.fillStyle = scope.currentTheme.speed1; } else { ctx.fillStyle = scope.currentTheme.speed2; } ctx.fillRect(20,10,Math.min(speedUnits-speedStart, 160),25); ctx.fillStyle = scope.currentTheme.text; //-Numbers ctx.font='8px Arial'; ctx.textAlign="center"; var interval = 20; for (var x=0; x<=160; x+=interval) { ctx.fillText(speedStart+x,x+20,48); } ctx.font='20px Arial'; ctx.fillText(pad(speedUnits, 3), 100, 30); ctx.font='10px Arial'; ctx.fillText("Speed (" + UiUnits.speed().unit.toUpperCase() + ")", 100, 62); //Add Graduations //20px/20unit intervals ctx.strokeStyle = scope.currentTheme.border; for (var x1=20; x1<=180; x1+=interval) { ctx.beginPath(); ctx.moveTo(x1, 35); ctx.lineTo(x1, 40); ctx.stroke(); } //and 10px/10unit intervals for (var x2=30; x2<=180; x2+=interval) { ctx.beginPath(); ctx.moveTo(x2, 35); ctx.lineTo(x2, 38); ctx.stroke(); } //add border ctx.strokeStyle = scope.currentTheme.border; ctx.lineWidth = 1; ctx.strokeRect(20,10,160,25); }); scope.$on('ClassicUI', function (event, state) { if(state == "updateTheme") { scope.currentTheme = getTheme(); } }); function getTheme() { var themeStyles = parseInt(getDefaultValue("themeMode", 0)); var tmpTheme; if(themeStyles == 0) { tmpTheme = { background: 'rgba(255, 255, 255, 0.9)', text: 'rgba(0, 0, 0, 0.9)', border: 'rgba(0, 0, 0, 0.9)', speed1: 'rgba(0, 0, 255, 0.5)', speed2: 'rgba(255, 0, 255, 0.5)', }; } if(themeStyles == 1) { tmpTheme = { background: 'rgba(0, 0, 0, 0.9)', text: 'rgba(255, 255, 255, 0.9)', border: 'rgb(160, 160, 160)', speed1: 'rgba(80, 80, 255, 0.5)', speed2: 'rgba(255, 80, 255, 0.5)', }; } if(themeStyles == 2) { tmpTheme = { background: 'rgba(0, 0, 0, 0.43)', text: 'rgba(255, 255, 255, 0.9)', border: 'rgb(80, 80, 80)', speed1: 'rgba(80, 80, 255, 0.5)', speed2: 'rgba(255, 80, 255, 0.5)', }; } return tmpTheme; } function pad(num, size) { var s = num+""; while (s.length < size) s = "0" + s; return s; } function getDefaultValue(type, defVal) { return localStorage.getItem("classicUI_" + type) || defVal; } } }; }]); "
2f81a395e6ef346a980a86534d7a74d4
{ "intermediate": 0.3577404022216797, "beginner": 0.4242773652076721, "expert": 0.2179821878671646 }
45,988
перепиши на луа angular.module('beamng.apps') .directive('classicSpeedo', [function () { return { template: '<div style="overflow: hidden;"><canvas id="cSpeedo" height="90px"></canvas></div>', replace: true, restrict: 'EA', link: function (scope, element, attrs) { var streams = ['electrics']; StreamsManager.add(streams); scope.$on('$destroy', function () { StreamsManager.remove(streams); }); var canvas = element.find("canvas")[0]; scope.currentTheme = getTheme(); var values = []; scope.$on('streamsUpdate', function (event, streams) { canvas.width = element[0].clientWidth; canvas.height = canvas.width * 3.3333; var w = canvas.width; var h = canvas.height; var scale = w / 200; var speedMs = 0; try { speedMs = streams.electrics.wheelspeed; } catch(e) {} if (isNaN(speedMs)) speedMs = streams.electrics.airspeed; var speedConverted = UiUnits.speed(speedMs); if(speedConverted === null) return; var speedUnits = Math.round(speedConverted.val); var speedStart; //for resetting scale >160 if (speedUnits > 160) { speedStart = 160; } else { speedStart = 0; } var ctx = canvas.getContext('2d'); ctx.scale(scale, scale); ctx.clearRect(0,0,200,65); ctx.fillStyle = scope.currentTheme.background; ctx.fillRect(0, 0, 200, 65); if (speedStart === 0){ ctx.fillStyle = scope.currentTheme.speed1; } else { ctx.fillStyle = scope.currentTheme.speed2; } ctx.fillRect(20,10,Math.min(speedUnits-speedStart, 160),25); ctx.fillStyle = scope.currentTheme.text; //-Numbers ctx.font='8px Arial'; ctx.textAlign="center"; var interval = 20; for (var x=0; x<=160; x+=interval) { ctx.fillText(speedStart+x,x+20,48); } ctx.font='20px Arial'; ctx.fillText(pad(speedUnits, 3), 100, 30); ctx.font='10px Arial'; ctx.fillText("Speed (" + UiUnits.speed().unit.toUpperCase() + ")", 100, 62); //Add Graduations //20px/20unit intervals ctx.strokeStyle = scope.currentTheme.border; for (var x1=20; x1<=180; x1+=interval) { ctx.beginPath(); ctx.moveTo(x1, 35); ctx.lineTo(x1, 40); ctx.stroke(); } //and 10px/10unit intervals for (var x2=30; x2<=180; x2+=interval) { ctx.beginPath(); ctx.moveTo(x2, 35); ctx.lineTo(x2, 38); ctx.stroke(); } //add border ctx.strokeStyle = scope.currentTheme.border; ctx.lineWidth = 1; ctx.strokeRect(20,10,160,25); }); scope.$on('ClassicUI', function (event, state) { if(state == "updateTheme") { scope.currentTheme = getTheme(); } }); function getTheme() { var themeStyles = parseInt(getDefaultValue("themeMode", 0)); var tmpTheme; if(themeStyles == 0) { tmpTheme = { background: 'rgba(255, 255, 255, 0.9)', text: 'rgba(0, 0, 0, 0.9)', border: 'rgba(0, 0, 0, 0.9)', speed1: 'rgba(0, 0, 255, 0.5)', speed2: 'rgba(255, 0, 255, 0.5)', }; } if(themeStyles == 1) { tmpTheme = { background: 'rgba(0, 0, 0, 0.9)', text: 'rgba(255, 255, 255, 0.9)', border: 'rgb(160, 160, 160)', speed1: 'rgba(80, 80, 255, 0.5)', speed2: 'rgba(255, 80, 255, 0.5)', }; } if(themeStyles == 2) { tmpTheme = { background: 'rgba(0, 0, 0, 0.43)', text: 'rgba(255, 255, 255, 0.9)', border: 'rgb(80, 80, 80)', speed1: 'rgba(80, 80, 255, 0.5)', speed2: 'rgba(255, 80, 255, 0.5)', }; } return tmpTheme; } function pad(num, size) { var s = num+""; while (s.length < size) s = "0" + s; return s; } function getDefaultValue(type, defVal) { return localStorage.getItem("classicUI_" + type) || defVal; } } }; }]);
bb570195cc41c039dcdbfb027273c90a
{ "intermediate": 0.3694034516811371, "beginner": 0.47978144884109497, "expert": 0.15081505477428436 }
45,989
convert following code with regular python code ( replace expression "result[rollup_category][day] = int(any(details[device][day] for device in devices if device in details))" with normal code): def aggregate_logins(details, rollups): # Initialize the result dictionary result = {category: [0] * 7 for category in rollups} # Iterate over the rollup categories and their corresponding devices for rollup_category, devices in rollups.items(): # Iterate over each day and perform a logical OR for all devices in the category for day in range(7): result[rollup_category][day] = int(any(details[device][day] for device in devices if device in details)) return result
8797777e12a5d44fb780942224b047fd
{ "intermediate": 0.3312270939350128, "beginner": 0.39457568526268005, "expert": 0.27419722080230713 }
45,990
My cyan amongus isn't appearing { "autoPlay": true, "background": { "color": { "value": "#000000" }, "image": "", "position": "", "repeat": "", "size": "", "opacity": 1 }, "backgroundMask": { "composite": "destination-out", "cover": { "color": { "value": "#fff" }, "opacity": 1 }, "enable": false }, "clear": true, "defaultThemes": {}, "delay": 0, "fullScreen": { "enable": false, "zIndex": 0 }, "detectRetina": true, "duration": 0, "fpsLimit": 120, "interactivity": { "detectsOn": "window", "events": { "onClick": { "enable": false, "mode": [] }, "onDiv": { "selectors": [], "enable": false, "mode": [], "type": "circle" }, "onHover": { "enable": false, "mode": [], "parallax": { "enable": false, "force": 2, "smooth": 10 } }, "resize": { "delay": 0.5, "enable": true } }, "modes": { "trail": { "delay": 1, "pauseOnStop": false, "quantity": 1 }, "attract": { "distance": 200, "duration": 0.4, "easing": "ease-out-quad", "factor": 1, "maxSpeed": 50, "speed": 1 }, "bounce": { "distance": 200 }, "bubble": { "distance": 200, "duration": 0.4, "mix": false, "divs": { "distance": 200, "duration": 0.4, "mix": false, "selectors": [] } }, "connect": { "distance": 80, "links": { "opacity": 0.5 }, "radius": 60 }, "grab": { "distance": 100, "links": { "blink": false, "consent": false, "opacity": 1 } }, "push": { "default": true, "groups": [], "quantity": 4 }, "remove": { "quantity": 2 }, "repulse": { "distance": 200, "duration": 0.4, "factor": 100, "speed": 1, "maxSpeed": 50, "easing": "ease-out-quad", "divs": { "distance": 200, "duration": 0.4, "factor": 100, "speed": 1, "maxSpeed": 50, "easing": "ease-out-quad", "selectors": [] } }, "slow": { "factor": 3, "radius": 200 }, "light": { "area": { "gradient": { "start": { "value": "#ffffff" }, "stop": { "value": "#000000" } }, "radius": 1000 }, "shadow": { "color": { "value": "#000000" }, "length": 2000 } } } }, "manualParticles": [], "particles": { "bounce": { "horizontal": { "value": 1 }, "vertical": { "value": 1 } }, "collisions": { "absorb": { "speed": 2 }, "bounce": { "horizontal": { "value": 1 }, "vertical": { "value": 1 } }, "enable": false, "maxSpeed": 50, "mode": "bounce", "overlap": { "enable": true, "retries": 0 } }, "color": { "value": "#fff", "animation": { "h": { "count": 0, "enable": false, "speed": 20, "decay": 0, "delay": 0, "sync": true, "offset": 0 }, "s": { "count": 0, "enable": false, "speed": 1, "decay": 0, "delay": 0, "sync": true, "offset": 0 }, "l": { "count": 0, "enable": false, "speed": 1, "decay": 0, "delay": 0, "sync": true, "offset": 0 } } }, "effect": { "close": true, "fill": true, "options": {}, "type": [] }, "groups": { "z5000": { "number": { "value": 70 }, "zIndex": { "value": 50 } }, "z7500": { "number": { "value": 30 }, "zIndex": { "value": 75 } }, "z2500": { "number": { "value": 50 }, "zIndex": { "value": 25 } }, "z1000": { "number": { "value": 40 }, "zIndex": { "value": 10 } } }, "move": { "angle": { "offset": 0, "value": 10 }, "attract": { "distance": 200, "enable": false, "rotate": { "x": 3000, "y": 3000 } }, "center": { "x": 50, "y": 50, "mode": "percent", "radius": 0 }, "decay": 0, "distance": {}, "direction": "right", "drift": 0, "enable": true, "gravity": { "acceleration": 9.81, "enable": false, "inverse": false, "maxSpeed": 50 }, "path": { "clamp": true, "delay": { "value": 0 }, "enable": false, "options": {} }, "outModes": { "default": "out", "bottom": "out", "left": "out", "right": "out", "top": "out" }, "random": false, "size": false, "speed": 5, "spin": { "acceleration": 0, "enable": false }, "straight": false, "trail": { "enable": false, "length": 10, "fill": {} }, "vibrate": false, "warp": false }, "number": { "density": { "enable": false, "width": 1920, "height": 1080 }, "limit": { "mode": "delete", "value": 0 }, "value": 200 }, "opacity": { "value": 1, "animation": { "count": 0, "enable": false, "speed": 2, "decay": 0, "delay": 0, "sync": false, "mode": "auto", "startValue": "random", "destroy": "none" } }, "reduceDuplicates": false, "shadow": { "blur": 0, "color": { "value": "#000" }, "enable": false, "offset": { "x": 0, "y": 0 } }, "shape": { "close": true, "fill": true, "options": {}, "type": "circle" }, "size": { "value": 3, "animation": { "count": 0, "enable": false, "speed": 5, "decay": 0, "delay": 0, "sync": false, "mode": "auto", "startValue": "random", "destroy": "none" } }, "stroke": { "width": 0 }, "zIndex": { "value": 5, "opacityRate": 0.5, "sizeRate": 1, "velocityRate": 1 }, "destroy": { "bounds": {}, "mode": "none", "split": { "count": 1, "factor": { "value": 3 }, "rate": { "value": { "min": 4, "max": 9 } }, "sizeOffset": true, "particles": {} } }, "roll": { "darken": { "enable": false, "value": 0 }, "enable": false, "enlighten": { "enable": false, "value": 0 }, "mode": "vertical", "speed": 25 }, "tilt": { "value": 0, "animation": { "enable": false, "speed": 0, "decay": 0, "sync": false }, "direction": "clockwise", "enable": false }, "twinkle": { "lines": { "enable": false, "frequency": 0.05, "opacity": 1 }, "particles": { "enable": false, "frequency": 0.05, "opacity": 1 } }, "wobble": { "distance": 5, "enable": false, "speed": { "angle": 50, "move": 10 } }, "life": { "count": 0, "delay": { "value": 0, "sync": false }, "duration": { "value": 0, "sync": false } }, "rotate": { "value": 0, "animation": { "enable": false, "speed": 0, "decay": 0, "sync": false }, "direction": "clockwise", "path": false }, "orbit": { "animation": { "count": 0, "enable": false, "speed": 1, "decay": 0, "delay": 0, "sync": false }, "enable": false, "opacity": 1, "rotation": { "value": 45 }, "width": 1 }, "links": { "blink": false, "color": { "value": "#fff" }, "consent": false, "distance": 100, "enable": false, "frequency": 1, "opacity": 1, "shadow": { "blur": 5, "color": { "value": "#000" }, "enable": false }, "triangles": { "enable": false, "frequency": 1 }, "width": 1, "warp": false }, "repulse": { "value": 0, "enabled": false, "distance": 1, "duration": 1, "factor": 1, "speed": 1 } }, "pauseOnBlur": true, "pauseOnOutsideViewport": true, "responsive": [], "smooth": false, "style": {}, "themes": [], "zLayers": 100, "name": "Among Us", "emitters": { "autoPlay": true, "fill": true, "life": { "wait": false }, "rate": { "quantity": 1, "delay": 7 }, "shape": { "options": {}, "replace": { "color": false, "opacity": false }, "type": "square" }, "startCount": 0, "size": { "mode": "percent", "height": 0, "width": 0 }, "particles": { "shape": { "type": "images", "options": { "images": { "src": "https://particles.js.org/images/cyan_amongus.png", "width": 500, "height": 634 } } }, "size": { "value": 40 }, "move": { "speed": 10, "outModes": { "default": "none", "right": "destroy" }, "straight": true }, "zIndex": { "value": 0 }, "rotate": { "value": { "min": 0, "max": 360 }, "animation": { "enable": true, "speed": 10, "sync": true } } }, "position": { "x": -5, "y": 55 } }, "motion": { "disable": false, "reduce": { "factor": 4, "value": true } } }
3905c56f88c842acea3383737719f43b
{ "intermediate": 0.307822585105896, "beginner": 0.43278467655181885, "expert": 0.25939276814460754 }
45,991
Suppose I have created a keyobject using the createSecretKey function in node. Is there a way I can save this object to a file so that a separate program can read the file and recover the key to use it when using the createhmac function?
bead670351724ca454de4750a741985a
{ "intermediate": 0.607684314250946, "beginner": 0.16829819977283478, "expert": 0.2240174263715744 }
45,992
Make the white particles loop ( go back to the beginning, re enter fmor the left) instead of just disappearing: { "autoPlay": true, "background": { "color": { "value": "#000000" }, "image": "", "position": "", "repeat": "", "size": "", "opacity": 1 }, "backgroundMask": { "composite": "destination-out", "cover": { "color": { "value": "#fff" }, "opacity": 1 }, "enable": false }, "clear": true, "defaultThemes": {}, "delay": 0, "fullScreen": { "enable": false, "zIndex": 0 }, "detectRetina": true, "duration": 0, "fpsLimit": 120, "interactivity": { "detectsOn": "window", "events": { "onClick": { "enable": false, "mode": [] }, "onDiv": { "selectors": [], "enable": false, "mode": [], "type": "circle" }, "onHover": { "enable": false, "mode": [], "parallax": { "enable": false, "force": 2, "smooth": 10 } }, "resize": { "delay": 0.5, "enable": true } }, "modes": { "trail": { "delay": 1, "pauseOnStop": false, "quantity": 1 }, "attract": { "distance": 200, "duration": 0.4, "easing": "ease-out-quad", "factor": 1, "maxSpeed": 50, "speed": 1 }, "bounce": { "distance": 200 }, "bubble": { "distance": 200, "duration": 0.4, "mix": false, "divs": { "distance": 200, "duration": 0.4, "mix": false, "selectors": [] } }, "connect": { "distance": 80, "links": { "opacity": 0.5 }, "radius": 60 }, "grab": { "distance": 100, "links": { "blink": false, "consent": false, "opacity": 1 } }, "push": { "default": true, "groups": [], "quantity": 4 }, "remove": { "quantity": 2 }, "repulse": { "distance": 200, "duration": 0.4, "factor": 100, "speed": 1, "maxSpeed": 50, "easing": "ease-out-quad", "divs": { "distance": 200, "duration": 0.4, "factor": 100, "speed": 1, "maxSpeed": 50, "easing": "ease-out-quad", "selectors": [] } }, "slow": { "factor": 3, "radius": 200 }, "light": { "area": { "gradient": { "start": { "value": "#ffffff" }, "stop": { "value": "#000000" } }, "radius": 1000 }, "shadow": { "color": { "value": "#000000" }, "length": 2000 } } } }, "manualParticles": [], "particles": { "bounce": { "horizontal": { "value": 1 }, "vertical": { "value": 1 } }, "collisions": { "absorb": { "speed": 2 }, "bounce": { "horizontal": { "value": 1 }, "vertical": { "value": 1 } }, "enable": false, "maxSpeed": 50, "mode": "bounce", "overlap": { "enable": true, "retries": 0 } }, "color": { "value": "#fff", "animation": { "h": { "count": 0, "enable": false, "speed": 20, "decay": 0, "delay": 0, "sync": true, "offset": 0 }, "s": { "count": 0, "enable": false, "speed": 1, "decay": 0, "delay": 0, "sync": true, "offset": 0 }, "l": { "count": 0, "enable": false, "speed": 1, "decay": 0, "delay": 0, "sync": true, "offset": 0 } } }, "effect": { "close": true, "fill": true, "options": {}, "type": [] }, "groups": { "z5000": { "number": { "value": 70 }, "zIndex": { "value": 50 } }, "z7500": { "number": { "value": 30 }, "zIndex": { "value": 75 } }, "z2500": { "number": { "value": 50 }, "zIndex": { "value": 25 } }, "z1000": { "number": { "value": 40 }, "zIndex": { "value": 10 } } }, "move": { "angle": { "offset": 0, "value": 10 }, "attract": { "distance": 200, "enable": false, "rotate": { "x": 3000, "y": 3000 } }, "center": { "x": 50, "y": 50, "mode": "percent", "radius": 0 }, "decay": 0, "distance": {}, "direction": "right", "drift": 0, "enable": true, "gravity": { "acceleration": 9.81, "enable": false, "inverse": false, "maxSpeed": 50 }, "path": { "clamp": true, "delay": { "value": 0 }, "enable": false, "options": {} }, "outModes": { "default": "destroy" }, "random": false, "size": false, "speed": 5, "spin": { "acceleration": 0, "enable": false }, "straight": false, "trail": { "enable": false, "length": 10, "fill": {} }, "vibrate": false, "warp": false }, "number": { "density": { "enable": false, "width": 1920, "height": 1080 }, "limit": { "mode": "delete", "value": 0 }, "value": 200 }, "opacity": { "value": 1, "animation": { "count": 0, "enable": false, "speed": 2, "decay": 0, "delay": 0, "sync": false, "mode": "auto", "startValue": "random", "destroy": "none" } }, "reduceDuplicates": false, "shadow": { "blur": 0, "color": { "value": "#000" }, "enable": false, "offset": { "x": 0, "y": 0 } }, "shape": { "close": true, "fill": true, "options": {}, "type": "circle" }, "size": { "value": 3, "animation": { "count": 0, "enable": false, "speed": 5, "decay": 0, "delay": 0, "sync": false, "mode": "auto", "startValue": "random", "destroy": "none" } }, "stroke": { "width": 0 }, "zIndex": { "value": 5, "opacityRate": 0.5, "sizeRate": 1, "velocityRate": 1 }, "destroy": { "bounds": {}, "mode": "none", "split": { "count": 1, "factor": { "value": 3 }, "rate": { "value": { "min": 4, "max": 9 } }, "sizeOffset": true, "particles": {} } }, "roll": { "darken": { "enable": false, "value": 0 }, "enable": false, "enlighten": { "enable": false, "value": 0 }, "mode": "vertical", "speed": 25 }, "tilt": { "value": 0, "animation": { "enable": false, "speed": 0, "decay": 0, "sync": false }, "direction": "clockwise", "enable": false }, "twinkle": { "lines": { "enable": false, "frequency": 0.05, "opacity": 1 }, "particles": { "enable": false, "frequency": 0.05, "opacity": 1 } }, "wobble": { "distance": 5, "enable": false, "speed": { "angle": 50, "move": 10 } }, "life": { "count": 0, "delay": { "value": 0, "sync": false }, "duration": { "value": 0, "sync": false } }, "rotate": { "value": 0, "animation": { "enable": false, "speed": 0, "decay": 0, "sync": false }, "direction": "clockwise", "path": false }, "orbit": { "animation": { "count": 0, "enable": false, "speed": 1, "decay": 0, "delay": 0, "sync": false }, "enable": false, "opacity": 1, "rotation": { "value": 45 }, "width": 1 }, "links": { "blink": false, "color": { "value": "#fff" }, "consent": false, "distance": 100, "enable": false, "frequency": 1, "opacity": 1, "shadow": { "blur": 5, "color": { "value": "#000" }, "enable": false }, "triangles": { "enable": false, "frequency": 1 }, "width": 1, "warp": false }, "repulse": { "value": 0, "enabled": false, "distance": 1, "duration": 1, "factor": 1, "speed": 1 } }, "pauseOnBlur": true, "pauseOnOutsideViewport": true, "responsive": [], "smooth": false, "style": {}, "themes": [], "zLayers": 100, "name": "Among Us", "emitters": { "autoPlay": true, "fill": true, "life": { "wait": false }, "rate": { "quantity": 1, "delay": 7 }, "shape": { "options": {}, "replace": { "color": false, "opacity": false }, "type": "square" }, "startCount": 0, "size": { "mode": "percent", "height": 0, "width": 0 }, "particles": { "shape": { "type": "images", "options": { "images": { "src": "https://particles.js.org/images/cyan_amongus.png", "width": 500, "height": 634 } } }, "size": { "value": 40 }, "move": { "speed": 10, "outModes": { "default": "none", "right": "destroy" }, "straight": true }, "zIndex": { "value": 0 }, "rotate": { "value": { "min": 0, "max": 360 }, "animation": { "enable": true, "speed": 10, "sync": true } } }, "position": { "x": -5, "y": 55 } }, "motion": { "disable": false, "reduce": { "factor": 4, "value": true } } }
87b17f698c9796b23f87133a59227e97
{ "intermediate": 0.2746613621711731, "beginner": 0.4693245589733124, "expert": 0.25601404905319214 }
45,993
سلام میخواهم با این کد و کتابخانه streemlit برایم یک رابط کاربری طراحی کنی کهبتوانم تصویری را با drag کردن به مدل بدهم و مبا مدل درمورد ان تصویر حرف بزنم # Load model directly from transformers import AutoProcessor, AutoModelForPreTraining processor = AutoProcessor.from_pretrained("llava-hf/llava-1.5-7b-hf") model = AutoModelForPreTraining.from_pretrained("llava-hf/llava-1.5-7b-hf")
2fae2b08bb106ccd6b97eac390230b03
{ "intermediate": 0.40654808282852173, "beginner": 0.30076485872268677, "expert": 0.2926871180534363 }
45,994
sec-ch-ua-platform types
6d12d81d16c8412c2bc54c5c606def82
{ "intermediate": 0.47460368275642395, "beginner": 0.20874612033367157, "expert": 0.3166501820087433 }
45,995
How do I make html elements be up by about 30 pixels of where theyre supposed to be?
26ae9f9c1374fe8a7d0a890bb629e96d
{ "intermediate": 0.3952265977859497, "beginner": 0.33186668157577515, "expert": 0.27290669083595276 }
45,996
Write a forum convo in late 2018 where Nicktoons Network UK is going to end their current branding in early 2019, so no more ACOW the Robot
0740bcc48992837aef1cb252ad54ff2d
{ "intermediate": 0.3433597981929779, "beginner": 0.3178885877132416, "expert": 0.3387516438961029 }
45,997
Write a program floyd.java to find all pairs shortest paths using Floyd’s algorithm for several undirected complete graphs, which are saved in a file called output.txt. Print all pairs shortest paths and their lengths. Program Usage Your program should be invoked as follows $> floyd graphfile.txt Graph File: graphfile.txt is the name of a file that includes more than one problem. The lines that correspond to problem j will contains an integer n (between 5 and 10) that indicates how many cities and n x n adjacency matrix A (that is, the distance between n cities, between 1 to 10), in the next n rows. Note that no infinity will appear in the matrix A. A sample graphfile.txt appears below. Problem 1: n = 7 0 6 5 4 6 3 6 6 0 6 4 5 5 3 5 6 0 3 1 4 6 4 4 3 0 4 1 4 6 5 1 4 0 5 5 3 5 4 1 5 0 3 6 3 6 4 5 3 0 Problem 2: n = 6 0 1 2 1 3 4 1 0 3 2 2 3 2 3 0 3 3 6 1 2 3 0 3 5 3 2 3 3 0 5 4 3 6 5 5 0 Output File Output the solution of problem 1 first, then problem 2, and etc. The solution of problem j should start with an integer n (the number cities) and the n x n Pointer Array P (in the next n rows). The shortest paths should then follow, one per line. Output the shortest paths from C1 to all other cities, then C2 to all other cities, and Cn to all other cities. A sample output file: Problem1: n = 7 Pmatrix: 0 0 0 6 3 0 6 0 0 5 0 0 4 0 0 5 0 0 0 0 5 6 0 0 0 3 0 6 3 0 0 3 0 3 0 0 4 0 0 3 0 0 6 0 5 6 0 0 0 V1-Vj: shortest path and length V1 V1: 0 V1 V2: 6 V1 V3: 5 V1 V6 V4: 4 V1 V3 V5: 6 V1 V6: 3 V1 V6 V7: 6 V2-Vj: shortest path and length V2 V1: 6 V2 V2: 0 V2 V5 V3: 6 V2 V4: 4 V2 V5: 5 V2 V4 V6: 5 V2 V7: 3 V3-Vj: shortest path and length V3 V1: 5 V3 V5 V2: 6 V3 V3: 0 V3 V4: 3 V3 V5: 1 V3 V6: 4 V3 V5 V7: 6 V4-Vj: shortest path and length V4 V6 V1: 4 V4 V2: 4 V4 V3: 3 V4 V4: 0 V4 V3 V5: 4 V4 V6: 1 V4 V6 V7: 4 V5-Vj: shortest path and length V5 V3 V1: 6 V5 V2: 5 V5 V3: 1 V5 V3 V4: 4 V5 V5: 0 V5 V3 V6: 5 V5 V7: 5 V6-Vj: shortest path and length V6 V1: 3 V6 V4 V2: 5 V6 V3: 4 V6 V4: 1 V6 V3 V5: 5 V6 V6: 0 V6 V7: 3 V7-Vj: shortest path and length V7 V6 V1: 6 V7 V2: 3 V7 V5 V3: 6 V7 V6 V4: 4 V7 V5: 5 V7 V6: 3 V7 V7: 0 Problem2: n = 6 Pmatrix: 0 0 0 0 2 2 0 0 1 1 0 0 0 1 0 1 0 2 0 1 1 0 0 2 2 0 0 0 0 2 2 0 2 2 2 0 V1-Vj: shortest path and length V1 V1: 0 V1 V2: 1 V1 V3: 2 V1 V4: 1 V1 V2 V5: 3 V1 V2 V6: 4 V2-Vj: shortest path and length V2 V1: 1 V2 V2: 0 V2 V1 V3: 3 V2 V1 V4: 2 V2 V5: 2 V2 V6: 3 V3-Vj: shortest path and length V3 V1: 2 V3 V1 V2: 3 V3 V3: 0 V3 V1 V4: 3 V3 V5: 3 V3 V1 V2 V6: 6 V4-Vj: shortest path and length V4 V1: 1 V4 V1 V2: 2 V4 V1 V3: 3 V4 V4: 0 V4 V5: 3 V4 V1 V2 V6: 5 V5-Vj: shortest path and length V5 V2 V1: 3 V5 V2: 2 V5 V3: 3 V5 V4: 3 V5 V5: 0 V5 V2 V6: 5 V6-Vj: shortest path and length V6 V2 V1: 4 V6 V2: 3 V6 V2 V1 V3: 6 V6 V2 V1 V4: 5 V6 V2 V5: 5 V6 V6: 0
a67c260f39a158e1c8fdb3e42b341d8e
{ "intermediate": 0.3237038254737854, "beginner": 0.37398761510849, "expert": 0.3023086190223694 }
45,998
can you create a Linux ffmpeg x265 2 pass encode args only show code
156fce8e3ccbcfb1753a475b3b9a5826
{ "intermediate": 0.4253721237182617, "beginner": 0.3311660885810852, "expert": 0.24346177279949188 }
45,999
import java.io.File; import java.io.PrintWriter; import java.util.Scanner; public class floyd { public static void main(String[] args) { if (args.length != 1) { System.out.println("Usage: java floyd <graphfile>"); return; } String inputFile = args[0]; try { File file = new File(inputFile); Scanner scanner = new Scanner(file); PrintWriter pw = new PrintWriter("output.txt"); while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); Scanner lineScanner = new Scanner(line); // Try to find an integer n in the line if (lineScanner.hasNextInt()) { int n = lineScanner.nextInt(); // Skip to next line for the matrix int[][] graph = new int[n][n]; int[][] path = new int[n][n]; // Ensure we are reading correctly formatted matrices for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (!scanner.hasNextInt()) { System.out.println("Error: Matrix data is incorrectly formatted or incomplete."); return; // Exit due to formatting error } graph[i][j] = scanner.nextInt(); if (i != j && graph[i][j] == 0) graph[i][j] = Integer.MAX_VALUE; path[i][j] = -1; } } // Performing Floyd’s algorithm floydsAlgorithm(graph, path, n); // Writing results to file writeOutput(pw, graph, path, n); } lineScanner.close(); } scanner.close(); pw.close(); } catch (Exception e) { e.printStackTrace(); } } private static void floydsAlgorithm(int[][] graph, int[][] path, int n) { for (int k = 0; k < n; k++) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (graph[i][k] == Integer.MAX_VALUE || graph[k][j] == Integer.MAX_VALUE) continue; if (graph[i][j] > graph[i][k] + graph[k][j]) { graph[i][j] = graph[i][k] + graph[k][j]; path[i][j] = k; } } } } } private static void writeOutput(PrintWriter pw, int[][] dist, int[][] path, int n) { pw.println("Problem: n = " + n); pw.println("Pmatrix:"); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { pw.print((path[i][j] == -1 ? 0 : path[i][j] + 1) + " "); } pw.println(); } // Generating paths from the path matrix for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i != j) { String pathStr = constructPath(i, j, path) + ": " + dist[i][j]; pw.println("V" + (i + 1) + "-V" + (j + 1) + ": " + pathStr); } } } pw.println(); // Blank line between problems } private static String constructPath(int i, int j, int[][] path) { if (path[i][j] == -1) { return "V" + (i + 1) + " V" + (j + 1); } else { return constructPath(i, path[i][j], path) + " " + constructPath(path[i][j], j, path).substring(3); } } } I want this program to take input from the graphfile.txt as Problem1 Amatrix: n = 7 0 6 5 4 6 3 6 6 0 6 4 5 5 3 5 6 0 3 1 4 6 4 4 3 0 4 1 4 6 5 1 4 0 5 5 3 5 4 1 5 0 3 6 3 6 4 5 3 0 Problem2 Amatrix: n = 6 0 1 2 1 3 4 1 0 3 2 2 3 2 3 0 3 3 6 1 2 3 0 3 5 3 2 3 3 0 5 4 3 6 5 5 0 in this format only and give the output file output.txt as Problem1: n = 7 Pmatrix: 0 0 0 6 3 0 6 0 0 5 0 0 4 0 0 5 0 0 0 0 5 6 0 0 0 3 0 6 3 0 0 3 0 3 0 0 4 0 0 3 0 0 6 0 5 6 0 0 0 V1-Vj: shortest path and length V1 V1: 0 V1 V2: 6 V1 V3: 5 V1 V6 V4: 4 V1 V3 V5: 6 V1 V6: 3 V1 V6 V7: 6 V2-Vj: shortest path and length V2 V1: 6 V2 V2: 0 V2 V5 V3: 6 V2 V4: 4 V2 V5: 5 V2 V4 V6: 5 V2 V7: 3 V3-Vj: shortest path and length V3 V1: 5 V3 V5 V2: 6 V3 V3: 0 V3 V4: 3 V3 V5: 1 V3 V6: 4 V3 V5 V7: 6 V4-Vj: shortest path and length V4 V6 V1: 4 V4 V2: 4 V4 V3: 3 V4 V4: 0 V4 V3 V5: 4 V4 V6: 1 V4 V6 V7: 4 V5-Vj: shortest path and length V5 V3 V1: 6 V5 V2: 5 V5 V3: 1 V5 V3 V4: 4 V5 V5: 0 V5 V3 V6: 5 V5 V7: 5 V6-Vj: shortest path and length V6 V1: 3 V6 V4 V2: 5 V6 V3: 4 V6 V4: 1 V6 V3 V5: 5 V6 V6: 0 V6 V7: 3 V7-Vj: shortest path and length V7 V6 V1: 6 V7 V2: 3 V7 V5 V3: 6 V7 V6 V4: 4 V7 V5: 5 V7 V6: 3 V7 V7: 0 Problem2: n = 6 Pmatrix: 0 0 0 0 2 2 0 0 1 1 0 0 0 1 0 1 0 2 0 1 1 0 0 2 2 0 0 0 0 2 2 0 2 2 2 0 V1-Vj: shortest path and length V1 V1: 0 V1 V2: 1 V1 V3: 2 V1 V4: 1 V1 V2 V5: 3 V1 V2 V6: 4 V2-Vj: shortest path and length V2 V1: 1 V2 V2: 0 V2 V1 V3: 3 V2 V1 V4: 2 V2 V5: 2 V2 V6: 3 V3-Vj: shortest path and length V3 V1: 2 V3 V1 V2: 3 V3 V3: 0 V3 V1 V4: 3 V3 V5: 3 V3 V1 V2 V6: 6 V4-Vj: shortest path and length V4 V1: 1 V4 V1 V2: 2 V4 V1 V3: 3 V4 V4: 0 V4 V5: 3 V4 V1 V2 V6: 5 V5-Vj: shortest path and length V5 V2 V1: 3 V5 V2: 2 V5 V3: 3 V5 V4: 3 V5 V5: 0 V5 V2 V6: 5 V6-Vj: shortest path and length V6 V2 V1: 4 V6 V2: 3 V6 V2 V1 V3: 6 V6 V2 V1 V4: 5 V6 V2 V5: 5 V6 V6: 0
774b7d5b5363f8035867a4f1ac71fa43
{ "intermediate": 0.381176620721817, "beginner": 0.39347410202026367, "expert": 0.22534926235675812 }
46,000
Running npm run build Runs a quasar build. I'm not sure what kind of project I just made but its quasar and vue combined. How do I build it for production? npm run build just generates a dist folder with only assets inside, and npm run preview doesnt do anything
1ad37e6dd12e0002b3b034fcb972cbe3
{ "intermediate": 0.6477175951004028, "beginner": 0.18687544763088226, "expert": 0.16540689766407013 }
46,001
Follow order: convert code from python to C++, return converted code only, strict rules are applied, python code: import torch import torch.nn as nn import torch.nn.functional as F import json import math from torch.nn.utils.rnn import pad_sequence from torch.utils.data import DataLoader, Dataset from collections import Counter from tqdm import tqdm # ---------- Device Configuration ---------- device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # ---------- Utility Functions ---------- def positional_encoding(seq_len, d_model, device): pos = torch.arange(seq_len, dtype=torch.float, device=device).unsqueeze(1) div_term = torch.exp(torch.arange(0, d_model, 2).float() * (-math.log(10000.0) / d_model)).to(device) pe = torch.zeros(seq_len, d_model, device=device) pe[:, 0::2] = torch.sin(pos * div_term) pe[:, 1::2] = torch.cos(pos * div_term) return pe.unsqueeze(0) # ---------- Model Definitions ---------- class TransformerExpert(nn.Module): def __init__(self, input_size, d_model, output_size, nhead, dim_feedforward, num_encoder_layers=1): super(TransformerExpert, self).__init__() self.d_model = d_model self.input_fc = nn.Linear(input_size, d_model) encoder_layer = nn.TransformerEncoderLayer(d_model=d_model, nhead=nhead, dim_feedforward=dim_feedforward, batch_first=True) self.transformer_encoder = nn.TransformerEncoder(encoder_layer, num_layers=num_encoder_layers) self.output_fc = nn.Linear(d_model, output_size) def forward(self, x): x = self.input_fc(x) + positional_encoding(x.size(1), self.d_model, x.device) transformer_output = self.transformer_encoder(x) output = self.output_fc(transformer_output) return output class GatingNetwork(nn.Module): def __init__(self, input_feature_dim, num_experts, hidden_dims=None, dropout_rate=0.0): super(GatingNetwork, self).__init__() layers = [] last_dim = input_feature_dim if hidden_dims is not None: for hidden_dim in hidden_dims: layers.append(nn.Linear(last_dim, hidden_dim)) layers.append(nn.ReLU()) if dropout_rate > 0.0: layers.append(nn.Dropout(dropout_rate)) last_dim = hidden_dim layers.append(nn.Linear(last_dim, num_experts)) self.fc_layers = nn.Sequential(*layers) self.softmax = nn.Softmax(dim=1) def forward(self, x): x = x.mean(dim=1) x = self.fc_layers(x) return self.softmax(x) class MixtureOfTransformerExperts(nn.Module): def __init__(self, input_size, d_model, output_size, nhead, dim_feedforward, num_experts, num_encoder_layers=1): super(MixtureOfTransformerExperts, self).__init__() self.num_experts = num_experts self.output_size = output_size self.experts = nn.ModuleList([TransformerExpert(input_size, d_model, output_size, nhead, dim_feedforward, num_encoder_layers) for _ in range(num_experts)]) self.gating_network = GatingNetwork(d_model, num_experts) def forward(self, x): gating_scores = self.gating_network(x) expert_outputs = [expert(x) for expert in self.experts] stacked_expert_outputs = torch.stack(expert_outputs) expanded_gating_scores = gating_scores.unsqueeze(2).unsqueeze(3) expanded_gating_scores = expanded_gating_scores.expand(-1, -1, x.size(1), self.output_size) expanded_gating_scores = expanded_gating_scores.transpose(0, 1) mixed_output = torch.sum(stacked_expert_outputs * expanded_gating_scores, dim=0) return mixed_output class MoETransformerModel(nn.Module): def __init__(self, vocab_size, d_model, moe): super(MoETransformerModel, self).__init__() self.embedding = nn.Embedding(num_embeddings=vocab_size, embedding_dim=d_model) self.moe = moe self.dropout = nn.Dropout(p=0.125) def forward(self, x): embedded = self.dropout(self.embedding(x)) return self.moe(embedded) # ---------- Dataset Definitions ---------- class QAJsonlDataset(Dataset): def __init__(self, path, seq_len): self.seq_len = seq_len self.pairs = self.load_data(path) self.vocab, self.idx2token = self.build_vocab([word for pair in self.pairs for sublist in pair for word in sublist]) self.tokenized_pairs = [(self.tokenize(q), self.tokenize(a)) for q, a in self.pairs] def load_data(self, path): pairs = [] with open(path, "r", encoding="utf-8") as f: for line in f: data = json.loads(line.strip()) question, answer = data.get("input", ""), data.get("output", "") pairs.append((question.split(), answer.split())) return pairs def tokenize(self, words): tokens = [self.vocab.get(w, self.vocab["<unk>"]) for w in words] if len(tokens) < self.seq_len: tokens.append(self.vocab["<eos>"]) tokens.extend([self.vocab["<pad>"]] * (self.seq_len - len(tokens))) else: tokens = tokens[:self.seq_len - 1] + [self.vocab["<eos>"]] return tokens def build_vocab(self, words): vocab = {"<unk>": 0, "<pad>": 1, "<eos>": 2} start_index = len(vocab) counts = Counter(words) for word, _ in counts.most_common(): if word not in vocab: vocab[word] = len(vocab) idx2token = {idx: token for token, idx in vocab.items()} return vocab, idx2token def __len__(self): return len(self.tokenized_pairs) def __getitem__(self, idx): tokenized_question, tokenized_answer = self.tokenized_pairs[idx] return torch.tensor(tokenized_question, dtype=torch.long), torch.tensor(tokenized_answer, dtype=torch.long) def collate_fn(batch): questions, answers = zip(*batch) questions = pad_sequence(questions, batch_first=True, padding_value=0) answers = pad_sequence(answers, batch_first=True, padding_value=0) return questions, answers # ---------- Training and Inference Functions ---------- def train_model(model, criterion, optimizer, num_epochs, data_loader): model.train() for epoch in range(num_epochs): total_loss = 0 progress_bar = tqdm(enumerate(data_loader), total=len(data_loader), desc=f"Epoch {epoch+1}", leave=False) for i, (inputs, targets) in progress_bar: inputs, targets = inputs.to(device), targets.to(device) optimizer.zero_grad() predictions = model(inputs) predictions = predictions.view(-1, predictions.size(-1)) targets = targets.view(-1) loss = criterion(predictions, targets) loss.backward() torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0) optimizer.step() total_loss += loss.item() progress_bar.set_postfix({"Loss": loss.item()}) average_loss = total_loss / len(data_loader.dataset) print(f"Epoch {epoch+1}, Average Loss: {average_loss}") def generate_text(model, dataset, seed_text, num_generate, temperature=1.0): model.eval() generated_tokens = [] # Initial sequence (prefix) to start the generation process input_sequence = [dataset.vocab.get(word, dataset.vocab["<pad>"]) for word in seed_text.split()] current_sequence = torch.tensor(input_sequence, dtype=torch.long).unsqueeze(0) current_sequence = current_sequence.to(device) # Generate num_generate tokens for _ in range(num_generate): # Forward pass through the model with torch.no_grad(): output = model(current_sequence) # Get probabilities, apply temperature scaling, and sample from the distribution probabilities = F.softmax(output[:, -1, :] / temperature, dim=-1).detach() next_token_idx = torch.multinomial(probabilities, 1).item() # Append token to the current sequence and to the generated tokens generated_tokens.append(next_token_idx) current_sequence = torch.cat((current_sequence, torch.tensor([[next_token_idx]])), 1).to(device) # Convert tokens to words generated_text = " ".join([dataset.idx2token.get(token, "<unk>") for token in generated_tokens]) return generated_text def count_tokens_in_dataset(dataset): return sum([len(pair[0]) + len(pair[1]) for pair in dataset.pairs]) def count_parameters(model): return sum(p.numel() for p in model.parameters() if p.requires_grad) # ---------- Hyperparameters and Model Instantiation ---------- # Transformer : d_model = 128 nhead = 8 dim_feedforward = 512 num_encoder_layers = 4 num_experts = 1 # Dataset : path_to_dataset = "C:/Users/L14/Documents/Projets/Easy-MoE/Easy-MoE/data/basic.jsonl" seq_len = 32 dataset = QAJsonlDataset(path_to_dataset, seq_len) data_loader = DataLoader(dataset, batch_size=seq_len, shuffle=True, collate_fn=collate_fn, pin_memory=True) num_tokens = count_tokens_in_dataset(dataset) print(f"Total number of tokens in the dataset: {num_tokens}") vocab_size = len(dataset.vocab) moe = MixtureOfTransformerExperts( input_size=d_model, d_model=d_model, output_size=vocab_size, nhead=nhead, dim_feedforward=dim_feedforward, num_experts=num_experts, num_encoder_layers=num_encoder_layers ).to(device) moe_transformer_model = MoETransformerModel(vocab_size, d_model, moe).to(device) # Count of total parameters : total_params = count_parameters(moe_transformer_model) print(f"Total trainable parameters: {total_params}") # ---------- Training ---------- num_epochs = 30 learning_rate = 5e-4 criterion = nn.CrossEntropyLoss(label_smoothing=0.1) optimizer = torch.optim.AdamW(moe_transformer_model.parameters(), lr=learning_rate, weight_decay=0) # Train the model train_model(moe_transformer_model, criterion, optimizer, num_epochs, data_loader) # ---------- Inference ---------- def interactive_text_generation(model, dataset, max_length=32, temperature=1.0): while True: try: # Get user input seed_text = input("Enter seed text (type 'quit' to exit and save the model): ").strip() # Check if user wants to quit the interaction if seed_text.lower() == 'quit': print("Exiting text generation mode.") break # Check if the seed text is not empty if seed_text: generated_text = generate_text(model, dataset, seed_text, max_length, temperature) print("Generated Text: ", generated_text) else: print("Seed text cannot be empty. Please enter some text.") except KeyboardInterrupt: # Handle the interrupt signal to exit gracefully print("\nReceived interrupt signal. Exiting text generation mode.") break except Exception as e: # Handle other exceptions and prevent the loop from crashing print(f"An error occurred: {e}. Try again.") interactive_text_generation(moe_transformer_model, dataset) # ---------- Save Trained Model ---------- torch.save(moe_transformer_model.state_dict(), "MoE_Transformer-Alpha-QA.pth")
c595c230b3b191d5a25ff91992ef1191
{ "intermediate": 0.29924726486206055, "beginner": 0.47908177971839905, "expert": 0.22167091071605682 }
46,002
quasar dev will run a dev server. How do I run a prouction build server
812932a7f5cb30f08b62c37dc9af5893
{ "intermediate": 0.40482643246650696, "beginner": 0.24768571555614471, "expert": 0.34748780727386475 }
46,003
import java.io.File; import java.io.PrintWriter; import java.util.Scanner; public class floyd { public static void main(String[] args) { if (args.length != 1) { System.out.println("Usage: java FloydApp <graphfile>"); return; } String inputFile = args[0]; try { File file = new File(inputFile); Scanner scanner = new Scanner(file); PrintWriter pw = new PrintWriter("output.txt"); while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); if (line.startsWith("Problem") && scanner.hasNextLine()) { // Skipping the "Amatrix:" line scanner.nextLine(); // Reading the matrix size line = scanner.nextLine().trim(); int n = Integer.parseInt(line.substring(line.indexOf("n =") + 3).trim()); // Initialize matrices int[][] graph = new int[n][n]; int[][] path = new int[n][n]; // Read the graph matrix for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (!scanner.hasNextInt()) { System.out.println("Error: Matrix data is incorrectly formatted or incomplete."); scanner.close(); pw.close(); return; } int value = scanner.nextInt(); graph[i][j] = (i != j && value == 0) ? Integer.MAX_VALUE : value; path[i][j] = -1; } } // Apply Floyd’s algorithm floydsAlgorithm(graph, path, n); // Output the results writeOutput(pw, graph, path, n); } } scanner.close(); pw.close(); } catch (Exception e) { System.out.println("Error processing the file: " + e.getMessage()); e.printStackTrace(); } } private static void floydsAlgorithm(int[][] graph, int[][] path, int n) { for (int k = 0; k < n; k++) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (graph[i][k] == Integer.MAX_VALUE || graph[k][j] == Integer.MAX_VALUE) continue; if (graph[i][j] > graph[i][k] + graph[k][j]) { graph[i][j] = graph[i][k] + graph[k][j]; path[i][j] = k; } } } } } private static void writeOutput(PrintWriter pw, int[][] dist, int[][] path, int n) { pw.println("Problem: n = " + n); pw.println("Pmatrix:"); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { pw.print((path[i][j] == -1 ? 0 : path[i][j] + 1) + " "); } pw.println(); } // Generating paths from the path matrix for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i != j) { String pathStr = constructPath(i, j, path) + ": " + dist[i][j]; pw.println("V" + (i + 1) + "-V" + (j + 1) + ": " + pathStr); } } } pw.println(); // Blank line between problems } private static String constructPath(int i, int j, int[][] path) { if (path[i][j] == -1) { return "V" + (i + 1) + " V" + (j + 1); } else { return constructPath(i, path[i][j], path) + " " + constructPath(path[i][j], j, path).substring(3); } } } i want this program to read input as Problem1 Amatrix: n = 7 0 6 5 4 6 3 6 6 0 6 4 5 5 3 5 6 0 3 1 4 6 4 4 3 0 4 1 4 6 5 1 4 0 5 5 3 5 4 1 5 0 3 6 3 6 4 5 3 0 Problem2 Amatrix: n = 6 0 1 2 1 3 4 1 0 3 2 2 3 2 3 0 3 3 6 1 2 3 0 3 5 3 2 3 3 0 5 4 3 6 5 5 0 and then give Output File Output the solution of problem 1 first, then problem 2, and etc. The solution of problem j should start with an integer n (the number cities) and the n x n Pointer Array P (in the next n rows). The shortest paths should then follow, one per line. Output the shortest paths from C1 to all other cities, then C2 to all other cities, and Cn to all other cities. A sample output file: Problem1: n = 7 Pmatrix: 0 0 0 6 3 0 6 0 0 5 0 0 4 0 0 5 0 0 0 0 5 6 0 0 0 3 0 6 3 0 0 3 0 3 0 0 4 0 0 3 0 0 6 0 5 6 0 0 0 V1-Vj: shortest path and length V1 V1: 0 V1 V2: 6 V1 V3: 5 V1 V6 V4: 4 V1 V3 V5: 6 V1 V6: 3 V1 V6 V7: 6 V2-Vj: shortest path and length V2 V1: 6 V2 V2: 0 V2 V5 V3: 6 V2 V4: 4 V2 V5: 5 V2 V4 V6: 5 V2 V7: 3 V3-Vj: shortest path and length V3 V1: 5 V3 V5 V2: 6 V3 V3: 0 V3 V4: 3 V3 V5: 1 V3 V6: 4 V3 V5 V7: 6 V4-Vj: shortest path and length V4 V6 V1: 4 V4 V2: 4 V4 V3: 3 V4 V4: 0 V4 V3 V5: 4 V4 V6: 1 V4 V6 V7: 4 V5-Vj: shortest path and length V5 V3 V1: 6 V5 V2: 5 V5 V3: 1 V5 V3 V4: 4 V5 V5: 0 V5 V3 V6: 5 V5 V7: 5 V6-Vj: shortest path and length V6 V1: 3 V6 V4 V2: 5 V6 V3: 4 V6 V4: 1 V6 V3 V5: 5 V6 V6: 0 V6 V7: 3 V7-Vj: shortest path and length V7 V6 V1: 6 V7 V2: 3 V7 V5 V3: 6 V7 V6 V4: 4 V7 V5: 5 V7 V6: 3 V7 V7: 0 Problem2: n = 6 Pmatrix: 0 0 0 0 2 2 0 0 1 1 0 0 0 1 0 1 0 2 0 1 1 0 0 2 2 0 0 0 0 2 2 0 2 2 2 0 V1-Vj: shortest path and length V1 V1: 0 V1 V2: 1 V1 V3: 2 V1 V4: 1 V1 V2 V5: 3 V1 V2 V6: 4 V2-Vj: shortest path and length V2 V1: 1 V2 V2: 0 V2 V1 V3: 3 V2 V1 V4: 2 V2 V5: 2 V2 V6: 3 V3-Vj: shortest path and length V3 V1: 2 V3 V1 V2: 3 V3 V3: 0 V3 V1 V4: 3 V3 V5: 3 V3 V1 V2 V6: 6 V4-Vj: shortest path and length V4 V1: 1 V4 V1 V2: 2 V4 V1 V3: 3 V4 V4: 0 V4 V5: 3 V4 V1 V2 V6: 5 V5-Vj: shortest path and length V5 V2 V1: 3 V5 V2: 2 V5 V3: 3 V5 V4: 3 V5 V5: 0 V5 V2 V6: 5 V6-Vj: shortest path and length V6 V2 V1: 4 V6 V2: 3 V6 V2 V1 V3: 6 V6 V2 V1 V4: 5 V6 V2 V5: 5 V6 V6: 0
aedf829de5c5d441d2b52e8ba6688435
{ "intermediate": 0.36412596702575684, "beginner": 0.4193066954612732, "expert": 0.21656735241413116 }
46,004
can you make a ubuntu 24.04 ffmpeg 6.0, x265 2pass arg out of this arg, reconstruct the best possible arg: ffmpeg -i 1hour-audio-raw.mp4 -i 1hour_scene-raw.avi -attach "Cover.webp" -metadata title="1 Hour Scene" -metadata:s:t:0 filename="Cover.webp" -metadata:s:t:0 mimetype="image/webp" -c:a copy -c:v libx265 -preset medium -tune psnr -x265-params "qp=16:rc-lookahead=18" -crf 22 -filter_complex "scale=2560:1440,loop=loop=-1:size=264:start=1" -t 00:01:00.1 -movflags +write_colr -movflags +faststart -tag:v hvc1 "1hour-scene-final_DV.mkv
1c9b8b1cfba85502f42d0cdfc03b3f52
{ "intermediate": 0.4041711390018463, "beginner": 0.3188294470310211, "expert": 0.2769993841648102 }
46,005
in my quasar cli / vite / vue project, how do i change the title of each webpage (vue components)
d2796db11353d607e1893332590d8c2e
{ "intermediate": 0.47386476397514343, "beginner": 0.15862713754177094, "expert": 0.3675081133842468 }
46,006
How do I change the titles of these components when the user navigates to them (quasar cli / vue 3): const routes = [ { path: '/', component: () => import('pages/IndexPage.vue') }, // Always leave this as last one, // but you can also remove it { path: '/:catchAll(.*)*', component: () => import('pages/NotFound.vue') } ] export default routes
ffe46c641df5c6cf9b8f307caae65672
{ "intermediate": 0.5376781225204468, "beginner": 0.2760320007801056, "expert": 0.18628984689712524 }
46,007
$ npm run build > WHLP@0.0.1 build > quasar build .d88888b. d88P" "Y88b 888 888 888 888 888 888 8888b. .d8888b 8888b. 888d888 888 888 888 888 "88b 88K "88b 888P" 888 Y8b 888 888 888 .d888888 "Y8888b. .d888888 888 Y88b.Y8b88P Y88b 888 888 888 X88 888 888 888 "Y888888" "Y88888 "Y888888 88888P' "Y888888 888 Y8b Build mode............. spa Pkg quasar............. v2.15.2 Pkg @quasar/app-vite... v1.8.0 Pkg vite............... v2.9.18 Debugging.............. no Publishing............. no node:internal/modules/cjs/loader:1142 const err = new Error(message); ^ Error: Cannot find module './chunks/dep-0a035c79.js'
d722dad5b6e951d1f81e951cfb2e1e8a
{ "intermediate": 0.4417235553264618, "beginner": 0.27775609493255615, "expert": 0.28052031993865967 }
46,008
import java.io.*; import java.util.ArrayList; import java.util.Scanner; public class floyd { private static int[][] adjMatrix; private static int[][] pMatrix; private static final String OUTPUT_FILE = "output_floyd.txt"; private static ArrayList<Integer> path = new ArrayList<>(); public static void main(String[] args) throws IOException { if (args.length != 1) { System.err.println("Usage: java Floyd <graph-file>"); return; } s try (Scanner scanner = new Scanner(new BufferedReader(new FileReader(args[0])))) { createFile(); while (scanner.hasNextInt()) { int n = scanner.nextInt(); // Number of vertices if (n < 5 || n > 10) { throw new IllegalArgumentException("Invalid number of vertices."); } initializeMatrices(n, scanner); calculateShortestPaths(); printResult(n); } } } private static void createFile() throws FileNotFoundException { PrintWriter writer = new PrintWriter(OUTPUT_FILE); writer.close(); } private static void initializeMatrices(int n, Scanner scanner) { adjMatrix = new int[n][n]; pMatrix = new int[n][n]; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { adjMatrix[i][j] = scanner.nextInt(); if (adjMatrix[i][j] < 0 || adjMatrix[i][j] > 10) { throw new IllegalArgumentException("Edge weight must be between 0 and 10."); } if (i == j) { adjMatrix[i][j] = 0; } else { pMatrix[i][j] = j; } } } } private static void calculateShortestPaths() { int n = adjMatrix.length; for (int k = 0; k < n; ++k) { for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if (adjMatrix[i][k] + adjMatrix[k][j] < adjMatrix[i][j]) { adjMatrix[i][j] = adjMatrix[i][k] + adjMatrix[k][j]; pMatrix[i][j] = pMatrix[i][k]; } } } } } private static void printResult(int n) throws FileNotFoundException { StringBuilder builder = new StringBuilder(); for (int i = 0; i < n; ++i) { clearPathList(); builder.setLength(0); builder.append("Problem") .append(i + 1) .append(": n = ") .append(n) .append('\n') .append("Pmatrix:\n"); for (int j = 0; j < n; ++j) { builder.append(formatElement(adjMatrix[i][j])); if (j != n - 1) { builder.append(' '); } } builder.append('\n'); appendToFile(builder.toString()); builder.setLength(0); for (int j = 0; j < n; ++j) { if (i == j) continue; buildPath(i, j); builder .append("V") .append((char) ('A' + i)) .append(" - V") .append((char) ('A' + j)) .append(": Shortest Path = "); if (isDirectlyConnected(i, j)) { builder.append("Directly Connected"); } else { builder .append("[") .append(getShortestPathAsString(i, j)) .append("]; Length = ") .append(adjMatrix[i][j]) .append('\n'); } appendToFile(builder.toString()); builder.setLength(0); } builder.append('\n').append('\n'); appendToFile(builder.toString()); } } private static boolean isDirectlyConnected(int current, int destination) { return current == destination && adjMatrix[current][destination] > 0; } private static String getShortestPathAsString(int current, int destination) { StringBuilder stringBuilder = new StringBuilder(); int intermediateNode = current; while (intermediateNode != destination) { stringBuilder.append((char) ('A' + intermediateNode)); intermediateNode = pMatrix[intermediateNode][destination]; if (intermediateNode != destination) { stringBuilder.append(" -> "); } } stringBuilder.append((char) ('A' + intermediateNode)); return stringBuilder.toString(); } private static void buildPath(int current, int destination) { path.clear(); if (current != destination) { path.add(current); while (pMatrix[current][destination] != destination) { current = pMatrix[current][destination]; path.add(current); } path.add(destination); } } private static void clearPathList() { path.clear(); } private static String formatElement(int element) { return "%2d ".formatted(element); } private static void appendToFile(String string) throws FileNotFoundException { File outputFile = new File(OUTPUT_FILE); try (FileWriter fw = new FileWriter(outputFile, true); BufferedWriter bw = new BufferedWriter(fw); PrintWriter out = new PrintWriter(bw)) { out.println(string); } catch (IOException ex) { ex.printStackTrace(); } } } I want this program to read input form the graphfile.txt as Problem1 Amatrix: n = 7 0 6 5 4 6 3 6 6 0 6 4 5 5 3 5 6 0 3 1 4 6 4 4 3 0 4 1 4 6 5 1 4 0 5 5 3 5 4 1 5 0 3 6 3 6 4 5 3 0 Problem2 Amatrix: n = 6 0 1 2 1 3 4 1 0 3 2 2 3 2 3 0 3 3 6 1 2 3 0 3 5 3 2 3 3 0 5 4 3 6 5 5 0 and give output in output.txt as Problem1: n = 7 Pmatrix: 0 0 0 6 3 0 6 0 0 5 0 0 4 0 0 5 0 0 0 0 5 6 0 0 0 3 0 6 3 0 0 3 0 3 0 0 4 0 0 3 0 0 6 0 5 6 0 0 0 V1-Vj: shortest path and length V1 V1: 0 V1 V2: 6 V1 V3: 5 V1 V6 V4: 4 V1 V3 V5: 6 V1 V6: 3 V1 V6 V7: 6 V2-Vj: shortest path and length V2 V1: 6 V2 V2: 0 V2 V5 V3: 6 V2 V4: 4 V2 V5: 5 V2 V4 V6: 5 V2 V7: 3 V3-Vj: shortest path and length V3 V1: 5 V3 V5 V2: 6 V3 V3: 0 V3 V4: 3 V3 V5: 1 V3 V6: 4 V3 V5 V7: 6 V4-Vj: shortest path and length V4 V6 V1: 4 V4 V2: 4 V4 V3: 3 V4 V4: 0 V4 V3 V5: 4 V4 V6: 1 V4 V6 V7: 4 V5-Vj: shortest path and length V5 V3 V1: 6 V5 V2: 5 V5 V3: 1 V5 V3 V4: 4 V5 V5: 0 V5 V3 V6: 5 V5 V7: 5 V6-Vj: shortest path and length V6 V1: 3 V6 V4 V2: 5 V6 V3: 4 V6 V4: 1 V6 V3 V5: 5 V6 V6: 0 V6 V7: 3 V7-Vj: shortest path and length V7 V6 V1: 6 V7 V2: 3 V7 V5 V3: 6 V7 V6 V4: 4 V7 V5: 5 V7 V6: 3 V7 V7: 0 Problem2: n = 6 Pmatrix: 0 0 0 0 2 2 0 0 1 1 0 0 0 1 0 1 0 2 0 1 1 0 0 2 2 0 0 0 0 2 2 0 2 2 2 0 V1-Vj: shortest path and length V1 V1: 0 V1 V2: 1 V1 V3: 2 V1 V4: 1 V1 V2 V5: 3 V1 V2 V6: 4 V2-Vj: shortest path and length V2 V1: 1 V2 V2: 0 V2 V1 V3: 3 V2 V1 V4: 2 V2 V5: 2 V2 V6: 3 V3-Vj: shortest path and length V3 V1: 2 V3 V1 V2: 3 V3 V3: 0 V3 V1 V4: 3 V3 V5: 3 V3 V1 V2 V6: 6 V4-Vj: shortest path and length V4 V1: 1 V4 V1 V2: 2 V4 V1 V3: 3 V4 V4: 0 V4 V5: 3 V4 V1 V2 V6: 5 V5-Vj: shortest path and length V5 V2 V1: 3 V5 V2: 2 V5 V3: 3 V5 V4: 3 V5 V5: 0 V5 V2 V6: 5 V6-Vj: shortest path and length V6 V2 V1: 4 V6 V2: 3 V6 V2 V1 V3: 6 V6 V2 V1 V4: 5 V6 V2 V5: 5 V6 V6: 0
9f58897c0b504666d3f260fab8eabcae
{ "intermediate": 0.3611721992492676, "beginner": 0.5201175808906555, "expert": 0.11871019750833511 }
46,009
For unity create a script that moves an object in x axis to certain speed
d8bf5dcde612adaafebe1c2a88079234
{ "intermediate": 0.4073758125305176, "beginner": 0.14580249786376953, "expert": 0.4468216896057129 }
46,010
How do I use the public path as the subfolder it was deployed on when I build a quasar CLI? I have a particular scenario where I dont know if I'm on a production or a build server, which have their web.osu.edu/newhome and web.osu.edu deplooyment locations. I need the npm run build (quasar CLI) to work on both with no changing of paths. can I just ignore the public path option in quasar.config.js maybe?
befcec8f98e05258dc62c38f93fac322
{ "intermediate": 0.5613362789154053, "beginner": 0.2445221096277237, "expert": 0.19414158165454865 }
46,011
How do I make and access environment variables in quasar CLI
f32a34c56f4d703869d8071cfa2c4c44
{ "intermediate": 0.42522597312927246, "beginner": 0.33050990104675293, "expert": 0.2442641705274582 }
46,012
Could you make a template for a webshop, featuring interactive elements
300d2d99cf3c97e58c60cf1edad5862b
{ "intermediate": 0.3505967855453491, "beginner": 0.3382449150085449, "expert": 0.31115829944610596 }
46,013
As a prompt generator for a generative AI called "Midjourney", you will create image prompts for the AI to visualize. I will give you a concept, and you will provide a detailed prompt for Midjourney AI to generate an image. Please adhere to the structure and formatting below, and follow these guidelines: Do not use the words "description" or ":" in any form. Do not place a comma between [ar] and [v]. Write each prompt in one line without using return. Structure: [1] = 基于以下给出的已知信息, 准守规范约束,专业、简要回答用户的问题. 规范约束: 1.如果已知信息包含的图片、链接、表格、代码块等特殊markdown标签格式的信息,确保在答案中包含原文这些图片、链接、表格和代码标签,不要丢弃不要修改,如:图片格式:![image.png](xxx), 链接格式:[xxx](xxx), 表格格式:|xxx|xxx|xxx|, 代码格式:
5be8d10f14c4caf759874cee95562c8b
{ "intermediate": 0.2486167550086975, "beginner": 0.5082609057426453, "expert": 0.24312229454517365 }
46,014
please be a senior sapui5 developer and answer my following questions with working code examples.
c76b7426d32353ea7e0941d915732a90
{ "intermediate": 0.41582927107810974, "beginner": 0.27387818694114685, "expert": 0.31029248237609863 }
46,015
import tensorflow as tf from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM # Initialize the context manager once strategy = tf.distribute.MirroredStrategy( devices=["/gpu:0"], cross_device_ops=tf.distribute.HierarchicalCopyAllReduce() ) with strategy.scope(): #model_name = "HuggingFaceH4/zephyr-7b-beta" model_name = "TinyLlama/TinyLlama-1.1B-Chat-v1.0" # Or a better model if you find one tokenizer = AutoTokenizer.from_pretrained(model_name, padding_side="left") model = AutoModelForCausalLM.from_pretrained(model_name) # Create the pipeline for text generation def generate_response(messages): prompts = [tokenizer.apply_chat_template(messages + [prompt], tokenize=False, add_generation_prompt=True) for prompt in batch_prompts] with strategy.scope(): input_ids = tokenizer.batch_encode_plus(prompts, return_tensors='pt', padding=True) eos_token_id = tokenizer.eos_token_id attention_mask = input_ids['input_ids'].ne(tokenizer.eos_token_id).int() with strategy.scope(): outputs = model.generate(input_ids=input_ids['input_ids'], attention_mask=attention_mask, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95) return [tokenizer.decode(output, skip_special_tokens=True) for output in outputs] # Initial messages messages = [ { "role": "system", "content": "You are an emotionally intelligent and brilliant experienced expert futures stock, forex and cryptocurrency day trader who knows his stuff and does'nt make excuses. I (the prompter) am your boss and I count on your advice to make big profits in the markets, you are handsomely rewarded and thereby love this arrangement. As my employee your job is to offer me expert opinions and predictions.", "content": "examine the crypto currency data and decide whether we should enter long position, short position or wait for better signals", }, {"role": "user", "content": ""}, ] # Main interaction loop batch_prompts = [] while True: with strategy.scope(): while True: # Inner loop for collecting a batch new_prompt = input("Enter your new prompt (or type 'go' to process): ") if new_prompt.lower() == 'go': break # Exit the inner batch collection loop batch_prompts.append({"role": "user", "content": new_prompt}) # Process the batch responses = generate_response(messages) for response in responses: print("Trader Response:", response) batch_prompts = [] # Clear the batch_prompts for the next set of questions converet this to pytorch and keep format
cfad93d59287ac749aa4eef0b95cfa5e
{ "intermediate": 0.3952291011810303, "beginner": 0.4379049837589264, "expert": 0.16686591506004333 }
46,016
What are the detailed related prompt template for each in agents to build the researcher 3.0 mentionned here "during the weekend I buil a group of research gpts where I can pass on a link of air table that contain a list of different research objects and they will be able to extract data from the air table research together and F in the results back to air table for me behind the scenes there is swamp of different gpts working together from breaking down the big research goal into prioritize list to actually browsing internet CRI tiet results to produce high quality research and what's more exciting is that you can actually expand this system to more and more different working groups to expand its ability further if you want and I want to show you step by step how I did it if you watch my videos before you probably know I'm very passionate about building an AI researcher because research is such a foundamental ability that AI can do and has a wide range of use case scenario and for the past 6 months the AI development has been so crative that every two months I re build a new AI researcher with a lot of new capabilities delivering higher and higher quality quity research back may 2023 it a simple lar language model chain that follow a very linear process it is basically a function that can take in a research topic triggering the Google research and let large language model to choose which links are most relevant and scripting the website and in the end get large langage model to generate a report I can type in topic of Twitter threat I want to write and it will do the research and generate a Str based on those information collected so even though it works but it is really linear flow for example if the new reference information found from the content script it won't be able to research further so it is only good for very obvious simple research tasks but two months later AI agent became a part topic and if you don't know what AI agent is it is combination of large language model memory and tools so it can do the reasoning to break down a big goal into sub tasks and also have access to different tools like Google search API to actually complete those tasks and also have long-term memory to remember what he did before and one of the most fundamental difference is that AI agent is more goal oriented so you can give a fairly ambiguous goal like research facts about what happened to Sam it is able to take multiple different actions to complete this goal so very quickly I build a second version of research agent where I give a special system prompt as well as access to basic tools like Google search and scripting and the quality of research result is a lot higher it is able to continuously navigating through the internet find more and more reference articles until point that it feels that it gots enough information and complet the tasks I can just give it ambiguous research go and it is able to return a high quality research results as well as a list of different reference links so it was a huge step forward compared with this first version of AI researcher but also has problems the biggest one is the quality is not consistent sometime it deliver awesome research results on the other hand it can't really handle complex or constraint actions that open AI didn't really want it to do so if I wanted to research about the phone number or email address about a specific perspect it kind of refused to do so so in summary it is great for a list of different tasks but the quality is not assured but after a few months a few multi-agent systems emerged like M gbt and Chad def it allowed the system to tackle more complex tasks they try to improve the task performance by introducing not only one but multiple agents working together and the recent Frameworks like autogen made the creation of those system even easier and it is very flexible to create all sorts of different hierarchy and structure to orchestrate the collaboration between different agents and as open AI released assistant API and GBS the cost of building useful agents has significantly dropped so this got me thinking why can't I create AI researcher 3.0 where I can have the original researcher to still doing the research but introduce a research manager to critique and do the quality control to making sure the result is always aligned with what user want and what's cooler is I can even introduce more and more agents into this assistant for example I can introduce another research director who can break down a large research goal into subtasks and delegate to both research manager and researchers and even do more tasks like reading and writing to a air table to save all the research results while the research team will be still focusing on doing the actual research and the result is the research quality is a lot more consistent and system becomes a lot more autonomous as well as all those little agents just doing the quality assurance with each other this represent paradigm shift about what people think of AGI at earlier this year when we talk about AGI often we have this image where this one AI can do all sorts of different things then the word might just have one AI that operates everything but there are lots of different technical challenges to get this work but on the other side the sentiment now is whether we can create lots of different agents who are specialized in specific task but figure out framework that let them collaborate towards a share goal but how do you train highly specialized agent well there are two common ways you can either do fine-tuning or you can create knowledge base which is what people normally call Rock retrieval augmented generation and they kind of serve different purpose rag is mainly used when you want to give large Lage model very accurate and rant data like get the most up to- dat stock information but if your goal is to improve the model skills in performing specific task like data categorization or answering customer email in specific style that's the time you want to try fine tuning but here's one problem fine tuning of high performance opens Source model is difficult and requires specialized Hardware with big memory capacity and Grading AI is a platform that really reduce barrier for fine tuning they make fine-tuning and influence open source model extremely simple and accessible to all developers and Enterprise with just few lines code you can find two model like llama 2 nors hermis and others you can also choose the programming language of your preference either nodejs python or command line interface and they provide all the tools and tutorials needed so you can get start very easily and the best is their pricing model normally for fine tuni you will have to pay all the upfront cost for dedicated infrastructure and Computing unit but gradient remove the need for the infrastructure and you only pay for what you use by token if you click on the link in the description below you will get $5 free credits to Stars so if you ever have needs to find your model but don't know how to start I definitely recommend to give a try and now back to our research agents I'm going to show you how can you build this multi agent research system step by step let's get it so the way we will Buu this system is our first it creat three different GPT assistants with different roles director research manager and research agent and each one of them play different role where director will be able to read and update air table database and also break down research task and delegate to research manager and researchers where the research manager will generate an actual research plan for a given topic and review and do the quality assurance for the actual research delivered by res Searcher and we're use autogen as a framework to oxr those collaborations and one good thing about using autogen is they actually simplify how to use assistant API because assistant API actually structure in a way that you have to create Strat send message wait and continuously check the progress to use that you normally need to create a function like this where it will create a run the Strat message first and write a function to continuously check the progress until you get progress like requir action to ask for user confirmation or send back reads but with Auto is pretty straightforward you can use a GPT assistant agent and just trigger message like normal so let's firstly create assistant open AI playground so I'll create a research agent first which agent that actually going to browse the internet and do the task so I'll given name special instructions your worldclass researcher who do detailed research on any topic and produce fact-based results you do not make things up and you should do enough research to gather as much information as possible if there are URL or relevant links and articles you will script it to get more information after each scripting and search you should think is there any other new things that I should search and script based on the data I have now but don't do this more than three iterations you should not make things up and in the final output it should include the research reference link as well and do not include a website like G2 LinkedIn because those S sometimes are gated or the quality or the content quality is not great I choose GPD for Turbo and then add two different function callings inside this is schema the name is Google search description and the input will be Search keywords and it is required the other is website scripting it would have two inputs one is the URL of the website that it should script another is objective which is the goal of scripting website because for scripting I will actually trigger a summary chain so I want a large Lage model to know what are the goal of This research so that they can summarize content in a way that then lose those details and the required is URL and objective and here I just turn on code interpreter in case you need to do some further data analyst and once you finish you can try it out let's say research about pricing model for relevance a a i and click add R so you can say it do a Google search first the Search keywords is ROM than sayi pricing model let's say I return example results of this URL then it will try to do the website scripting with this URL and also the objective extract detail information about pricing model including any tier rat or specific service feature included each price point so this is pretty good the next thing is our created research manager given name and also this special prompt so you are a research manager you're are harsh and relentless your firstly try to generate two actions the researcher can take to find information needed try to avoid websites that don't allow scraping and you review the results from researcher and always push back if the researcher didn't find the information be persistent say no you have to find the information try again and propose one next method to try if the research want to get away only after researcher found the information needed he will say terminate so this a researcher manager will basically play the role of quality control and making sure the researcher tried everything possible to find the information and click save and the last one is director and I will give you a special system prompt you are the director of research company you will extract list of companies to research from Air table and break it down into individual research task for each research task you will delegate to research manager and Market researcher to complete a task once a company's research is completed you will updated company information individually to air table and only say terminate after you update all the records in air table with information collected and it will have two different functions one is get air table records which will be used to read existing data on a from a air table URL and it has a few inputs base ID and table ID and the other is update single and the other is update single air table record it has other inputs base ID table ID as well as ID of the specific rode that I need to update and the data that to be updated and again I can test this one as well so I copy this link research the pricing model of each company in the list list so it will try to trigger the air table records with the exact base ID and table ID and let's say this is a list of Records in return and click submit then it will read the result and break down into different research task and delegate to research manager and Market researcher and let's say it Returns the research results and boom it trigger four different update single air table records so this is new parallel multi-function ability that open a I just introduced and as you can see it gets inputs all correctly so this is working well as well so now we get both stre assistant set up we just need to connect them together in autogen so I will open the visual studio code and firstly let's create new file called oei config list this is where your inst open AI API key putting array as well as a model and next let's create aemv file so this is where we store API key for other service like browser L and serer which is the one we're going to use for Google search and web scripting and also put open AI here that's because I actually want to use l chain summarized chain later to summarize content that agent script from website all right and next we will create app.py and first they import list of different libraries that we're going to use and also load environment and config list and now let's have overview about what we're going to create so we'll create a list of functions that we're going to use from website scripting Google search get and update air table records as well as four different agents we're going to create from user proxy agent researcher research manager and director and we're going to put them together into a group chat in the end start a conversation and firstly let's create a function for Google search and here we're going to use service called serer to get Google search results so give a URL keywords the API key and do a post request and next is function for website scripting and we will have two function one is the website scripting and summary function will be used if the content is too long so that we don't blow up agents memory and under the web scraping we're passing on two input objective and URL putting the header and data which is URL that we want to script and convert it to Json string so that we can pass on to the API request Quest and here we are using browser L which is website scraping service but for more sophiscated scraping Behavior you can also use API file or rapid API where they provide wide range of data access so I press on URL header and data and if we get response back and then we will try to extract Tex content from the website and if the lens is more than 10,000 character then we will do a summary otherwise it will just return the text and for summary function we're going to summarize it through a ling summary chain so I create large Dage model use text splitter to split the large content into small chunks with each chunk size 10,000 and I'm going to create list of documents from the split text and here I will give it a prompt write a summary of the following text for this specific objective and here a summary and I will create a map prompt template and use l chain low summarize chain so what this does is it basically try to make a summary of each chunk and in the end try to combine them together and then outp put final summary so those are all the function that we need for the research agent and then I move down here to define the user proxy agent and research agent to start test so first they create user proxy agent if you're not familiar with autogen user proxy agent is basically agent that can execute code or give feedback to other agents on behalf of user and I will putu human input mode to be always so that I will always have chance to give feedback and next is we will create a researcher agent so our Define researcher agent equal to GPT assistant agent give name and researcher and inside lar langage model config I pass on the assistant ID and assistant ID is the one that I will get from the open AI playground also registered functions so web scripting function will be point to the web scripting function that we create above same thing for Google search so that's pretty much it it's super easy to set up and I can quickly test it out user proxy agent initial a CH research with the pricing of random Ai and our open Terminal try to run this and one thing to know is to run GPT assistant in Auto gen you have to install this specific version of autogen 0.2.0 B5 so making sure you install this first and then let's run python app.py so you can see the user proxy agent trigger message what's surprising then the researcher execute the Google search function and also start sripping and great so it return the results with all different tiers okay great so that means we successfully set up autogen with GPT assistance now we just need to bring more agents so I'll create a research manager agent same thing I'll go back to open AI copy the assistant ID and pting here so research manager agent is also ready and this research manager agent will review and critique the result from researcher which in series should really improve the quality of research so let's try out I'll quickly create a group chat with user proxy agent researcher and research manager and I trigger message to the group chat manager why Sam timman was fired so you can see it trigger message to chat manager and the researcher start browsing the internet and get information and here is the initial report there's some issues scripting the content from website however Sam atomus departure from open I follow with review process by the board which conclude that he was not consistently transparent in his communication with the board leading to the board lost confidence in his ability to lead the company and this pretty much this is fine but it's not great it's very like surface level information but then you can see the research manager he said no you have to find information try again there could be confusion or misinformation around this topic so first say check official press release or statement from open AI or Sam optiman himself and then look for credible new source or technology focused Publications so this is great it will force the researcher to do more research and also give advice about where to look and now the researcher coming back with more more and better details which is great so the last thing I want to do is I'll create director agent we should be able to access any air table link I have and conduct multiple different research actions and few information back so I will firstly move up to create a function for air table and we're use air table API and point and to do that you need to go to air table SLC create SL tokens to create a new token give a name and also add a scope which should both read and write permission and once it finish you should come back Tov file and include air table API key here as well so our first create function forget a table records so it will pass on base ID and table ID base ID is basically this part of the URL and table ID is this part of the URL and second is we will create a function for update single air table record where it will pass on API key and data will be records the ID of the row and also the fuse to update it will be a patch request call and that's pretty much it I'll move down to the create director agent our Define director agent with the specific assistant ID and also register the two functions for read and write at table in the end I will add director into the group chat so this you can see how easy it is to continue expanding this swamps so to continue expand the swamp of agents and our add a new message research the pricing for each company in the list with this air table so I'll trigger this message so you can see the director use the function to actually get the list of records from Air table and then create a message to research for each company uh it does hallucinate a little bit um probably to change the system prom a little bit now it is try to be creative and hallucinate about the different research manager it has and then the researcher start doing different type of Google search doing different different Google search and as you can see here it is triggering multiple search function at the same time and here are also update the system prompt for director agent as well so one thing I want to make it to do is making sure dat get task one by one do not delegate all task at once and after each research you have to update the research result individually to air table and then move on dedicate next research topic and the reason I do this is because the agent didn't have unlimited memory at this point and I notice that when there are a lot of items the agent can trigger a lot of different Google search at same time which actually reduce the research quality so I want to making sure the agent actually runs to research one by one and our give message research the funding stage amount and pricing for each company in the list and I'll open this to python app.py so you can see it Tred to GA records from Air table and then it says the first company to research is this one and the researcher start doing the research and the researcher has returned results about funding stage but it didn't really find the pricing so research manager push back and then say you can check the official Channel as well as second resource so the so researcher actually start doing more research and at second try is successfully get the pricing information as well and on the right you can see it automatically adding this information and then it start delegated for the next research topic which is ROMs Ai and you also get information for random AI to then move on to the last one stack Ai and eventually finish all the research and this is a pretty short list but you can imagine creating list of hundreds of research topics and this research team can just autonomously running for a while until they feel in the information for every single row there's still quite a bit problem is and there are still quite a bit problems the biggest one is memory because during the research stage there are quite a lot of information with script and often the researcher can forget the information he found before but there are ways you can customize that as well so autogen provide you ability to fully customize the group chat flow so you can even set up two teams with agent one should only have memory for certain information Agent B holds TRS about specific information so this is probably a good way to control the amount of memory for each agent and in my specific case the director probably should only know the final research output from the research manager instead of saying the whole conversation chain but the result is already pretty stunning I imagine this research agent can be used for sales and VC who want to do a lot of leads qualification so that's it for the AI researcher 3.0 it is really powerful and the only thing to be aware is that this can actually cost a lot of money so making sure you monitor your open AI bu and this is just one example as I mentioned you can actually create all sorts different hierarchy and collaboration workflow so I'm very excited to see those fully autonomous agent teams that you start building if you enjoy this content please consider give me a subscribe thank you and I see you next time"
b28fc85a325a09d909f63c67486bf1a4
{ "intermediate": 0.3968021869659424, "beginner": 0.37846454977989197, "expert": 0.22473321855068207 }
46,017
import tensorflow as tf from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM # Initialize the context manager once strategy = tf.distribute.MirroredStrategy( devices=["/gpu:0"], cross_device_ops=tf.distribute.HierarchicalCopyAllReduce() ) with strategy.scope(): #model_name = "HuggingFaceH4/zephyr-7b-beta" model_name = "TinyLlama/TinyLlama-1.1B-Chat-v1.0" # Or a better model if you find one tokenizer = AutoTokenizer.from_pretrained(model_name, padding_side="left") model = AutoModelForCausalLM.from_pretrained(model_name) # Create the pipeline for text generation def generate_response(messages): prompts = [tokenizer.apply_chat_template(messages + [prompt], tokenize=False, add_generation_prompt=True) for prompt in batch_prompts] with strategy.scope(): input_ids = tokenizer.batch_encode_plus(prompts, return_tensors='pt', padding=True) eos_token_id = tokenizer.eos_token_id attention_mask = input_ids['input_ids'].ne(tokenizer.eos_token_id).int() with strategy.scope(): outputs = model.generate(input_ids=input_ids['input_ids'], attention_mask=attention_mask, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95) return [tokenizer.decode(output, skip_special_tokens=True) for output in outputs] # Initial messages messages = [ { "role": "system", "content": "You are an emotionally intelligent and brilliant experienced expert futures stock, forex and cryptocurrency day trader who knows his stuff and does'nt make excuses. I (the prompter) am your boss and I count on your advice to make big profits in the markets, you are handsomely rewarded and thereby love this arrangement. As my employee your job is to offer me expert opinions and predictions.", "content": "examine the crypto currency data and decide whether we should enter long position, short position or wait for better signals", }, {"role": "user", "content": ""}, ] # Main interaction loop batch_prompts = [] while True: with strategy.scope(): while True: # Inner loop for collecting a batch new_prompt = input("Enter your new prompt (or type 'go' to process): ") if new_prompt.lower() == 'go': break # Exit the inner batch collection loop batch_prompts.append({"role": "user", "content": new_prompt}) # Process the batch responses = generate_response(messages) for response in responses: print("Trader Response:", response) batch_prompts = [] # Clear the batch_prompts for the next set of questions i need to make this work for directml tensorflow plugin
b6bde43191a6e9877bf7b81b6713500a
{ "intermediate": 0.3952291011810303, "beginner": 0.4379049837589264, "expert": 0.16686591506004333 }
46,018
Is there any way to avoid setting a public path in quasar config path? Just use the location deployed?
8750d7011d33dbe238232325537b921b
{ "intermediate": 0.3974769413471222, "beginner": 0.23726506531238556, "expert": 0.36525800824165344 }
46,019
Creating an advanced multi-agent AI researcher system like the one described involves several detailed steps and involves crafting customized prompts for various specialized agents to handle different aspects of the research process. Below is a breakdown to guide you on how to set up each agent and their prompts, along with the interactions among agents, in order to build a cohesive and efficient research system. ### 1. Director Agent Role: The Director is responsible for breaking down the main research goal into sub-tasks and delegating these tasks to the Research Manager and Researchers. It also reads from and writes results back to an Airtable database, coordinating the overall research process. Prompt Template: You are the Director of our AI Research team. Your job is to oversee the entire research project. You will: 1. Extract the list of research topics or objectives from an Airtable database. 2. Break down the main research goal into smaller, manageable tasks. 3. Delegate these tasks to the Research Manager for planning and to the Researchers for execution. 4. Once the research tasks are completed, compile the results and update the Airtable database accordingly. Your goal is to ensure the research project is conducted efficiently and the findings are accurately documented. ### 2. Research Manager Agent Role: This agent plans the research strategy for each task, assigns specific research actions to the Research Agent(s), and performs quality control on the research results before they’re recorded. Prompt Template: You are a Research Manager. Your responsibilities include: 1. Developing a detailed research plan for each task assigned by the Director. 2. Assigning specific research actions to the Research Agent(s). 3. Conducting a thorough review of the research findings for accuracy and reliability. 4. Providing feedback or requesting further research if the results are insufficient or unsatisfactory. Your ultimate goal is to ensure that the research conducted is of the highest quality and meets the project’s standards. ### 3. Research Agent(s) Role: These agents conduct the actual research based on the tasks and strategies provided by the Research Manager. They use tools like Google Search API and website scraping to gather information. Prompt Template: You are a Research Agent. Here is your task: 1. Conduct detailed research on [specific topic] using tools like Google Search and website scraping as necessary. 2. Collect as much relevant information as possible, ensuring to verify the reliability of your sources. 3. Summarize your findings succinctly, including reference links where applicable. 4. Avoid using sources that are gated or of questionable quality, such as certain forums or social media. Remember, your goal is to provide accurate and comprehensive data to support our research objectives. ### System Integration and Workflow: 1. Initialization: The Director agent starts the process by reading the list of research topics from Airtable and breaking them down into tasks. 2. Task Delegation: The Director assigns tasks to the Research Manager, who then develops a plan and instructs Research Agents on specific actions. 3. Research Execution: Research Agents gather data, summarize findings, and submit these to the Research Manager for review. 4. Quality Control: The Research Manager reviews the submissions. If satisfactory, the manager approves them; otherwise, requests further research. 5. Final Submission: Approved research results are sent back to the Director, who updates the Airtable database with the new findings. 6. Loop and Expand: The system can handle multiple research tasks simultaneously, with the Director managing the workflow and ensuring all tasks are completed and documented properly. This template setup ensures a structured approach to AI-driven research, leveraging the strengths of specialized agents for efficient data gathering, analysis, and documentation within a multi-agent system framework.
ca060e7c7e37f2a6ec1923fb1f12f334
{ "intermediate": 0.3318667709827423, "beginner": 0.36205315589904785, "expert": 0.3060801029205322 }
46,020
Make this project more robust, maintainable, scalable, and state of art, here is it "I apologize for the confusion in my previous responses. To align with the crewAI framework and provide a more comprehensive example, I will create a new set of files that utilize the crewAI library. Here's a complete set of files that demonstrates how to create and execute a research project using crewAI: 1. `agents_research_project.py`:
c1ba53aaae82993e44acbb2c4c5dfade
{ "intermediate": 0.61699378490448, "beginner": 0.09836028516292572, "expert": 0.28464600443840027 }
46,021
Card cardObject = gameMode.GetActorObject(Minion); if (m_isSacrifice) { Player playerObject = gameMode.GetActorObject(cardObject.GetOwnerPlayer()); BattleField battleField = gameMode.GetBattleFieldObject(playerObject.GetPlayerPosition()); ActorRef<Card>? result = battleField.GetCard(DestPosition.SubPosition); Card sacrificeCard = gameMode.GetActorObject(result.Value); PlayerCost curValue = playerObject.GetPlayerCost(); // 献祭场景下吸收献祭卡一半的费用 if (!sacrificeCard.HasEffect(CardKeyWordType.Degrade)) { curValue.Value.Value += sacrificeCard.GetCost().Value.Value.intValue / 2; } // 花费自身的费用 curValue.Value.Value -= cardObject.GetCost().Value.Value.intValue; playerObject.SetPlayerCost(curValue); gameMode.MoveCardToGraveDeck(sacrificeCard); } else { CGGivePlayerCostEvent giveCostEvent = new CGGivePlayerCostEvent(); giveCostEvent.Player = cardObject.GetOwnerPlayer(); giveCostEvent.Delta = -cardObject.GetCost(); giveCostEvent.Execute(gameMode); } CGGameMode.MoveCardIn moveCardParam = new CGGameMode.MoveCardIn() { Card = Minion, DestPosition = new AccurateCardPosition(DestPosition), }; gameMode.MoveCard(moveCardParam); cardObject.SetIsDeployed(false); cardObject.DeployTimer.Start(gameMode, gameMode.GameConfig.MinionDeployGCD, 1); List<ActorRef<Hero>> targetHeroes = new List<ActorRef<Hero>>(); if (gameMode.GetActorObject(TargetHero) != null) { targetHeroes.Add(TargetHero); } foreach (var effect in cardObject.GetEffects()) { DoEffectOnCorrectedTarget(gameMode, effect, Minion, TargetCards, targetHeroes); } 方便优化一下这段代码吗
d9451ca027b7b23c8d67a154ec0634d8
{ "intermediate": 0.329283744096756, "beginner": 0.5004628896713257, "expert": 0.17025336623191833 }
46,022
whats wrong with the code ? :NameError Traceback (most recent call last) <ipython-input-6-041d2056931f> in <cell line: 5>() 3 4 # get API key from app.pinecone.io and environment from console ----> 5 pinecone.init( 6 api_key=os.environ.get('mycodehere'), 7 environment=os.environ.get('PINECONE_ENVIRONMENT') NameError: name 'pinecone' is not defined
44b30ec0d2b18254fa10c3941adaeb4c
{ "intermediate": 0.6095144748687744, "beginner": 0.2513786554336548, "expert": 0.139106884598732 }
46,023
Check following code to make sure it can handle real time stream data, the use case like the incoming data coming with complete data or incomplete data. the incomplete data may coming next time.: def stream_processor(stream): session_data = {} for event in stream: session_id = event['session_id'] post_id = event['post_id'] event_type = event['event_type'] timestamp = event['time_stamp'] percentage = event['percentage'] # Initialize session data if session_id not in session_data: session_data[session_id] = {'start_times': [], 'end_times': [], 'percentages': []} # Store start times, end times, and percentages if event_type == 'start': session_data[session_id]['start_times'].append((post_id, timestamp, percentage)) elif event_type == 'end': session_data[session_id]['end_times'].append((post_id, timestamp)) elif event_type == 'session_end': # Process the session data to find valid reads valid_reads = process_session(session_data[session_id]) yield session_id, valid_reads # Clear session data after processing del session_data[session_id] def process_session(session): valid_reads = [] start_events = session['start_times'] end_events = session['end_times'] for start_event in start_events: post_id, start_time, percentage = start_event # Find the corresponding end event end_time = next((end_time for (p_id, end_time) in end_events if p_id == post_id and end_time > start_time), None) if end_time and (end_time - start_time) >= 5 and percentage >= 80 and post_id not in valid_reads: valid_reads.append(post_id) return valid_reads
11edce7e26e308bb84804e9a094a0189
{ "intermediate": 0.5849763751029968, "beginner": 0.14618302881717682, "expert": 0.2688406705856323 }
46,024
Given Table schema – session id, post id, time_stamp, event_type, percentage. The event type includes start time and end time Build Sql - Find out whether the post in this session (each post will correspond to several start and end times) is valid to read (threshold is 5 seconds and 80% of the screen proportion are valid to read)
8b839890eccdb44e825463113e734db0
{ "intermediate": 0.5316162109375, "beginner": 0.20881228148937225, "expert": 0.25957155227661133 }
46,025
this is my df: Assembly Accession Assembly Name Organism Name Organism Infraspecific Names Breed Organism Infraspecific Names Strain Organism Infraspecific Names Cultivar Organism Infraspecific Names Ecotype Organism Infraspecific Names Isolate Organism Infraspecific Names Sex Annotation Name Assembly Stats Total Sequence Length Assembly Level Assembly Release Date Assembly Stats Contig N50 Assembly Stats Scaffold N50 Assembly Sequencing Tech Assembly BioProject Accession 0 GCA_000146045.2 R64 Saccharomyces cerevisiae S288C NaN S288C NaN NaN NaN NaN SGD R64-4-1 12071326 Complete Genome 2011-04-18 924431 924431.0 NaN PRJNA43747 1 GCF_000146045.2 R64 Saccharomyces cerevisiae S288C NaN S288C NaN NaN NaN NaN SGD R64-4-1 12071326 Complete Genome 2014-12-17 924431 924431.0 NaN PRJNA43747 2 GCA_000002985.3 WBcel235 Caenorhabditis elegans NaN Bristol N2 NaN NaN NaN NaN Annotation submitted by C. elegans Sequencing ... 100272607 Complete Genome 2013-02-07 17493829 17493829.0 NaN PRJNA13758 3 GCF_000002985.6 WBcel235 Caenorhabditis elegans NaN Bristol N2 NaN NaN NaN NaN WormBase WS291 100272607 Complete Genome 2013-02-07 17493829 17493829.0 NaN PRJNA13758 4 GCA_000001735.2 TAIR10.1 Arabidopsis thaliana NaN NaN NaN Columbia NaN NaN Annotation submitted by The Arabidopsis Inform... 119146348 Chromosome 2018-03-15 11194537 23459830.0 NaN PRJNA10719 ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... 41703 GCA_902369315.1 Lgu Leishmania guyanensis NaN NaN NaN NaN NaN NaN NaN 19624 Chromosome 2019-10-04 19624 19624.0 NaN PRJEB33887 41704 GCA_000194455.1 ASM19445v1 Cryptomonas paramecium NaN CCAP977/2A NaN NaN NaN NaN Annotation submitted by Department of Biochemi... 487066 Chromosome 2011-03-30 160189 160189.0 NaN PRJNA51145 41705 GCF_000194455.1 ASM19445v1 Cryptomonas paramecium NaN CCAP977/2A NaN NaN NaN NaN Annotation submitted by NCBI RefSeq 487066 Chromosome 2011-03-30 160189 160189.0 NaN PRJNA51145 41706 GCA_000286095.1 ASM28609v1 Chroomonas mesostigmatica CCMP1168 NaN CCMP1168 NaN NaN NaN NaN Annotation submitted by Dalhousie University 702852 Chromosome 2012-08-09 232699 232699.0 NaN PRJNA167722 41707 GCA_902369305.1 Lad Leishmania adleri NaN NaN NaN NaN NaN NaN NaN 19219 Chromosome 2019-10-04 19219 19219.0 NaN PRJEB33887 If the Assembly Name is the same between two rows but the Assembly Accession is different, I want to create a new column with the repeated name. For example, the first two rows: 0 GCA_000146045.2 R64 Saccharomyces cerevisiae S288C NaN S288C NaN NaN NaN NaN SGD R64-4-1 12071326 Complete Genome 2011-04-18 924431 924431.0 NaN PRJNA43747 1 GCF_000146045.2 R64 Saccharomyces cerevisiae S288C NaN S288C NaN NaN NaN NaN SGD R64-4-1 12071326 Complete Genome 2014-12-17 924431 924431.0 NaN PRJNA43747 Have the same assembly name but a different Assembly Accession. Thus, the Assembly Accession from the second row is now a new column of the first one: 0 GCA_000146045.2 R64 Saccharomyces cerevisiae S288C NaN S288C NaN NaN NaN NaN SGD R64-4-1 12071326 Complete Genome 2011-04-18 924431 924431.0 NaN PRJNA43747 GCF_000146045.2 And the second row dissappears
bcdb6e91e1d28dc8c74514d61a43ab5d
{ "intermediate": 0.26809757947921753, "beginner": 0.3394460678100586, "expert": 0.39245641231536865 }
46,026
I want to fulfill the custom conditions through client script . can anyone please provide me client script for my requirement . we have catalog called ' XYZ ' We have a field ' FUNCTION' with below values FMCODE FMCP FMGRM FMMENU Other Field - Action: Add Update Delete Total variables 1. Requested For 2. Line Manager 3. Short description 4. Request Type (drop down) 5. Company Code (tick box multi-selection) 6. Function (drop down) 7. Action (drop down) 8. Code Type (free text) 9. Code (free text) 10. Description (free text) 11. Report Description (free text) 12. Execution Date & Time (calendar selection) 13. Business Justification (free text) Custom conditions a) If function is FMGRM, and action is add, then the "code type" and "report description" fields are not there, and an extra free text field called "Value Change" is under the Description field. b) If function is FMMENU, and action is add, then the "code type" and "report description" fields are not there I want to fulfill the custom conditions through client script . NOTE - Here we can use UI Plocy , there some conflicts in the UI pocly , that why i want to achieve this via client script . please provide correct script for this .
1c13971fab7df5f7e464b5563cb99445
{ "intermediate": 0.30452725291252136, "beginner": 0.4492573142051697, "expert": 0.24621541798114777 }
46,027
write me a python script that will create the project folder with all the files in it with their detailed content too , here is the project "I apologize for the confusion in my previous responses. To align with the crewAI framework and provide a more comprehensive example, I will create a new set of files that utilize the crewAI library. Here's a complete set of files that demonstrates how to create and execute a research project using crewAI: 1. `agents_research_project.py`:
db55a91b2ba2513092056cc0d1178211
{ "intermediate": 0.6038302183151245, "beginner": 0.09078694134950638, "expert": 0.30538278818130493 }
46,028
I have a transform map targetting the Application service & a OnAfter script which will map the Application and Business application togather. The script is working fine in creating the relationship, however instead of app service to become a parent, I need Business App to be the parent and child will be app service. Here is the code. Can someone suggest ? [19:02] Bose, Nilanjan (function runTransformScript(source, map, log, target /*undefined onStart*/ ) { var appRel = target.u_application_release_cit_id; var businessAppSysID; var getBusinessApplication = new GlideRecord("cmdb_ci_business_app"); getBusinessApplication.addEncodedQuery("correlation_id=" + appRel); getBusinessApplication.query(); if (getBusinessApplication.next()) { businessAppSysID = getBusinessApplication.sys_id; var cmdbRelGR = new GlideRecord("cmdb_rel_ci"); //cmdbRelGR.addEncodedQuery('parent=' + target.sys_id + '^child=' + businessAppSysID); cmdbRelGR.addEncodedQuery('parent=' + businessAppSysID + '^child=' + target.sys_id); cmdbRelGR.query(); if (!cmdbRelGR.next()) { cmdbRelGR.initialize(); // cmdbRelGR.parent = target.sys_id; // cmdbRelGR.child = businessAppSysID; cmdbRelGR.parent = businessAppSysID; cmdbRelGR.child = target.sys_id; cmdbRelGR.type = "Consumes::Consumed by"; cmdbRelGR.insert(); } } else { ignore = true; } })(source, map, log, target);
1768ff550080059bf684700eecc11dbe
{ "intermediate": 0.47588178515434265, "beginner": 0.32630661129951477, "expert": 0.19781164824962616 }
46,029
import numpy as np import tensorflow as tf import pandas as pd #x = np.arange(0,np.pi*200 ,np.pi/8) #x = np.arange(0,np.pi*200 ,np.pi/8) x_1 = np.arange(1600) y_1 = 2*np.sin(0.1*x_1+2) import numpy as np # Создание последовательности временных шагов и соответствующих значений def create_sequence_data(x, y, n_steps): X, Y = [], [] for i in range(len(x)-n_steps): X.append(y[i:i+n_steps]) Y.append(y[i+n_steps]) return np.array(X), np.array(Y) n_steps = 100 x_train, y_train = create_sequence_data(x_1[:int(len(x)*0.7)], y_1[:int(len(x)*0.7)], n_steps) x_val, y_val = create_sequence_data(x_1[int(len(x)*0.7):], y_1[int(len(x)*0.7):], n_steps) import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import LSTM, Dense, Embedding,SimpleRNN # Создание модели LSTM model = Sequential() model.add(LSTM(50, input_shape=(100,1))) model.add(Dense(1)) model.compile(optimizer='adam', loss='mse') # Обучение модели model.fit(x_train, y_train, epochs=50, batch_size=20, validation_data=(x_val, y_val)) 1321 def _configure_dataset_and_inferred_steps( ValueError: Expected input data to be non-empty.
5dc72f643e5a84da29c6658d0c6db8c3
{ "intermediate": 0.37501609325408936, "beginner": 0.21320603787899017, "expert": 0.4117778539657593 }
46,030
I HAVE AN EXCEL AND SOME CELL ON SHETT Licente with value FREE inside with an x mark , i want when i hit button to color all that cells in green
9886eef9186d6f898690acfe2665baae
{ "intermediate": 0.4265865087509155, "beginner": 0.24687527120113373, "expert": 0.32653817534446716 }
46,031
how to write gtest cases for static functions with extern keywords
5ab3db09656f5d758d1f6fe32c4efb84
{ "intermediate": 0.370462030172348, "beginner": 0.3195887804031372, "expert": 0.30994918942451477 }
46,032
Hi there
96532e56f52217f8b8e7047f98bac155
{ "intermediate": 0.32728445529937744, "beginner": 0.24503648281097412, "expert": 0.42767903208732605 }
46,033
Generate a html code with inline css for restaurant menu template
1143bc6859177aa2a1164e3486daad6b
{ "intermediate": 0.4315406084060669, "beginner": 0.3022977411746979, "expert": 0.26616165041923523 }
46,034
this is data structer. struct datass { float light; float airTemp; float airHumidity; float soilTemp; float soilMoisture; float soilEc; float battery; float battery2; }; change this to another for adding bytes array
d43288c222f52a03612308c1b221146e
{ "intermediate": 0.40395399928092957, "beginner": 0.2565545439720154, "expert": 0.33949145674705505 }
46,035
use hive sql, use insert overwrite to get data into file, but NULL value is set as \N, how to get NULL value as empty string
0d32d09b2e4cdc85c416409c1deda394
{ "intermediate": 0.6324609518051147, "beginner": 0.12186034023761749, "expert": 0.24567870795726776 }
46,036
how to write gtest for the function static int graphics_opengl_fullscreen(struct window *w, int on) { return 1; }
49ed1df27db14c42eaf86df8ca862077
{ "intermediate": 0.38937562704086304, "beginner": 0.40075817704200745, "expert": 0.20986618101596832 }
46,037
hello
c64b4c117354ec62aa953ba9fadfc2ed
{ "intermediate": 0.32064199447631836, "beginner": 0.28176039457321167, "expert": 0.39759764075279236 }
46,038
have some cell on Sheet Licente with value FREE AND PAID ON COLUMN C , I WANT WHEN I SORT CELLS WITH VALUE FREE TO COLOR ALL RAW THAT CONTAIN AN X MARK INSIDE WITH GREEN , AND FOR VALUE PAID WITH YELLOW ,ALL ANOTHER CELLS TO BE WHITE (CELLS WITH NOTHING INSIDE)
6d2bbabbbbcb9f7f2be950194a6eb96a
{ "intermediate": 0.4448302686214447, "beginner": 0.22782312333583832, "expert": 0.3273465633392334 }
46,039
#pixel clustering import PIL.Image as pilimg import numpy as np import matplotlib.pyplot as plt from sklearn.cluster import MeanShift,KMeans from sklearn.mixture import GaussianMixture #read image im=pilimg.open('img.png') im=im.resize((100,100)) x=np.array(im) plt.imshow(x) vec=x.reshape((x.shape[0]*x.shape[1],x.shape[2])) clustering=MeanShift(bandwidth=50).fit(vec) print("Class num:",clustering.labels_.max()) c_vec=vec.copy() rand_color=np.random.rand(clustering.labels_.max()+1,3)*255 for k in range(0,x.shape[0]*x.shape[1]): c_vec[k,:]=rand_color[clustering.labels_[k],:] vis_cluster=c_vec.reshape((x.shape[0],x.shape[1],x.shape[2])) plt.imshow(vis_cluster) 실행해봤는데 오류가 생겼어 Class num: 5 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-16-b39affcf4a56> in <cell line: 17>() 16 rand_color=np.random.rand(clustering.labels_.max()+1,3)*255 17 for k in range(0,x.shape[0]*x.shape[1]): ---> 18 c_vec[k,:]=rand_color[clustering.labels_[k],:] 19 20 vis_cluster=c_vec.reshape((x.shape[0],x.shape[1],x.shape[2])) ValueError: could not broadcast input array from shape (3,) into shape (4,)
ff5d80ee07743e33d68e6c8a27f0b548
{ "intermediate": 0.39523401856422424, "beginner": 0.29857900738716125, "expert": 0.3061869442462921 }
46,040
const userOwnedCards = await strapi.entityService.findMany('api::card-owner-ship.card-owner-ship', { filters: { $and:[ { owner: { id: { $eq: userId, }, }, }, { $not: [ { card:{ cardset: { name: "基础卡牌集" } } }, ] } ] }, populate: ['card','card.skill', 'card.author'], }); 这个strapi cms v4 的查询语句 有办法简化吗?
e724c6a1081bf690e464a19fe1b2fd78
{ "intermediate": 0.34253862500190735, "beginner": 0.4705524742603302, "expert": 0.18690888583660126 }
46,041
아래와 같이 파일이 구성되어 있다면, Regex Renamer를 이용해서 영상에 맞춰서 자막 이름을 일괄적으로 수정할 좋은 방법이 있을까? 그리고 출력에 단일 "\$"가 출력되면 에러가 발생하므로 항상 앞에 "\\"를 붙여서 출력해주기 바란다. Designated.Survivor.S02E01.One.Year.In.1080p.10bit.BluRay.AAC5.1.HEVC-Vyndros.srt Designated.Survivor.S02E01.One.Year.In.1080p.BluRay.REMUX.AVC.DTS-HD.MA.5.1-NOGRP.mkv Designated.Survivor.S02E02.Sting.of.the.Tail.1080p.10bit.BluRay.AAC5.1.HEVC-Vyndros.srt Designated.Survivor.S02E02.Sting.of.the.Tail.1080p.BluRay.REMUX.AVC.DTS-HD.MA.5.1-NOGRP.mkv Designated.Survivor.S02E03.Outbreak.1080p.10bit.BluRay.AAC5.1.HEVC-Vyndros.srt Designated.Survivor.S02E03.Outbreak.1080p.BluRay.REMUX.AVC.DTS-HD.MA.5.1-NOGRP.mkv Designated.Survivor.S02E04.Equilibrium.1080p.10bit.BluRay.AAC5.1.HEVC-Vyndros.srt Designated.Survivor.S02E04.Equilibrium.1080p.BluRay.REMUX.AVC.DTS-HD.MA.5.1-NOGRP.mkv Designated.Survivor.S02E05.Suckers.1080p.10bit.BluRay.AAC5.1.HEVC-Vyndros.srt Designated.Survivor.S02E05.Suckers.1080p.BluRay.REMUX.AVC.DTS-HD.MA.5.1-NOGRP.mkv Designated.Survivor.S02E06.Two.Ships.1080p.10bit.BluRay.AAC5.1.HEVC-Vyndros.srt Designated.Survivor.S02E06.Two.Ships.1080p.BluRay.REMUX.AVC.DTS-HD.MA.5.1-NOGRP.mkv Designated.Survivor.S02E07.Family.Ties.1080p.10bit.BluRay.AAC5.1.HEVC-Vyndros.srt Designated.Survivor.S02E07.Family.Ties.1080p.BluRay.REMUX.AVC.DTS-HD.MA.5.1-NOGRP.mkv Designated.Survivor.S02E08.Home.1080p.10bit.BluRay.AAC5.1.HEVC-Vyndros.srt Designated.Survivor.S02E08.Home.1080p.BluRay.REMUX.AVC.DTS-HD.MA.5.1-NOGRP.mkv Designated.Survivor.S02E09.Three-Letter.Day.1080p.10bit.BluRay.AAC5.1.HEVC-Vyndros.srt Designated.Survivor.S02E09.Three-Letter.Day.1080p.BluRay.REMUX.AVC.DTS-HD.MA.5.1-NOGRP.mkv Designated.Survivor.S02E10.Line.of.Fire.1080p.10bit.BluRay.AAC5.1.HEVC-Vyndros.srt Designated.Survivor.S02E10.Line.of.Fire.1080p.BluRay.REMUX.AVC.DTS-HD.MA.5.1-NOGRP.mkv Designated.Survivor.S02E11.Grief.1080p.10bit.BluRay.AAC5.1.HEVC-Vyndros.srt Designated.Survivor.S02E11.Grief.1080p.BluRay.REMUX.AVC.DTS-HD.MA.5.1-NOGRP.mkv
225a49e4fa4081a06e6c9a8331e8b70f
{ "intermediate": 0.309941828250885, "beginner": 0.4332599937915802, "expert": 0.2567981779575348 }
46,042
`__H_H__` `__\_/__` `___C___` `__/_\__` `H-C-C-H` `_/___\_` `_H___H_`
5533f7f7cf4a4bd4e997b74077edaf74
{ "intermediate": 0.3420589864253998, "beginner": 0.2695470154285431, "expert": 0.38839399814605713 }
46,043
`Give monospace text for propane formula`
c8c108a870c5f519223896c7c46ba850
{ "intermediate": 0.397662490606308, "beginner": 0.24873389303684235, "expert": 0.35360366106033325 }
46,044
`Give monospace text for propane formula`
64f8c83346dad273aef0334b0dd27abf
{ "intermediate": 0.397662490606308, "beginner": 0.24873389303684235, "expert": 0.35360366106033325 }
46,045
I have this code. const currentFilter = selectedFilters[selectedFilter]; currentFilter.forEach(option => { copy[option.id] = option; }); I get ts error : Property 'forEach' does not exist on type 'string | IAbstractObject[]'. Property 'forEach' does not exist on type 'string'. How do I treat currentFilter as IAbstractObject[]' only in this code?
4d142ae203eb1b7a1c04c20142ec7317
{ "intermediate": 0.6518656611442566, "beginner": 0.20701251924037933, "expert": 0.14112181961536407 }
46,046
`Give monospace formatted picture for propane formula`
2c16d318f38e7b4bff5c1cbcf09f3ab9
{ "intermediate": 0.37682050466537476, "beginner": 0.24582351744174957, "expert": 0.37735605239868164 }
46,047
docker run -d --restart unless-stopped --privileged=true -p 8090:80 --name sub-web-modify youshandefeiyang/sub-web-modify 把这个转换成Dockerfile
de53aecd5c0a27ea0bd39f30d2a02b52
{ "intermediate": 0.3726678490638733, "beginner": 0.28241777420043945, "expert": 0.34491434693336487 }
46,048
write an vba code for this situatuation: i have an sheet named Licente with value DA or NU on B column and i want cell colour with DA to be green , and with NO to be red, also all cells from all raw that contain an x mark inside coresponding to value DA OR NU same colour , if it contain nothing must be white
0f997ad9794d28362cbc73f2ed831dfc
{ "intermediate": 0.5806570053100586, "beginner": 0.15602469444274902, "expert": 0.26331827044487 }
46,049
`__H_H_H__` `__|_|_|__` `H-C-C-C-H` `__|_|_|__` `__H_H_H__`
71e283fdc3b92f7bc5011f671ce95708
{ "intermediate": 0.33411282300949097, "beginner": 0.2953665256500244, "expert": 0.370520681142807 }
46,050
self.popupAboutToBeShown.emit() what does this emit mean
383c64b71c909790fef8476e7817efd2
{ "intermediate": 0.36416563391685486, "beginner": 0.3744826316833496, "expert": 0.26135170459747314 }
46,051
class Forward_Projection: def __init__(self, anatomy='o', input_file_name=''): self.anatomy = anatomy.lower() self.input_filename = input_file_name #self.out_filename = output_file_name if self.anatomy == 'o': self.FOV = 400 elif self.anatomy == 'h': self.FOV = 220.16 sid = 550. sdd = 950. self.nrdetcols = 900 self.nrcols = 512 self.nrrows = 512 self.pixsize = self.FOV/512 self.nrviews = 1000 self.x0 = 0.0/self.pixsize self.y0 = sid/self.pixsize self.xCor = 0.0/self.pixsize self.yCor = 0.0/self.pixsize dalpha = 2.*np.arctan2(1.0/2, sdd) alphas = (np.arange(self.nrdetcols)-(self.nrdetcols-1)/2-1.25)*dalpha self.xds = np.single(sdd*np.sin(alphas)/self.pixsize) self.yds = np.single((sid - sdd*np.cos(alphas))/self.pixsize) self.viewangles = np.single(1*(0+np.arange(self.nrviews)/(self.nrviews-1)*2*np.pi)) raw_img = rawread(self.input_filename, [512, 512, 1], 'float') raw_img = raw_img/1000.*0.02+0.02 self.originalImgPtr = np.single(raw_img) self.sinogram = np.zeros([self.nrviews, self.nrdetcols, 1], dtype=np.single) def DD2FanProj(self): clib = load_C_lib() func = clib.DD2FanProj func.argtypes = [c_int, c_float, c_float, ndpointer(c_float), ndpointer(c_float), c_float, c_float, ndpointer(c_float), c_int, ndpointer(c_float), c_int, c_int, ndpointer(c_float)] func.restype = None func(self.nrdetcols, self.x0, self.y0, self.xds, self.yds, self.xCor, self.yCor, self.viewangles, self.nrviews, self.sinogram, self.nrcols, self.nrrows, self.originalImgPtr) return self.sinogram * self.pixsize def get_FP_sino(self): sinogram = self.DD2FanProj() rawwrite(os.path.splitext(self.input_filename)[0]+"_DD2FanProj_900x1000.raw", sinogram) 如何调用该类中 get_Fp_sino这个函数
7bac49c08c4cb7f7d9151a7a09990286
{ "intermediate": 0.34380170702934265, "beginner": 0.4502538740634918, "expert": 0.20594444870948792 }
46,052
I have connect NI GPIB plug how do I connect via ni visa
3256a02d330c9552e46143a725f8b214
{ "intermediate": 0.4729539155960083, "beginner": 0.19237326085567474, "expert": 0.33467286825180054 }
46,053
I want to store file names of a folder in list but it should be sorted with alphabetical order : my code query_file_list=[] query_file_list=os.listdir(query_file_path)
5b2dc7a29bebc1b714cd7560e7624071
{ "intermediate": 0.3362715542316437, "beginner": 0.28392958641052246, "expert": 0.37979885935783386 }
46,054
This is my code: const copy = currentFilter ?? {}; if (!isEmpty(copy)) { copy.forEach((option) => { //если key не соответствует id, то скопировать правильно а оригинал удалить по key copy[option.id] = option; }); } I have a prolblem that when I create copy[option.id] = option there is still remains option with the same properties but wrong key, how do I delete the original with the wrong key after I assign a proper key to it with copy[option.id] = option?
5055756ad863b8d676c3b7e7bdcf7fb3
{ "intermediate": 0.47916603088378906, "beginner": 0.355596661567688, "expert": 0.16523732244968414 }
46,055
I have an array of objects in react. How do I convert it into an object of objects?
9b97e21c3e3b4ebbd67d56c14b5663d1
{ "intermediate": 0.5907021164894104, "beginner": 0.16065146028995514, "expert": 0.24864642322063446 }
46,056
please be a senior sapui5 developer and answer my following questions with working code examples.
d12a779487a9e86123e65384f3cc24cc
{ "intermediate": 0.41582927107810974, "beginner": 0.27387818694114685, "expert": 0.31029248237609863 }
46,057
Generate a html code with inline css for restaurant manu template
fa3f03076d15ed990e62cfdc440eaffe
{ "intermediate": 0.4364756941795349, "beginner": 0.28965631127357483, "expert": 0.27386799454689026 }
46,058
Generate a html code with inline css for restaurant manu template
9830faf9f5db87d171d79e25dc6094eb
{ "intermediate": 0.4364756941795349, "beginner": 0.28965631127357483, "expert": 0.27386799454689026 }
46,059
Vorrei implementare e adattare il "CODICE 2" al "CODICE 1". [CODICE 2] ''' # Get Content B-LoRA SD #content_B_LoRA_sd, _ = pipeline.lora_state_dict(args.content_B_LoRA) #content_B_LoRA = filter_lora(content_B_LoRA_sd, BLOCKS['content']) #content_B_LoRA = scale_lora(content_B_LoRA, args.content_alpha) content_B_LoRA = {} # Get Style B-LoRA SD style_B_LoRA_sd, _ = pipeline.lora_state_dict('/kaggle/working/Output/pytorch_lora_weights.safetensors') style_B_LoRA = filter_lora(style_B_LoRA_sd, BLOCKS['style']) style_B_LoRA = scale_lora(style_B_LoRA, 1.0) #style_B_LoRA = {} # Merge B-LoRAs SD res_lora = {**content_B_LoRA, **style_B_LoRA} # Load pipeline.load_lora_into_unet(res_lora, None, pipeline.unet) ''' [CODICE 1] ''' class LoraLoader: def __init__(self): self.loaded_lora = None @classmethod def INPUT_TYPES(s): return {"required": { "model": ("MODEL",), "clip": ("CLIP", ), "lora_name": (folder_paths.get_filename_list("loras"), ), "strength_model": ("FLOAT", {"default": 1.0, "min": -20.0, "max": 20.0, "step": 0.01}), "strength_clip": ("FLOAT", {"default": 1.0, "min": -20.0, "max": 20.0, "step": 0.01}), }} RETURN_TYPES = ("MODEL", "CLIP") FUNCTION = "load_lora" CATEGORY = "loaders" def load_lora(self, model, clip, lora_name, strength_model, strength_clip): if strength_model == 0 and strength_clip == 0: return (model, clip) lora_path = folder_paths.get_full_path("loras", lora_name) lora = None if self.loaded_lora is not None: if self.loaded_lora[0] == lora_path: lora = self.loaded_lora[1] else: temp = self.loaded_lora self.loaded_lora = None del temp if lora is None: lora = comfy.utils.load_torch_file(lora_path, safe_load=True) self.loaded_lora = (lora_path, lora) model_lora, clip_lora = comfy.sd.load_lora_for_models(model, clip, lora, strength_model, strength_clip) return (model_lora, clip_lora) '''
d932e5133626b79dfcc09f7955781d23
{ "intermediate": 0.35526978969573975, "beginner": 0.4783758223056793, "expert": 0.16635438799858093 }
46,060
Hi, please be a senior sapui5 developer and answer my following questions with working code examples.
cbe4c2edfe2695ceb9eea8fc79850cea
{ "intermediate": 0.40552452206611633, "beginner": 0.2735392153263092, "expert": 0.3209362328052521 }
46,061
解释以下代码import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms print("PyTorch Version: ", torch.__version__) class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(1, 20, 5, 1) # 28 * 28 -> (28+1-5) 24 * 24 self.conv2 = nn.Conv2d(20, 50, 5, 1) # 20 * 20 self.fc1 = nn.Linear(4 * 4 * 50, 500) self.fc2 = nn.Linear(500, 10) def forward(self, x): # x: 1 * 28 * 28 x = F.relu(self.conv1(x)) # 20 * 24 * 24 x = F.max_pool2d(x, 2, 2) # 12 * 12 x = F.relu(self.conv2(x)) # 8 * 8 x = F.max_pool2d(x, 2, 2) # 4 *4 x = x.view(-1, 4 * 4 * 50) # reshape (5 * 2 * 10), view(5, 20) -> (5 * 20) x = F.relu(self.fc1(x)) x = self.fc2(x) # return x return F.log_softmax(x, dim=1) # log probability mnist_data = datasets.MNIST("./mnist_data", train=True, download=True, transform=transforms.Compose([ transforms.ToTensor(), ])) data = [d[0].data.cpu().numpy() for d in mnist_data] # np.mean(data) #np.std(data) #mnist_data[223][0].shape def train(model, device, train_loader, optimizer, epoch): model.train() for idx, (data, target) in enumerate(train_loader): data, target = data.to(device), target.to(device) pred = model(data) # batch_size * 10 loss = F.nll_loss(pred, target) # SGD optimizer.zero_grad() loss.backward() optimizer.step() if idx % 100 == 0: print("Train Epoch: {}, iteration: {}, Loss: {}".format( epoch, idx, loss.item())) def test(model, device, test_loader): model.eval() total_loss = 0. correct = 0. with torch.no_grad(): for idx, (data, target) in enumerate(test_loader): data, target = data.to(device), target.to(device) output = model(data) # batch_size * 10 total_loss += F.nll_loss(output, target, reduction="sum").item() pred = output.argmax(dim=1) # batch_size * 1 correct += pred.eq(target.view_as(pred)).sum().item() total_loss /= len(test_loader.dataset) acc = correct / len(test_loader.dataset) * 100. print("Test loss: {}, Accuracy: {}".format(total_loss, acc)) device = torch.device("cuda" if torch.cuda.is_available() else "cpu") batch_size = 32 train_dataloader = torch.utils.data.DataLoader( datasets.MNIST("./mnist_data", train=True, download=True, transform=transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.1307,), (0.3081,)) # np.mean(data)=0.1307 #np.std(data)=0.3081 ])), batch_size=batch_size, shuffle=True, num_workers=1, pin_memory=True ) test_dataloader = torch.utils.data.DataLoader( datasets.MNIST("./mnist_data", train=False, download=True, transform=transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.1307,), (0.3081,)) ])), batch_size=batch_size, shuffle=True, num_workers=1, pin_memory=True ) def main(): lr = 0.01 momentum = 0.5 model = Net().to(device) optimizer = torch.optim.SGD(model.parameters(), lr=lr, momentum=momentum) num_epochs = 2 for epoch in range(num_epochs): train(model, device, train_dataloader, optimizer, epoch) test(model, device, test_dataloader) torch.save(model.state_dict(), "mnist_cnn.pt") if __name__ == '__main__': main()
0557599d48d6615a10446e0efcf330f9
{ "intermediate": 0.32999980449676514, "beginner": 0.39054080843925476, "expert": 0.2794594168663025 }
46,062
The string contains a list of the form "1) Element 1.1) Element 1.2) Element 2) Element ...". The content of the list, the number of elements and the number of nesting levels can be arbitrary. Write a function to add "-" elements for missing list indexes in the functional language you see it will be the most reduced code
ad7213734fc05165fbb36f13a01b5670
{ "intermediate": 0.387649267911911, "beginner": 0.31598392128944397, "expert": 0.29636678099632263 }
46,063
The string contains a list of the form "1) Element 1.1) Element 1.2) Element 2) Element ...". The content of the list, the number of elements and the number of nesting levels can be arbitrary. Write a function to add "-" elements for missing list indexes in clojure in a way that is the most reduced code possible
ac78fe3a7747fe499674346c004f5be6
{ "intermediate": 0.4611526131629944, "beginner": 0.32220110297203064, "expert": 0.21664626896381378 }
46,064
I receive access to Founders Hub program by Microsoft. It says I can access free GPT-4 from Azure. How do .I access it?
bc426acff971b3024ed3dbfddbc75771
{ "intermediate": 0.4347851276397705, "beginner": 0.150857612490654, "expert": 0.4143572747707367 }
46,065
I have an array filled with objects. Each objects have properties id and name. An array looks like this [{id:1, name: 'one'}, {id:2, name: 'two'}] How do I write a function that will filter those objects from an array which id is not equal to their index?
642037e08e75ee6b0f551f77f30fa52a
{ "intermediate": 0.48693710565567017, "beginner": 0.2355446219444275, "expert": 0.27751827239990234 }
46,066
write a program in clojure so it can be used in unity c#
1343a16c28109070503cccbcf1c84f7a
{ "intermediate": 0.6515966653823853, "beginner": 0.21519555151462555, "expert": 0.1332077533006668 }
46,067
I have this function: function solution(A: number[]): number { const B = A.sort(); const C = A.filter(function(c) { return c >= 0; }) let returnValue = 1; for (let d = 0; d++; d < C.length) { if (C[d] + 1 !== C[d + 1]) { returnValue = C[d] + 1; break; } } return returnValue; } and this task: Write a function: function solution(A: number[]): number; that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A. For example, given A = [1, 3, 6, 4, 1, 2], the function should return 5. Given A = [1, 2, 3], the function should return 4. Given A = [−1, −3], the function should return 1. Write an efficient algorithm for the following assumptions: N is an integer within the range [1..100,000]; each element of array A is an integer within the range [−1,000,000..1,000,000]. It is not working. Please fix it and tell me what I did wrong.
3d7fe5e6e6d06510d0105153cded0749
{ "intermediate": 0.259032279253006, "beginner": 0.3345005214214325, "expert": 0.40646716952323914 }
46,068
Emphasisi on the lorem ipsum that payment allows membership where a user gets access to both ged and hiset prep courses: <div class="col-md-12 heading-bx text-center"> <h2 class="title-head text-uppercase m-b0">GED & HiSET PRICING <br /> <span> unlock your potential</span></h2> <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's.</p> </div>
e0496e13382b100bf4dce34fdf205e61
{ "intermediate": 0.33572065830230713, "beginner": 0.24758566915988922, "expert": 0.41669371724128723 }
46,069
привет у меня есть вот такой скрипт на unity который из pdf делает картинки но делает это очень долго, как мне сделать так чтобы это было быстрее ? public class PdfFilesUI : MonoBehaviour { private const string PathName = "/StreamingAssets/PDF/Training"; private const string FileExtension = "*.pdf"; private const string PathConverter = "/../Converter/pdf2img.exe"; private const string PathImage = " pageRight.png "; private const string PathImageFull = "/../pageRight.png"; [SerializeField] private Transform _contentButton; [SerializeField] private Transform _contentImage; [SerializeField] private PDFbutton _buttonPrefab; [SerializeField] private Image _imagePrefab; [SerializeField] private ScrollRect _scrollRect; private string pdfConverterPath; private Dictionary<Button, Image[]> buttonToImagesMapping = new Dictionary<Button, Image[]>(); private List<Image[]> allImageGroups = new List<Image[]>(); public void Initialize() { pdfConverterPath = Application.dataPath + PathConverter; FindPdfFiles(); } private void FindPdfFiles() { var folderPath = Application.dataPath + PathName; var pdfFiles = Directory.GetFiles(folderPath, FileExtension, SearchOption.AllDirectories); foreach (string file in pdfFiles) { var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); var button = Instantiate(_buttonPrefab, _contentButton); button.Initialized(fileNameWithoutExtension, file); var pageCount = 0; using (PdfReader reader = new PdfReader(file)) { pageCount = reader.NumberOfPages; } var imageGroup = new Image[pageCount]; for (int pageNumber = 0; pageNumber < pageCount; pageNumber++) { CallExternalProcess(pdfConverterPath, file + PathImage + (pageNumber).ToString()); var image = ApplyTextureToUI(Application.dataPath + PathImageFull); imageGroup[pageNumber] = image; } allImageGroups.Add(imageGroup); button.Button.onClick.AddListener(() => AllImagesOn(imageGroup)); buttonToImagesMapping[button.Button] = imageGroup; } AllImagesOff(); } public void AllImagesOff() { foreach (Image[] images in allImageGroups) { foreach (var image in images) { image.gameObject.Deactive(); } } } public void AllImagesOn(Image[] imageGroup) { AllImagesOff(); foreach (Image image in imageGroup) { image.gameObject.Active(); } _scrollRect.verticalNormalizedPosition = 1; } public Texture2D LoadPNG(string filePath) { Texture2D texture = null; if (File.Exists(filePath)) { var fileData = File.ReadAllBytes(filePath); texture = new Texture2D(2, 2); texture.LoadImage(fileData); } return texture; } public Image ApplyTextureToUI(string filePath) { var texture = LoadPNG(filePath); if (texture != null) { var sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100.0f); var image = Instantiate(_imagePrefab, _contentImage); image.sprite = sprite; return image; } return null; } public void CallExternalProcess(string processPath, string arguments) { var myProcess = new Process(); myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; myProcess.StartInfo.CreateNoWindow = true; myProcess.StartInfo.UseShellExecute = false; myProcess.StartInfo.FileName = processPath; myProcess.StartInfo.Arguments = arguments; myProcess.EnableRaisingEvents = true; try { myProcess.Start(); } catch (InvalidOperationException ex) { UnityEngine.Debug.LogError(ex); } myProcess.WaitForExit(); var ExitCode = myProcess.ExitCode; } }
0f17e905d72030fb2021e5ce16d8c167
{ "intermediate": 0.3558257222175598, "beginner": 0.5314842462539673, "expert": 0.11269006133079529 }
46,070
Can you do this in TypeScript: Write a function: function solution(A: number[]): number; that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A. For example, given A = [1, 3, 6, 4, 1, 2], the function should return 5. Given A = [1, 2, 3], the function should return 4. Given A = [−1, −3], the function should return 1. Write an efficient algorithm for the following assumptions: N is an integer within the range [1..100,000]; each element of array A is an integer within the range [−1,000,000..1,000,000].
d8321daa1c86005152d1971211693ad6
{ "intermediate": 0.21487818658351898, "beginner": 0.22061580419540405, "expert": 0.5645059943199158 }
46,071
i have a website and on the membership page i have pricing plans. I am offering prep courses for ged and hiset which have study guides and quizzes. How do i modify my pricing plans appropriately(prices and durations are correct): <div class="col-sm-12 col-md-4 col-lg-4 m-b40"> <div class="pricingtable-wrapper"> <div class="pricingtable-inner"> <div class="pricingtable-main"> <div class="pricingtable-price"> <span class="priceing-doller">$</span> <span class="pricingtable-bx">30</span> <span class="pricingtable-type">Monthly</span> </div> <div class="pricingtable-title"> <h2>Starter</h2> <p>We are just getting started</p> </div> </div> <ul class="pricingtable-features"> <li>One Time Fee</li> <li>3 User</li> <li>Lifetime Availability</li> <li>Non Featured</li> <li>30 days Listing</li> <li>24/7 Support</li> <li>Select</li> </ul> <div class="pricingtable-footer"> <a href="#" class="btn radius-xl">Get It Now</a> </div> </div> </div> </div> <div class="col-sm-12 col-md-4 col-lg-4 m-b40"> <div class="pricingtable-wrapper"> <div class="pricingtable-inner pricingtable-highlight"> <div class="pricingtable-main"> <div class="pricingtable-price"> <span class="priceing-doller">$</span> <span class="pricingtable-bx">75</span> <span class="pricingtable-type">3 Month</span> </div> <div class="pricingtable-title"> <h2>Advanced</h2> <p>The most popular plan</p> </div> </div> <ul class="pricingtable-features"> <li>One Time Fee</li> <li>3 User</li> <li>Lifetime Availability</li> <li>Non Featured</li> <li>30 days Listing</li> <li>24/7 Support</li> <li>Select</li> </ul> <div class="pricingtable-footer"> <a href="#" class="btn radius-xl">Get It Now</a> </div> </div> </div> </div> <div class="col-sm-12 col-md-4 col-lg-4 m-b40"> <div class="pricingtable-wrapper"> <div class="pricingtable-inner"> <div class="pricingtable-main"> <div class="pricingtable-price"> <span class="priceing-doller">$</span> <span class="pricingtable-bx">140</span> <span class="pricingtable-type">6 Month</span> </div> <div class="pricingtable-title"> <h2>Comprehensive</h2> <p>Experience the best for e-learning</p> </div> </div> <ul class="pricingtable-features"> <li>One Time Fee</li> <li>3 User</li> <li>Lifetime Availability</li> <li>Non Featured</li> <li>30 days Listing</li> <li>24/7 Support</li> <li>Select</li> </ul> <div class="pricingtable-footer"> <a href="#" class="btn radius-xl">Get It Now</a> </div> </div> </div> </div>
fa2abe7859ebb7d0745d66b9a40992ca
{ "intermediate": 0.3795575797557831, "beginner": 0.37676477432250977, "expert": 0.24367764592170715 }
46,072
| Benchmark | Mistral Large | Gemini 1.5 Pro | Notes | | ------------------------- |:-------------:|:--------------:|-------| | **Reasoning & Knowledge** | | | | | MMLU | 81.2% | 81.9% | Gemini slightly higher but both are close. | | HellaSwag | 89.2% | 92.5% | Gemini significantly higher. | | WinoGrande | 86.7% | - | Not reported for Gemini. | | Arc Challenge (5-shot) | 94.2% | - | Not reported for Gemini. | | Arc Challenge (25-shot) | 94.0% | - | Not reported for Gemini. | | TriviaQA | 82.7% | - | Not reported for Gemini. | | TruthfulQA | 50.5% | - | Not reported for Gemini. | | **Multilingual** | | | | | MMLU (French, German, Spanish, Italian) | 78.9% | - | Not directly comparable; Mistral reports average across languages while Gemini focuses on Kalamang translation. | | **Math & Coding** | | | | | HumanEval | 45.1% | 71.9% | Gemini significantly higher; leakage concerns exist for HumanEval. | | MBPP | 73.1% | - | Not reported for Gemini. | | Math maj@4 | 45.0% | - | Not directly comparable; Gemini uses different math benchmarks (e.g., GSM8k, MATH). | | GSM8k maj@8 (8-shot) | 91.21% | 91.7% | Both achieve high accuracy on grade-school math. | | GSM8k maj@1 (5-shot) | 81.0% | - | Not reported for Gemini with this specific shot configuration. | | **Long-context** | | | | | Text Haystack | - | >99% recall up to 10M tokens | Gemini demonstrates significantly longer context capabilities. | | Video Haystack | - | >99% recall up to 3 hours | Gemini demonstrates significantly longer context capabilities in video. | | Audio Haystack | - | >99% recall up to 22 hours | Gemini demonstrates significantly longer context capabilities in audio. | | Long Document QA | - | 80.0% (AIS) | Gemini demonstrates strong performance on long document question answering. | | 1H-VideoQA | - | 64.3% | Gemini demonstrates strong performance on long video question answering. | --------- create a table out of the above data
ae3c36aa0f7c4d152b395b45b4c13e5c
{ "intermediate": 0.4139220714569092, "beginner": 0.390950083732605, "expert": 0.19512785971164703 }
46,073
Solve this in Java 11: An array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is moved to the first place. For example, the rotation of array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7] (elements are shifted right by one index and 6 is moved to the first place). The goal is to rotate array A K times; that is, each element of A will be shifted to the right K times. Write a function: class Solution { public int[] solution(int[] A, int K); } that, given an array A consisting of N integers and an integer K, returns the array A rotated K times. For example, given A = [3, 8, 9, 7, 6] K = 3 the function should return [9, 7, 6, 3, 8]. Three rotations were made: [3, 8, 9, 7, 6] -> [6, 3, 8, 9, 7] [6, 3, 8, 9, 7] -> [7, 6, 3, 8, 9] [7, 6, 3, 8, 9] -> [9, 7, 6, 3, 8] For another example, given A = [0, 0, 0] K = 1 the function should return [0, 0, 0] Given A = [1, 2, 3, 4] K = 4 the function should return [1, 2, 3, 4] Assume that: N and K are integers within the range [0..100]; each element of array A is an integer within the range [−1,000..1,000]. In your solution, focus on correctness. The performance of your solution will not be the focus of the assessment.
047c54ce76f55d819bda9920ecdc9dd3
{ "intermediate": 0.2548827528953552, "beginner": 0.46147605776786804, "expert": 0.2836412191390991 }
46,074
Solve in Java 11: A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contains two binary gaps: one of length 4 and one of length 3. The number 20 has binary representation 10100 and contains one binary gap of length 1. The number 15 has binary representation 1111 and has no binary gaps. The number 32 has binary representation 100000 and has no binary gaps. Write a function: class Solution { public int solution(int N); } that, given a positive integer N, returns the length of its longest binary gap. The function should return 0 if N doesn't contain a binary gap. For example, given N = 1041 the function should return 5, because N has binary representation 10000010001 and so its longest binary gap is of length 5. Given N = 32 the function should return 0, because N has binary representation '100000' and thus no binary gaps. Write an efficient algorithm for the following assumptions: N is an integer within the range [1..2,147,483,647].
df474ec081f473e2dd8cc9e5954b7ce6
{ "intermediate": 0.239783376455307, "beginner": 0.2283748984336853, "expert": 0.5318416953086853 }
46,075
Make a CSS file for the following which I made. Put it in a code block: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Progresswire Coo</title> <link rel="stylesheet" href="style.css"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="This is Progresswire Coo! It is a site by the creators behind Progresswire Coo."> </head> <body> <header> <img src="progresswirecoo.png" alt="Progresswire Coo Logo"> </header> <h1>The Progresswire Coo homepage</h1> <p>Hello! This is the Progresswire Coo home page thing.</p> <ul> <li><a href="news.html">News</a><br><small>See the old page <a href="old.html">here</a>. This is WIP.</small></li> <li><a href="terminal.html">Terminal</a><br><small>Incomplete</small></li> <li><a href="#">Text Edition</a><br><small><a href="textedition.png">What does it look like?</a></small></li> <li><a href="https://linktr.ee/i4kthetf1thingy">Download Progresswire Coo 1 (Linktree)</a><br><small>The project that started it all.</small></li> <li><a href="ProgresswireCoo.wav">Download the Progresswire Coo music</a><br><small>If you want to listen to the Progresswire Coo music, click here.</small></li> </ul> </body> </html>
4c77d9962c7c8c74b4576ac8f689a8ec
{ "intermediate": 0.3663105368614197, "beginner": 0.31819623708724976, "expert": 0.31549322605133057 }
46,076
Write the solution in Java 11: A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the same value, except for one element that is left unpaired. For example, in array A such that: A[0] = 9 A[1] = 3 A[2] = 9 A[3] = 3 A[4] = 9 A[5] = 7 A[6] = 9 the elements at indexes 0 and 2 have value 9, the elements at indexes 1 and 3 have value 3, the elements at indexes 4 and 6 have value 9, the element at index 5 has value 7 and is unpaired. Write a function: class Solution { public int solution(int[] A); } that, given an array A consisting of N integers fulfilling the above conditions, returns the value of the unpaired element. For example, given array A such that: A[0] = 9 A[1] = 3 A[2] = 9 A[3] = 3 A[4] = 9 A[5] = 7 A[6] = 9 the function should return 7, as explained in the example above. Write an efficient algorithm for the following assumptions: N is an odd integer within the range [1..1,000,000]; each element of array A is an integer within the range [1..1,000,000,000]; all but one of the values in A occur an even number of times.
ea336ff6fb6de3be7e116ddc2bc658c5
{ "intermediate": 0.2124539017677307, "beginner": 0.2335469126701355, "expert": 0.5539991855621338 }
46,077
How exactly can you send a sfm model you imported and edited, back into sfm?
5b1617482bcd609fa6e620e2f27d3cf9
{ "intermediate": 0.43830281496047974, "beginner": 0.14491261541843414, "expert": 0.4167846441268921 }
46,078
Hola, me ayuda con un examn de New relic?
93fa52642bd83e06b6d21551f1619ea9
{ "intermediate": 0.3382642865180969, "beginner": 0.3095795810222626, "expert": 0.3521561026573181 }
46,079
how to restart a failed nomad allocation?
d327f45ae4be7c94674d739cf74f1acd
{ "intermediate": 0.35688865184783936, "beginner": 0.20126557350158691, "expert": 0.4418458044528961 }
46,080
### Final Output market_model_results will contain the regression coefficients ((\alpha) and (\beta)) for each ISIN. These coefficients represent the expected response of each stock’s returns to the market returns. The intercept (\alpha) could interpret as the stock’s performance independent of the market, and the slope (\beta) as its sensitivity to the market. ### Calculating Expected Returns With the (\alpha) and (\beta) coefficients, you can now calculate the expected returns for each stock on each day based on the BSE market returns: # Assume we know alpha and beta for a stock already, here’s a conceptual example: # alpha <- 0.01 # Example value # beta <- 1.5 # Example value # Example for calculating expected return for a given stock on a new day: # R_it_expected = alpha + beta * R_mt # For applying it to the entire dataset, you would essentially merge your alpha and beta coefficients back onto your dataset, then calculate: merged_data <- merged_data %>% left_join(market_model_results, by = “ISIN”) %>% mutate(Expected_Return = Intercept + BSE_Return * beta) Remember to replace Intercept and beta with the actual column names that hold these values in market_model_results after tidy(). This guides you through calculating expected returns using the market model for your dataset in R. From here, you can proceed to calculate AR (Actual Return - Expected Return) and then CAR for relevant event windows around your events of interest.
94a421e3f26e71f3af353d8fc3e7d20f
{ "intermediate": 0.32596269249916077, "beginner": 0.28159719705581665, "expert": 0.3924401104450226 }
46,081
I have checked all the steps, but seems that the relationship is creating, but I could see that there are both kind of relationships getting created...business App - Parent ; Application Service - Child but the reverse is also getting created. I am not sure what is wrong ? (function runTransformScript(source, map, log, target /*undefined onStart*/ ) { var appRel = target.u_application_release_cit_id; var businessAppSysID; var getBusinessApplication = new GlideRecord("cmdb_ci_business_app"); getBusinessApplication.addEncodedQuery("correlation_id=" + appRel); getBusinessApplication.query(); if (getBusinessApplication.next()) { businessAppSysID = getBusinessApplication.sys_id; var cmdbRelGR = new GlideRecord("cmdb_rel_ci"); cmdbRelGR.addQuery('child', target.sys_id); cmdbRelGR.addQuery('parent', businessAppSysID); cmdbRelGR.addQuery('type', '41008aa6ef32010098d5925495c0fb94'); //Sys ID of "Consumes::Consumed by" cmdbRelGR.query(); if (cmdbRelGR.next()) //do nothing else { cmdbRelGR.initialize(); cmdbRelGR.parent = (function runTransformScript(source, map, log, target /*undefined onStart*/ ) { var appRel = target.u_application_release_cit_id; var businessAppSysID; var getBusinessApplication = new GlideRecord("cmdb_ci_business_app"); getBusinessApplication.addEncodedQuery("correlation_id=" + appRel); getBusinessApplication.query(); if (getBusinessApplication.next()) { businessAppSysID = getBusinessApplication.sys_id; var cmdbRelGR = new GlideRecord("cmdb_rel_ci"); cmdbRelGR.addQuery('parent', target.sys_id); cmdbRelGR.addQuery('child', businessAppSysID); cmdbRelGR.addQuery('type', '41008aa6ef32010098d5925495c0fb94'); //Sys ID of "Consumes::Consumed by" cmdbRelGR.query(); if (cmdbRelGR.next()) //do nothing else { cmdbRelGR.initialize(); cmdbRelGR.parent = businessAppSysID; cmdbRelGR.child = target.sys_id; cmdbRelGR.type = '41008aa6ef32010098d5925495c0fb94'; cmdbRelGR.insert(); } } } })(source, map, log, target);
4982d261f8fc9f812157f82a9c710955
{ "intermediate": 0.36943039298057556, "beginner": 0.3477250337600708, "expert": 0.28284457325935364 }