row_id
int64
0
48.4k
init_message
stringlengths
1
342k
conversation_hash
stringlengths
32
32
scores
dict
19,493
my wechat id is gg123, how to use URL to allow the user to add my wechat?
f3beb1ccc006ee324f4539708ba10656
{ "intermediate": 0.445881187915802, "beginner": 0.2898736596107483, "expert": 0.26424506306648254 }
19,494
hi
5264519ee49649364b2fb684402a9dfd
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
19,495
CustomerID Name Age Gender Location Subscription_Length_Months Monthly_Bill Total_Usage_GB Churn 1.0 Customer_1 63.0 Male Los Angeles 17.0 73.36 236.0 0.0 2.0 Customer_2 62.0 Female New York 1.0 48.76 172.0 0.0 3.0 Customer_3 24.0 Female Los Angeles 5.0 85.47 460.0 0.0 4.0 Customer_4 36.0 Female Miami 3.0 97.94 297.0 1.0 5.0 Customer_5 46.0 Female Miami 19.0 58.14 266.0 0.0 6.0 Customer_6 67.0 Male New York 15.0 82.65 456.0 1.0 7.0 Customer_7 30.0 Female Chicago 3.0 73.79 269.0 0.0 8.0 Customer_8 67.0 Female Miami 1.0 97.70 396.0 1.0 9.0 Customer_9 20.0 Female Miami 10.0 42.45 150.0 1.0 10.0 Customer_10 53.0 Female Los Angeles 12.0 64.49 383.0 1.0
2a0936044d134bde6f5976ead8a290aa
{ "intermediate": 0.3537132740020752, "beginner": 0.3339827060699463, "expert": 0.31230399012565613 }
19,496
I want to make a nft project of generative art onchain. Can you write me a processing script for the nfts
0f448a467b9e9d33b6cc857200d30d9d
{ "intermediate": 0.4353448450565338, "beginner": 0.16460677981376648, "expert": 0.4000483453273773 }
19,497
Is there a command that can be used in Debian to determine the license of software being used?
69eeecf9b1155d1bb8827032ba685081
{ "intermediate": 0.36545130610466003, "beginner": 0.27525442838668823, "expert": 0.35929426550865173 }
19,498
Unknown column 'skuver' in 'field list'
03f9bd1e7c06c3fa98818de628d5888a
{ "intermediate": 0.32850292325019836, "beginner": 0.25185126066207886, "expert": 0.41964584589004517 }
19,499
CREATE TABLE `app_cdp_category_ym_snap` ( `area_id` BIGINT(20) NOT NULL COMMENT '区域ID', `goods_lib_id` BIGINT NOT NULL COMMENT '商品库ID', `cid` BIGINT NOT NULL COMMENT '商品类目ID', `cycle` VARCHAR(20) NOT NULL COMMENT '时间区间;近7天、近30天、近60天、近90天、近180天、近365天', `type` INT(11) NOT NULL COMMENT '数据指标:1-销售额、2-销售件数、3-销售订单数、4-购买人数、5-下单商品件数、6-成交商品件数、7-动销商品个数(去重)、8-退款数、9-退款率', `update_time` DATETIME NOT NULL COMMENT '更新时间', `state` INT(11) REPLACE_IF_NOT_NULL NULL COMMENT '状态 0:无效数据; 1:有效;', `value` decimalv3(36,2) REPLACE_IF_NOT_NULL NULL COMMENT '当前周期指标值', `month_on_month` decimalv3(36,2) REPLACE_IF_NOT_NULL NULL COMMENT '环比上周期指标值', `year_on_year` decimalv3(36,2) REPLACE_IF_NOT_NULL NULL COMMENT '同比去年指标值' ) ENGINE = OLAP Unique KEY(`area_id`, `goods_lib_id`, `cid`, `cycle`, `type`, `update_time`) COMMENT 'cdp品类同环比值快照表' DISTRIBUTED BY HASH(`area_id`, `goods_lib_id`, `cid`, `cycle`, `type`, `update_time`) BUCKETS 10 PROPERTIES ( "replication_allocation" = "tag.location.default: 3", "storage_format" = "V2", "light_schema_change" = "true", "disable_auto_compaction" = "false", "enable_single_replica_compaction" = "false" ); 采用该建表语句执行时,报错:SQL 错误 [1105] [HY000]: errCode = 2, detailMessage = UNIQUE_KEYS table should not specify aggregate type for non-key column[state]
cef66810aeeb24c7c263443664c2c417
{ "intermediate": 0.20633015036582947, "beginner": 0.6522570848464966, "expert": 0.14141274988651276 }
19,500
watch(tab,(new_val,old_val)=>{ if(new_val == "sheetAndfile"){ document.getElementById("sheet").appendChild('<p>你好</p>') // luckysheet.create(); } })这段代码有什么问题
608120e921c1bc2b7ecb4480530b8afa
{ "intermediate": 0.38024237751960754, "beginner": 0.37173810601234436, "expert": 0.2480195015668869 }
19,501
ImportError:tinycudann-1.7-py3.10-linux-x86_64.egg cuMemAddressFree解决方法
fc8fe8780ce48d5ad344f199b1f0f258
{ "intermediate": 0.33714601397514343, "beginner": 0.31793317198753357, "expert": 0.344920814037323 }
19,502
const positions: Record<string, AccountPosition> = { "BTCBUSD": { symbol: "BTCBUSD", quantity: 3, openPrice: 25690, amount: 150, openDate: "2023-01-01", side: "ask", apiKeyId: "2", }, }; useEffect(() => { if (!workerRef.current) return; workerRef.current.onmessage = (event: MessageEvent<UpdateCupEvent|OrderEvent>) => { if (event?.data?.type === "update_cup") { animationFrameId = requestAnimationFrame(() => { const data = event.data as UpdateCupEvent; const context = canvasRef.current?.getContext("2d"); const zoomedTickSize = data.priceStep * data.aggregation; if (context) { const rowsOnScreenCount = cupTools.getRowsCountOnScreen( canvasSize.height, cupOptions().cell.defaultHeight * dpiScale, ); const realCellHeight = parseInt((canvasSize.height / rowsOnScreenCount).toFixed(0)); if (data.rowsCount !== rowsOnScreenCount) { workerRef.current?.postMessage(JSON.stringify({type: "change_rows_count", value: rowsOnScreenCount})); } cupDrawer.clear(context, canvasSize); if (cupParams.rowCount !== rowsOnScreenCount || cupParams.cellHeight !== realCellHeight || cupParams.aggregation !== data.aggregation ) { dispatch(setCupParams({ aggregation: data.aggregation, rowCount: rowsOnScreenCount, cellHeight: realCellHeight, pricePrecision: data.pricePrecision, priceStep: data.priceStep, quantityPrecision: data.quantityPrecision, })); } console.log(data.priceStep); if (data.camera === 0 && isLoaded) { setIsLoaded(false); } if (data.camera > 0 && !isLoaded) { setIsLoaded(true); } if (data.camera !== 0) { cupDrawer.draw( context, canvasSize, dpiScale, data.bestBidPrice, data.bestAskPrice, data.maxVolume, data.pricePrecision, data.quantityPrecision, data.priceStep, data.aggregation, rowsOnScreenCount, data.camera, realCellHeight, { buy: parseInt((Math.floor(data.bestBidPrice / zoomedTickSize) * zoomedTickSize).toFixed(0)), sell: parseInt((Math.ceil(data.bestAskPrice / zoomedTickSize) * zoomedTickSize).toFixed(0)), }, darkMode, data.volumeAsDollars, data.cup, positions, ); } } }); } }; return () => { if (null !== animationFrameId) { cancelAnimationFrame(animationFrameId); } }; }, [workerRef.current, canvasSize, darkMode, dpiScale, isLoaded, quantity]); const cupDrawer = { clear: (ctx: CanvasRenderingContext2D, size: CanvasSize) => { ctx.clearRect(0, 0, size.width, size.height); }, draw: ( ctx: CanvasRenderingContext2D, size: CanvasSize, dpiScale: number, bestBidPrice: number, bestAskPrice: number, maxVolume: number, pricePrecision: number, quantityPrecision: number, priceStep: number, zoom: number, rowCount: number, camera: number, cellHeight: number, zoomedBestMicroPrice: any, darkMode: boolean, volumeAsDollars: boolean, cup: {[key: number]: CupItem}, positions: Record<string, AccountPosition>, ) => { const zoomedTickSize = priceStep * zoom; const startMicroPrice = camera + rowCount / 2 * zoomedTickSize - zoomedTickSize; const quantityDivider = Math.pow(10, quantityPrecision); const priceDivider = Math.pow(10, pricePrecision); for (let index = 0; index <= rowCount; index++) { const microPrice = startMicroPrice - index * zoomedTickSize; if (microPrice < 0) continue; const item = cup[microPrice] || {}; let side = "undefined" !== typeof item?.bid ? "bid" : "undefined" !== typeof item?.ask ? "ask" : ""; if ("" === side || (!item?.bid && !item.ask)) { side = (microPrice >= (zoomedBestMicroPrice?.buy || zoomedBestMicroPrice?.sell || 0) ? "ask" : "bid"); } const yPosition = cellHeight * index; const quantity = volumeAsDollars ? ((side === "bid" ? item?.bid || 0 : item?.ask || 0) / quantityDivider) * (microPrice / priceDivider) : (side === "bid" ? item?.bid || 0 : item?.ask || 0) / quantityDivider; const isBestPrice = cupTools.isBestPrice( side, microPrice, zoomedBestMicroPrice, ); if ((microPrice / zoomedTickSize) % 5 === 0) { ctx.beginPath(); ctx.strokeStyle = darkMode ? "#232425" : "#dddedf"; ctx.lineWidth = Math.max(1, dpiScale); ctx.moveTo(0, yPosition); ctx.lineTo(size.width, yPosition); ctx.stroke(); } cupDrawer.drawCell( ctx, quantity, side, maxVolume, isBestPrice, yPosition, cellHeight, size.width, dpiScale, darkMode ); if (isBestPrice) { cupDrawer.drawFill( ctx, quantity, side, maxVolume, yPosition, cellHeight, size.width, dpiScale, darkMode ); } cupDrawer.drawPrice( ctx, cupTools.microPriceToReal(microPrice, pricePrecision), side, isBestPrice, yPosition, cellHeight, size.width, dpiScale, darkMode ); cupDrawer.drawQuantity( ctx, cupTools.abbreviateNumber(quantity), side, isBestPrice, yPosition, cellHeight, size.width, dpiScale, darkMode ); } }, drawCell: ( ctx: CanvasRenderingContext2D, quantity: number, side: string, maxVolume: number, isBestPrice: boolean, yPosition: number, cellHeight: number, fullWidth: number, dpiScale: number, darkMode: boolean, ) => { ctx.beginPath(); ctx.strokeStyle = cupOptions(darkMode).border.color; ctx.lineWidth = cupOptions(darkMode).border.width; ctx.fillStyle = cupTools.getCellBackground(side, isBestPrice, darkMode); // @ts-ignore ctx.roundRect( 0, yPosition, cupTools.getCellWidth(fullWidth, quantity, maxVolume, isBestPrice), cellHeight, cupOptions(darkMode).border.radius * dpiScale, ); ctx.fill(); ctx.stroke(); }, drawFill: ( ctx: CanvasRenderingContext2D, quantity: number, side: string, maxVolume: number, yPosition: number, cellHeight: number, fullWidth: number, dpiScale: number, darkMode: boolean, ) => { const cornerRadius = cupOptions().border.radius * dpiScale; const x = 0; const y = yPosition; const height = cellHeight; const fillColor = side === "bid" ? cupOptions(darkMode).bestBuy.fillColor : cupOptions(darkMode).bestSell.fillColor; ctx.beginPath(); ctx.rect( 0, y + 1, cupTools.getCellWidth(fullWidth, quantity, maxVolume, false), height - 2, ); ctx.fillStyle = fillColor; ctx.fill(); ctx.fillStyle = darkMode ? "#191919" : "#fff"; ctx.beginPath(); ctx.moveTo(x, y + cornerRadius); ctx.arc(x + cornerRadius, y + cornerRadius, cornerRadius, Math.PI, Math.PI * 1.5); ctx.lineTo(x, y); ctx.closePath(); ctx.fill(); ctx.beginPath(); ctx.moveTo(x + cornerRadius, y + height); ctx.arc(x + cornerRadius, y + height - cornerRadius, cornerRadius, Math.PI * 0.5, Math.PI); ctx.lineTo(x, y + height); ctx.closePath(); ctx.fill(); ctx.beginPath(); ctx.moveTo(x + fullWidth - cornerRadius, y); ctx.arc(x + fullWidth - cornerRadius, y + cornerRadius, cornerRadius, Math.PI * 1.5, 0); ctx.lineTo(x + fullWidth, y); ctx.closePath(); ctx.fill(); ctx.beginPath(); ctx.moveTo(x + fullWidth, y + height - cornerRadius); ctx.arc(x + fullWidth - cornerRadius, y + height - cornerRadius, cornerRadius, 0, Math.PI * 0.5); ctx.lineTo(x + fullWidth, y + height); ctx.closePath(); ctx.fill(); ctx.stroke(); }, drawPrice: ( ctx: CanvasRenderingContext2D, price: string, side: string, isBestPrice: boolean, yPosition: number, cellHeight: number, fullWidth: number, dpiScale: number, darkMode: boolean, ) => { const {width: textWidth} = ctx.measureText(price); ctx.textBaseline = "middle"; ctx.font = `${cupOptions().font.weight} ${cupOptions().font.sizePx * dpiScale}px ${cupOptions().font.family}`; ctx.fillStyle = cupTools.getPriceColor(side, isBestPrice, darkMode); ctx.fillText( price, fullWidth - cupOptions().cell.paddingX * dpiScale - textWidth, yPosition + cellHeight / 2, ); }, drawQuantity: ( ctx: CanvasRenderingContext2D, quantity: string, side: string, isBestPrice: boolean, yPosition: number, cellHeight: number, fullWidth: number, dpiScale: number, darkMode: boolean, ) => { ctx.textBaseline = "middle"; ctx.fillStyle = cupTools.getQuantityColor(side, isBestPrice, darkMode); ctx.fillText( quantity, cupOptions().cell.paddingX * dpiScale, yPosition + cellHeight / 2, ); }, }; export default cupDrawer; positions нужно отображать в виде полупрозрачного прямоугольника от цены входа до bestPrice.
9684ddeb708e7e434c0e557e614e043d
{ "intermediate": 0.4877622425556183, "beginner": 0.39700427651405334, "expert": 0.11523350328207016 }
19,503
if 'Area' not in field_names: arcpy.AddField_management(shp, 'Area', 'Double') arcpy.CalculateField_management(shp, 'Area', "!SHAPE.area!", expression_type="python") if 'Area_mu' not in field_names: arcpy.AddField_management(shp, 'Area_mu', 'Double') arcpy.CalculateField_management(shp, 'Area_mu', round( [Area] *0.0015,4), expression_type="python") 计算亩数
f2776484e61603e124da4a0d0663ed7e
{ "intermediate": 0.32301589846611023, "beginner": 0.3584159016609192, "expert": 0.3185681998729706 }
19,504
# -- coding: utf-8 -- import arcpy import os import glob import re import datetime import pandas as pd from arcpy.sa import * arcpy.CheckOutExtension('Spatial') arcpy.env.overwriteOutput = True class BatchClip: def __init__(self, inws, outws, mask): self.inws = inws self.outws = outws self.mask = mask print(self.outws) def clip(self): if not os.path.exists(self.outws): os.mkdir(self.outws) rasters = glob.glob(os.path.join(self.inws, "*.tif")) shps = glob.glob(os.path.join(self.mask, "*.shp")) inwsname = self.inws[-5:] print(inwsname) for shp in shps: shp_name = os.path.basename(shp) # print(shp_name) for ras in rasters: ras_name = os.path.basename(ras) shpname = shp_name[-8:-4] rastername = ras_name[:8] nameT = inwsname + shpname +"_"+ rastername + ".tif" outname = os.path.join(self.outws, nameT) out_extract = arcpy.sa.ExtractByMask(ras, shp) out_extract.save(outname) print("----Batchclip down ----") class RasterReclassify: def __init__(self, workspace): # Set workspace self.workspace = workspace arcpy.env.workspace = self.workspace def reclassify_rasters(self, index): folder = arcpy.env.workspace[-4:] # print(folder) folder_name = "reclassify" + folder folder_path = os.path.join(arcpy.env.workspace) #dirname raclassify_output_path = os.path.join(folder_path, folder_name) # print(raclassify_output_path) if not os.path.exists(raclassify_output_path): os.mkdir(raclassify_output_path) rasterlist = arcpy.ListRasters("*", "tif") # print("raster:",rasterlist) if rasterlist is not None: for raster in rasterlist: inRaster = arcpy.Raster(raster) # print(inRaster) time = inRaster.name[5:18] # print(time) out = os.path.join(raclassify_output_path, time + ".tif") # print(out) # if index == "ndvi": # # NDVI outCon = arcpy.sa.Con(inRaster <= 0.19, 1, arcpy.sa.Con((inRaster > 0.19) & (inRaster <= 0.39), 2, arcpy.sa.Con((inRaster > 0.39) & (inRaster <= 0.55), 3, arcpy.sa.Con((inRaster > 0.55) & (inRaster <= 0.75), 4, arcpy.sa.Con((inRaster > 0.75), 5))))) # elif index == "gndvi": # GNDVI # outCon = arcpy.sa.Con(inRaster <= 0.2, 1, # arcpy.sa.Con((inRaster > 0.2) & (inRaster <= 0.4), 2, # arcpy.sa.Con((inRaster > 0.4) & (inRaster <= 0.6), 3, # arcpy.sa.Con((inRaster > 0.6) & (inRaster <= 0.8), 4, # arcpy.sa.Con((inRaster > 0.8), 5))))) # elif index == "vci": # # VCI # outCon = arcpy.sa.Con(inRaster <= 0.15, 1, # arcpy.sa.Con((inRaster > 0.15) & (inRaster <= 0.3), 2, # arcpy.sa.Con((inRaster > 0.3) & (inRaster <= 0.45), 3, # arcpy.sa.Con((inRaster > 0.45) & (inRaster <= 0.6), 4, # arcpy.sa.Con((inRaster > 0.6), 5))))) # elif index == "chlor": # # # Chlor # outCon = arcpy.sa.Con(inRaster <= 12, 1, # arcpy.sa.Con((inRaster > 12) & (inRaster <= 21), 2, # arcpy.sa.Con((inRaster > 21) & (inRaster <= 32), 3, # arcpy.sa.Con((inRaster > 32) & (inRaster <= 43), 4, # arcpy.sa.Con((inRaster > 43), 5))))) outCon.save(out) print("---raclassify down---") class RasterToPolygonConverter: def __init__(self, input_raster_path, output_shp_path): self.input_raster_path = input_raster_path self.output_shp_path = output_shp_path def convert_raster_to_polygon(self): # Set workspace arcpy.env.workspace = self.input_raster_path # print(arcpy.env.workspace) # Create output folder if it doesn’t exist if not os.path.exists(self.output_shp_path): os.mkdir(self.output_shp_path) # List raster files rasters = arcpy.ListRasters("*", "tif") # print("rasterstopolygon:",rasters) for raster in rasters: # Extract catchment name from raster filename catchment_name = raster[:13] # print(catchment_name) # Set output shapefile path shp_out_name = os.path.join(self.output_shp_path, catchment_name) # print(shp_out_name) # Convert raster to polygon arcpy.RasterToPolygon_conversion(raster, shp_out_name, "true", "Value") # print("finished") print("---polygon down---") class Dissolve: def __init__(self, input_workspace, output_workspace): self.input_workspace = input_workspace self.output_workspace = output_workspace def dissolve_shapefiles(self): arcpy.env.workspace = self.input_workspace shps = arcpy.ListFiles("*.shp") if shps is not None: for shp in shps: catchment_name = shp[:13] print(catchment_name) disslove_out_name = os.path.join(self.output_workspace,catchment_name) # print(disslove_out_name) arcpy.Dissolve_management(shp, disslove_out_name, "gridcode") # print("Finished dissolving") class FieldCalculator: def __init__(self, input_polygon, df): self.input_polygon = input_polygon self.df = df def calculate_fields(self): current_year = datetime.datetime.now().year # if not os.path.exists(self.input_polygon): # return # path_list = os.listdir(self.input_polygon) # for i in range(len(path_list)): # landid = path_list[i][:4] # print(landid) # # path = os.path.join(self.input_polygon, path_list[i]) shps = glob.glob(os.path.join(self.input_polygon, "*.shp")) print(shps) for shp in shps: catchment_name = shp[-12:-4] landid = shp[-17:-13] landId = int(landid) print(landId) if landid is not None: filtered_df = self.df[self.df['ID'] == landId] df_crop = filtered_df[u'种植作物'].iloc[0] crop = '"' + df_crop + '"' # crop = df_crop.encode('unicode_escape').decode('utf-8') df_landName = filtered_df[u'项目名称'].iloc[0] landName = '"' + df_landName + '"' # landName = df_landName.encode('unicode_escape').decode('utf-8') print(crop) print(landName) date = int(catchment_name) arcpy.DeleteField_management(shp, ["id"]) field_names = [f.name for f in arcpy.ListFields(shp)] if 'date' not in field_names: arcpy.AddField_management(shp, 'date', 'Long') arcpy.CalculateField_management(shp, 'date', expression=date, expression_type="python", code_block="") if 'landId' not in field_names: arcpy.AddField_management(shp, 'landId', 'Short') arcpy.CalculateField_management(shp, 'landId', landid, expression_type="python") if 'landName' not in field_names: arcpy.AddField_management(shp, 'landName', 'TEXT') arcpy.CalculateField_management(shp, 'landName', expression=landName, expression_type="python") if 'crop' not in field_names: arcpy.AddField_management(shp, 'crop', 'TEXT') arcpy.CalculateField_management(shp, 'crop', expression=crop, expression_type="python") if 'Area' not in field_names: arcpy.AddField_management(shp, 'Area', 'Double') arcpy.CalculateField_management(shp, 'Area', "!SHAPE.area!", expression_type="python") if 'Area_mu' not in field_names: arcpy.AddField_management(shp, 'Area_mu', 'Double') arcpy.CalculateField_management(shp, 'Area_mu', "round( !Area! *0.0015,4)", expression_type="python") if 'year' not in field_names: arcpy.AddField_management(shp, 'year', 'Double') arcpy.CalculateField_management(shp, 'year', current_year, expression_type="python") print("---dbf down---") class Merge: def __init__(self,workfloder,Merge_output): self.workfloder = workfloder self.Merge_output = Merge_output def merge(self): arcpy.env.workspace = self.workfloder #change this merge_name = self.workfloder[-4:] shplist = arcpy.ListFeatureClasses('*.shp') arcpy.Merge_management(shplist, os.path.join(self.Merge_output, merge_name)) def main(): # Set input and output paths inws = r"F:\GEE\chenjianjun\tif\growth" outws = r"F:\GEE\chenjianjun\growth" mask = r"F:\GEE\chenjianjun\1_shp" # Batch clip rasters batch_clip = BatchClip(inws, outws, mask) batch_clip.clip() # Reclassify rasters reclassify_workspace = os.path.join(outws) rr = RasterReclassify(reclassify_workspace) # rr.reclassify_rasters() rr.reclassify_rasters("ndvi") # rr.reclassify_rasters("gndvi") # # rr.reclassify_rasters("vci") # rr.reclassify_rasters("chlor") # Convert rasters to polygons polygon_workspace = os.path.join(outws) folder = polygon_workspace[-4:] folder_name = "polygon" + folder output_polygon_path = os.path.join(outws, folder_name) raclassify_output_path = os.path.join(outws, "reclassify" + folder) # 定义 raclassify_output_path 变量 converter = RasterToPolygonConverter(raclassify_output_path, output_polygon_path) converter.convert_raster_to_polygon() # Dissolve polygons dissolve_workspace = os.path.join(outws) folder = dissolve_workspace[-4:] folder_name = "dissolve" + folder output_dissolve_path = os.path.join(outws, folder_name) if not os.path.exists(output_dissolve_path): os.mkdir(output_dissolve_path) dissolve = Dissolve(output_polygon_path, output_dissolve_path) dissolve.dissolve_shapefiles() # Calculate fields df = pd.read_excel(ur'F:\GEE\z_other\\遥感地块信息.xlsx') field_calculator = FieldCalculator(output_dissolve_path,df) field_calculator.calculate_fields() #Merge folder_name = "merge" output_merge_path = os.path.join(outws, folder_name) meger = Merge(output_dissolve_path,output_merge_path) meger.merge() arcpy.ClearWorkspaceCache_management() if __name__ == "__main__": main() Traceback (most recent call last): File "f:/GEE/z_py/pre.py", line 311, in <module> main() File "f:/GEE/z_py/pre.py", line 305, in main meger.merge() File "f:/GEE/z_py/pre.py", line 252, in merge arcpy.Merge_management(shplist, os.path.join(self.Merge_output, merge_name)) File "C:\Program Files (x86)\ArcGIS\Desktop10.7\ArcPy\arcpy\management.py", line 4493, in Merge raise e arcgisscripting.ExecuteError: ERROR 000210: Cannot create output F:\GEE\chenjianjun\growth\merge\owth Failed to execute (Merge).如何解决
23dee474fb6d9e5a4786ddd5b91b51cf
{ "intermediate": 0.2990756928920746, "beginner": 0.5320842862129211, "expert": 0.16883999109268188 }
19,505
Have lease start date and lease end date fields in excel, need to know how many each days in April, May and June are occupied and only days for those 3 months as result in three separate fields
c60128f78d957d7ca0eb7092f358ab2f
{ "intermediate": 0.3725878596305847, "beginner": 0.27243852615356445, "expert": 0.35497355461120605 }
19,506
ImportError:tinycudann_bindings/_86_C.cpython-310-x86_64-linux-gnu.so: undefined symbol: cuMemAddressFree解决方法
354874aa9ee89863dc87c34e03d57545
{ "intermediate": 0.42817223072052, "beginner": 0.28410372138023376, "expert": 0.2877240478992462 }
19,507
Complete <marquee>the effect of scrolling subtitles with tags.
50b44e3ec5a84b2781432a8bd2932e34
{ "intermediate": 0.386238157749176, "beginner": 0.3030474781990051, "expert": 0.31071439385414124 }
19,508
how does unique() method works in pandas python. provide step by step instrucitons and examples
0ee038a2f9e6859cb7233764e6a2984c
{ "intermediate": 0.5672942996025085, "beginner": 0.13528667390346527, "expert": 0.29741907119750977 }
19,509
python script to delete any files or subfolders in directory
82dfc0b6480ad2c043dc4dcbe3a79081
{ "intermediate": 0.4132559895515442, "beginner": 0.1896059513092041, "expert": 0.3971380293369293 }
19,510
If i have prisma schema, andd generated my sql tables, do i need models in node express js application?
bce5e13411b28d43a71a98e60106d231
{ "intermediate": 0.6893882751464844, "beginner": 0.1453532576560974, "expert": 0.1652584969997406 }
19,511
give me code for crud in nest js with typerom
3041301cc2fe6cdcdb2b37f8e1b81554
{ "intermediate": 0.34342437982559204, "beginner": 0.501803994178772, "expert": 0.15477153658866882 }
19,512
Which website to design map for target area?
0296ae574685a1d2a1eef48328e4ef61
{ "intermediate": 0.3173673450946808, "beginner": 0.28366491198539734, "expert": 0.3989677131175995 }
19,513
change following code to render ejs page from knjige/addBook:export async function getBook(req: Request, res: Response, next: NextFunction) { const bookId = parseInt(req.params.id); try { const book = await Book.getBook(bookId); res.json({ book: book, }); } catch (error) { return next(error); } }
90d5b80625891a093fc2aa2ab791011a
{ "intermediate": 0.39673474431037903, "beginner": 0.406926691532135, "expert": 0.19633853435516357 }
19,514
how do i 1 / 7 step by step
8fff22877da2dbf5d71e310bd82ddf33
{ "intermediate": 0.39151638746261597, "beginner": 0.3169153928756714, "expert": 0.29156824946403503 }
19,515
i have fixed navbar, when user name in navbar is large the navbar cover the next div how solve this
657ed68436d879697bf0ddcb93a45e05
{ "intermediate": 0.42026203870773315, "beginner": 0.2115633487701416, "expert": 0.36817458271980286 }
19,516
when select on any place on window close the menutabs angular
ebef6c8911e71a36350ef59165d93f1b
{ "intermediate": 0.41996270418167114, "beginner": 0.23773597180843353, "expert": 0.3423013687133789 }
19,517
psycopg2 example of select * from datatable
b08d543a350e6ac26c9a86990e3ca253
{ "intermediate": 0.35675308108329773, "beginner": 0.2708723843097687, "expert": 0.3723745346069336 }
19,518
document.addEventListener('click', () => { this.showSubMenu = false; }); i want to this only when subMenu is true
549405ed4851e3d97448da45b3eafc51
{ "intermediate": 0.4626128077507019, "beginner": 0.25007882714271545, "expert": 0.28730836510658264 }
19,519
var menu = document.getElementById('menu'); // When the user clicks anywhere outside of the modal, close it window.addEventListener('click', function(event) { if (event.target === menu) { menu.style.display = "none"; } }) how use this code in angular
d749c98ce1583fa54efa370fd4224417
{ "intermediate": 0.4963186979293823, "beginner": 0.35094645619392395, "expert": 0.15273486077785492 }
19,520
i have fixed navbar with this properties postion:fixed and z-index: 999999, when its height the followed divs disapper under navbar how solve this
7c5537bc2cd6c79f50d63541719646ea
{ "intermediate": 0.5145865082740784, "beginner": 0.19424216449260712, "expert": 0.2911713719367981 }
19,521
write an email to recognize effort of an employee
3e4f8fd4541025ca95e80e95ecb26d10
{ "intermediate": 0.3807222545146942, "beginner": 0.24854817986488342, "expert": 0.3707294762134552 }
19,522
please use selenium and python and make a bot that goes to a url and waits for and fills out all of these feilds then clicks submit card num: input tag with id="cardNumber" expiry: input tag with id="cardExpiry" cvc: input tag with id="cardCvc" cardholder name: input tag with id="billingName" country: select tag with id="billingCountry" pay button: class="SubmitButton"
2029ea23808be911f9ed53a34b053c87
{ "intermediate": 0.47109100222587585, "beginner": 0.09980893135070801, "expert": 0.42910003662109375 }
19,523
Write a C# program to create a hidden file
eab60b79c337826afbb0444de1a78cf9
{ "intermediate": 0.35539713501930237, "beginner": 0.29121899604797363, "expert": 0.3533838987350464 }
19,524
# -- coding: utf-8 -- import arcpy import os import glob import re import datetime import pandas as pd from arcpy.sa import * arcpy.CheckOutExtension('Spatial') arcpy.env.overwriteOutput = True class BatchClip: def __init__(self, inws, outws, mask): self.inws = inws self.outws = outws self.mask = mask print(self.outws) def clip(self): if not os.path.exists(self.outws): os.mkdir(self.outws) rasters = glob.glob(os.path.join(self.inws, "*.tif")) shps = glob.glob(os.path.join(self.mask, "*.shp")) inwsname = self.inws[-5:] print(inwsname) for shp in shps: shp_name = os.path.basename(shp) # print(shp_name) for ras in rasters: ras_name = os.path.basename(ras) shpname = shp_name[-8:-4] rastername = ras_name[:8] nameT = inwsname + shpname +"_"+ rastername + ".tif" outname = os.path.join(self.outws, nameT) out_extract = arcpy.sa.ExtractByMask(ras, shp) out_extract.save(outname) print("----Batchclip down ----") class RasterReclassify: def __init__(self, workspace): # Set workspace self.workspace = workspace arcpy.env.workspace = self.workspace def reclassify_rasters(self, index): folder = arcpy.env.workspace[-4:] # print(folder) folder_name = "reclassify" + folder folder_path = os.path.join(arcpy.env.workspace) #dirname raclassify_output_path = os.path.join(folder_path, folder_name) # print(raclassify_output_path) if not os.path.exists(raclassify_output_path): os.mkdir(raclassify_output_path) rasterlist = arcpy.ListRasters("*", "tif") # print("raster:",rasterlist) if rasterlist is not None: for raster in rasterlist: inRaster = arcpy.Raster(raster) # print(inRaster) time = inRaster.name[5:18] # print(time) out = os.path.join(raclassify_output_path, time + ".tif") # print(out) # if index == "ndvi": # # NDVI # outCon = arcpy.sa.Con(inRaster <= 0.19, 1, # arcpy.sa.Con((inRaster > 0.19) & (inRaster <= 0.39), 2, # arcpy.sa.Con((inRaster > 0.39) & (inRaster <= 0.55), 3, # arcpy.sa.Con((inRaster > 0.55) & (inRaster <= 0.75), 4, # arcpy.sa.Con((inRaster > 0.75), 5))))) # elif index == "gndvi": # GNDVI # outCon = arcpy.sa.Con(inRaster <= 0.2, 1, # arcpy.sa.Con((inRaster > 0.2) & (inRaster <= 0.4), 2, # arcpy.sa.Con((inRaster > 0.4) & (inRaster <= 0.6), 3, # arcpy.sa.Con((inRaster > 0.6) & (inRaster <= 0.8), 4, # arcpy.sa.Con((inRaster > 0.8), 5))))) # elif index == "vci": # # VCI # outCon = arcpy.sa.Con(inRaster <= 0.15, 1, # arcpy.sa.Con((inRaster > 0.15) & (inRaster <= 0.3), 2, # arcpy.sa.Con((inRaster > 0.3) & (inRaster <= 0.45), 3, # arcpy.sa.Con((inRaster > 0.45) & (inRaster <= 0.6), 4, # arcpy.sa.Con((inRaster > 0.6), 5))))) # elif index == "chlor": # # Chlor outCon = arcpy.sa.Con(inRaster <= 12, 1, arcpy.sa.Con((inRaster > 12) & (inRaster <= 21), 2, arcpy.sa.Con((inRaster > 21) & (inRaster <= 32), 3, arcpy.sa.Con((inRaster > 32) & (inRaster <= 43), 4, arcpy.sa.Con((inRaster > 43), 5))))) outCon.save(out) print("---raclassify down---") class RasterToPolygonConverter: def __init__(self, input_raster_path, output_shp_path): self.input_raster_path = input_raster_path self.output_shp_path = output_shp_path def convert_raster_to_polygon(self): # Set workspace arcpy.env.workspace = self.input_raster_path # print(arcpy.env.workspace) # Create output folder if it doesn’t exist if not os.path.exists(self.output_shp_path): os.mkdir(self.output_shp_path) # List raster files rasters = arcpy.ListRasters("*", "tif") # print("rasterstopolygon:",rasters) for raster in rasters: # Extract catchment name from raster filename catchment_name = raster[:13] # print(catchment_name) # Set output shapefile path shp_out_name = os.path.join(self.output_shp_path, catchment_name) # print(shp_out_name) # Convert raster to polygon arcpy.RasterToPolygon_conversion(raster, shp_out_name, "true", "Value") # print("finished") print("---polygon down---") class Dissolve: def __init__(self, input_workspace, output_workspace): self.input_workspace = input_workspace self.output_workspace = output_workspace def dissolve_shapefiles(self): arcpy.env.workspace = self.input_workspace shps = arcpy.ListFiles("*.shp") if shps is not None: for shp in shps: catchment_name = shp[:13] print(catchment_name) disslove_out_name = os.path.join(self.output_workspace,catchment_name) # print(disslove_out_name) arcpy.Dissolve_management(shp, disslove_out_name, "gridcode") # print("Finished dissolving") class FieldCalculator: def __init__(self, input_polygon, df): self.input_polygon = input_polygon self.df = df def calculate_fields(self): current_year = datetime.datetime.now().year # if not os.path.exists(self.input_polygon): # return # path_list = os.listdir(self.input_polygon) # for i in range(len(path_list)): # landid = path_list[i][:4] # print(landid) # # path = os.path.join(self.input_polygon, path_list[i]) shps = glob.glob(os.path.join(self.input_polygon, "*.shp")) print(shps) for shp in shps: catchment_name = shp[-12:-4] landid = shp[-17:-13] print(landid) landId = int(landid) print(landId) if landid is not None: filtered_df = self.df[self.df['ID'] == landId] df_crop = filtered_df[u'种植作物'].iloc[0] crop = '"' + df_crop + '"' # crop = df_crop.encode('unicode_escape').decode('utf-8') df_landName = filtered_df[u'项目名称'].iloc[0] landName = '"' + df_landName + '"' # landName = df_landName.encode('unicode_escape').decode('utf-8') print(crop) print(landName) date = int(catchment_name) arcpy.DeleteField_management(shp, ["id"]) field_names = [f.name for f in arcpy.ListFields(shp)] if 'date' not in field_names: arcpy.AddField_management(shp, 'date', 'Long') arcpy.CalculateField_management(shp, 'date', expression=date, expression_type="python", code_block="") if 'landId' not in field_names: arcpy.AddField_management(shp, 'landId', 'Short') arcpy.CalculateField_management(shp, 'landId', landid, expression_type="python") if 'landName' not in field_names: arcpy.AddField_management(shp, 'landName', 'TEXT') arcpy.CalculateField_management(shp, 'landName', expression=landName, expression_type="python") if 'crop' not in field_names: arcpy.AddField_management(shp, 'crop', 'TEXT') arcpy.CalculateField_management(shp, 'crop', expression=crop, expression_type="python") if 'Area' not in field_names: arcpy.AddField_management(shp, 'Area', 'Double') arcpy.CalculateField_management(shp, 'Area', "!SHAPE.area!", expression_type="python") if 'Area_mu' not in field_names: arcpy.AddField_management(shp, 'Area_mu', 'Double') arcpy.CalculateField_management(shp, 'Area_mu', "round( !Area! *0.0015,4)", expression_type="python") if 'year' not in field_names: arcpy.AddField_management(shp, 'year', 'Double') arcpy.CalculateField_management(shp, 'year', current_year, expression_type="python") print("---dbf down---") class Merge: def __init__(self,workfloder,Merge_output): self.workfloder = workfloder self.Merge_output = Merge_output def merge(self): arcpy.env.workspace = self.workfloder #change this merge_name = self.workfloder[-4:] if not os.path.exists(self.Merge_output): os.mkdir(self.Merge_output) output_merge_path = os.path.join(self.Merge_output, merge_name + ".shp") shplist = arcpy.ListFeatureClasses('*.shp') arcpy.Merge_management(shplist, output_merge_path) def main(): # Set input and output paths inws = r"F:\GEE\chenlongwen\tif\chenlongwen_ndvi" outws = r"F:\GEE\chenlongwen\growth" mask = r"F:\GEE\chenlongwen\1_shp" # Batch clip rasters batch_clip = BatchClip(inws, outws, mask) batch_clip.clip() # Reclassify rasters reclassify_workspace = os.path.join(outws) rr = RasterReclassify(reclassify_workspace) # rr.reclassify_rasters() rr.reclassify_rasters("ndvi") # rr.reclassify_rasters("gndvi") # # rr.reclassify_rasters("vci") # rr.reclassify_rasters("chlor") # Convert rasters to polygons polygon_workspace = os.path.join(outws) folder = polygon_workspace[-4:] folder_name = "polygon" + folder output_polygon_path = os.path.join(outws, folder_name) raclassify_output_path = os.path.join(outws, "reclassify" + folder) # 定义 raclassify_output_path 变量 converter = RasterToPolygonConverter(raclassify_output_path, output_polygon_path) converter.convert_raster_to_polygon() # Dissolve polygons dissolve_workspace = os.path.join(outws) folder = dissolve_workspace[-4:] folder_name = "dissolve" + folder output_dissolve_path = os.path.join(outws, folder_name) if not os.path.exists(output_dissolve_path): os.mkdir(output_dissolve_path) dissolve = Dissolve(output_polygon_path, output_dissolve_path) dissolve.dissolve_shapefiles() # Calculate fields df = pd.read_excel(ur'F:\GEE\z_other\\遥感地块信息.xlsx') field_calculator = FieldCalculator(output_dissolve_path,df) field_calculator.calculate_fields() #Merge folder_name = "merge" output_merge_path = os.path.join(outws, folder_name) meger = Merge(output_dissolve_path,output_merge_path) meger.merge() arcpy.ClearWorkspaceCache_management() if __name__ == "__main__": main() 如何使用index
21c750fd3437165c03148a14c05eb693
{ "intermediate": 0.2990756928920746, "beginner": 0.5320842862129211, "expert": 0.16883999109268188 }
19,525
please use pupeteer and nodejs and make a bot that goes to a url and waits for and fills out all of these feilds then clicks submit card num: input tag with id=“cardNumber” expiry: input tag with id=“cardExpiry” cvc: input tag with id=“cardCvc” cardholder name: input tag with id=“billingName” country: select tag with id=“billingCountry” pay button: class=“SubmitButton”
05a175162ba5ad420b751b099cea22ee
{ "intermediate": 0.7131331562995911, "beginner": 0.08669845759868622, "expert": 0.2001684010028839 }
19,526
make a nodejs function that generates a luhn valid card number, expiry date, cvc. the card number will be passed a bin number it will generate it based off of.
e78137e2cf0c5617f0793282a8bd81c6
{ "intermediate": 0.3622357249259949, "beginner": 0.23706501722335815, "expert": 0.40069931745529175 }
19,527
R code for QQ plot
69e0ef5db9b4f8e96311a813a22c925d
{ "intermediate": 0.36552754044532776, "beginner": 0.26861417293548584, "expert": 0.3658583462238312 }
19,528
I am doing a c# project with sqlite as database, the problem I am having is that the csv exporter is writing negative numbers beccause the getvalue doesn't take into account that integer in sqlite can have long values. Here is a real database value: 20180101062818 11 01/01/2018 06:28:18 01/01/2018 20:07:38 0 0 22.0 0.0 1690.0 0.0 0.0 0.0 1712.0 0.0 0.0 0.0 0.0 0.0 150.0 0.0 0.0 0.0 0.0 0.0 1862.0 1862.0 20180101200738 Here is the written value: -1950261086,11,"01/01/2018 06:28:18","01/01/2018 20:07:38",0,0,22,0,1690,0,0,0,1712,0,0,0,0,0,150,0,0,0,0,0,1862,1862,"","","",-1950123166 and here is my code to export to csv file: using (var connection = new SQLiteConnection(connectionString)) { connection.Open(); using (var command = new SQLiteCommand($"SELECT * FROM {tableName}", connection)) { using (var reader = command.ExecuteReader()) { var csv = new StringBuilder(); var headers = Enumerable.Range(0, reader.FieldCount).Select(reader.GetName).ToArray(); csv.AppendLine(string.Join(",", headers)); while (reader.Read()) { var values = Enumerable.Range(0, reader.FieldCount) .Select(i => reader.GetValue(i)) .Select(v => v is string ? $"\"{v}\"" : v) .ToArray(); csv.AppendLine(string.Join(",", values)); } File.WriteAllText(filePath, csv.ToString()); } } } How can I fix this problem?
ee56fe518df10b50881e84cedcd0b6cc
{ "intermediate": 0.6768029928207397, "beginner": 0.11132889240980148, "expert": 0.21186815202236176 }
19,529
I am doing a c# project with sqlite as database, the problem I am having is that the csv exporter is writing negative numbers beccause the getvalue doesn't take into account that integer in sqlite can have long values. Here is a real database value: 20180101062818 11 01/01/2018 06:28:18 01/01/2018 20:07:38 0 0 22.0 0.0 1690.0 0.0 0.0 0.0 1712.0 0.0 0.0 0.0 0.0 0.0 150.0 0.0 0.0 0.0 0.0 0.0 1862.0 1862.0 20180101200738 Here is the written value: -1950261086,11,"01/01/2018 06:28:18","01/01/2018 20:07:38",0,0,22,0,1690,0,0,0,1712,0,0,0,0,0,150,0,0,0,0,0,1862,1862,"","","",-1950123166 and here is my code to export to csv file: using (var connection = new SQLiteConnection(connectionString)) { connection.Open(); using (var command = new SQLiteCommand($"SELECT * FROM {tableName}", connection)) { using (var reader = command.ExecuteReader()) { var csv = new StringBuilder(); var headers = Enumerable.Range(0, reader.FieldCount).Select(reader.GetName).ToArray(); csv.AppendLine(string.Join(",", headers)); while (reader.Read()) { var values = Enumerable.Range(0, reader.FieldCount) .Select(i => reader.GetValue(i)) .Select(v => v is string ? $"\"{v}\"" : v) .ToArray(); csv.AppendLine(string.Join(",", values)); } File.WriteAllText(filePath, csv.ToString()); } } } How can I fix this problem?
6013066daa62275b90fe392e1c14f760
{ "intermediate": 0.6768029928207397, "beginner": 0.11132889240980148, "expert": 0.21186815202236176 }
19,530
whats the error i think its syntax ior semicolon: //*************************************** // Dio // // Purpose: // // Made by Michael Ortola // R0: 30-Aug-2023 Ortola - Beginning //*************************************** import java.util.Scanner; public class Dio_MAO { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long et = System.nanoTime(); System.out.print("Enter range for k: "); int krange = scan.nextInt(); System.out.print("Enter span for x, y, z: "); int span = scan.nextInt(); int solution = 0; for (int k = 0, k <= krange, k++) { boolean solutionFound = false; for (int x = -span, x <= span && !solutionFound, x++) { for (int y = -span, y <= span && !solutionFound, y++) { int z = (int) Math.cbrt(k - Math.pow(x,3) - Math.pow(y,3)); if (Math.pow(z,3) == k - Math.pow(x,3) - Math.pow(y,3)) { System.out.print("k: + " + k + ", x: " + x + ", y: " + y + ", z: " + z); solutionFound = true; solution++; } } } if (!solutionFound) { System.out.print("k: + " + k + " Not found!"); } } et = System.nanoTime() - et; System.out.print("Solution(s) found for " + solution + " values of k."); System.out.printf("\nElapsed time: %.2E nsecs", (double) et); } }
6f758656d3f06659819af6d7340e176b
{ "intermediate": 0.37258198857307434, "beginner": 0.4225180745124817, "expert": 0.20489992201328278 }
19,531
what is silverbullet by mohamm4dx?
e9f8371caad346ac40f6d85cc1dda9c7
{ "intermediate": 0.43159979581832886, "beginner": 0.18774448335170746, "expert": 0.3806556761264801 }
19,532
The formula to convert Celsius temperature given a Fahrenheit temperature is below: C° = (F° - 32) x (5 / 9) //consider the danger of integer division in your C++ formula Create a C++ program to: 1) accept input of a Fahrenheit temperature from the user 2) Calculate the Celsius temperature only 3) Output the Celsius temperature to the screen. 4) Set the precision of the outputted Celsius variable to 4 decimal places.
86b2a35f2be008528e58022155e9b119
{ "intermediate": 0.4095323085784912, "beginner": 0.14704951643943787, "expert": 0.4434182345867157 }
19,533
I am doing a c# project with sqlite as database, the problem is that the csv exporter is writing negative numbers because the getvalue doesn't take into account that integer in sqlite can have long values. Here is a real database value: 20180101062818 11 01/01/2018 06:28:18 01/01/2018 20:07:38 0 0 22.0 0.0 1690.0 0.0 0.0 0.0 1712.0 0.0 0.0 0.0 0.0 0.0 150.0 0.0 0.0 0.0 0.0 0.0 1862.0 1862.0 20180101200738 Here is the written value: -1950261086,11,"01/01/2018 06:28:18","01/01/2018 20:07:38",0,0,22,0,1690,0,0,0,1712,0,0,0,0,0,150,0,0,0,0,0,1862,1862,"","","",-1950123166 and here is my code to export to csv file: var values = Enumerable.Range(0, reader.FieldCount) .Select(i => reader.GetValue(i)) .Select(v => v is string ? $""{v}"" : v) .ToArray(); csv.AppendLine(string.Join(",", values));
b358aed0cd04e967a4fc24d103df3cda
{ "intermediate": 0.44045335054397583, "beginner": 0.24965651333332062, "expert": 0.30989009141921997 }
19,534
I am getting a Type Mismatch error on this line; If TimeValue(currentTime) >= TimeValue(timePeriods(rangeIndex)) And TimeValue(currentTime) < TimeValue(timePeriods(rangeIndex + 1)) Then In the following event: Private Sub Worksheet_Activate() Call CopyPA ' Call the CopyPA code Application.Calculate ' Perform calculations after the data is copied End Sub Sub CopyPA() Dim today As String today = Format(Now, "ddd") ' Get the current day ' Define the source and destination ranges Dim sourceRange As Range Dim destRange As Range Set sourceRange = Worksheets("PA").Range("A3:P3") ' Source range in the "PA" sheet ' Destination range in the "Daily" sheet ' Adjust the row number (3) according to your requirements Set destRange = Worksheets("Daily").Range("D3:S3") ' Clear the destination range and copy the format from the source range destRange.ClearContents sourceRange.Copy destRange.PasteSpecial Paste:=xlPasteFormats ' Copy the data from the source range to the destination range based on the current day Select Case today Case "Mon" sourceRange.Copy destRange Case "Tue" sourceRange.Offset(1).Copy destRange Case "Wed" sourceRange.Offset(2).Copy destRange Case "Thu" sourceRange.Offset(3).Copy destRange Case "Fri" sourceRange.Offset(4).Copy destRange End Select Application.CutCopyMode = False ' Clear the copy mode Call CopyAA End Sub Sub CopyAA() Dim today As String today = Format(Now, "ddd") Dim sourceRange As Range Dim destRange As Range Set sourceRange = Worksheets("AA").Range("A3:L3") ' Source range in the "PA" sheet Set destRange = Worksheets("Daily").Range("A9:L9") destRange.ClearContents sourceRange.Copy destRange.PasteSpecial Paste:=xlPasteFormats Select Case today Case "Mon" sourceRange.Copy destRange Case "Tue" sourceRange.Offset(1).Copy destRange Case "Wed" sourceRange.Offset(2).Copy destRange Case "Thu" sourceRange.Offset(3).Copy destRange Case "Fri" sourceRange.Offset(4).Copy destRange End Select Application.CutCopyMode = False Call CopyCL End Sub Sub CopyCL() Dim today As String today = Format(Now, "ddd") Dim sourceRange As Range Dim destRange As Range Set sourceRange = Worksheets("CL").Range("A3:O3") ' Source range in the "CL" sheet Set destRange = Worksheets("Daily").Range("F15:T15") destRange.ClearContents sourceRange.Copy destRange.PasteSpecial Paste:=xlPasteFormats Select Case today Case "Mon" sourceRange.Copy destRange Case "Tue" sourceRange.Offset(1).Copy destRange Case "Wed" sourceRange.Offset(2).Copy destRange Case "Thu" sourceRange.Offset(3).Copy destRange Case "Fri" sourceRange.Offset(4).Copy destRange End Select Application.CutCopyMode = False Call ShowTime End Sub Sub ShowTime() Dim currentTime As Date currentTime = Now ' Get the current time ' Define the ranges and their corresponding time periods Dim ranges(27) As Range Dim timePeriods(10) As String ' Assign the worksheet and ranges Dim ws As Worksheet Set ws = ThisWorkbook.Worksheets("Daily") ' Replace "Daily" with your sheet name Set ranges(1) = ws.Range("C5:D6") Set ranges(2) = ws.Range("C11:D12") Set ranges(3) = ws.Range("C17:D18") Set ranges(4) = ws.Range("E5:F6") Set ranges(5) = ws.Range("E11:F12") Set ranges(6) = ws.Range("E17:F18") Set ranges(7) = ws.Range("G5:H6") Set ranges(8) = ws.Range("G11:H12") Set ranges(9) = ws.Range("G17:H18") Set ranges(10) = ws.Range("I5:J6") Set ranges(11) = ws.Range("I11:J12") Set ranges(12) = ws.Range("I17:J18") Set ranges(13) = ws.Range("K5:L6") Set ranges(14) = ws.Range("K11:L12") Set ranges(15) = ws.Range("K17:L18") Set ranges(16) = ws.Range("M5:N6") Set ranges(17) = ws.Range("M11:N12") Set ranges(18) = ws.Range("M17:N18") Set ranges(19) = ws.Range("O5:P6") Set ranges(20) = ws.Range("O11:P12") Set ranges(21) = ws.Range("O17:P18") Set ranges(22) = ws.Range("Q5:R6") Set ranges(23) = ws.Range("Q11:R12") Set ranges(24) = ws.Range("Q17:R18") Set ranges(25) = ws.Range("S5:T6") Set ranges(26) = ws.Range("S11:T12") Set ranges(27) = ws.Range("S17:T18") timePeriods(1) = "06:59:59" ' 6:59am - before any time period" timePeriods(2) = "08:00:00" ' 8am" timePeriods(3) = "09:00:00" ' 9am" timePeriods(4) = "10:00:00" ' 10am" timePeriods(5) = "11:00:00" ' 11am" timePeriods(6) = "12:00:00" ' 12pm" timePeriods(7) = "13:00:00" ' 1pm" timePeriods(8) = "14:00:00" ' 2pm" timePeriods(9) = "15:00:00" ' 3pm" timePeriods(10) = "16:00:00" ' 4pm - after all time periods" ' Loop through the ranges and check if the current time falls within a specific time period Dim i As Integer For i = 1 To 27 Dim rangeIndex As Integer If i Mod 3 = 1 Then ' Determine the time period based on the index of the range rangeIndex = (i + 2) \ 3 Else rangeIndex = ((i + 2) \ 3) - 1 End If If TimeValue(currentTime) >= TimeValue(timePeriods(rangeIndex)) And TimeValue(currentTime) < TimeValue(timePeriods(rangeIndex + 1)) Then ranges(i).Interior.Color = RGB(255, 255, 0) ' Change the background color to Yellow End If Next i End Sub
2d01b23083cb80a6efd5aa89ed1d8377
{ "intermediate": 0.3812476098537445, "beginner": 0.34748706221580505, "expert": 0.2712653577327728 }
19,535
I am making a c# sqlite project, and my current csv tableimporter is taking too long to finish, how can I speed the import process? Assume I don't know beforehand the type of the columns that's why my original approach is using inserts for each data row. foreach (string line in File.ReadLines(filePath)) { if (line != "") { if (headers) { headers = false; columns = line.Split('|'); } else { string query = $@" INSERT INTO {tableName} ("; foreach (string c in columns) { query += $"{c},"; } query = query.Remove(query.Length - 1); query += $@") VALUES ("; foreach (string l in line.Split('|')) { query += $"{l},"; } query = query.Remove(query.Length - 1); query += ")"; try { ExecuteSQLQueries(sqliteConn, query); } catch (Exception e) { correcto = false; } } } }
a7d61a11f44f07ee2c32fb2726763cf9
{ "intermediate": 0.4214297831058502, "beginner": 0.2911316156387329, "expert": 0.28743860125541687 }
19,536
in c# sqlite project, I need to import a csv file into my table, but i don't know how to write the transaction code to insert my data, I have this code so far: System.Data.DataTable dataTable = new System.Data.DataTable(); foreach (string line in File.ReadLines(filePath)) { if (line != "") { if (headers) { headers = false; // Split the line into columns columns = line.Split('|'); foreach (string column in columns) { dataTable.Columns.Add(column); } } else { // Split the line into values string[] values = line.Split('|'); // Create a new DataRow and populate it with values System.Data.DataRow row = dataTable.NewRow(); for (int i = 0; i < values.Length; i++) { row[i] = values[i].Trim('\''); } // Add the DataRow to the DataTable dataTable.Rows.Add(row); } } } using (SQLiteTransaction transaction = sqliteConn.BeginTransaction()) { using (SQLiteDataAdapter adapter = new SQLiteDataAdapter()) { // TODO: MAKE THE INSERT STATEMENT // Use the DataTable as the source for the insert operation adapter.Update(dataTable); } transaction.Commit(); }
87491f762ed02142c9130b395cd607f2
{ "intermediate": 0.45957764983177185, "beginner": 0.2961554229259491, "expert": 0.24426695704460144 }
19,537
I am getting a Type Mismatch error on this line; If TimeValue(currentTime) >= TimeValue(timePeriods(rangeIndex)) And TimeValue(currentTime) < TimeValue(timePeriods(rangeIndex + 1)) Then In the following event: Sub ShowTime() Dim currentTime As Date currentTime = Now Dim ranges(27) As Range Dim timePeriods(10) As Variant Dim ws As Worksheet Set ws = ThisWorkbook.Worksheets("Daily") Set ranges(1) = ws.Range("C5:D6") Set ranges(2) = ws.Range("C11:D12") Set ranges(3) = ws.Range("C17:D18") Set ranges(4) = ws.Range("E5:F6") Set ranges(5) = ws.Range("E11:F12") Set ranges(6) = ws.Range("E17:F18") Set ranges(7) = ws.Range("G5:H6") Set ranges(8) = ws.Range("G11:H12") Set ranges(9) = ws.Range("G17:H18") Set ranges(10) = ws.Range("I5:J6") Set ranges(11) = ws.Range("I11:J12") Set ranges(12) = ws.Range("I17:J18") Set ranges(13) = ws.Range("K5:L6") Set ranges(14) = ws.Range("K11:L12") Set ranges(15) = ws.Range("K17:L18") Set ranges(16) = ws.Range("M5:N6") Set ranges(17) = ws.Range("M11:N12") Set ranges(18) = ws.Range("M17:N18") Set ranges(19) = ws.Range("O5:P6") Set ranges(20) = ws.Range("O11:P12") Set ranges(21) = ws.Range("O17:P18") Set ranges(22) = ws.Range("Q5:R6") Set ranges(23) = ws.Range("Q11:R12") Set ranges(24) = ws.Range("Q17:R18") Set ranges(25) = ws.Range("S5:T6") Set ranges(26) = ws.Range("S11:T12") Set ranges(27) = ws.Range("S17:T18") timePeriods(1) = "06:59:59" ' 6:59am - before any time period" timePeriods(2) = "08:00:00" ' 8am" timePeriods(3) = "09:00:00" ' 9am" timePeriods(4) = "10:00:00" ' 10am" timePeriods(5) = "11:00:00" ' 11am" timePeriods(6) = "12:00:00" ' 12pm" timePeriods(7) = "13:00:00" ' 1pm" timePeriods(8) = "14:00:00" ' 2pm" timePeriods(9) = "15:00:00" ' 3pm" timePeriods(10) = "16:00:00" ' 4pm - after all time periods" Dim i As Integer For i = 1 To 27 Dim rangeIndex As Integer If i Mod 3 = 1 Then ' Determine the time period based on the index of the range rangeIndex = (i + 2) \ 3 Else rangeIndex = ((i + 2) \ 3) - 1 End If If TimeValue(currentTime) >= TimeValue(timePeriods(rangeIndex)) And TimeValue(currentTime) < TimeValue(timePeriods(rangeIndex + 1)) Then ranges(i).Interior.Color = RGB(255, 255, 0) ' Change the background color to Yellow End If Next i End Sub
937258f24056039d64074e9bc0085ba5
{ "intermediate": 0.33457762002944946, "beginner": 0.3532254993915558, "expert": 0.31219691038131714 }
19,538
I think need to remove these "Retry Attempts" and "Timeout" for queuing an text2image AI api backend, by leaving only interval for query. remove all unnecessary code, and also check all the timings used (and even do it more intricate and advanced in terms used!) to not spam with queries to that text2image AI api backend. output fully modified javascript: const modelUrl = 'https://api-inference.huggingface.co/models/hogiahien/counterfeit-v30-edited'; const modelToken = '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'; const progressBarFilled = document.querySelector('.progress-bar-filled'); const imageCanvas = document.getElementById('imageCanvas'); const ctx = imageCanvas.getContext('2d'); let estimatedTime = 0; let isGenerating = false; let generateInterval; const galleryArray = []; const bufferContainer = document.querySelector('.buffer-container'); const container = document.querySelector('.canvas-container'); const canvas = document.getElementById('imageCanvas'); bufferContainer.addEventListener('click', handleImageClick); window.addEventListener('resize', handleResize); document.addEventListener('DOMContentLoaded', function() { handleResize(); generateImage(); }); function handleImageClick(e) { const target = e.target; if (target.tagName === 'IMG') { const fullWindowDiv = document.createElement('div'); const fullWindowImg = document.createElement('img'); fullWindowDiv.style.position = 'fixed'; fullWindowDiv.style.top = '0'; fullWindowDiv.style.left = '0'; fullWindowDiv.style.width = '100%'; fullWindowDiv.style.height = '100%'; fullWindowDiv.style.background = 'linear-gradient(to bottom right, rgba(39, 0, 39, 0.6), rgba(155, 0, 155, 0.6))'; fullWindowDiv.style.display = 'flex'; fullWindowDiv.style.zIndex = '2'; fullWindowDiv.style.justifyContent = 'center'; fullWindowDiv.style.alignItems = 'center'; fullWindowImg.style.maxHeight = '90vh'; fullWindowImg.style.maxWidth = '90vw'; fullWindowImg.src = target.src; fullWindowDiv.addEventListener('click', function() { document.body.removeChild(fullWindowDiv); }); document.body.appendChild(fullWindowDiv); fullWindowDiv.appendChild(fullWindowImg); } } async function query(data) { const response = await fetch(modelUrl, { headers: { Authorization: "Bearer " + modelToken }, method: 'POST', body: JSON.stringify(data) }); const headers = response.headers; const estimatedTimeString = headers.get('estimated_time'); estimatedTime = parseFloat(estimatedTimeString) * 1000; const result = await response.blob(); return result; } function autoQueueChanged() { clearInterval(generateInterval); const autoQueueActive = document.getElementById('autoQueueCheckbox').checked; if (autoQueueActive) { const timeout = parseInt(document.getElementById('timeoutInput').value) * 1000; const interval = parseInt(document.getElementById('intervalInput').value) * 1000; setTimeout(generateImage, timeout); generateInterval = setInterval(generateImage, interval); } } function generateImage() { if (isGenerating) { return; } isGenerating = true; const inputText = document.getElementById('inputText').value; const numAttempts = parseInt(document.getElementById('numAttemptsInput').value); progressBarFilled.style.width = '0%'; progressBarFilled.style.backgroundColor = 'green'; setTimeout(() => { let retryAttempts = 0; const maxRetryAttempts = numAttempts; let autoQueueActive = false; function queryImages() { const startTime = Date.now(); const timeLeft = Math.floor(estimatedTime / 1000); const interval = setInterval(function() { if (isGenerating) { const elapsedTime = Math.floor((Date.now() - startTime) / 1000); const progress = Math.floor((elapsedTime / timeLeft) * 1000); progressBarFilled.style.width = progress + '%'; } }, 1000); const cacheBuster = new Date().getTime(); query({ inputs: inputText, cacheBuster }) .then(response => { const url = URL.createObjectURL(response); let img = new Image(); img.classList.add('image-preview'); img.src = url; img.onload = function() { galleryArray.push(img); bufferContainer.appendChild(img); const imageWidth = img.naturalWidth; const imageHeight = img.naturalHeight; const aspectRatio = img.width / img.height; const containerWidth = container.clientWidth; const containerHeight = container.clientHeight; const minAvailableWidth = containerWidth; const maxAvailableHeight = containerHeight; let canvasWidth = containerWidth; let canvasHeight = maxAvailableHeight; if (aspectRatio > 1) { canvasWidth = containerWidth; canvasHeight = containerWidth / aspectRatio; if (canvasHeight > maxAvailableHeight) { canvasHeight = maxAvailableHeight; canvasWidth = canvasHeight * aspectRatio; } } else { canvasWidth = maxAvailableHeight * aspectRatio; canvasHeight = maxAvailableHeight; if (canvasWidth > containerWidth) { canvasWidth = containerWidth; canvasHeight = canvasWidth / aspectRatio; } } imageCanvas.width = canvasWidth; imageCanvas.height = canvasHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); galleryArray.forEach((image) => { const imageWidth = image.naturalWidth; const imageHeight = image.naturalHeight; const aspectRatio = imageWidth / imageHeight; let canvasImageWidth = canvasWidth; let canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } const x = (canvas.width - canvasImageWidth) / 2; const y = (canvas.height - canvasImageHeight) / 2; ctx.drawImage(image, x, y, canvasImageWidth, canvasImageHeight); }); }; img.src = url; clearInterval(interval); progressBarFilled.style.width = '100%'; progressBarFilled.style.background = 'linear-gradient(to bottom right, rgba(39, 0, 39, 0.5), rgb(155, 0, 155))'; isGenerating = false; }) .catch(error => { console.error(error); retryAttempts++; if (autoQueueActive) { const timeout = estimatedTime + 2000; setTimeout(queryImages, timeout); } autoQueueActive = document.getElementById('autoQueueCheckbox').checked; }); } queryImages(); }, 1000); } let isResizing = false; function handleResize() { if (isResizing) return; isResizing = true; requestAnimationFrame(() => { generateImage(); const containerWidth = container.clientWidth; const containerHeight = container.clientHeight; const aspectRatio = canvas.width / canvas.height; let canvasWidth = containerWidth; let canvasHeight = containerWidth / aspectRatio; if (canvasHeight > containerHeight) { canvasHeight = containerHeight; canvasWidth = canvasHeight * aspectRatio; } canvas.width = canvasWidth; canvas.height = canvasHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); var bufferContainer = document.querySelector('.buffer-container'); bufferContainer.style.width = '' + canvasWidth + 'px'; galleryArray.forEach(function(image) { if (image.classList.contains('image-canvas')) { // Only resize the .image-preview elements var imageWidth = image.naturalWidth; var imageHeight = image.naturalHeight; var aspectRatio = imageWidth / imageHeight; var canvasImageWidth = canvasWidth; var canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } image.style.width = '' + canvasImageWidth + 'px'; image.style.height = '' + canvasImageHeight + 'px'; } }); galleryArray.forEach((image) => { const imageWidth = image.naturalWidth; const imageHeight = image.naturalHeight; const aspectRatio = imageWidth / imageHeight; let canvasImageWidth = canvasWidth; let canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } const x = (canvas.width - canvasImageWidth) / 2; const y = (canvas.height - canvasImageHeight) / 2; ctx.drawImage(image, x, y, canvasImageWidth, canvasImageHeight); }); isResizing = false; }); }
cd984f4780d6caad98e4e34aa75bcb6a
{ "intermediate": 0.42875930666923523, "beginner": 0.41175299882888794, "expert": 0.15948766469955444 }
19,539
Custom implementation of comboboxes in actionscript 3
05e45828b63956fb3e427e77b223ef5c
{ "intermediate": 0.3075184226036072, "beginner": 0.20166043937206268, "expert": 0.49082112312316895 }
19,540
I think need to remove these “Retry Attempts” and “Timeout” for queuing an text2image AI api backend, by leaving only interval for query. remove all related code, and also check all the timings used (and even do it more intricate and advanced in terms used!) to not spam with queries to that text2image AI api backend. also, need to make sure that progress bar catches all previous cooldowns and estimate internally the next hypothetical progression in progress bar animation while auto-queue radiobutton is checked. output fully modified javascript: const modelUrl = 'https://api-inference.huggingface.co/models/hogiahien/counterfeit-v30-edited'; const modelToken = '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'; const progressBarFilled = document.querySelector('.progress-bar-filled'); const imageCanvas = document.getElementById('imageCanvas'); const ctx = imageCanvas.getContext('2d'); let estimatedTime = 0; let isGenerating = false; let generateInterval; const galleryArray = []; const bufferContainer = document.querySelector('.buffer-container'); const container = document.querySelector('.canvas-container'); const canvas = document.getElementById('imageCanvas'); bufferContainer.addEventListener('click', handleImageClick); window.addEventListener('resize', handleResize); document.addEventListener('DOMContentLoaded', function() { handleResize(); generateImage(); }); function handleImageClick(e) { const target = e.target; if (target.tagName === 'IMG') { const fullWindowDiv = document.createElement('div'); const fullWindowImg = document.createElement('img'); fullWindowDiv.style.position = 'fixed'; fullWindowDiv.style.top = '0'; fullWindowDiv.style.left = '0'; fullWindowDiv.style.width = '100%'; fullWindowDiv.style.height = '100%'; fullWindowDiv.style.background = 'linear-gradient(to bottom right, rgba(39, 0, 39, 0.6), rgba(155, 0, 155, 0.6))'; fullWindowDiv.style.display = 'flex'; fullWindowDiv.style.zIndex = '2'; fullWindowDiv.style.justifyContent = 'center'; fullWindowDiv.style.alignItems = 'center'; fullWindowImg.style.maxHeight = '90vh'; fullWindowImg.style.maxWidth = '90vw'; fullWindowImg.src = target.src; fullWindowDiv.addEventListener('click', function() { document.body.removeChild(fullWindowDiv); }); document.body.appendChild(fullWindowDiv); fullWindowDiv.appendChild(fullWindowImg); } } async function query(data) { const response = await fetch(modelUrl, { headers: { Authorization: "Bearer " + modelToken }, method: 'POST', body: JSON.stringify(data) }); const headers = response.headers; const estimatedTimeString = headers.get('estimated_time'); estimatedTime = parseFloat(estimatedTimeString) * 1000; const result = await response.blob(); return result; } function autoQueueChanged() { clearInterval(generateInterval); const autoQueueActive = document.getElementById('autoQueueCheckbox').checked; if (autoQueueActive) { const timeout = parseInt(document.getElementById('timeoutInput').value) * 1000; const interval = parseInt(document.getElementById('intervalInput').value) * 1000; setTimeout(generateImage, timeout); generateInterval = setInterval(generateImage, interval); } } function generateImage() { if (isGenerating) { return; } isGenerating = true; const inputText = document.getElementById('inputText').value; const numAttempts = parseInt(document.getElementById('numAttemptsInput').value); progressBarFilled.style.width = '0%'; progressBarFilled.style.backgroundColor = 'green'; setTimeout(() => { let retryAttempts = 0; const maxRetryAttempts = numAttempts; let autoQueueActive = false; function queryImages() { const startTime = Date.now(); const timeLeft = Math.floor(estimatedTime / 1000); const interval = setInterval(function() { if (isGenerating) { const elapsedTime = Math.floor((Date.now() - startTime) / 1000); const progress = Math.floor((elapsedTime / timeLeft) * 1000); progressBarFilled.style.width = progress + '%'; } }, 1000); const cacheBuster = new Date().getTime(); query({ inputs: inputText, cacheBuster }) .then(response => { const url = URL.createObjectURL(response); let img = new Image(); img.classList.add('image-preview'); img.src = url; img.onload = function() { galleryArray.push(img); bufferContainer.appendChild(img); const imageWidth = img.naturalWidth; const imageHeight = img.naturalHeight; const aspectRatio = img.width / img.height; const containerWidth = container.clientWidth; const containerHeight = container.clientHeight; const minAvailableWidth = containerWidth; const maxAvailableHeight = containerHeight; let canvasWidth = containerWidth; let canvasHeight = maxAvailableHeight; if (aspectRatio > 1) { canvasWidth = containerWidth; canvasHeight = containerWidth / aspectRatio; if (canvasHeight > maxAvailableHeight) { canvasHeight = maxAvailableHeight; canvasWidth = canvasHeight * aspectRatio; } } else { canvasWidth = maxAvailableHeight * aspectRatio; canvasHeight = maxAvailableHeight; if (canvasWidth > containerWidth) { canvasWidth = containerWidth; canvasHeight = canvasWidth / aspectRatio; } } imageCanvas.width = canvasWidth; imageCanvas.height = canvasHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); galleryArray.forEach((image) => { const imageWidth = image.naturalWidth; const imageHeight = image.naturalHeight; const aspectRatio = imageWidth / imageHeight; let canvasImageWidth = canvasWidth; let canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } const x = (canvas.width - canvasImageWidth) / 2; const y = (canvas.height - canvasImageHeight) / 2; ctx.drawImage(image, x, y, canvasImageWidth, canvasImageHeight); }); }; img.src = url; clearInterval(interval); progressBarFilled.style.width = '100%'; progressBarFilled.style.background = 'linear-gradient(to bottom right, rgba(39, 0, 39, 0.5), rgb(155, 0, 155))'; isGenerating = false; }) .catch(error => { console.error(error); retryAttempts++; if (autoQueueActive) { const timeout = estimatedTime + 2000; setTimeout(queryImages, timeout); } autoQueueActive = document.getElementById('autoQueueCheckbox').checked; }); } queryImages(); }, 1000); } let isResizing = false; function handleResize() { if (isResizing) return; isResizing = true; requestAnimationFrame(() => { generateImage(); const containerWidth = container.clientWidth; const containerHeight = container.clientHeight; const aspectRatio = canvas.width / canvas.height; let canvasWidth = containerWidth; let canvasHeight = containerWidth / aspectRatio; if (canvasHeight > containerHeight) { canvasHeight = containerHeight; canvasWidth = canvasHeight * aspectRatio; } canvas.width = canvasWidth; canvas.height = canvasHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); var bufferContainer = document.querySelector('.buffer-container'); bufferContainer.style.width = '' + canvasWidth + 'px'; galleryArray.forEach(function(image) { if (image.classList.contains('image-canvas')) { // Only resize the .image-preview elements var imageWidth = image.naturalWidth; var imageHeight = image.naturalHeight; var aspectRatio = imageWidth / imageHeight; var canvasImageWidth = canvasWidth; var canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } image.style.width = '' + canvasImageWidth + 'px'; image.style.height = '' + canvasImageHeight + 'px'; } }); galleryArray.forEach((image) => { const imageWidth = image.naturalWidth; const imageHeight = image.naturalHeight; const aspectRatio = imageWidth / imageHeight; let canvasImageWidth = canvasWidth; let canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } const x = (canvas.width - canvasImageWidth) / 2; const y = (canvas.height - canvasImageHeight) / 2; ctx.drawImage(image, x, y, canvasImageWidth, canvasImageHeight); }); isResizing = false; }); }
4f92700cdd098b6732baa49f195c01f6
{ "intermediate": 0.3544999063014984, "beginner": 0.4061054289340973, "expert": 0.2393946498632431 }
19,541
I think need to remove these “Retry Attempts” and “Timeout” for queuing an text2image AI api backend, by leaving only interval for query. remove all related code, and also check all the timings used (and even do it more intricate and advanced in terms used!) to not spam with queries to that text2image AI api backend. also, need to make sure that progress bar catches all previous cooldowns and estimate internally the next hypothetical progression in progress bar animation while auto-queue radiobutton is checked. output fully modified javascript: const modelUrl = 'https://api-inference.huggingface.co/models/hogiahien/counterfeit-v30-edited'; const modelToken = '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'; const progressBarFilled = document.querySelector('.progress-bar-filled'); const imageCanvas = document.getElementById('imageCanvas'); const ctx = imageCanvas.getContext('2d'); let estimatedTime = 0; let isGenerating = false; let generateInterval; const galleryArray = []; const bufferContainer = document.querySelector('.buffer-container'); const container = document.querySelector('.canvas-container'); const canvas = document.getElementById('imageCanvas'); bufferContainer.addEventListener('click', handleImageClick); window.addEventListener('resize', handleResize); document.addEventListener('DOMContentLoaded', function() { handleResize(); generateImage(); }); function handleImageClick(e) { const target = e.target; if (target.tagName === 'IMG') { const fullWindowDiv = document.createElement('div'); const fullWindowImg = document.createElement('img'); fullWindowDiv.style.position = 'fixed'; fullWindowDiv.style.top = '0'; fullWindowDiv.style.left = '0'; fullWindowDiv.style.width = '100%'; fullWindowDiv.style.height = '100%'; fullWindowDiv.style.background = 'linear-gradient(to bottom right, rgba(39, 0, 39, 0.6), rgba(155, 0, 155, 0.6))'; fullWindowDiv.style.display = 'flex'; fullWindowDiv.style.zIndex = '2'; fullWindowDiv.style.justifyContent = 'center'; fullWindowDiv.style.alignItems = 'center'; fullWindowImg.style.maxHeight = '90vh'; fullWindowImg.style.maxWidth = '90vw'; fullWindowImg.src = target.src; fullWindowDiv.addEventListener('click', function() { document.body.removeChild(fullWindowDiv); }); document.body.appendChild(fullWindowDiv); fullWindowDiv.appendChild(fullWindowImg); } } async function query(data) { const response = await fetch(modelUrl, { headers: { Authorization: "Bearer " + modelToken }, method: 'POST', body: JSON.stringify(data) }); const headers = response.headers; const estimatedTimeString = headers.get('estimated_time'); estimatedTime = parseFloat(estimatedTimeString) * 1000; const result = await response.blob(); return result; } function autoQueueChanged() { clearInterval(generateInterval); const autoQueueActive = document.getElementById('autoQueueCheckbox').checked; if (autoQueueActive) { const timeout = parseInt(document.getElementById('timeoutInput').value) * 1000; const interval = parseInt(document.getElementById('intervalInput').value) * 1000; setTimeout(generateImage, timeout); generateInterval = setInterval(generateImage, interval); } } function generateImage() { if (isGenerating) { return; } isGenerating = true; const inputText = document.getElementById('inputText').value; const numAttempts = parseInt(document.getElementById('numAttemptsInput').value); progressBarFilled.style.width = '0%'; progressBarFilled.style.backgroundColor = 'green'; setTimeout(() => { let retryAttempts = 0; const maxRetryAttempts = numAttempts; let autoQueueActive = false; function queryImages() { const startTime = Date.now(); const timeLeft = Math.floor(estimatedTime / 1000); const interval = setInterval(function() { if (isGenerating) { const elapsedTime = Math.floor((Date.now() - startTime) / 1000); const progress = Math.floor((elapsedTime / timeLeft) * 1000); progressBarFilled.style.width = progress + '%'; } }, 1000); const cacheBuster = new Date().getTime(); query({ inputs: inputText, cacheBuster }) .then(response => { const url = URL.createObjectURL(response); let img = new Image(); img.classList.add('image-preview'); img.src = url; img.onload = function() { galleryArray.push(img); bufferContainer.appendChild(img); const imageWidth = img.naturalWidth; const imageHeight = img.naturalHeight; const aspectRatio = img.width / img.height; const containerWidth = container.clientWidth; const containerHeight = container.clientHeight; const minAvailableWidth = containerWidth; const maxAvailableHeight = containerHeight; let canvasWidth = containerWidth; let canvasHeight = maxAvailableHeight; if (aspectRatio > 1) { canvasWidth = containerWidth; canvasHeight = containerWidth / aspectRatio; if (canvasHeight > maxAvailableHeight) { canvasHeight = maxAvailableHeight; canvasWidth = canvasHeight * aspectRatio; } } else { canvasWidth = maxAvailableHeight * aspectRatio; canvasHeight = maxAvailableHeight; if (canvasWidth > containerWidth) { canvasWidth = containerWidth; canvasHeight = canvasWidth / aspectRatio; } } imageCanvas.width = canvasWidth; imageCanvas.height = canvasHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); galleryArray.forEach((image) => { const imageWidth = image.naturalWidth; const imageHeight = image.naturalHeight; const aspectRatio = imageWidth / imageHeight; let canvasImageWidth = canvasWidth; let canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } const x = (canvas.width - canvasImageWidth) / 2; const y = (canvas.height - canvasImageHeight) / 2; ctx.drawImage(image, x, y, canvasImageWidth, canvasImageHeight); }); }; img.src = url; clearInterval(interval); progressBarFilled.style.width = '100%'; progressBarFilled.style.background = 'linear-gradient(to bottom right, rgba(39, 0, 39, 0.5), rgb(155, 0, 155))'; isGenerating = false; }) .catch(error => { console.error(error); retryAttempts++; if (autoQueueActive) { const timeout = estimatedTime + 2000; setTimeout(queryImages, timeout); } autoQueueActive = document.getElementById('autoQueueCheckbox').checked; }); } queryImages(); }, 1000); } let isResizing = false; function handleResize() { if (isResizing) return; isResizing = true; requestAnimationFrame(() => { generateImage(); const containerWidth = container.clientWidth; const containerHeight = container.clientHeight; const aspectRatio = canvas.width / canvas.height; let canvasWidth = containerWidth; let canvasHeight = containerWidth / aspectRatio; if (canvasHeight > containerHeight) { canvasHeight = containerHeight; canvasWidth = canvasHeight * aspectRatio; } canvas.width = canvasWidth; canvas.height = canvasHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); var bufferContainer = document.querySelector('.buffer-container'); bufferContainer.style.width = '' + canvasWidth + 'px'; galleryArray.forEach(function(image) { if (image.classList.contains('image-canvas')) { // Only resize the .image-preview elements var imageWidth = image.naturalWidth; var imageHeight = image.naturalHeight; var aspectRatio = imageWidth / imageHeight; var canvasImageWidth = canvasWidth; var canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } image.style.width = '' + canvasImageWidth + 'px'; image.style.height = '' + canvasImageHeight + 'px'; } }); galleryArray.forEach((image) => { const imageWidth = image.naturalWidth; const imageHeight = image.naturalHeight; const aspectRatio = imageWidth / imageHeight; let canvasImageWidth = canvasWidth; let canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } const x = (canvas.width - canvasImageWidth) / 2; const y = (canvas.height - canvasImageHeight) / 2; ctx.drawImage(image, x, y, canvasImageWidth, canvasImageHeight); }); isResizing = false; }); }
85bc3a5e1146db6e583c3b791942b3d1
{ "intermediate": 0.3544999063014984, "beginner": 0.4061054289340973, "expert": 0.2393946498632431 }
19,542
generate me a ecommerce react application which can show items and pricing from a catalog and have all the flows in terms of user registration, purchase, payments and orders
26a711b6f737a9675d7a2c637f880f7e
{ "intermediate": 0.6671626567840576, "beginner": 0.12989698350429535, "expert": 0.20294032990932465 }
19,543
in c# sqlite project, I need to import a csv file into my table, but i don’t know how to write the transaction code to insert my data, consider I don't know which data type is each column and I only have the headers. I have this code so far: System.Data.DataTable dataTable = new System.Data.DataTable(); foreach (string line in File.ReadLines(filePath)) { if (line != “”) { if (headers) { headers = false; // Split the line into columns columns = line.Split(‘|’); foreach (string column in columns) { dataTable.Columns.Add(column); } } else { // Split the line into values string[] values = line.Split(‘|’); // Create a new DataRow and populate it with values System.Data.DataRow row = dataTable.NewRow(); for (int i = 0; i < values.Length; i++) { row[i] = values[i].Trim(‘’'); } // Add the DataRow to the DataTable dataTable.Rows.Add(row); } } } using (SQLiteTransaction transaction = sqliteConn.BeginTransaction()) { using (SQLiteDataAdapter adapter = new SQLiteDataAdapter()) { // TODO: MAKE THE INSERT STATEMENT // Use the DataTable as the source for the insert operation adapter.Update(dataTable); } transaction.Commit(); }
c921c4424136bc1d822e19fe1d7e832d
{ "intermediate": 0.5437249541282654, "beginner": 0.2689085006713867, "expert": 0.1873665302991867 }
19,544
in this code class Employee_Postgraduate(models.Model): Qualification_degree = [ ('دبلومة', 'دبلومة'), ('ماجيستير', 'ماجيستير'), ('دكتوراه', 'دكتوراه'), ] Authority_type = [ ('حكومي', 'حكومي'), ('خاص', 'خاص'), ] user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='employee_Postgraduate') Qualification_degree = models.CharField(max_length=250, choices=Qualification_degree) Authority_type = models.CharField(max_length=250, choices=Authority_type) Qualification_title = models.CharField(max_length=250,) Qualification_authority = models.CharField(max_length=250,) Qualification_year = models.IntegerField(validators=[MinValueValidator(1960),]) Qualification_file = models.FileField(upload_to='files/%Y/%m/%d') action_creator =models.CharField(max_length=250) action_date = models.DateTimeField(null=True, blank=True, auto_now=True) def __str__(self): return ", ".join([str(self.Qualification_degree)]) def save(self, *args, **kwargs): # Get the old value of Qualification_degree old_qualification_degree = None if self.pk: old_qualification_degree = Employee_Postgraduate.objects.get(pk=self.pk).Qualification_degree # Call the parent class's save method to save the object super().save(*args, **kwargs) # Check if the Qualification_degree has been updated if old_qualification_degree != self.Qualification_degree: try: # Retrieve the points based on the selected certificate certificate_mapping = CertificatePointMapping.objects.get(certificate=self.Qualification_degree) points_to_add = certificate_mapping.points except CertificatePointMapping.DoesNotExist: points_to_add = 0 # Get or create the Evaluation object for the user evaluation, created = Evaluation.objects.get_or_create(user=self.user) # Update Qualification_degree_points with the new points evaluation.Postgraduate_points = points_to_add evaluation.save() class Meta: verbose_name="Employee_Postgraduate" @property def ex_year(self): today = datetime.now(timezone.utc) return today.year - self.Qualification_year if Employee_Postgraduate has the same new Qualification_degree do not do that evaluation, created = Evaluation.objects.get_or_create(user=self.user) # Update Qualification_degree_points with the new points evaluation.Postgraduate_points = points_to_add evaluation.save()
4393451cb9203f5ec21f316729df59cd
{ "intermediate": 0.30641964077949524, "beginner": 0.5453798174858093, "expert": 0.14820057153701782 }
19,545
I wish to be financially free ten years from now. I require 1000000 rupees annually as on date. in addition, i anticipate expenditure for education of my two children 16 and 20 years from now. The present value of the same would be 2000000 per child. i intend to buy a car after 15 years. the present value of the same would be 1500000. In addition, i wish to maintain an emergency corpus for the next 50 years equivalent to 20,00,000 rupees in today's value. Tell me the following, considering the above:-
136d89c8bf5e3d17af516130b6753972
{ "intermediate": 0.3764467239379883, "beginner": 0.286557137966156, "expert": 0.3369961082935333 }
19,546
In the Event below, How can I make this condition in the code run only once in a day : Worksheets("Daily").Range("E4:S4").ClearContents Sub CopyPA() Dim today As String today = Format(Now, "ddd") ' Get the current day ' Define the source and destination ranges Dim sourceRange As Range Dim destRange As Range Set sourceRange = Worksheets("PA").Range("A3:P3") ' Source range in the "PA" sheet ' Destination range in the "Daily" sheet ' Adjust the row number (3) according to your requirements Set destRange = Worksheets("Daily").Range("D3:S3") ' Clear the destination range and copy the format from the source range destRange.ClearContents sourceRange.Copy destRange.PasteSpecial Paste:=xlPasteFormats ' Copy the data from the source range to the destination range based on the current day Select Case today Case "Mon" sourceRange.Copy destRange Worksheets("Daily").Range("E4:S4").ClearContents Case "Tue" sourceRange.Offset(1).Copy destRange Worksheets("Daily").Range("E4:S4").ClearContents Case "Wed" sourceRange.Offset(2).Copy destRange Worksheets("Daily").Range("E4:S4").ClearContents Case "Thu" sourceRange.Offset(3).Copy destRange Worksheets("Daily").Range("E4:S4").ClearContents Case "Fri" sourceRange.Offset(4).Copy destRange Worksheets("Daily").Range("E4:S4").ClearContents End Select Application.CutCopyMode = False ' Clear the copy mode Call CopyAA End Sub
9ac033a5050401caed10a2a246271e5c
{ "intermediate": 0.5437164306640625, "beginner": 0.3168129622936249, "expert": 0.13947059214115143 }
19,547
𝑓(𝑥)=𝑥2−3𝑥+2 𝑔(𝑥)=3sin(𝑥) ℎ(𝑥)=42𝑥𝑥2+4
385ccb1e780b99055e7d50b319960207
{ "intermediate": 0.3422788679599762, "beginner": 0.31857845187187195, "expert": 0.339142769575119 }
19,548
How do I create a new Tree in Kotlin
43e49b403cd031891d24edadd9e7805a
{ "intermediate": 0.4796844720840454, "beginner": 0.12232883274555206, "expert": 0.3979867398738861 }
19,549
an arcade carcontroller C# unity
7ab1006fc8af1d4d7d776f233ea4c328
{ "intermediate": 0.40142330527305603, "beginner": 0.4779135286808014, "expert": 0.12066315859556198 }
19,550
in c# sqlite project, I am compariong two tables wit hthis code: for (int i = 0; i < originalTable.Rows.Count && tablesAreEqual; i++) { for (int j = 0; j < originalTable.Columns.Count && tablesAreEqual; j++) { if (!originalTable.Rows[i][j].Equals(importedTable.Rows[i][j]) || !(originalTable.Rows[i][j].Equals(DBNull.Value) && importedTable.Rows[i][j].Equals(""))) { tablesAreEqual = false; break; } } } And these are the values I got from debugging: importedTable.Rows[i][j] 20180101062818 object {decimal} originalTable.Rows[i][j] 20180101062818 object {decimal} originalTable.Rows[i][j].Equals(DBNull.Value) false bool importedTable.Rows[i][j].Equals("") false bool originalTable.Rows[i][j].Equals(importedTable.Rows[i][j]) true bool !originalTable.Rows[i][j].Equals(importedTable.Rows[i][j]) false bool and I don't understand why is going inside the if, if the if condition is false. Why is that?
a2627eac5e843747648b73cf0bb36548
{ "intermediate": 0.4894176721572876, "beginner": 0.30387330055236816, "expert": 0.20670902729034424 }
19,551
in a c# sqlite project, my csv importer code is importing double values wrong. My csv has the value 0,33 and it is importing 0 instead. using (SQLiteTransaction transaction = sqliteConn.BeginTransaction()) { using (SQLiteCommand command = new SQLiteCommand(sqliteConn)) { foreach (System.Data.DataRow row in dataTable.Rows) { // Create the INSERT statement System.Text.StringBuilder insertQuery = new System.Text.StringBuilder(); insertQuery.Append($"INSERT INTO {tableName} "); // Build the column names System.Text.StringBuilder cols = new System.Text.StringBuilder(); foreach (System.Data.DataColumn column in dataTable.Columns) { cols.Append($"{column.ColumnName},"); } cols = cols.Remove(cols.Length - 1, 1); insertQuery.Append($"({cols}) "); // Build the parameter placeholders System.Text.StringBuilder values = new System.Text.StringBuilder(); foreach (System.Data.DataColumn column in dataTable.Columns) { values.Append($"@param_{column.ColumnName},"); command.Parameters.AddWithValue($"@param_{column.ColumnName}", row[column]); } values = values.Remove(values.Length - 1, 1); insertQuery.Append($"VALUES({values})"); // Execute the INSERT statement command.CommandText = insertQuery.ToString(); command.ExecuteNonQuery(); } } transaction.Commit(); }
f493d2060c22bce3f1dd67aeeaf19b10
{ "intermediate": 0.4627019166946411, "beginner": 0.3762083649635315, "expert": 0.16108962893486023 }
19,552
in a c# sqlite project, my csv importer code is importing double values wrongly, value '0,33' gets 0. How can I fix it? foreach (System.Data.DataRow row in dataTable.Rows) { System.Text.StringBuilder insertQuery = new System.Text.StringBuilder(); insertQuery.Append($"INSERT INTO {tableName} "); System.Text.StringBuilder cols = new System.Text.StringBuilder(); foreach (System.Data.DataColumn column in dataTable.Columns) { cols.Append($"{column.ColumnName},"); } cols = cols.Remove(cols.Length - 1, 1); insertQuery.Append($"({cols}) "); System.Text.StringBuilder values = new System.Text.StringBuilder(); foreach (System.Data.DataColumn column in dataTable.Columns) { values.Append($"@param_{column.ColumnName},"); command.Parameters.AddWithValue($"@param_{column.ColumnName}", row[column]); } values = values.Remove(values.Length - 1, 1); insertQuery.Append($"VALUES({values})"); command.CommandText = insertQuery.ToString(); command.ExecuteNonQuery(); }
b046b94ac0f23dd73a1ed8f2f446f0b3
{ "intermediate": 0.47407832741737366, "beginner": 0.31573718786239624, "expert": 0.21018454432487488 }
19,553
in a c# sqlite project, my csv importer code is importing double values wrongly, value '0,33' gets 0. foreach (DataRow row in dataTable.Rows) { insertQuery.Append($"INSERT INTO {tableName} "); foreach (DataColumn column in dataTable.Columns) { cols.Append($"{column.ColumnName},"); } cols = cols.Remove(cols.Length - 1, 1); insertQuery.Append($"({cols}) "); foreach (DataColumn column in dataTable.Columns) { values.Append($"@param_{column.ColumnName},"); command.Parameters.AddWithValue($"@param_{column.ColumnName}", row[column]); } values = values.Remove(values.Length - 1, 1); insertQuery.Append($"VALUES({values})"); command.CommandText = insertQuery.ToString(); command.ExecuteNonQuery(); }
722dde8e695c1ed1bd51633d51843342
{ "intermediate": 0.4821086823940277, "beginner": 0.29144373536109924, "expert": 0.22644759714603424 }
19,554
in a c# sqlite project, my csv importer is importing double values wrongly, value '0,33' gets 0. foreach (DataRow row in dataTable.Rows) { insertQuery.Append($"INSERT INTO {tableName} "); foreach (DataColumn column in dataTable.Columns) { cols.Append($"{column.ColumnName},"); } cols = cols.Remove(cols.Length - 1, 1); insertQuery.Append($"({cols}) "); foreach (DataColumn column in dataTable.Columns) { values.Append($"@param_{column.ColumnName},"); command.Parameters.AddWithValue($"@param_{column.ColumnName}", row[column]); } values = values.Remove(values.Length - 1, 1); insertQuery.Append($"VALUES({values})"); command.CommandText = insertQuery.ToString(); command.ExecuteNonQuery(); }
f8ae2a99e7b2d268d5ec53a8dbe85e0f
{ "intermediate": 0.4540776312351227, "beginner": 0.30178898572921753, "expert": 0.2441333681344986 }
19,555
in a c# sqlite project, my csv importer is importing double values wrongly, value '0,33' gets 0. foreach (DataRow row in dataTable.Rows) { insertQuery.Append($"INSERT INTO {tableName} "); foreach (DataColumn column in dataTable.Columns) { cols.Append($"{column.ColumnName},"); } cols = cols.Remove(cols.Length - 1, 1); insertQuery.Append($"({cols}) "); foreach (DataColumn column in dataTable.Columns) { values.Append($"@param_{column.ColumnName},"); command.Parameters.AddWithValue($"@param_{column.ColumnName}", row[column]); } values = values.Remove(values.Length - 1, 1); insertQuery.Append($"VALUES({values})"); command.CommandText = insertQuery.ToString(); command.ExecuteNonQuery(); }
970c517a84ee944c9a9f505abc06f839
{ "intermediate": 0.4376557767391205, "beginner": 0.34625735878944397, "expert": 0.21608686447143555 }
19,556
export interface SettingsBigOrders { assets: string[]; quantity: number; quantityAssets: {[key: string]: number}; } const [settings, setSettings] = useState<SettingsBigOrders>({ assets: JSON.parse(window.localStorage.getItem("big-orders-assets") || "[]"), quantity: +(window.localStorage.getItem("big-orders-quantity") || 0), quantityAssets: JSON.parse(window.localStorage.getItem("big-orders-quantity-assets") || "{}"), }); <Autocomplete multiple disableCloseOnSelect value={Object.keys(settings.quantityAssets)} options={symbols.map(symbol => symbol)} getOptionLabel={option => option} onChange={(e, value: string[]) => { setSettings({...settings, quantityAssets: .... }) } } нужно в onChange массив value превращать в объект, где ключи это будут строки value, а значением будет 0, если такой ключ уже есть в quantityAssets, то значением должно быть значение из quantityAssets по ключу
337128b0502b28172c5dba02563ef267
{ "intermediate": 0.3756522536277771, "beginner": 0.34762296080589294, "expert": 0.27672475576400757 }
19,557
is there any way to place a "+" before inputText" and "-" before "inputText2" in a row inline like manner? <html> <head> <title>Text2Image AI</title> <style> html, body { margin: 0; padding: 0; background-color:midnightblue; color:white; } .title{ width:150px; height:64px; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at top center, #929, #519); color: brightblue; border-radius: 6px; padding: 2px; font-size: var(--font-size, 24px); font-family: var(--font-family, monospace); font-weight: var(--font-weight, bold); -webkit-text-stroke: 1px darkmagenta; text-stroke: 1px darkmagenta; white-space: nowrap; } .container { display: flex; flex-direction: column; justify-content: center; align-items: top; min-height: 0; } .control-container { display: grid; grid-template-columns: auto auto auto; grid-gap: 10px; margin:5px; align-items: center; } .input-field-container { position: relative; display: column; width: 100%; align-items: center; justify-content: center; } .inputText { grid-column: 1 / span 2; } .inputText2 { grid-column: 3; } .input-field { display:flex; width: 100%; height: 32px; box-sizing: border-box; background-color:#010130; color:#aa50ff; border:1px solid darkmagenta; border-radius:6px; margin-bottom:4px; padding:5px; align-items: center; justify-content: center; font-size: var(--font-size, 16px); font-family: var(--font-family, monospace); font-weight: var(--font-weight, bold); -webkit-text-stroke: 1px rgba(139, 0, 139, 0.5); text-stroke: 1px rgba(139, 0, 139, 1); } .gen-button-container { display: flex; align-items: center; justify-content: center; width:150px; } .gen-button { align-items: center; justify-content: center; margin: 0; background: radial-gradient(circle at top center, #929, #519); color: white; border-radius: 6px; padding: 24px; font-size: var(--font-size, 16px); font-family: var(--font-family, monospace); font-weight: var(--font-weight, bold); -webkit-text-stroke: 1px rgba(139, 0, 139, 0.5); text-stroke: 1px rgba(139, 0, 139, 1); text-shadow: 0px 0px 0.1px rgba(255, 255, 255, 1); } .image-canvas, .buffer-container { display: flex; align-items: center; position: relative; width: 100%; background: linear-gradient(to right, darkmagenta 1px, transparent 1px) 0 0, linear-gradient(to right, darkmagenta 1px, transparent 1px) 0 100%, linear-gradient(to top, darkmagenta 1px, transparent 1px) 0 0, linear-gradient(to top, darkmagenta 1px, transparent 1px) 100% 0; background-size: 25% 10%, 25% 200px, 10% 25%, 10% 25%; background-repeat: repeat-x, repeat-x, repeat-y, repeat-y; background-position: top left, bottom left, top left, top right; background-color: #010130; border-style: double dashed; border-width: 2px; border-color: darkmagenta; z-index: 1; } .image-canvas:before { content: ''; position: relative; top: 2px; left: 2px; width: calc(100% - 4px); height: calc(100% - 4px); background-color: #010130; z-index: -1; } .canvas-container { position: relative; width: 100%; max-width: 100%; height: calc(100vw / 0vh); max-height: calc(100vw / 0vh); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; z-index: 2; } .progress-bar { margin-top: 0px; margin-bottom: 5px; position: relative; width:100%; height: 10px; display: flex; border-bottom:1px inset darkmagenta; border-radius:2px; align-items: center; justify-content: center; background-color: #010130; } .progress-bar-filled { width: 0%; height: 10px; background-color: green; } .independent-container { width: 100%; position:relative; display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: flex-start; align-items: center; margin-top: -10px; background-color:#010130; color:#aabbee; border-top:1px solid darkmagenta; border-radius:1px; } .buffer-container { display: inline-table; overflow-x: scroll; margin-top: 10px; width:100%; height: 50px; background-color:#010130; margin: 0 auto; } .image-preview { width: 50px; height: 50px; object-fit: contain; } .buffer-container::-webkit-scrollbar { width: 10px; } .buffer-container::-webkit-scrollbar-thumb { background-color: darkmagenta; border-radius: 5px; } .buffer-container::-webkit-scrollbar-track { background-color: midnightblue; } </style> </head> <body> <div class='container'> <div class='control-container' style='display: flex; justify-content: space-between;'> <h1 class='title' style='margin-top: 0px;'>T2I AI UI</h1> <div class='input-field-container' style='margin-top: -10px;'> <input id='inputText' type='text' value='armoured girl riding an armored cock' class='input-field inputText'> <input id='inputText2' type='text' value='armoured girl riding an armored cock' class='input-field inputText2'> </div> <div class='gen-button-container'> <button onclick='generateImage()' class='gen-button' style='border-style:none;margin-bottom: 14px;'>Process</button> </div> </div> <div class='independent-container'style='margin-top: -15px;'> <label for='autoQueueCheckbox' style='margin-left: 10px;margin-right: 5px;'>Auto Queue:</label> <input type='checkbox' id='autoQueueCheckbox' onchange='autoQueueChanged()'> <label for='intervalInput' style='margin-left: 10px;margin-right: 5px;'>Interval (sec):</label> <input type='number' id='intervalInput' value='10' min='1' max='300' style='width: 64px;height: 16px; background-color:#010130; color:#aabbee; border-top:1px solid darkmagenta; border-radius:6px;'> </div> <div class='progress-bar'> <div class='progress-bar-filled'></div> </div> <div class='canvas-container'> <canvas id='imageCanvas' class='image-canvas'></canvas> <h2 class='title' style='width:100%;margin-bottom: 10px;margin-top: 10px;display:flex;align-items: flex-start;justify-content: center;'>Gallery:</h2> <div class='buffer-container'></div> </div> <script> ... </script> </body> </html>
70acb1beca35d2052abcb5cdec79905c
{ "intermediate": 0.2910532057285309, "beginner": 0.328001469373703, "expert": 0.3809452950954437 }
19,558
you are a data analyst, please look up sample data that grade field is higher than 80 and then output matching data as table format, the sample data is a json format and they are [{'Id': 1, 'Name': 'Bob_1', 'Grade': 85}, {'Id': 2, 'Name': 'Bob_2', 'Grade': 71}, {'Id': 3, 'Name': 'Bob_3', 'Grade': 81}]
5556c7eadb2bbd241c11b75a45b21698
{ "intermediate": 0.45354369282722473, "beginner": 0.1692514717578888, "expert": 0.37720486521720886 }
19,559
you are a data analyst, please look up sample data that grade field is higher than 80 and then output matching data as table format, the sample data is a json format and they are [{'Id': 1, 'Name': 'Bob_1', 'Grade': 85}, {'Id': 2, 'Name': 'Bob_2', 'Grade': 71}, {'Id': 3, 'Name': 'Bob_3', 'Grade': 81}]
66c330485586f31a183d072858398c20
{ "intermediate": 0.45354369282722473, "beginner": 0.1692514717578888, "expert": 0.37720486521720886 }
19,560
#!/usr/bin/python import requests import json import sys url = "http://hrsearch.jd.com/search/byKey" payload = [{"searchKey":"zongyue1","page":1,"pageSize":20,"searchIndex":"ehr-person*"}] headers = { 'sso.jd.com': 'BJ.14E22D2CF49C82855B42C7EB6022DEDC.4120230905094533', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) parsed = json.loads(response.text) print(json.dumps(parsed,indent=4,ensure_ascii=False)) 这个程序有什么问题
9c94fa342060e892d5beaf4ab02600dc
{ "intermediate": 0.4103632867336273, "beginner": 0.290299654006958, "expert": 0.2993370592594147 }
19,561
To write a piece of code, the requirements are as follows: 1. Screening data: retention date, physician ID and account balance, and screening data with non-duplicate patient ID numbers. 2. Count whether the patient ID of every day received by each doctor ID appears in the next 14 days. If it does, regardless of the number of times it appears, it will be recorded as 1, and the follow-up rate will be calculated = the total number of patient IDs received by the doctor on the same day/the total number of patients received by the doctor on the same day. 3. Calculate the membership rate = the total number of accounts with a balance greater than or equal to 0 corresponding to the patient ID admitted by the doctor/the total number of people admitted by the doctor that day.
475867e2f0bcefef40acf851deb34f25
{ "intermediate": 0.3151088058948517, "beginner": 0.25963109731674194, "expert": 0.42526009678840637 }
19,562
C#同过System.Threading.Thread.Sleep做Delay功能
e75d334593d785ede61863a222ad39df
{ "intermediate": 0.4177655875682831, "beginner": 0.3509078621864319, "expert": 0.23132649064064026 }
19,563
create table Patients (ID int, Name varchar(20), Date date, ShotAmount int) insert into Patients values (101, 'Anna', '2022-01-01', 80), (101, 'Anna', '2022-01-05', 75), (101, 'Anna', '2022-01-10', 90), (101, 'Anna', '2023-01-01', 81), (101, 'Anna', '2023-01-06', 86), (101, 'Anna', '2023-01-15', 80), (102, 'Nancy', '2022-01-01', 80), (102, 'Nancy', '2022-01-05', 75), (102, 'Nancy', '2022-01-18', 90), (102, 'Nancy', '2023-01-01', 81), (102, 'Nancy', '2023-01-06', 86), (102, 'Nancy', '2023-01-11', 80), (103, 'Alli', '2022-01-09', 80), (103, 'Alli', '2022-01-11', 75), (103, 'Alli', '2022-01-30', 90), (103, 'Alli', '2023-01-04', 81), (103, 'Alli', '2023-01-14', 86), (103, 'Alli', '2023-01-28', 80) select * from Patients
e00b2bf6f29849d5192c190b22df9d52
{ "intermediate": 0.3693380355834961, "beginner": 0.3469645380973816, "expert": 0.2836973965167999 }
19,564
for each customer the least amount of shots' all information for each month.
d3b4759e3fbd7d5255b384b0ff63321b
{ "intermediate": 0.36598727107048035, "beginner": 0.28698232769966125, "expert": 0.3470304012298584 }
19,565
for each customer the second least amount of shots' all information for each month.
90e76348bc38279baca2b1231f813582
{ "intermediate": 0.37460482120513916, "beginner": 0.2791178822517395, "expert": 0.34627723693847656 }
19,566
DAX command to converrt a date to include week number
beb8d2ad4520787d9fb74a754c102ef4
{ "intermediate": 0.3561926782131195, "beginner": 0.20131729543209076, "expert": 0.44248995184898376 }
19,567
Microsoft excel
60f38e95fd847152ed7a6fbe184be5d8
{ "intermediate": 0.3467850685119629, "beginner": 0.243940070271492, "expert": 0.4092748761177063 }
19,568
In React.js is there a way to activate hover effect on one tag if user hovers another tag ?
7fec6de607e76c075242c6bbe79d2152
{ "intermediate": 0.6973280906677246, "beginner": 0.14478346705436707, "expert": 0.1578884720802307 }
19,569
How to put two "cvitem" next to each other in a LaTeX document ?
be449999da46504d38744d9f44773630
{ "intermediate": 0.3290201425552368, "beginner": 0.29439079761505127, "expert": 0.3765890300273895 }
19,570
Previous ChatGPT session: "1) How long does it typically take for one confirmation to be processed? How long does it typically take for six confirmations to be processed? 2) How does one determine the amount of confirmations using Solidity (in an Ethereum smart contract)? 1) The time it takes for one confirmation to be processed on the Ethereum network can vary depending on network conditions, gas price, and block propagation time. On average, it can take around 15 seconds to a few minutes for a transaction to receive its first confirmation. The time it takes for six confirmations to be processed generally ranges from a few minutes to around 30 minutes, again depending on the network conditions. 2) The determination of the required number of confirmations in an Ethereum smart contract is typically subjective and dependent on the specific requirements of the contract. It involves considering factors like the sensitivity of the contract’s operations, the value of the transactions being processed, and the desired level of security. In Solidity, there are no predefined methods to directly determine the number of confirmations a transaction has. Instead, developers need to implement their own logic to track and verify the confirmations received by monitoring the blockchain’s state and events related to the specific transaction. This can be achieved by storing the transaction hash and checking its inclusion in different blocks as confirmations increase. " Redo 1, but be more specific with the number intervals. Also, for 2, show some concise code for how that could be done.
4c744954db1dac095fdd4e29e492861e
{ "intermediate": 0.4465413987636566, "beginner": 0.29042041301727295, "expert": 0.26303815841674805 }
19,571
write mysql code that copies an innodb dataabase to one with a new name
10748e8cd6806b5bcfcdd75d1e3259f5
{ "intermediate": 0.5116414427757263, "beginner": 0.17856760323047638, "expert": 0.3097909390926361 }
19,572
Do you know what my problem is?: cd /home/user/NetBeansProjects/HibernateLearningVideos03And04; JAVA_HOME=/app/jdk /app/netbeans/java/maven/bin/mvn -Dexec.vmArgs= "-Dexec.args=${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}" -Dexec.executable=/app/jdk/bin/java -Dexec.mainClass=com.mycompany.hibernatelearningvideos03and04.client.ClientCode -Dexec.classpathScope=runtime -Dexec.appArgs= process-classes org.codehaus.mojo:exec-maven-plugin:3.1.0:exec Scanning for projects... ------------< com.mycompany:HibernateLearningVideos03And04 >------------ Building HibernateLearningVideos03And04 1.0-SNAPSHOT from pom.xml --------------------------------[ jar ]--------------------------------- --- resources:3.3.0:resources (default-resources) @ HibernateLearningVideos03And04 --- Copying 1 resource --- compiler:3.10.1:compile (default-compile) @ HibernateLearningVideos03And04 --- Changes detected - recompiling the module! Compiling 3 source files to /home/user/NetBeansProjects/HibernateLearningVideos03And04/target/classes /home/user/NetBeansProjects/HibernateLearningVideos03And04/src/main/java/com/mycompany/hibernatelearningvideos03and04/client/ClientCode.java: /home/user/NetBeansProjects/HibernateLearningVideos03And04/src/main/java/com/mycompany/hibernatelearningvideos03and04/client/ClientCode.java uses or overrides a deprecated API. /home/user/NetBeansProjects/HibernateLearningVideos03And04/src/main/java/com/mycompany/hibernatelearningvideos03and04/client/ClientCode.java: Recompile with -Xlint:deprecation for details. --- exec:3.1.0:exec (default-cli) @ HibernateLearningVideos03And04 --- Hello World! Sep. 06, 2023 1:32:28 A.M. org.hibernate.Version logVersion INFO: HHH000412: Hibernate ORM core version 6.2.7.Final Sep. 06, 2023 1:32:28 A.M. org.hibernate.cfg.Environment <clinit> INFO: HHH000406: Using bytecode reflection optimizer org.hibernate.boot.MappingNotFoundException: Mapping (RESOURCE) not found : com/mycompany/hibernatelearningvideos03and04/model/student.hbm.xml : origin(com/mycompany/hibernatelearningvideos03and04/model/student.hbm.xml) at org.hibernate.boot.jaxb.internal.XmlSources.fromResource(XmlSources.java:48) at org.hibernate.boot.MetadataSources.addResource(MetadataSources.java:329) at org.hibernate.cfg.Configuration.addResource(Configuration.java:619) at com.mycompany.hibernatelearningvideos03and04.util.HibernateUtil.<clinit>(HibernateUtil.java:20) at com.mycompany.hibernatelearningvideos03and04.client.ClientCode.main(ClientCode.java:18) ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 6.568 s Finished at: 2023-09-06T01:32:29-04:00 ------------------------------------------------------------------------
cb3e4c2d1922c1db327fcd191424648f
{ "intermediate": 0.41275128722190857, "beginner": 0.3644697666168213, "expert": 0.22277890145778656 }
19,573
analyze this code. the request to the backend api (text2image AI model) should be sent only once per in auto-queue radiobutton checked and interval in seconds specified inside input field, also a manual button update. because I see that on window resize it got auto-queued the backend, which is not right. set all timings and calculation formula correctly. output fixed modified full javascript.: const modelUrl = 'https://api-inference.huggingface.co/models/hogiahien/counterfeit-v30-edited'; const modelToken = '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'; const progressBarFilled = document.querySelector('.progress-bar-filled'); const imageCanvas = document.getElementById('imageCanvas'); const ctx = imageCanvas.getContext('2d'); let estimatedTime = 0; let isGenerating = false; let generateInterval; const galleryArray = []; const bufferContainer = document.querySelector('.buffer-container'); const container = document.querySelector('.canvas-container'); const canvas = document.getElementById('imageCanvas'); bufferContainer.addEventListener('click', handleImageClick); window.addEventListener('resize', handleResize); document.addEventListener('DOMContentLoaded', function() { handleResize(); generateImage(); }); function handleImageClick(e) { const target = e.target; if (target.tagName === 'IMG') { const fullWindowDiv = document.createElement('div'); const fullWindowImg = document.createElement('img'); fullWindowDiv.style.position = 'fixed'; fullWindowDiv.style.top = '0'; fullWindowDiv.style.left = '0'; fullWindowDiv.style.width = '100%'; fullWindowDiv.style.height = '100%'; fullWindowDiv.style.background = 'linear-gradient(to bottom right, rgba(39, 0, 39, 0.6), rgba(155, 0, 155, 0.6))'; fullWindowDiv.style.display = 'flex'; fullWindowDiv.style.zIndex = '2'; fullWindowDiv.style.justifyContent = 'center'; fullWindowDiv.style.alignItems = 'center'; fullWindowImg.style.maxHeight = '90vh'; fullWindowImg.style.maxWidth = '90vw'; fullWindowImg.src = target.src; fullWindowDiv.addEventListener('click', function() { document.body.removeChild(fullWindowDiv); }); document.body.appendChild(fullWindowDiv); fullWindowDiv.appendChild(fullWindowImg); } } async function query(data) { const response = await fetch(modelUrl, { headers: { Authorization: "Bearer " + modelToken }, method: 'POST', body: JSON.stringify(data) }); const headers = response.headers; const estimatedTimeString = headers.get('estimated_time'); estimatedTime = parseFloat(estimatedTimeString) * 10000; const result = await response.blob(); return result; } function autoQueueChanged() { clearInterval(generateInterval); const autoQueueActive = document.getElementById('autoQueueCheckbox').checked; if (autoQueueActive) { const interval = parseInt(document.getElementById('intervalInput').value) * 10000; generateInterval = setInterval(generateImage, interval); } } function generateImage() { if (isGenerating) { return; } isGenerating = true; const inputText = document.getElementById('inputText').value; progressBarFilled.style.width = '0%'; progressBarFilled.style.backgroundColor = 'green'; setTimeout(() => { const startTime = Date.now(); const timeLeft = Math.floor(estimatedTime / 10000); const interval = setInterval(function() { if (isGenerating) { const elapsedTime = Math.floor((Date.now() - startTime) / 10000); const progress = Math.floor((elapsedTime / timeLeft) * 10000); progressBarFilled.style.width = progress + '%'; } }, 10000); const cacheBuster = new Date().getTime(); query({ inputs: inputText, cacheBuster }) .then(response => { const url = URL.createObjectURL(response); let img = new Image(); img.classList.add('image-preview'); img.src = url; img.onload = function() { galleryArray.push(img); bufferContainer.appendChild(img); const imageWidth = img.naturalWidth; const imageHeight = img.naturalHeight; const aspectRatio = img.width / img.height; const containerWidth = container.clientWidth; const containerHeight = container.clientHeight; const minAvailableWidth = containerWidth; const maxAvailableHeight = containerHeight; let canvasWidth = containerWidth; let canvasHeight = maxAvailableHeight; if (aspectRatio > 1) { canvasWidth = containerWidth; canvasHeight = containerWidth / aspectRatio; if (canvasHeight > maxAvailableHeight) { canvasHeight = maxAvailableHeight; canvasWidth = canvasHeight * aspectRatio; } } else { canvasWidth = maxAvailableHeight * aspectRatio; canvasHeight = maxAvailableHeight; if (canvasWidth > containerWidth) { canvasWidth = containerWidth; canvasHeight = canvasWidth / aspectRatio; } } imageCanvas.width = canvasWidth; imageCanvas.height = canvasHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); galleryArray.forEach((image) => { const imageWidth = image.naturalWidth; const imageHeight = image.naturalHeight; const aspectRatio = imageWidth / imageHeight; let canvasImageWidth = canvasWidth; let canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } const x = (canvas.width - canvasImageWidth) / 2; const y = (canvas.height - canvasImageHeight) / 2; ctx.drawImage(image, x, y, canvasImageWidth, canvasImageHeight); }); }; img.src = url; clearInterval(interval); progressBarFilled.style.width = '100%'; progressBarFilled.style.background = 'linear-gradient(to bottom right, rgba(39, 0, 39, 0.5), rgb(155, 0, 155))'; isGenerating = false; }) .catch(error => { console.error(error); }); }, 10000); } let isResizing = false; function handleResize() { if (isResizing) return; isResizing = true; requestAnimationFrame(() => { generateImage(); const containerWidth = container.clientWidth; const containerHeight = container.clientHeight; const aspectRatio = canvas.width / canvas.height; let canvasWidth = containerWidth; let canvasHeight = containerWidth / aspectRatio; if (canvasHeight > containerHeight) { canvasHeight = containerHeight; canvasWidth = canvasHeight * aspectRatio; } canvas.width = canvasWidth; canvas.height = canvasHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); var bufferContainer = document.querySelector('.buffer-container'); bufferContainer.style.width = '' + canvasWidth + 'px'; galleryArray.forEach(function(image) { if (image.classList.contains('image-canvas')) { // Only resize the .image-preview elements var imageWidth = image.naturalWidth; var imageHeight = image.naturalHeight; var aspectRatio = imageWidth / imageHeight; var canvasImageWidth = canvasWidth; var canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } image.style.width = '' + canvasImageWidth + 'px'; image.style.height = '' + canvasImageHeight + 'px'; } }); galleryArray.forEach((image) => { const imageWidth = image.naturalWidth; const imageHeight = image.naturalHeight; const aspectRatio = imageWidth / imageHeight; let canvasImageWidth = canvasWidth; let canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } const x = (canvas.width - canvasImageWidth) / 2; const y = (canvas.height - canvasImageHeight) / 2; ctx.drawImage(image, x, y, canvasImageWidth, canvasImageHeight); }); isResizing = false; }); }
fa6f82846c5da1f2d51971c8f294377b
{ "intermediate": 0.342563271522522, "beginner": 0.4072013199329376, "expert": 0.250235378742218 }
19,574
fix and analyze this code. the request to the backend api (text2image AI model) should be sent only once per in auto-queue radiobutton checked and interval in seconds specified inside input field, also a manual button update. because I see that on window resize it got auto-queued the backend, which is not right. set all timings and calculation formula correctly. output fixed modified full javascript.: const modelUrl = 'https://api-inference.huggingface.co/models/hogiahien/counterfeit-v30-edited'; const modelToken = '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'; const progressBarFilled = document.querySelector('.progress-bar-filled'); const imageCanvas = document.getElementById('imageCanvas'); const ctx = imageCanvas.getContext('2d'); let estimatedTime = 0; let isGenerating = false; let generateInterval; const galleryArray = []; const bufferContainer = document.querySelector('.buffer-container'); const container = document.querySelector('.canvas-container'); const canvas = document.getElementById('imageCanvas'); bufferContainer.addEventListener('click', handleImageClick); window.addEventListener('resize', handleResize); document.addEventListener('DOMContentLoaded', function() { handleResize(); generateImage(); }); function handleImageClick(e) { const target = e.target; if (target.tagName === 'IMG') { const fullWindowDiv = document.createElement('div'); const fullWindowImg = document.createElement('img'); fullWindowDiv.style.position = 'fixed'; fullWindowDiv.style.top = '0'; fullWindowDiv.style.left = '0'; fullWindowDiv.style.width = '100%'; fullWindowDiv.style.height = '100%'; fullWindowDiv.style.background = 'linear-gradient(to bottom right, rgba(39, 0, 39, 0.6), rgba(155, 0, 155, 0.6))'; fullWindowDiv.style.display = 'flex'; fullWindowDiv.style.zIndex = '2'; fullWindowDiv.style.justifyContent = 'center'; fullWindowDiv.style.alignItems = 'center'; fullWindowImg.style.maxHeight = '90vh'; fullWindowImg.style.maxWidth = '90vw'; fullWindowImg.src = target.src; fullWindowDiv.addEventListener('click', function() { document.body.removeChild(fullWindowDiv); }); document.body.appendChild(fullWindowDiv); fullWindowDiv.appendChild(fullWindowImg); } } async function query(data) { const response = await fetch(modelUrl, { headers: { Authorization: "Bearer " + modelToken }, method: 'POST', body: JSON.stringify(data) }); const headers = response.headers; const estimatedTimeString = headers.get('estimated_time'); estimatedTime = parseFloat(estimatedTimeString) * 10000; const result = await response.blob(); return result; } function autoQueueChanged() { clearInterval(generateInterval); const autoQueueActive = document.getElementById('autoQueueCheckbox').checked; if (autoQueueActive) { const interval = parseInt(document.getElementById('intervalInput').value) * 10000; generateInterval = setInterval(generateImage, interval); } } function generateImage() { if (isGenerating) { return; } isGenerating = true; const inputText = document.getElementById('inputText').value; progressBarFilled.style.width = '0%'; progressBarFilled.style.backgroundColor = 'green'; setTimeout(() => { const startTime = Date.now(); const timeLeft = Math.floor(estimatedTime / 10000); const interval = setInterval(function() { if (isGenerating) { const elapsedTime = Math.floor((Date.now() - startTime) / 10000); const progress = Math.floor((elapsedTime / timeLeft) * 10000); progressBarFilled.style.width = progress + '%'; } }, 10000); const cacheBuster = new Date().getTime(); query({ inputs: inputText, cacheBuster }) .then(response => { const url = URL.createObjectURL(response); let img = new Image(); img.classList.add('image-preview'); img.src = url; img.onload = function() { galleryArray.push(img); bufferContainer.appendChild(img); const imageWidth = img.naturalWidth; const imageHeight = img.naturalHeight; const aspectRatio = img.width / img.height; const containerWidth = container.clientWidth; const containerHeight = container.clientHeight; const minAvailableWidth = containerWidth; const maxAvailableHeight = containerHeight; let canvasWidth = containerWidth; let canvasHeight = maxAvailableHeight; if (aspectRatio > 1) { canvasWidth = containerWidth; canvasHeight = containerWidth / aspectRatio; if (canvasHeight > maxAvailableHeight) { canvasHeight = maxAvailableHeight; canvasWidth = canvasHeight * aspectRatio; } } else { canvasWidth = maxAvailableHeight * aspectRatio; canvasHeight = maxAvailableHeight; if (canvasWidth > containerWidth) { canvasWidth = containerWidth; canvasHeight = canvasWidth / aspectRatio; } } imageCanvas.width = canvasWidth; imageCanvas.height = canvasHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); galleryArray.forEach((image) => { const imageWidth = image.naturalWidth; const imageHeight = image.naturalHeight; const aspectRatio = imageWidth / imageHeight; let canvasImageWidth = canvasWidth; let canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } const x = (canvas.width - canvasImageWidth) / 2; const y = (canvas.height - canvasImageHeight) / 2; ctx.drawImage(image, x, y, canvasImageWidth, canvasImageHeight); }); }; img.src = url; clearInterval(interval); progressBarFilled.style.width = '100%'; progressBarFilled.style.background = 'linear-gradient(to bottom right, rgba(39, 0, 39, 0.5), rgb(155, 0, 155))'; isGenerating = false; }) .catch(error => { console.error(error); }); }, 10000); } let isResizing = false; function handleResize() { if (isResizing) return; isResizing = true; requestAnimationFrame(() => { generateImage(); const containerWidth = container.clientWidth; const containerHeight = container.clientHeight; const aspectRatio = canvas.width / canvas.height; let canvasWidth = containerWidth; let canvasHeight = containerWidth / aspectRatio; if (canvasHeight > containerHeight) { canvasHeight = containerHeight; canvasWidth = canvasHeight * aspectRatio; } canvas.width = canvasWidth; canvas.height = canvasHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); var bufferContainer = document.querySelector('.buffer-container'); bufferContainer.style.width = '' + canvasWidth + 'px'; galleryArray.forEach(function(image) { if (image.classList.contains('image-canvas')) { // Only resize the .image-preview elements var imageWidth = image.naturalWidth; var imageHeight = image.naturalHeight; var aspectRatio = imageWidth / imageHeight; var canvasImageWidth = canvasWidth; var canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } image.style.width = '' + canvasImageWidth + 'px'; image.style.height = '' + canvasImageHeight + 'px'; } }); galleryArray.forEach((image) => { const imageWidth = image.naturalWidth; const imageHeight = image.naturalHeight; const aspectRatio = imageWidth / imageHeight; let canvasImageWidth = canvasWidth; let canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } const x = (canvas.width - canvasImageWidth) / 2; const y = (canvas.height - canvasImageHeight) / 2; ctx.drawImage(image, x, y, canvasImageWidth, canvasImageHeight); }); isResizing = false; }); }
cfae45ddc2586aa52f768e0ac009353f
{ "intermediate": 0.3714473247528076, "beginner": 0.4225032925605774, "expert": 0.20604932308197021 }
19,575
fix and analyze this code. the request to the backend api (text2image AI model) should be sent only once per in auto-queue radiobutton checked and interval in seconds specified inside input field, also a manual button update. because I see that on window resize it got auto-queued the backend, which is not right. set all timings and calculation formula correctly. output fixed modified full javascript.: const modelUrl = 'https://api-inference.huggingface.co/models/hogiahien/counterfeit-v30-edited'; const modelToken = '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'; const progressBarFilled = document.querySelector('.progress-bar-filled'); const imageCanvas = document.getElementById('imageCanvas'); const ctx = imageCanvas.getContext('2d'); let estimatedTime = 0; let isGenerating = false; let generateInterval; const galleryArray = []; const bufferContainer = document.querySelector('.buffer-container'); const container = document.querySelector('.canvas-container'); const canvas = document.getElementById('imageCanvas'); bufferContainer.addEventListener('click', handleImageClick); window.addEventListener('resize', handleResize); document.addEventListener('DOMContentLoaded', function() { handleResize(); generateImage(); }); function handleImageClick(e) { const target = e.target; if (target.tagName === 'IMG') { const fullWindowDiv = document.createElement('div'); const fullWindowImg = document.createElement('img'); fullWindowDiv.style.position = 'fixed'; fullWindowDiv.style.top = '0'; fullWindowDiv.style.left = '0'; fullWindowDiv.style.width = '100%'; fullWindowDiv.style.height = '100%'; fullWindowDiv.style.background = 'linear-gradient(to bottom right, rgba(39, 0, 39, 0.6), rgba(155, 0, 155, 0.6))'; fullWindowDiv.style.display = 'flex'; fullWindowDiv.style.zIndex = '2'; fullWindowDiv.style.justifyContent = 'center'; fullWindowDiv.style.alignItems = 'center'; fullWindowImg.style.maxHeight = '90vh'; fullWindowImg.style.maxWidth = '90vw'; fullWindowImg.src = target.src; fullWindowDiv.addEventListener('click', function() { document.body.removeChild(fullWindowDiv); }); document.body.appendChild(fullWindowDiv); fullWindowDiv.appendChild(fullWindowImg); } } async function query(data) { const response = await fetch(modelUrl, { headers: { Authorization: "Bearer " + modelToken }, method: 'POST', body: JSON.stringify(data) }); const headers = response.headers; const estimatedTimeString = headers.get('estimated_time'); estimatedTime = parseFloat(estimatedTimeString) * 10000; const result = await response.blob(); return result; } function autoQueueChanged() { clearInterval(generateInterval); const autoQueueActive = document.getElementById('autoQueueCheckbox').checked; if (autoQueueActive) { const interval = parseInt(document.getElementById('intervalInput').value) * 10000; generateInterval = setInterval(generateImage, interval); } } function generateImage() { if (isGenerating) { return; } isGenerating = true; const inputText = document.getElementById('inputText').value; progressBarFilled.style.width = '0%'; progressBarFilled.style.backgroundColor = 'green'; setTimeout(() => { const startTime = Date.now(); const timeLeft = Math.floor(estimatedTime / 10000); const interval = setInterval(function() { if (isGenerating) { const elapsedTime = Math.floor((Date.now() - startTime) / 10000); const progress = Math.floor((elapsedTime / timeLeft) * 10000); progressBarFilled.style.width = progress + '%'; } }, 10000); const cacheBuster = new Date().getTime(); query({ inputs: inputText, cacheBuster }) .then(response => { const url = URL.createObjectURL(response); let img = new Image(); img.classList.add('image-preview'); img.src = url; img.onload = function() { galleryArray.push(img); bufferContainer.appendChild(img); const imageWidth = img.naturalWidth; const imageHeight = img.naturalHeight; const aspectRatio = img.width / img.height; const containerWidth = container.clientWidth; const containerHeight = container.clientHeight; const minAvailableWidth = containerWidth; const maxAvailableHeight = containerHeight; let canvasWidth = containerWidth; let canvasHeight = maxAvailableHeight; if (aspectRatio > 1) { canvasWidth = containerWidth; canvasHeight = containerWidth / aspectRatio; if (canvasHeight > maxAvailableHeight) { canvasHeight = maxAvailableHeight; canvasWidth = canvasHeight * aspectRatio; } } else { canvasWidth = maxAvailableHeight * aspectRatio; canvasHeight = maxAvailableHeight; if (canvasWidth > containerWidth) { canvasWidth = containerWidth; canvasHeight = canvasWidth / aspectRatio; } } imageCanvas.width = canvasWidth; imageCanvas.height = canvasHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); galleryArray.forEach((image) => { const imageWidth = image.naturalWidth; const imageHeight = image.naturalHeight; const aspectRatio = imageWidth / imageHeight; let canvasImageWidth = canvasWidth; let canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } const x = (canvas.width - canvasImageWidth) / 2; const y = (canvas.height - canvasImageHeight) / 2; ctx.drawImage(image, x, y, canvasImageWidth, canvasImageHeight); }); }; img.src = url; clearInterval(interval); progressBarFilled.style.width = '100%'; progressBarFilled.style.background = 'linear-gradient(to bottom right, rgba(39, 0, 39, 0.5), rgb(155, 0, 155))'; isGenerating = false; }) .catch(error => { console.error(error); }); }, 10000); } let isResizing = false; function handleResize() { if (isResizing) return; isResizing = true; requestAnimationFrame(() => { generateImage(); const containerWidth = container.clientWidth; const containerHeight = container.clientHeight; const aspectRatio = canvas.width / canvas.height; let canvasWidth = containerWidth; let canvasHeight = containerWidth / aspectRatio; if (canvasHeight > containerHeight) { canvasHeight = containerHeight; canvasWidth = canvasHeight * aspectRatio; } canvas.width = canvasWidth; canvas.height = canvasHeight; ctx.clearRect(0, 0, canvas.width, canvas.height); var bufferContainer = document.querySelector('.buffer-container'); bufferContainer.style.width = '' + canvasWidth + 'px'; galleryArray.forEach(function(image) { if (image.classList.contains('image-canvas')) { // Only resize the .image-preview elements var imageWidth = image.naturalWidth; var imageHeight = image.naturalHeight; var aspectRatio = imageWidth / imageHeight; var canvasImageWidth = canvasWidth; var canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } image.style.width = '' + canvasImageWidth + 'px'; image.style.height = '' + canvasImageHeight + 'px'; } }); galleryArray.forEach((image) => { const imageWidth = image.naturalWidth; const imageHeight = image.naturalHeight; const aspectRatio = imageWidth / imageHeight; let canvasImageWidth = canvasWidth; let canvasImageHeight = canvasWidth / aspectRatio; if (canvasImageHeight > canvasHeight) { canvasImageHeight = canvasHeight; canvasImageWidth = canvasHeight * aspectRatio; } const x = (canvas.width - canvasImageWidth) / 2; const y = (canvas.height - canvasImageHeight) / 2; ctx.drawImage(image, x, y, canvasImageWidth, canvasImageHeight); }); isResizing = false; }); }
88460556b1390d02345306a81e64187e
{ "intermediate": 0.3714473247528076, "beginner": 0.4225032925605774, "expert": 0.20604932308197021 }
19,576
Find what the problem is.: cd /home/user/NetBeansProjects/HibernateLearningVideos03And04; JAVA_HOME=/app/jdk /app/netbeans/java/maven/bin/mvn -Dexec.vmArgs= "-Dexec.args=${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}" -Dexec.executable=/app/jdk/bin/java -Dexec.mainClass=com.mycompany.hibernatelearningvideos03and04.client.ClientCode -Dexec.classpathScope=runtime -Dexec.appArgs= process-classes org.codehaus.mojo:exec-maven-plugin:3.1.0:exec Scanning for projects... ------------< com.mycompany:HibernateLearningVideos03And04 >------------ Building HibernateLearningVideos03And04 1.0-SNAPSHOT from pom.xml --------------------------------[ jar ]--------------------------------- --- resources:3.3.0:resources (default-resources) @ HibernateLearningVideos03And04 --- Copying 1 resource --- compiler:3.10.1:compile (default-compile) @ HibernateLearningVideos03And04 --- Nothing to compile - all classes are up to date --- exec:3.1.0:exec (default-cli) @ HibernateLearningVideos03And04 --- Hello World! Sep. 06, 2023 2:20:35 A.M. org.hibernate.Version logVersion INFO: HHH000412: Hibernate ORM core version 6.2.7.Final Sep. 06, 2023 2:20:35 A.M. org.hibernate.cfg.Environment <clinit> INFO: HHH000406: Using bytecode reflection optimizer org.hibernate.boot.MappingNotFoundException: Mapping (RESOURCE) not found : com/mycompany/hibernatelearningvideos03and04/model/student.hbm.xml : origin(com/mycompany/hibernatelearningvideos03and04/model/student.hbm.xml) at org.hibernate.boot.jaxb.internal.XmlSources.fromResource(XmlSources.java:48) at org.hibernate.boot.MetadataSources.addResource(MetadataSources.java:329) at org.hibernate.cfg.Configuration.addResource(Configuration.java:619) at com.mycompany.hibernatelearningvideos03and04.util.HibernateUtil.<clinit>(HibernateUtil.java:20) at com.mycompany.hibernatelearningvideos03and04.client.ClientCode.main(ClientCode.java:18) ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 6.110 s Finished at: 2023-09-06T02:20:36-04:00 ------------------------------------------------------------------------ and /* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license */ package com.mycompany.hibernatelearningvideos03and04.client; import com.mycompany.hibernatelearningvideos03and04.model.Student; import com.mycompany.hibernatelearningvideos03and04.util.HibernateUtil; import org.hibernate.Session; import org.hibernate.Transaction; public class ClientCode { public static void main(String[] args) { System.out.println("Hello World!"); Transaction tx = null; try { Session session = HibernateUtil.getSessionFactory().openSession(); Student st = new Student(); st.setId(1); st.setName("Hibernate"); st.setEmail("hibernate@123"); st.setPhone(12345); session.save(st); } catch(Exception e) { // } } } and <?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name = "Student" table = "students"> <id name = "id" type = "int" column = "id"> <generator class="increment"/> </id> <property name = "name" column = "name" type = "string"/> <property name = "email" column = "email"/> <!-- No need to explicitly state string type. --> <property name = "phone" column = "phone" type = "Long"/> </class> </hibernate-mapping> and <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- Database connection settings --> <property name="connection.driver_class">org.sqlite.JDBC</property> <property name="connection.url">jdbc:sqlite:mydatabaseyo.sqlite</property> <!-- SQL dialect for SQLite --> <!-- <property name="dialect">org.hibernate.dialect.SQLiteDialect</property> --> <property name="hibernate.dialect">org.hibernate.community.dialect.SQLiteDialect</property> <!-- <property name="hibernate.dialect">org.hibernate.dialect.SQLiteDialect</property> --> <mapping resource="com/mycompany/hibernatelearningvideos03and04/model/student.hbm.xml"/> </session-factory> </hibernate-configuration> and <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany</groupId> <artifactId>HibernateLearningVideos03And04</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> <exec.mainClass>com.mycompany.hibernatelearningvideos03and04.HibernateLearningVideos03And04</exec.mainClass> </properties> <dependencies> <!-- https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-core --> <dependency> <groupId>org.hibernate.orm</groupId> <artifactId>hibernate-core</artifactId> <version>6.2.7.Final</version> </dependency> <!--https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc--> <dependency> <groupId>org.xerial</groupId> <artifactId>sqlite-jdbc</artifactId> <version>3.42.0.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-community-dialects --> <dependency> <groupId>org.hibernate.orm</groupId> <artifactId>hibernate-community-dialects</artifactId> <version>6.2.7.Final</version> </dependency> </dependencies> </project> and /* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template */ package com.mycompany.hibernatelearningvideos03and04.util; import org.hibernate.SessionFactory; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; public class HibernateUtil { private static SessionFactory sessionFactory; static { if(sessionFactory == null) { try { Configuration cfg = new Configuration().configure(); ///home/user/NetBeansProjects/HibernateLearningVideos03And04/src/main/java/ cfg.addResource("com/mycompany/hibernatelearningvideos03and04/model/student.hbm.xml"); StandardServiceRegistry ssRegistry = new StandardServiceRegistryBuilder().applySettings(cfg.getProperties()).build(); sessionFactory = cfg.buildSessionFactory(ssRegistry); } catch(Exception e) { e.printStackTrace(); } } } public static SessionFactory getSessionFactory() { return sessionFactory; } } and /* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template */ package com.mycompany.hibernatelearningvideos03and04.model; /** * * @author user */ public class Student { private int id; private String name; private String email; private long phone; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public long getPhone() { return phone; } public void setPhone(long phone) { this.phone = phone; } }
850ff1327c502f8781c7965876f57764
{ "intermediate": 0.306549996137619, "beginner": 0.4534800946712494, "expert": 0.23996984958648682 }
19,577
CachedRowSetImpl java 11
479b0e1d07fe21d44ad697561b2d4ac7
{ "intermediate": 0.35290154814720154, "beginner": 0.28685659170150757, "expert": 0.3602418601512909 }
19,578
Tell me how to solve the problem.: cd /home/user/NetBeansProjects/HibernateLearningVideos03And04; JAVA_HOME=/app/jdk /app/netbeans/java/maven/bin/mvn -Dexec.vmArgs= "-Dexec.args=${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}" -Dexec.executable=/app/jdk/bin/java -Dexec.mainClass=com.mycompany.hibernatelearningvideos03and04.client.ClientCode -Dexec.classpathScope=runtime -Dexec.appArgs= process-classes org.codehaus.mojo:exec-maven-plugin:3.1.0:exec Scanning for projects... ------------< com.mycompany:HibernateLearningVideos03And04 >------------ Building HibernateLearningVideos03And04 1.0-SNAPSHOT from pom.xml --------------------------------[ jar ]--------------------------------- --- resources:3.3.0:resources (default-resources) @ HibernateLearningVideos03And04 --- Copying 1 resource --- compiler:3.10.1:compile (default-compile) @ HibernateLearningVideos03And04 --- Nothing to compile - all classes are up to date --- exec:3.1.0:exec (default-cli) @ HibernateLearningVideos03And04 --- Hello World! Sep. 06, 2023 3:08:03 A.M. org.hibernate.Version logVersion INFO: HHH000412: Hibernate ORM core version 6.2.7.Final Sep. 06, 2023 3:08:03 A.M. org.hibernate.cfg.Environment <clinit> INFO: HHH000406: Using bytecode reflection optimizer org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml] at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:53) at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:244) at org.hibernate.cfg.Configuration.configure(Configuration.java:358) at org.hibernate.cfg.Configuration.configure(Configuration.java:343) at com.mycompany.hibernatelearningvideos03and04.util.HibernateUtil.<clinit>(HibernateUtil.java:18) at com.mycompany.hibernatelearningvideos03and04.client.ClientCode.main(ClientCode.java:18) ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 3.308 s Finished at: 2023-09-06T03:08:03-04:00 ------------------------------------------------------------------------ student.hbm.xml: <?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name = "Student" table = "students"> <id name = "id" type = "int" column = "id"> <generator class="increment"/> </id> <property name = "name" column = "name" type = "string"/> <property name = "email" column = "email"/> <!-- No need to explicitly state string type. --> <property name = "phone" column = "phone" type = "Long"/> </class> </hibernate-mapping> hibernate.cfg.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- Database connection settings --> <property name="connection.driver_class">org.sqlite.JDBC</property> <property name="connection.url">jdbc:sqlite:mydatabaseyo.sqlite</property> <!-- SQL dialect for SQLite --> <!-- <property name="dialect">org.hibernate.dialect.SQLiteDialect</property> --> <property name="hibernate.dialect">org.hibernate.community.dialect.SQLiteDialect</property> <!-- <property name="hibernate.dialect">org.hibernate.dialect.SQLiteDialect</property> --> <mapping resource="com/mycompany/hibernatelearningvideos03and04/model/student.hbm.xml"/> </session-factory> </hibernate-configuration> pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany</groupId> <artifactId>HibernateLearningVideos03And04</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> <exec.mainClass>com.mycompany.hibernatelearningvideos03and04.HibernateLearningVideos03And04</exec.mainClass> </properties> <dependencies> <!-- https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-core --> <dependency> <groupId>org.hibernate.orm</groupId> <artifactId>hibernate-core</artifactId> <version>6.2.7.Final</version> </dependency> <!--https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc--> <dependency> <groupId>org.xerial</groupId> <artifactId>sqlite-jdbc</artifactId> <version>3.42.0.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-community-dialects --> <dependency> <groupId>org.hibernate.orm</groupId> <artifactId>hibernate-community-dialects</artifactId> <version>6.2.7.Final</version> </dependency> </dependencies> <build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> </resources> </build> </project> HibernateUtil.java: /* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template */ package com.mycompany.hibernatelearningvideos03and04.util; import org.hibernate.SessionFactory; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; public class HibernateUtil { private static SessionFactory sessionFactory; static { if(sessionFactory == null) { try { Configuration cfg = new Configuration().configure(); ///home/user/NetBeansProjects/HibernateLearningVideos03And04/src/main/java/ cfg.addResource("com/mycompany/hibernatelearningvideos03and04/model/student.hbm.xml"); StandardServiceRegistry ssRegistry = new StandardServiceRegistryBuilder().applySettings(cfg.getProperties()).build(); sessionFactory = cfg.buildSessionFactory(ssRegistry); } catch(Exception e) { e.printStackTrace(); } } } public static SessionFactory getSessionFactory() { return sessionFactory; } } Student.java: /* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template */ package com.mycompany.hibernatelearningvideos03and04.model; /** * * @author user */ public class Student { private int id; private String name; private String email; private long phone; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public long getPhone() { return phone; } public void setPhone(long phone) { this.phone = phone; } }
686e056184f5b4d51d4e27eca7ef1ac8
{ "intermediate": 0.34804415702819824, "beginner": 0.47593703866004944, "expert": 0.17601875960826874 }
19,579
you are a data analyst, please look up sample data that grade field is higher than 80 and then output matching data as table format, the sample data is a json format and they are [{'Id': 1, 'Name': 'Bob_1', 'Grade': 85}, {'Id': 2, 'Name': 'Bob_2', 'Grade': 71}, {'Id': 3, 'Name': 'Bob_3', 'Grade': 81}]
286b79f52d16601e4bd7d3b01fb18564
{ "intermediate": 0.45354369282722473, "beginner": 0.1692514717578888, "expert": 0.37720486521720886 }
19,580
<button Type="button" onclick="document.getElementById("demo").innerHTML=5+6";>Button, This statement not working in JS when used under HTML
d473f4c341c0725a0740dfecb857cdbb
{ "intermediate": 0.30805346369743347, "beginner": 0.4700552821159363, "expert": 0.22189126908779144 }
19,581
How do I fix this problem?: cd /home/user/NetBeansProjects/HibernateLearningVideos03And04; JAVA_HOME=/app/jdk /app/netbeans/java/maven/bin/mvn -Dexec.vmArgs= "-Dexec.args=${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}" -Dexec.executable=/app/jdk/bin/java -Dexec.mainClass=com.mycompany.hibernatelearningvideos03and04.client.ClientCode -Dexec.classpathScope=runtime -Dexec.appArgs= process-classes org.codehaus.mojo:exec-maven-plugin:3.1.0:exec Scanning for projects... ------------< com.mycompany:HibernateLearningVideos03And04 >------------ Building HibernateLearningVideos03And04 1.0-SNAPSHOT from pom.xml --------------------------------[ jar ]--------------------------------- --- resources:3.3.0:resources (default-resources) @ HibernateLearningVideos03And04 --- Copying 1 resource --- compiler:3.10.1:compile (default-compile) @ HibernateLearningVideos03And04 --- Nothing to compile - all classes are up to date --- exec:3.1.0:exec (default-cli) @ HibernateLearningVideos03And04 --- Hello World! Sep. 06, 2023 3:40:32 A.M. org.hibernate.Version logVersion INFO: HHH000412: Hibernate ORM core version 6.2.7.Final Sep. 06, 2023 3:40:32 A.M. org.hibernate.cfg.Environment <clinit> INFO: HHH000406: Using bytecode reflection optimizer org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml] at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:53) at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:244) at org.hibernate.cfg.Configuration.configure(Configuration.java:358) at org.hibernate.cfg.Configuration.configure(Configuration.java:343) at com.mycompany.hibernatelearningvideos03and04.util.HibernateUtil.<clinit>(HibernateUtil.java:18) at com.mycompany.hibernatelearningvideos03and04.client.ClientCode.main(ClientCode.java:18) ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 5.591 s Finished at: 2023-09-06T03:40:32-04:00 ------------------------------------------------------------------------ sh-5.1$ cd HibernateLearningVideos03And04/ sh-5.1$ ls mydatabaseyo.sqlite pom.xml src target sh-5.1$ cd src/ sh-5.1$ ls sh-5.1$ cd /home/user/NetBeansProjects/HibernateLearningVideos03And04/ sh-5.1$ ls mydatabaseyo.sqlite pom.xml src target sh-5.1$ cat ./pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany</groupId> <artifactId>HibernateLearningVideos03And04</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> <exec.mainClass>com.mycompany.hibernatelearningvideos03and04.HibernateLearningVideos03And04</exec.mainClass> </properties> <dependencies> <!-- https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-core --> <dependency> <groupId>org.hibernate.orm</groupId> <artifactId>hibernate-core</artifactId> <version>6.2.7.Final</version> </dependency> <!--https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc--> <dependency> <groupId>org.xerial</groupId> <artifactId>sqlite-jdbc</artifactId> <version>3.42.0.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-community-dialects --> <dependency> <groupId>org.hibernate.orm</groupId> <artifactId>hibernate-community-dialects</artifactId> <version>6.2.7.Final</version> </dependency> </dependencies> <build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> </resources> </build> </project>sh-5.1$ ls mydatabaseyo.sqlite pom.xml src target sh-5.1$ cd src/ sh-5.1$ ls main test sh-5.1$ cd main/ sh-5.1$ ls java resources sh-5.1$ cat ./resources/hibernate.cfg.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- Database connection settings --> <property name="connection.driver_class">org.sqlite.JDBC</property> <property name="connection.url">jdbc:sqlite:mydatabaseyo.sqlite</property> <!-- SQL dialect for SQLite --> <!-- <property name="dialect">org.hibernate.dialect.SQLiteDialect</property> --> <property name="hibernate.dialect">org.hibernate.community.dialect.SQLiteDialect</property> <!-- <property name="hibernate.dialect">org.hibernate.dialect.SQLiteDialect</property> --> <mapping resource="com/mycompany/hibernatelearningvideos03and04/model/student.hbm.xml"/> </session-factory> </hibernate-configuration>sh-5.1$ ls java resources sh-5.1$ cd java/ sh-5.1$ ls com sh-5.1$ cd com/mycompany/hibernatelearningvideos03and04/ sh-5.1$ ls client model util sh-5.1$ cat ./client/ClientCode.java /* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license */ package com.mycompany.hibernatelearningvideos03and04.client; import com.mycompany.hibernatelearningvideos03and04.model.Student; import com.mycompany.hibernatelearningvideos03and04.util.HibernateUtil; import org.hibernate.Session; import org.hibernate.Transaction; public class ClientCode { public static void main(String[] args) { System.out.println("Hello World!"); Transaction tx = null; try { Session session = HibernateUtil.getSessionFactory().openSession(); Student st = new Student(); st.setId(1); st.setName("Hibernate"); st.setEmail("hibernate@123"); st.setPhone(12345); session.save(st); } catch(Exception e) { // } } } sh-5.1$ cat ./ client/ model/ util/ sh-5.1$ cat ./model/ Student.java student.hbm.xml sh-5.1$ cat ./model/ Student.java student.hbm.xml sh-5.1$ cat ./model/* /* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template */ package com.mycompany.hibernatelearningvideos03and04.model; /** * * @author user */ public class Student { private int id; private String name; private String email; private long phone; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public long getPhone() { return phone; } public void setPhone(long phone) { this.phone = phone; } } <?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name = "Student" table = "students"> <id name = "id" type = "int" column = "id"> <generator class="increment"/> </id> <property name = "name" column = "name" type = "string"/> <property name = "email" column = "email"/> <!-- No need to explicitly state string type. --> <property name = "phone" column = "phone" type = "Long"/> </class> </hibernate-mapping>sh-5.1$ cat ./ client/ model/ util/ sh-5.1$ cat ./util/HibernateUtil.java /* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template */ package com.mycompany.hibernatelearningvideos03and04.util; import org.hibernate.SessionFactory; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; public class HibernateUtil { private static SessionFactory sessionFactory; static { if(sessionFactory == null) { try { Configuration cfg = new Configuration().configure(); ///home/user/NetBeansProjects/HibernateLearningVideos03And04/src/main/java/ cfg.addResource("com/mycompany/hibernatelearningvideos03and04/model/student.hbm.xml"); StandardServiceRegistry ssRegistry = new StandardServiceRegistryBuilder().applySettings(cfg.getProperties()).build(); sessionFactory = cfg.buildSessionFactory(ssRegistry); } catch(Exception e) { e.printStackTrace(); } } } public static SessionFactory getSessionFactory() { return sessionFactory; } } sh-5.1$
7f2e8a680f63633a4fafb8e6000ba8d5
{ "intermediate": 0.32506367564201355, "beginner": 0.5691403746604919, "expert": 0.10579593479633331 }
19,582
как получение списка вынести в отдельный метод List<AcquiringOperation> reverseOperations = acquiringOperationService.find(byReversedOperationId(singletonList(operationId))); int attempts = 1; int maxAttempts = 2; // Максимальное количество дополнительных запросов while (reverseOperations.isEmpty() && attempts <= maxAttempts) { try { Thread.sleep(1000); // Задержка в 1 секунду } catch (InterruptedException e) { e.printStackTrace(); } reverseOperations = acquiringOperationService.find(byReversedOperationId(singletonList(operationId))); LOGGER.info("Попытка " + attempts + ": найдено " + reverseOperations.size() + " записей"); attempts++; } LOGGER.info("Общее количество записей: " + reverseOperations.size());
3bbd064c7ca5cdb0e4d05c81f3142870
{ "intermediate": 0.3610057830810547, "beginner": 0.36502689123153687, "expert": 0.27396735548973083 }
19,583
Create a measure to find the sum of PromoDays for each Customer and SKU. Customer and SKU are placed in table1, while Customer Code, SKU Code, and PromoDays are placed in table2. Customer corresponds to Customer Code and SKU corresponds to SKU Code. Table1 and table2 are not related. Write the DAX expression
20a8d93435f0b395297ad12aa45afa5a
{ "intermediate": 0.34825974702835083, "beginner": 0.30636826157569885, "expert": 0.3453719913959503 }
19,584
from socket import * ADDR = ('localhost', 12345) udpCliSock = socket(AF_INET, SOCK_DGRAM) data = raw_input('> ') udpCliSock.sendto(data, ADDR) udpCliSock.close() 怎么实现两个电脑的互传
d55d38bb7f146aef19493cdc6e206821
{ "intermediate": 0.4514537751674652, "beginner": 0.29115375876426697, "expert": 0.2573924660682678 }
19,585
<template> <div id="luckysheet" style="margin:0px;padding:0px;position:absolute;width:70%;height:70%;left: 60px;top: 0px;"></div> <q-btn @click="save">保存</q-btn> </template> <script setup> import { onMounted,ref } from 'vue'; const data = ref([]); const options = { lang:'zh', column:"5", row:"5", data: [{ "name": "Sheet1", color: "", "status": "1", "order": "0", "data":data, "config": {}, "index":0 }] } const save = async () =>{ localStorage.setItem("data", JSON.stringify(luckysheet.getAllSheets()[0].data)); console.log(luckysheet.getAllSheets()[0].data) } onMounted( async ()=>{ data.value = JSON.parse(localStorage.getItem("data")); luckysheet.create(options); }) </script> vue3+lucksheet为什么拿不到保存好的data
48875b70b5350769eb9df40c29f6ce9b
{ "intermediate": 0.41884365677833557, "beginner": 0.33769291639328003, "expert": 0.2434634566307068 }
19,586
Write a Java program where it contains the following: A class to define a kind of objects in our daily life (i.e. cars, chairs) A main class (main program) to create an instance of your class and prints the results of all the methods of your class except the setters Basic Requirement: An executable program with all the classes in a single file No inner classes (e.g. a class declared in the main class) Explicitly define 1 constructor to the class Define 3 to 5 variables to the class Define a getter and a setter per each variable, and 1 to 2 methods for some other behavior to the class (e.g. a class with 3 variables should have 3 x 2 + 1 = 7 methods at least, except the constructor) All the variables must be initialized with a value within the constructor (i.e. do not just left Java assign the default value a variable) Example input & Output: A circle class has 3 variables: x, y and radius 3 getters, 3 setters and 2 methods, getArea() and contains(), are defined
e9b00e45a7f77510c61f5fa94311b8ec
{ "intermediate": 0.11047833412885666, "beginner": 0.8252150416374207, "expert": 0.06430662423372269 }
19,587
#include "allinclude.h" //DO NOT edit this line float Polynomial(int n, int a[], float x0) { // Add your code here int i; float P = 0; if(n==0){ P = a[0]; }else{ P = a[0]; for(i=1;i<=n;i++){ P+=a[i]*x0; x0*=x0; } } }
a4bac4c313983ecc779b13afdae988af
{ "intermediate": 0.38190069794654846, "beginner": 0.371167927980423, "expert": 0.24693135917186737 }
19,588
In the code below, when the hour changes a certain range of cells are highlighted Yellow. The problem I am having is as described below: When the hour changes the cells in row 5 & 6 are highlighted in the correct position. But the cells in both row 11 & 12 and row 17 & 18 are highligted in the wrong position. In the example below, when K5:L6 are highlighted, K11:L12 and K17:L81 should also be highlighted. Currently, when K5:L6 is highlighted, M11:N12 and M17:N18 are highlighted which should not be the case. Sub CopyAA() ' Copy AA Schedule for the current Day Dim today As String today = Format(Now, "ddd") Dim sourceRange As Range Dim destRange As Range Set sourceRange = Worksheets("AA").Range("A3:L3") ' Source range in the "AA" sheet Set destRange = Worksheets("Daily").Range("A9:L9") destRange.ClearContents sourceRange.Copy destRange.PasteSpecial Paste:=xlPasteFormats Select Case today Case "Mon" sourceRange.Copy destRange Case "Tue" sourceRange.Offset(1).Copy destRange Case "Wed" sourceRange.Offset(2).Copy destRange Case "Thu" sourceRange.Offset(3).Copy destRange Case "Fri" sourceRange.Offset(4).Copy destRange End Select Application.CutCopyMode = False Application.Wait Now + TimeValue("00:00:01") Call CopyCL End Sub Sub CopyCL() ' Copy CL Schedule for the current Day Dim today As String today = Format(Now, "ddd") Dim sourceRange As Range Dim destRange As Range Set sourceRange = Worksheets("CL").Range("A3:O3") ' Source range in the "CL" sheet Set destRange = Worksheets("Daily").Range("F15:T15") destRange.ClearContents sourceRange.Copy destRange.PasteSpecial Paste:=xlPasteFormats Select Case today Case "Mon" sourceRange.Copy destRange Case "Tue" sourceRange.Offset(1).Copy destRange Case "Wed" sourceRange.Offset(2).Copy destRange Case "Thu" sourceRange.Offset(3).Copy destRange Case "Fri" sourceRange.Offset(4).Copy destRange End Select Application.CutCopyMode = False Application.Wait Now + TimeValue("00:00:01") Call ClearCellBackgroundColors End Sub Sub ClearCellBackgroundColors() ' Clear Yellow Time Background colour Dim ws As Worksheet Set ws = ThisWorkbook.Worksheets("Daily") With ws.Range("A5:U6") .Interior.Color = xlNone End With With ws.Range("A11:U12") .Interior.Color = xlNone End With With ws.Range("A17:U18") .Interior.Color = xlNone End With Application.Wait Now + TimeValue("00:00:01") Call ShowTime End Sub Sub ShowTime() ' Highlight Time Periods in Yellow Dim currentTime As Date currentTime = Now Dim ranges(27) As Range Dim timePeriods(10) As Date Dim ws As Worksheet Set ws = ThisWorkbook.Worksheets("Daily") Set ranges(1) = ws.Range("C5:D6") Set ranges(2) = ws.Range("C11:D12") Set ranges(3) = ws.Range("C17:D18") Set ranges(4) = ws.Range("E5:F6") Set ranges(5) = ws.Range("E11:F12") Set ranges(6) = ws.Range("E17:F18") Set ranges(7) = ws.Range("G5:H6") Set ranges(8) = ws.Range("G11:H12") Set ranges(9) = ws.Range("G17:H18") Set ranges(10) = ws.Range("I5:J6") Set ranges(11) = ws.Range("I11:J12") Set ranges(12) = ws.Range("I17:J18") Set ranges(13) = ws.Range("K5:L6") Set ranges(14) = ws.Range("K11:L12") Set ranges(15) = ws.Range("K17:L18") Set ranges(16) = ws.Range("M5:N6") Set ranges(17) = ws.Range("M11:N12") Set ranges(18) = ws.Range("M17:N18") Set ranges(19) = ws.Range("O5:P6") Set ranges(20) = ws.Range("O11:P12") Set ranges(21) = ws.Range("O17:P18") Set ranges(22) = ws.Range("Q5:R6") Set ranges(23) = ws.Range("Q11:R12") Set ranges(24) = ws.Range("Q17:R18") Set ranges(25) = ws.Range("S5:T6") Set ranges(26) = ws.Range("S11:T12") Set ranges(27) = ws.Range("S17:T18") timePeriods(1) = "06:59:59" ' 6:59am - before any time period" timePeriods(2) = "08:00:00" timePeriods(3) = "09:00:00" timePeriods(4) = "10:00:00" timePeriods(5) = "11:00:00" timePeriods(6) = "12:00:00" timePeriods(7) = "13:00:00" timePeriods(8) = "14:00:00" timePeriods(9) = "15:00:00" timePeriods(10) = "16:00:00" ' 4pm - after all time periods" Dim i As Integer For i = 1 To 27 Dim rangeIndex As Integer If i Mod 3 = 1 Then ' Determine the time period based on the index of the range rangeIndex = (i + 2) \ 3 Else rangeIndex = ((i + 2) \ 3) - 1 End If If TimeValue(currentTime) >= TimeValue(timePeriods(rangeIndex)) And TimeValue(currentTime) < TimeValue(timePeriods(rangeIndex + 1)) Then ranges(i).Interior.Color = RGB(255, 255, 0) ' Change the background color to Yellow End If Next i Application.Wait Now + TimeValue("00:00:01") End Sub
2c93177914ca15abe98f165578d2c478
{ "intermediate": 0.35886576771736145, "beginner": 0.418357253074646, "expert": 0.22277696430683136 }
19,589
What does db keyword do in cheatenginr lua?
de6fce83a369cb1ab40fc39872124095
{ "intermediate": 0.4070568084716797, "beginner": 0.18744945526123047, "expert": 0.4054936468601227 }
19,590
<Box ref={ref} id={chart-${uniqueId}} width={!showToolbar ? "calc(100% - 5px)" : "calc(100% - 55px)"} height="100%" position="relative" sx={{ borderLeft: theme => 2px solid ${theme.palette.grey[50]} }} onWheel={handleWheel} > {/* Код вашего компонента */} </Box> нужно ускорить прокрутку колесиком в 50 раз
60e2ecb582ca05d9257c60a3e1b3952d
{ "intermediate": 0.3841809630393982, "beginner": 0.28071650862693787, "expert": 0.33510249853134155 }
19,591
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); scanner.nextLine(); int S = scanner.nextInt(); int a = N / S; for (int i=S;i>1; i--){ if ((a-i) < 0) { int res = i; break; } //if a-i == 0; a -= i; } System.out.println(res); } } Почему пишет, что куы yt yfqlty&
b3c4ddf47607581df717296c367217ce
{ "intermediate": 0.34055086970329285, "beginner": 0.4754619300365448, "expert": 0.18398721516132355 }
19,592
task = '(2x+3)/3' expr = parse_expr(task) ValueError: Error from parse_expr with transformed code: "(Integer (2 )Symbol ('x' )+Integer (3 ))/Integer (3 )" The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/IPython/core/interactiveshell.py", line 3553, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-26-d08f8235b38f>", line 2, in <cell line: 2> expr = parse_expr(task) File "/usr/local/lib/python3.10/dist-packages/sympy/parsing/sympy_parser.py", line 1087, in parse_expr raise e from ValueError(f"Error from parse_expr with transformed code: {code!r}") File "/usr/local/lib/python3.10/dist-packages/sympy/parsing/sympy_parser.py", line 1078, in parse_expr rv = eval_expr(code, local_dict, global_dict) File "/usr/local/lib/python3.10/dist-packages/sympy/parsing/sympy_parser.py", line 906, in eval_expr expr = eval( File "<string>", line 1 (Integer (2 )Symbol ('x' )+Integer (3 ))/Integer (3 ) ^ SyntaxError: invalid syntax. Perhaps you forgot a comma?
e0f5fd4b57fd77d380362fcc5876890b
{ "intermediate": 0.36461833119392395, "beginner": 0.4514726400375366, "expert": 0.183909073472023 }