row_id
int64
0
48.4k
init_message
stringlengths
1
342k
conversation_hash
stringlengths
32
32
scores
dict
15,673
i have three levels of groups in hierarchy design by flutter this page allow me to recieve data from user : from any group level and save , and also note how can i show data in hierarchy pattern
7afc6295388c2638543d789adba57fcc
{ "intermediate": 0.48271751403808594, "beginner": 0.18360625207424164, "expert": 0.333676278591156 }
15,674
Write me code for C# development WPF calendar
bc9825b8aaf6276e94a3c6540bcb32bd
{ "intermediate": 0.5577641129493713, "beginner": 0.32550275325775146, "expert": 0.11673308163881302 }
15,675
Can you remove any thing about stopLoss from my code please , code: def get_futures_balance(symbol): try: balance = mexc_futures.fetch_balance() futures_balance = balance['info']['data'][symbol] return futures_balance['total'] except Exception as e: print(f"Error getting futures balance: {e}") return 0 futures_balance = get_futures_balance(symbol) quantity = futures_balance * 0.5 print(f"Quantity: {quantity}") def execute_order(symbol, order_type, side, quantity): try: order_params = { 'symbol': symbol, 'side': side, 'type': order_type, 'quantity': quantity, 'stopPrice': None } order = mexc_futures.create_order(**order_params) return order except Exception as e: print(f"Error executing order: {e}") return None def set_stop_loss(symbol, side, quantity): try: # Calculate stop loss price based on your strategy stop_loss_price = 0.0 # Calculate the desired stop loss price order_params = { 'symbol': symbol, 'side': "SELL" if side == "BUY" else "BUY", 'type': 'STOP_MARKET', 'stopPrice': stop_loss_price, 'closePosition': True # Close the entire position } order = mexc_futures.create_order(**order_params) return order except Exception as e: print(f"Error setting stop loss: {e}") return None def cancel_order(symbol, order_id): try: mexc_futures.cancel_orders([order_id], symbol) print("Order cancelled successfully.") except Exception as e: print(f"Error cancelling order: {e}") def get_open_orders(symbol): try: orders = mexc_futures.fetch_open_orders(symbol) return orders except Exception as e: print(f"Error getting open orders: {e}") return [] def close_position(symbol, stop_loss_order_id): cancel_order(symbol, stop_loss_order_id) # Rest of the code… signal = signal_generator(df) stop_loss_order_id = None while True: stop_loss_order = set_stop_loss(symbol, 'BUY', quantity) orders = mexc_futures.fetch_open_orders(symbol) df = get_klines(symbol, '1m', 44640) if signal is not None: print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}:{signal}") time.sleep(1) if signal == 'buy': open_orders = get_open_orders(symbol) if not open_orders: # Open Long position quantity = 1 # Set your desired quantity here order = execute_order(symbol, 'MARKET', 'BUY', quantity) if order: print(f"Opened Long position. Order ID: {order['id']}") # Set Stop Loss at -50% stop_loss_order = set_stop_loss(symbol, 'BUY', quantity) if stop_loss_order: stop_loss_order_id = stop_loss_order['id'] print(f"Stop Loss order set. Order ID: {stop_loss_order_id}") elif stop_loss_order_id is not None: # Check if Stop Loss order has been triggered stop_loss_order = [order for order in open_orders if order['id'] == stop_loss_order_id][0] if stop_loss_order['status'] == 'closed': print("Stop Loss order triggered. Closing Long position…") # Close Long position close_position(symbol, stop_loss_order_id) stop_loss_order_id = None elif signal == 'sell': open_orders = get_open_orders(symbol) if not open_orders: # Open Short position quantity = 1 # Set your desired quantity here order = execute_order(symbol, 'MARKET', 'SELL', quantity) if order: print(f"Opened Short position. Order ID: {order['id']}") # Set Stop Loss at -50% stop_loss_order = set_stop_loss(symbol, 'SELL', quantity) if stop_loss_order: stop_loss_order_id = stop_loss_order['id'] print(f"Stop Loss order set. Order ID: {stop_loss_order_id}") elif stop_loss_order_id is not None: # Check if Stop Loss order has been triggered stop_loss_order = [order for order in open_orders if order['id'] == stop_loss_order_id][0] if stop_loss_order['status'] == 'closed': print("Stop Loss order triggered. Closing Short position…") # Close Short position close_position(symbol, stop_loss_order_id) stop_loss_order_id = None time.sleep(1)
55c3d96c6be2793bd31c39bd618ca28d
{ "intermediate": 0.3671749532222748, "beginner": 0.32156291604042053, "expert": 0.3112621009349823 }
15,676
I used your code: import time from binance.client import Client from binance.exceptions import BinanceAPIException from binance.helpers import round_step_size import pandas as pd import json import numpy as np import pytz import datetime as dt import ccxt from decimal import Decimal import requests import hmac import hashlib import ntplib import os import ta import ta.volatility API_KEY = '' API_SECRET = '' client = Client(API_KEY, API_SECRET) def sync_time(): server_time = requests.get('https://api.binance.com/api/v3/time').json()['serverTime'] local_time = int(time.time() * 1000) time_difference = server_time - local_time # Set the system clock to the new time os.system(f'sudo date -s @{int(server_time/1000)}') print(f'New time: {dt.datetime.now()}') # Sync your local time with the server time sync_time() # Set the endpoint and parameters for the request url = "https://fapi.binance.com/fapi/v1/klines" symbol = 'BCH/USDT' interval = '1m' lookback = 44640 timestamp = int(time.time() * 1000) - 500 # subtract 500ms from local time to account for clock-drift recv_window = 60000 # increased recv_window value params = { "symbol": symbol.replace("/", ""), "interval": interval, "startTime": int((time.time() - lookback * 60) * 1000), "endTime": int(time.time() * 1000), "timestamp": timestamp, "recvWindow": recv_window } # Sign the message using the Client’s secret key message = "&".join([f"{k}={v}" for k, v in params.items()]) signature = hmac.new(API_SECRET.encode(), message.encode(), hashlib.sha256).hexdigest() params[signature] = signature # Send the request using the requests library response = requests.get(url, params=params, headers={'X-MBX-APIKEY': API_KEY}) # Check for errors in the response response.raise_for_status() API_KEY_MEXC = '' API_SECRET_MEXC = '' # Initialize MEXC client mexc_futures = ccxt.mexc({ 'apiKey': API_KEY_MEXC, 'secret': API_SECRET_MEXC, 'enableRateLimit': True, 'options': { 'defaultType': 'future', } }) time.sleep(1) def get_klines(symbol, interval, lookback): url = "https://fapi.binance.com/fapi/v1/klines" end_time = int(time.time() * 1000) # end time is now start_time = end_time - (lookback * 60 * 1000) # start time is lookback minutes ago symbol = symbol.replace("/", "") # remove slash from symbol query_params = f"?symbol={symbol}&interval={interval}&startTime={start_time}&endTime={end_time}" headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36' } response = requests.get(url + query_params, headers=headers) response.raise_for_status() data = response.json() if not data: # if data is empty, return None print('No data found for the given timeframe and symbol') return None ohlcv = [] for d in data: timestamp = dt.datetime.fromtimestamp(d[0]/1000).strftime('%Y-%m-%d %H:%M:%S') ohlcv.append({ 'Open time': timestamp, 'Open': float(d[1]), 'High': float(d[2]), 'Low': float(d[3]), 'Close': float(d[4]), 'Volume': float(d[5]) }) df = pd.DataFrame(ohlcv) df.set_index('Open time', inplace=True) return df df = get_klines(symbol, interval, lookback) def signal_generator(df): if df is None: return '' ema_analysis = [] candle_analysis = [] df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean() df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean() df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean() df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean() if ( df['EMA5'].iloc[-1] > df['EMA20'].iloc[-1] and df['EMA20'].iloc[-1] > df['EMA100'].iloc[-1] and df['EMA100'].iloc[-1] > df['EMA200'].iloc[-1] and df['EMA5'].iloc[-2] < df['EMA20'].iloc[-2] and df['EMA20'].iloc[-2] < df['EMA100'].iloc[-2] and df['EMA100'].iloc[-2] < df['EMA200'].iloc[-2] ): ema_analysis.append('golden_cross') elif ( df['EMA5'].iloc[-1] < df['EMA20'].iloc[-1] and df['EMA20'].iloc[-1] < df['EMA100'].iloc[-1] and df['EMA100'].iloc[-1] < df['EMA200'].iloc[-1] and df['EMA5'].iloc[-2] > df['EMA20'].iloc[-2] and df['EMA20'].iloc[-2] > df['EMA100'].iloc[-2] and df['EMA100'].iloc[-2] > df['EMA200'].iloc[-2] ): ema_analysis.append('death_cross') if ( df['Close'].iloc[-1] > df['Open'].iloc[-1] and df['Open'].iloc[-1] > df['Low'].iloc[-1] and df['High'].iloc[-1] > df['Close'].iloc[-1] ): candle_analysis.append('bullish_engulfing') elif ( df['Close'].iloc[-1] < df['Open'].iloc[-1] and df['Open'].iloc[-1] < df['High'].iloc[-1] and df['Low'].iloc[-1] > df['Close'].iloc[-1] ): candle_analysis.append('bearish_engulfing') bollinger_std = df['Close'].rolling(window=20).std() df['UpperBand'] = df['EMA20'] + (bollinger_std * 2) df['LowerBand'] = df['EMA20'] - (bollinger_std * 2) if ( df['Close'].iloc[-1] > df['UpperBand'].iloc[-1] and df['Close'].iloc[-2] < df['UpperBand'].iloc[-2] ): candle_analysis.append('upper_band_breakout') elif ( df['Close'].iloc[-1] < df['LowerBand'].iloc[-1] and df['Close'].iloc[-2] > df['LowerBand'].iloc[-2] ): candle_analysis.append('lower_band_breakout') if ('golden_cross' in ema_analysis and 'bullish_engulfing' in candle_analysis) or 'upper_band_breakout' in candle_analysis: return 'buy' elif ('death_cross' in ema_analysis and 'bearish_engulfing' in candle_analysis) or 'lower_band_breakout' in candle_analysis: return 'sell' else: return '' end_time = int(time.time() * 1000) start_time = end_time - lookback * 60 * 1000 def get_futures_balance(symbol): try: balance = mexc_futures.fetch_balance() print(balance) # Add this line to inspect the balance variable futures_balance = balance['info']['data'][symbol] return futures_balance['total'] except Exception as e: print(f"Error getting futures balance: {e}") return 0 futures_balance = get_futures_balance(symbol) quantity = futures_balance * 0.5 print(f"Quantity: {quantity}") def execute_order(symbol, order_type, side, quantity): try: order_params = { 'symbol': symbol, 'side': side, 'type': order_type, 'quantity': quantity } order = mexc_futures.create_order(**order_params) return order except Exception as e: print(f"Error executing order: {e}") return None def cancel_order(symbol, order_id): try: mexc_futures.cancel_orders([order_id], symbol) print("Order cancelled successfully.") except Exception as e: print(f"Error cancelling order: {e}") def get_open_orders(symbol): try: orders = mexc_futures.fetch_open_orders(symbol) return orders except Exception as e: print(f"Error getting open orders: {e}") return [] def close_position(symbol): try: open_orders = get_open_orders(symbol) if open_orders: for order in open_orders: cancel_order(symbol, order['id']) except Exception as e: print(f"Error closing position: {e}") # Rest of the code… signal = signal_generator(df) while True: orders = mexc_futures.fetch_open_orders(symbol) df = get_klines(symbol, '1m', 44640) if signal is not None: print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}:{signal}") time.sleep(1) if signal == 'buy': open_orders = get_open_orders(symbol) if not open_orders: # Open Long position quantity = 1 # Set your desired quantity here order = execute_order(symbol, 'MARKET', 'BUY', quantity) if order: print(f"Opened Long position. Order ID: {order['id']}") else: # Close all open orders close_position(symbol) elif signal == 'sell': open_orders = get_open_orders(symbol) if not open_orders: # Open Short position quantity = 1 # Set your desired quantity here order = execute_order(symbol, 'MARKET', 'SELL', quantity) if order: print(f"Opened Short position. Order ID: {order['id']}") else: # Close all open orders close_position(symbol) time.sleep(1) But it doesn't give me any signal , please tell me where is problem ?
4753fff11f315661faf11ee3b27efb41
{ "intermediate": 0.4894009232521057, "beginner": 0.322678804397583, "expert": 0.1879202276468277 }
15,677
How to get all textures in dx9 window in c++?
43917569adfeb2d7418597ff7fee1a1e
{ "intermediate": 0.5381284952163696, "beginner": 0.17481456696987152, "expert": 0.28705698251724243 }
15,678
how can i fix this error (pymysql.err.OperationalError) (2006, "MySQL server has gone away (ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))")
a7af9ff8a88ef1ddfc689a903b5270c2
{ "intermediate": 0.5950064063072205, "beginner": 0.20329950749874115, "expert": 0.2016940861940384 }
15,679
How to get all textures from dx9 window in c++?
7b47a3c3cd70734f63d290d8544b0477
{ "intermediate": 0.5603081583976746, "beginner": 0.1640310138463974, "expert": 0.2756608724594116 }
15,680
How to get all textures from dx9 window in c++? d3dDevice->EnumResources not found
627d2f256803d885e798c8a5a2695b5d
{ "intermediate": 0.6284607648849487, "beginner": 0.20777447521686554, "expert": 0.16376477479934692 }
15,681
how to connect mysql database using flask.sqlalchemy
9e1b236e20cbdcafbd81a41472383bf0
{ "intermediate": 0.6984723210334778, "beginner": 0.15471230447292328, "expert": 0.14681538939476013 }
15,682
I want you to design command prompt for chatgpt to design best learning course on (Topic). in this course devide each topic into multiples of subtopic and suggest best free online course for each subtopic from free platform.
a78111cb3c23cc85c1a99d872cad0a84
{ "intermediate": 0.28966471552848816, "beginner": 0.2659693956375122, "expert": 0.44436588883399963 }
15,683
How to save dx9 texture to png in c++?
8802c4e022b89f7faeebf1b64c285067
{ "intermediate": 0.4299154579639435, "beginner": 0.14698754251003265, "expert": 0.42309698462486267 }
15,684
How to save dx9 texture to png in c++?
1da142cb8e1f2264d0f904ee437a6751
{ "intermediate": 0.4299154579639435, "beginner": 0.14698754251003265, "expert": 0.42309698462486267 }
15,685
My range of data in I:J starts at row 5. In the range, all the cells in column J have values. In the range, some of the cells in column I are empty. As you move down the range cell by cell, not all the empty cells in column I are grouped together. Occassionaly, a group of empty cells in column I is interupted by a cell or group of cells with values. I need a VBA code that will loop through all the cells in column J that have values, copy to memory all the values of column J where the value of column I on the same row is empty, then after completeing the entire loop of column J that has values, copy the matches (where I = "") stored in memory to column F starting at F9. The code below finds the first group of cells in column I where the values are empty but the loop stops and does not does not complete when it again encounters a cell in column I that has a value. Can you ammend the code below to provide the functionality described above. Sub IncompleteJobs() Dim wscf As Worksheet Dim wsjr As Worksheet Dim lastRow As Long Dim copyRange As Range Dim i As Long ActiveSheet.Range("F9:F38").ClearContents Application.Wait (Now + TimeValue("0:00:01")) ActiveSheet.Range("G3").Formula = ActiveSheet.Range("G3").Formula Application.Wait (Now + TimeValue("0:00:01")) ActiveSheet.Range("H3").Formula = ActiveSheet.Range("H3").Formula If ActiveSheet.Range("G3") = "" Or 0 Then Exit Sub End If Set wscf = Sheets(Range("G3").Value) Set wsjr = Sheets("Start Page") lastRow = wscf.Cells(Rows.count, "J").End(xlUp).Row For i = 5 To lastRow If wscf.Cells(i, "I") = "" Then If copyRange Is Nothing Then Set copyRange = wscf.Range("J" & i) Else Set copyRange = Union(copyRange, wscf.Range("J" & i)) End If End If Next i If Not copyRange Is Nothing Then wsjr.Range("F9").Resize(copyRange.Rows.count, 1).Value = copyRange.Value End If Application.Wait (Now + TimeValue("0:00:02")) Call LastTwentyJobs End Sub
276e2f330bcc7a754376ffb87042b2b1
{ "intermediate": 0.5050055384635925, "beginner": 0.29736965894699097, "expert": 0.1976248323917389 }
15,686
i have box on pine scrypt but i don't know how to make two lable on it. explain it to me
b16e0d0c42ae897d60f99ad499d3a0c9
{ "intermediate": 0.442345529794693, "beginner": 0.23294560611248016, "expert": 0.3247089385986328 }
15,687
My data range is B:L and starts at row 5. I want a Vba code that will do the following. When I enter a date into a cell in column I, The row B:L on which I entered the date in column I will be copied and pasted into the the next available empty row of the range B:L. After the paste the contents of the original row will be cleared from column B to L, then all the rows below the recently cleared row will be moved up to fill in the space of the recently cleared row.
3e772ec33d8c6bd51cb516208f686ee7
{ "intermediate": 0.542617678642273, "beginner": 0.2096136212348938, "expert": 0.24776874482631683 }
15,688
How to enumerate all textures from dx9 window with GetRenderTarget in c++?
bc80a0c94c37b3edb9378dd871bdf840
{ "intermediate": 0.5922276377677917, "beginner": 0.12558797001838684, "expert": 0.28218433260917664 }
15,689
How to save dx9 texture to png in c++ with D3DXSaveTextureToFileA?
1bfa69849970c00ecc2fc2a14f2aa63e
{ "intermediate": 0.6185924410820007, "beginner": 0.15869823098182678, "expert": 0.2227093130350113 }
15,690
My data range is B:L and starts at row 5. I want a Vba code that will do the following on Worksheet_SelectionChange. After I enter a date into a cell in column I identify the cell as my Target Cell, and the row from column B to column L as my Target Row. Find the last used row in column J using lastRow = ws.Cells(ws.Rows.Count, “J”).End(xlUp).Row. Copy and paste the Target Row into the the next available lastRow. After paste, clear the contents of the Target Row, then all the rows below the recently cleared Target should be moved up by 1 to fill in the space of the recently cleared Target Row.
c49c39dc4664980c191460f1a666b6f2
{ "intermediate": 0.5913169384002686, "beginner": 0.22716744244098663, "expert": 0.181515634059906 }
15,691
Can you remove take profit from my code : import time from binance.client import Client from binance.exceptions import BinanceAPIException from binance.helpers import round_step_size import pandas as pd import json import numpy as np import pytz import datetime as dt import ccxt from decimal import Decimal import requests import hmac import hashlib import ntplib import os import ta import ta.volatility API_KEY = '' API_SECRET = '' client = Client(API_KEY, API_SECRET) def sync_time(): server_time = requests.get('https://api.binance.com/api/v3/time').json()['serverTime'] local_time = int(time.time() * 1000) time_difference = server_time - local_time # Set the system clock to the new time os.system(f'sudo date -s @{int(server_time/1000)}') print(f'New time: {dt.datetime.now()}') # Sync your local time with the server time sync_time() # Set the endpoint and parameters for the request url = "https://fapi.binance.com/fapi/v1/klines" symbol = 'BCH/USDT' interval = '1m' lookback = 44640 timestamp = int(time.time() * 1000) - 500 # subtract 500ms from local time to account for clock-drift recv_window = 60000 # increased recv_window value params = { "symbol": symbol.replace("/", ""), "interval": interval, "startTime": int((time.time() - lookback * 60) * 1000), "endTime": int(time.time() * 1000), "timestamp": timestamp, "recvWindow": recv_window } # Sign the message using the Client’s secret key message = "&".join([f"{k}={v}" for k, v in params.items()]) signature = hmac.new(API_SECRET.encode(), message.encode(), hashlib.sha256).hexdigest() params[signature] = signature # Send the request using the requests library response = requests.get(url, params=params, headers={'X-MBX-APIKEY': API_KEY}) # Check for errors in the response response.raise_for_status() API_KEY_MEXC = '' API_SECRET_MEXC = '' # Initialize MEXC client mexc_futures = ccxt.mexc({ 'apiKey': API_KEY_MEXC, 'secret': API_SECRET_MEXC, 'enableRateLimit': True, 'options': { 'defaultType': 'future', } }) time.sleep(1) def get_klines(symbol, interval, lookback): url = "https://fapi.binance.com/fapi/v1/klines" end_time = int(time.time() * 1000) # end time is now start_time = end_time - (lookback * 60 * 1000) # start time is lookback minutes ago symbol = symbol.replace("/", "") # remove slash from symbol query_params = f"?symbol={symbol}&interval={interval}&startTime={start_time}&endTime={end_time}" headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36' } response = requests.get(url + query_params, headers=headers) response.raise_for_status() data = response.json() if not data: # if data is empty, return None print('No data found for the given timeframe and symbol') return None ohlcv = [] for d in data: timestamp = dt.datetime.fromtimestamp(d[0]/1000).strftime('%Y-%m-%d %H:%M:%S') ohlcv.append({ 'Open time': timestamp, 'Open': float(d[1]), 'High': float(d[2]), 'Low': float(d[3]), 'Close': float(d[4]), 'Volume': float(d[5]) }) df = pd.DataFrame(ohlcv) df.set_index('Open time', inplace=True) return df df = get_klines(symbol, interval, lookback) def signal_generator(df): if df is None: return '' ema_analysis = [] candle_analysis = [] df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean() df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean() df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean() df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean() if ( df['EMA5'].iloc[-1] > df['EMA20'].iloc[-1] and df['EMA20'].iloc[-1] > df['EMA100'].iloc[-1] and df['EMA100'].iloc[-1] > df['EMA200'].iloc[-1] and df['EMA5'].iloc[-2] < df['EMA20'].iloc[-2] and df['EMA20'].iloc[-2] < df['EMA100'].iloc[-2] and df['EMA100'].iloc[-2] < df['EMA200'].iloc[-2] ): ema_analysis.append('golden_cross') elif ( df['EMA5'].iloc[-1] < df['EMA20'].iloc[-1] and df['EMA20'].iloc[-1] < df['EMA100'].iloc[-1] and df['EMA100'].iloc[-1] < df['EMA200'].iloc[-1] and df['EMA5'].iloc[-2] > df['EMA20'].iloc[-2] and df['EMA20'].iloc[-2] > df['EMA100'].iloc[-2] and df['EMA100'].iloc[-2] > df['EMA200'].iloc[-2] ): ema_analysis.append('death_cross') if ( df['Close'].iloc[-1] > df['Open'].iloc[-1] and df['Open'].iloc[-1] > df['Low'].iloc[-1] and df['High'].iloc[-1] > df['Close'].iloc[-1] ): candle_analysis.append('bullish_engulfing') elif ( df['Close'].iloc[-1] < df['Open'].iloc[-1] and df['Open'].iloc[-1] < df['High'].iloc[-1] and df['Low'].iloc[-1] > df['Close'].iloc[-1] ): candle_analysis.append('bearish_engulfing') bollinger_std = df['Close'].rolling(window=20).std() df['UpperBand'] = df['EMA20'] + (bollinger_std * 2) df['LowerBand'] = df['EMA20'] - (bollinger_std * 2) if ( df['Close'].iloc[-1] > df['UpperBand'].iloc[-1] and df['Close'].iloc[-2] < df['UpperBand'].iloc[-2] ): candle_analysis.append('upper_band_breakout') elif ( df['Close'].iloc[-1] < df['LowerBand'].iloc[-1] and df['Close'].iloc[-2] > df['LowerBand'].iloc[-2] ): candle_analysis.append('lower_band_breakout') if ('golden_cross' in ema_analysis and 'bullish_engulfing' in candle_analysis) or 'upper_band_breakout' in candle_analysis: return 'buy' elif ('death_cross' in ema_analysis and 'bearish_engulfing' in candle_analysis) or 'lower_band_breakout' in candle_analysis: return 'sell' else: return '' end_time = int(time.time() * 1000) start_time = end_time - lookback * 60 * 1000 def get_futures_balance(symbol): try: balance = mexc_futures.fetch_balance() print(balance) # Add this line to inspect the balance variable futures_balance = balance['info']['data'][symbol] return futures_balance['total'] except Exception as e: print(f"Error getting futures balance: {e}") return 0 futures_balance = get_futures_balance(symbol) quantity = futures_balance * 0.5 print(f"Quantity: {quantity}") def execute_order(symbol, order_type, side, quantity): try: order_params = { 'symbol': symbol, 'side': side, 'type': order_type, 'quantity': quantity } order = mexc_futures.create_order(**order_params) return order except Exception as e: print(f"Error executing order: {e}") return None def cancel_order(symbol, order_id): try: mexc_futures.cancel_orders([order_id], symbol) print("Order cancelled successfully.") except Exception as e: print(f"Error cancelling order: {e}") def get_open_orders(symbol): try: orders = mexc_futures.fetch_open_orders(symbol) return orders except Exception as e: print(f"Error getting open orders: {e}") return [] def close_position(symbol): try: open_orders = get_open_orders(symbol) if open_orders: for order in open_orders: cancel_order(symbol, order['id']) except Exception as e: print(f"Error closing position: {e}") # Rest of the code… signal = signal_generator(df) while True: orders = mexc_futures.fetch_open_orders(symbol) df = get_klines(symbol, '1m', 44640) if signal is not None: print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}:{signal}") time.sleep(1) if signal == 'buy': open_orders = get_open_orders(symbol) if not open_orders: # Open Long position quantity = 1 # Set your desired quantity here order = execute_order(symbol, 'MARKET', 'BUY', quantity) if order: print(f"Opened Long position. Order ID: {order['id']}") else: # Close all open orders close_position(symbol) elif signal == 'sell': open_orders = get_open_orders(symbol) if not open_orders: # Open Short position quantity = 1 # Set your desired quantity here order = execute_order(symbol, 'MARKET', 'SELL', quantity) if order: print(f"Opened Short position. Order ID: {order['id']}") else: # Close all open orders close_position(symbol) time.sleep(1)
d4e36a4a40297c353a947c7cc19af196
{ "intermediate": 0.39300400018692017, "beginner": 0.3771689534187317, "expert": 0.22982710599899292 }
15,692
How to enumerate all textures from dx9 window in c++?
becd12844970e854f840e6cd3027495e
{ "intermediate": 0.5820992588996887, "beginner": 0.11718828976154327, "expert": 0.30071237683296204 }
15,693
Can you write an excel VBA code that does the following; For the Active sheet check column J from row 6 downwards to determine the last row with values. Then sort the range B to L by the date value in column I with the oldest date at the top and the earliest date at the bottom.
f112f07615ec747e0bdcfb4aa6a915cf
{ "intermediate": 0.3949768543243408, "beginner": 0.20781764388084412, "expert": 0.39720550179481506 }
15,694
custom breakpoint material ui
76d74752bd1fae647d3489d6e2c3aa66
{ "intermediate": 0.3942244350910187, "beginner": 0.365671306848526, "expert": 0.2401042878627777 }
15,695
how can i parse a csv file in c++ ?
8f3783a1cc48c8d25e0ed5e75de19c0a
{ "intermediate": 0.6567398905754089, "beginner": 0.12796811759471893, "expert": 0.21529199182987213 }
15,696
maternity leave email
b4467d0b61f8e0790e5ebf9873efd6af
{ "intermediate": 0.32885220646858215, "beginner": 0.45176687836647034, "expert": 0.2193809449672699 }
15,697
Vasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As all programmers do, he loves the famous drink "Beecola", which can be bought in n different shops in the city. It's known that the price of one bottle in the shop i is equal to xi coins. Vasiliy plans to buy his favorite drink for q consecutive days. He knows, that on the i-th day he will be able to spent mi coins. Now, for each of the days he want to know in how many different shops he can buy a bottle of "Beecola". Input The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of shops in the city that sell Vasiliy's favourite drink. The second line contains n integers xi (1 ≤ xi ≤ 100 000) — prices of the bottles of the drink in the i-th shop. The third line contains a single integer q (1 ≤ q ≤ 100 000) — the number of days Vasiliy plans to buy the drink. Then follow q lines each containing one integer mi (1 ≤ mi ≤ 109) — the number of coins Vasiliy can spent on the i-th day. Output Print q integers. The i-th of them should be equal to the number of shops where Vasiliy will be able to buy a bottle of the drink on the i-th day. Example inputCopy 5 3 10 8 6 11 4 1 10 3 11 outputCopy 0 4 1 5 Note On the first day, Vasiliy won't be able to buy a drink in any of the shops. On the second day, Vasiliy can buy a drink in the shops 1, 2, 3 and 4. On the third day, Vasiliy can buy a drink only in the shop number 1. Finally, on the last day Vasiliy can buy a drink in any shop. solve this in c language.
801af9392a38406d413f1fbc54eea37e
{ "intermediate": 0.35343948006629944, "beginner": 0.26769858598709106, "expert": 0.3788619637489319 }
15,698
using the livecode language how to get the name of a control when another control is placed on top
1503010ec89377aa3f8491f7b531b241
{ "intermediate": 0.2179386019706726, "beginner": 0.21548427641391754, "expert": 0.5665770769119263 }
15,699
<!DOCTYPE html> <html> <head> <meta charset=“UTF-8”/> <title>Multiplayer Chat Server</title> <script type="text/json">
7ea846ca96c8c5a5fe34070a0ccb0091
{ "intermediate": 0.31750842928886414, "beginner": 0.3262018859386444, "expert": 0.35628971457481384 }
15,700
I am trying to sort values in column B that start from row 18. I am using this code but getting error. Can you please correct it: Dim lastRow As Long Dim s As Long lastRow = Range("B" & Rows.count).End(xlUp).Row With Range("B18:B" & lastRow) .Sort Key1:=Range("B18:B" & lastRow), Order1:=xlAscending, Header:=xlYes End With
d2269958b6f167ad0f2c9b891c4f5b65
{ "intermediate": 0.42003336548805237, "beginner": 0.29039284586906433, "expert": 0.2895738184452057 }
15,701
I have data in column B that starts from B18. All the data starts with a text date in the format dd/mm/yyyy I would like to sort the range by the text date format with the oldest dat at the top. Can you please write a VBA code to do this
d23a69713de0d0f9aeb6fc7503c8379b
{ "intermediate": 0.5003864765167236, "beginner": 0.29492729902267456, "expert": 0.20468628406524658 }
15,702
You will act as a careful reader and annotator. You will be given some text. You will read the text carefully and identify all cause-and-effect relationship. In case such a relationship does exist, you should extract the cause with <CAUSE> and </CAUSE>, and extract the effect with <EFFECT> and </EFFECT>. Example: <CAUSE>Habitual smoking</CAUSE> may result in <EFFECT>poor health</EFFECT> text = Because of the rain, I stayed at home. I stayed at home due to the rain. It was raining. Consequently, I stayed at home. It was raining; therefore, I stayed home. Too much exposure to the sun will lead to skin cancer.
ceb74cc0c8f3a619f20962c6c4743b65
{ "intermediate": 0.362017959356308, "beginner": 0.3278590142726898, "expert": 0.3101230561733246 }
15,703
I have data in column B that starts from B18. All the data starts with a text date in the format dd/mm/yyyy I would like to sort the range by the text date format with the oldest dat at the top. Can you please write a VBA code to do this
218d0ab31da70976a116690fb7dee1e8
{ "intermediate": 0.5003864765167236, "beginner": 0.29492729902267456, "expert": 0.20468628406524658 }
15,704
I have values in column B that start from B18. All the values in column B are text values. All the values start with the text value of a date in the format dd/mm/yyyy I would like to sort the range by the text value of the represented date with the oldest date at the top. Can you please write a VBA code to do this.
aa71a3888602559490995dff36487b06
{ "intermediate": 0.46583935618400574, "beginner": 0.2818606197834015, "expert": 0.2523000240325928 }
15,705
Can you give me order_execution code with out take profit : import time from binance.client import Client from binance.exceptions import BinanceAPIException from binance.helpers import round_step_size import pandas as pd import json import numpy as np import pytz import datetime as dt import ccxt from decimal import Decimal import requests import hmac import hashlib import ntplib import os import ta import ta.volatility API_KEY = ‘’ API_SECRET = ‘’ client = Client(API_KEY, API_SECRET) def sync_time(): server_time = requests.get(‘https://api.binance.com/api/v3/time’).json()['serverTime’] local_time = int(time.time() * 1000) time_difference = server_time - local_time # Set the system clock to the new time os.system(f’sudo date -s @{int(server_time/1000)}‘) print(f’New time: {dt.datetime.now()}’) # Sync your local time with the server time sync_time() # Set the endpoint and parameters for the request url = “https://fapi.binance.com/fapi/v1/klines” symbol = ‘BCH/USDT’ interval = ‘1m’ lookback = 44640 timestamp = int(time.time() * 1000) - 500 # subtract 500ms from local time to account for clock-drift recv_window = 60000 # increased recv_window value params = { “symbol”: symbol.replace(“/”, “”), “interval”: interval, “startTime”: int((time.time() - lookback * 60) * 1000), “endTime”: int(time.time() * 1000), “timestamp”: timestamp, “recvWindow”: recv_window } # Sign the message using the Client’s secret key message = “&”.join([f"{k}={v}" for k, v in params.items()]) signature = hmac.new(API_SECRET.encode(), message.encode(), hashlib.sha256).hexdigest() params[signature] = signature # Send the request using the requests library response = requests.get(url, params=params, headers={‘X-MBX-APIKEY’: API_KEY}) # Check for errors in the response response.raise_for_status() API_KEY_MEXC = ‘’ API_SECRET_MEXC = ‘’ # Initialize MEXC client mexc_futures = ccxt.mexc({ ‘apiKey’: API_KEY_MEXC, ‘secret’: API_SECRET_MEXC, ‘enableRateLimit’: True, ‘options’: { ‘defaultType’: ‘future’, } }) time.sleep(1) def get_klines(symbol, interval, lookback): url = “https://fapi.binance.com/fapi/v1/klines” end_time = int(time.time() * 1000) # end time is now start_time = end_time - (lookback * 60 * 1000) # start time is lookback minutes ago symbol = symbol.replace(“/”, “”) # remove slash from symbol query_params = f"?symbol={symbol}&interval={interval}&startTime={start_time}&endTime={end_time}“ headers = { ‘User-Agent’: ‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36’ } response = requests.get(url + query_params, headers=headers) response.raise_for_status() data = response.json() if not data: # if data is empty, return None print(‘No data found for the given timeframe and symbol’) return None ohlcv = [] for d in data: timestamp = dt.datetime.fromtimestamp(d[0]/1000).strftime(‘%Y-%m-%d %H:%M:%S’) ohlcv.append({ ‘Open time’: timestamp, ‘Open’: float(d[1]), ‘High’: float(d[2]), ‘Low’: float(d[3]), ‘Close’: float(d[4]), ‘Volume’: float(d[5]) }) df = pd.DataFrame(ohlcv) df.set_index(‘Open time’, inplace=True) return df df = get_klines(symbol, interval, lookback) def signal_generator(df): if df is None: return ‘’ ema_analysis = [] candle_analysis = [] df[‘EMA5’] = df[‘Close’].ewm(span=5, adjust=False).mean() df[‘EMA20’] = df[‘Close’].ewm(span=20, adjust=False).mean() df[‘EMA100’] = df[‘Close’].ewm(span=100, adjust=False).mean() df[‘EMA200’] = df[‘Close’].ewm(span=200, adjust=False).mean() if ( df[‘EMA5’].iloc[-1] > df[‘EMA20’].iloc[-1] and df[‘EMA20’].iloc[-1] > df[‘EMA100’].iloc[-1] and df[‘EMA100’].iloc[-1] > df[‘EMA200’].iloc[-1] and df[‘EMA5’].iloc[-2] < df[‘EMA20’].iloc[-2] and df[‘EMA20’].iloc[-2] < df[‘EMA100’].iloc[-2] and df[‘EMA100’].iloc[-2] < df[‘EMA200’].iloc[-2] ): ema_analysis.append(‘golden_cross’) elif ( df[‘EMA5’].iloc[-1] < df[‘EMA20’].iloc[-1] and df[‘EMA20’].iloc[-1] < df[‘EMA100’].iloc[-1] and df[‘EMA100’].iloc[-1] < df[‘EMA200’].iloc[-1] and df[‘EMA5’].iloc[-2] > df[‘EMA20’].iloc[-2] and df[‘EMA20’].iloc[-2] > df[‘EMA100’].iloc[-2] and df[‘EMA100’].iloc[-2] > df[‘EMA200’].iloc[-2] ): ema_analysis.append(‘death_cross’) if ( df[‘Close’].iloc[-1] > df[‘Open’].iloc[-1] and df[‘Open’].iloc[-1] > df[‘Low’].iloc[-1] and df[‘High’].iloc[-1] > df[‘Close’].iloc[-1] ): candle_analysis.append(‘bullish_engulfing’) elif ( df[‘Close’].iloc[-1] < df[‘Open’].iloc[-1] and df[‘Open’].iloc[-1] < df[‘High’].iloc[-1] and df[‘Low’].iloc[-1] > df[‘Close’].iloc[-1] ): candle_analysis.append(‘bearish_engulfing’) bollinger_std = df[‘Close’].rolling(window=20).std() df[‘UpperBand’] = df[‘EMA20’] + (bollinger_std * 2) df[‘LowerBand’] = df[‘EMA20’] - (bollinger_std * 2) if ( df[‘Close’].iloc[-1] > df[‘UpperBand’].iloc[-1] and df[‘Close’].iloc[-2] < df[‘UpperBand’].iloc[-2] ): candle_analysis.append(‘upper_band_breakout’) elif ( df[‘Close’].iloc[-1] < df[‘LowerBand’].iloc[-1] and df[‘Close’].iloc[-2] > df[‘LowerBand’].iloc[-2] ): candle_analysis.append(‘lower_band_breakout’) if (‘golden_cross’ in ema_analysis and ‘bullish_engulfing’ in candle_analysis) or ‘upper_band_breakout’ in candle_analysis: return ‘buy’ elif (‘death_cross’ in ema_analysis and ‘bearish_engulfing’ in candle_analysis) or ‘lower_band_breakout’ in candle_analysis: return ‘sell’ else: return ‘’ end_time = int(time.time() * 1000) start_time = end_time - lookback * 60 * 1000 def get_futures_balance(symbol): try: balance = mexc_futures.fetch_balance() print(balance) # Add this line to inspect the balance variable futures_balance = balance[‘info’][‘data’][symbol] return futures_balance[‘total’] except Exception as e: print(f"Error getting futures balance: {e}”) return 0 futures_balance = get_futures_balance(symbol) quantity = futures_balance * 0.5 print(f"Quantity: {quantity}“) def execute_order(symbol, order_type, side, quantity): try: order_params = { ‘symbol’: symbol, ‘side’: side, ‘type’: order_type, ‘quantity’: quantity } order = mexc_futures.create_order(**order_params) return order except Exception as e: print(f"Error executing order: {e}”) return None def cancel_order(symbol, order_id): try: mexc_futures.cancel_orders([order_id], symbol) print(“Order cancelled successfully.”) except Exception as e: print(f"Error cancelling order: {e}“) def get_open_orders(symbol): try: orders = mexc_futures.fetch_open_orders(symbol) return orders except Exception as e: print(f"Error getting open orders: {e}”) return [] def close_position(symbol): try: open_orders = get_open_orders(symbol) if open_orders: for order in open_orders: cancel_order(symbol, order[‘id’]) except Exception as e: print(f"Error closing position: {e}“) # Rest of the code… signal = signal_generator(df) while True: orders = mexc_futures.fetch_open_orders(symbol) df = get_klines(symbol, ‘1m’, 44640) if signal is not None: print(f"The signal time is: {dt.datetime.now().strftime(‘%Y-%m-%d %H:%M:%S’)}:{signal}”) time.sleep(1) if signal == ‘buy’: open_orders = get_open_orders(symbol) if not open_orders: # Open Long position quantity = 1 # Set your desired quantity here order = execute_order(symbol, ‘MARKET’, ‘BUY’, quantity) if order: print(f"Opened Long position. Order ID: {order[‘id’]}“) else: # Close all open orders close_position(symbol) elif signal == ‘sell’: open_orders = get_open_orders(symbol) if not open_orders: # Open Short position quantity = 1 # Set your desired quantity here order = execute_order(symbol, ‘MARKET’, ‘SELL’, quantity) if order: print(f"Opened Short position. Order ID: {order[‘id’]}”) else: # Close all open orders close_position(symbol) time.sleep(1)
a64c44ac9a34757216dec210b8764b4d
{ "intermediate": 0.41546735167503357, "beginner": 0.4644708037376404, "expert": 0.12006180733442307 }
15,706
I used your trading bot code: import time from binance.client import Client from binance.exceptions import BinanceAPIException from binance.helpers import round_step_size import pandas as pd import json import numpy as np import pytz import datetime as dt import ccxt from decimal import Decimal import requests import hmac import hashlib import ntplib import os import ta import ta.volatility API_KEY = '' API_SECRET = '' client = Client(API_KEY, API_SECRET) def sync_time(): server_time = requests.get('https://api.binance.com/api/v3/time').json()['serverTime'] local_time = int(time.time() * 1000) time_difference = server_time - local_time # Set the system clock to the new time os.system(f'sudo date -s @{int(server_time/1000)}') print(f'New time: {dt.datetime.now()}') # Sync your local time with the server time sync_time() # Set the endpoint and parameters for the request url = "https://fapi.binance.com/fapi/v1/klines" symbol = 'BCH/USDT' interval = '1m' lookback = 44640 timestamp = int(time.time() * 1000) - 500 # subtract 500ms from local time to account for clock-drift recv_window = 60000 # increased recv_window value params = { "symbol": symbol.replace("/", ""), "interval": interval, "startTime": int((time.time() - lookback * 60) * 1000), "endTime": int(time.time() * 1000), "timestamp": timestamp, "recvWindow": recv_window } # Sign the message using the Client’s secret key message = "&".join([f"{k}={v}" for k, v in params.items()]) signature = hmac.new(API_SECRET.encode(), message.encode(), hashlib.sha256).hexdigest() params[signature] = signature # Send the request using the requests library response = requests.get(url, params=params, headers={'X-MBX-APIKEY': API_KEY}) # Check for errors in the response response.raise_for_status() API_KEY_MEXC = '' API_SECRET_MEXC = '' # Initialize MEXC client mexc_futures = ccxt.mexc({ 'apiKey': API_KEY_MEXC, 'secret': API_SECRET_MEXC, 'enableRateLimit': True, 'options': { 'defaultType': 'future', } }) time.sleep(1) def get_klines(symbol, interval, lookback): url = "https://fapi.binance.com/fapi/v1/klines" end_time = int(time.time() * 1000) # end time is now start_time = end_time - (lookback * 60 * 1000) # start time is lookback minutes ago symbol = symbol.replace("/", "") # remove slash from symbol query_params = f"?symbol={symbol}&interval={interval}&startTime={start_time}&endTime={end_time}" headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36' } response = requests.get(url + query_params, headers=headers) response.raise_for_status() data = response.json() if not data: # if data is empty, return None print('No data found for the given timeframe and symbol') return None ohlcv = [] for d in data: timestamp = dt.datetime.fromtimestamp(d[0]/1000).strftime('%Y-%m-%d %H:%M:%S') ohlcv.append({ 'Open time': timestamp, 'Open': float(d[1]), 'High': float(d[2]), 'Low': float(d[3]), 'Close': float(d[4]), 'Volume': float(d[5]) }) df = pd.DataFrame(ohlcv) df.set_index('Open time', inplace=True) return df df = get_klines(symbol, interval, lookback) def signal_generator(df): if df is None: return '' ema_analysis = [] candle_analysis = [] df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean() df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean() df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean() df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean() if ( df['EMA5'].iloc[-1] > df['EMA20'].iloc[-1] and df['EMA20'].iloc[-1] > df['EMA100'].iloc[-1] and df['EMA100'].iloc[-1] > df['EMA200'].iloc[-1] and df['EMA5'].iloc[-2] < df['EMA20'].iloc[-2] and df['EMA20'].iloc[-2] < df['EMA100'].iloc[-2] and df['EMA100'].iloc[-2] < df['EMA200'].iloc[-2] ): ema_analysis.append('golden_cross') elif ( df['EMA5'].iloc[-1] < df['EMA20'].iloc[-1] and df['EMA20'].iloc[-1] < df['EMA100'].iloc[-1] and df['EMA100'].iloc[-1] < df['EMA200'].iloc[-1] and df['EMA5'].iloc[-2] > df['EMA20'].iloc[-2] and df['EMA20'].iloc[-2] > df['EMA100'].iloc[-2] and df['EMA100'].iloc[-2] > df['EMA200'].iloc[-2] ): ema_analysis.append('death_cross') if ( df['Close'].iloc[-1] > df['Open'].iloc[-1] and df['Open'].iloc[-1] > df['Low'].iloc[-1] and df['High'].iloc[-1] > df['Close'].iloc[-1] ): candle_analysis.append('bullish_engulfing') elif ( df['Close'].iloc[-1] < df['Open'].iloc[-1] and df['Open'].iloc[-1] < df['High'].iloc[-1] and df['Low'].iloc[-1] > df['Close'].iloc[-1] ): candle_analysis.append('bearish_engulfing') bollinger_std = df['Close'].rolling(window=20).std() df['UpperBand'] = df['EMA20'] + (bollinger_std * 2) df['LowerBand'] = df['EMA20'] - (bollinger_std * 2) if ( df['Close'].iloc[-1] > df['UpperBand'].iloc[-1] and df['Close'].iloc[-2] < df['UpperBand'].iloc[-2] ): candle_analysis.append('upper_band_breakout') elif ( df['Close'].iloc[-1] < df['LowerBand'].iloc[-1] and df['Close'].iloc[-2] > df['LowerBand'].iloc[-2] ): candle_analysis.append('lower_band_breakout') if ('golden_cross' in ema_analysis and 'bullish_engulfing' in candle_analysis) or 'upper_band_breakout' in candle_analysis: return 'buy' elif ('death_cross' in ema_analysis and 'bearish_engulfing' in candle_analysis) or 'lower_band_breakout' in candle_analysis: return 'sell' else: return '' end_time = int(time.time() * 1000) start_time = end_time - lookback * 60 * 1000 def get_futures_balance(symbol): try: balance = mexc_futures.fetch_balance() print(balance) # Add this line to inspect the balance variable futures_balance = balance['info']['data'][symbol] return futures_balance['total'] except Exception as e: print(f"Error getting futures balance: {e}") return 0 futures_balance = get_futures_balance(symbol) quantity = futures_balance * 0.5 print(f"Quantity: {quantity}") def execute_order(symbol, order_type, side, quantity): try: order = client.create_order( symbol=symbol, side=side, type=order_type, quantity=quantity ) return order except Exception as e: print(f"Error executing order: {e}") return None def get_open_orders(symbol): try: orders = client.get_open_orders(symbol=symbol) return orders except Exception as e: print(f"Error getting open orders: {e}") return [] def close_position(symbol): try: open_orders = get_open_orders(symbol) if open_orders: for order in open_orders: client.cancel_order( symbol=symbol, origClientOrderId=order['orderId'] ) print("Position closed successfully.") except Exception as e: print(f"Error closing position: {e}") # Rest of the code… order_type = 'MARKET' while True: signal = signal_generator(df) if signal is not None: print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Signal: {signal}") if signal == 'buy': open_orders = get_open_orders(symbol) if not open_orders: # Open Long position order = execute_order(symbol, order_type, 'BUY', quantity) if order: print(f"Opened Long position. Order ID: {order['orderId']}") else: # Close all open orders close_position(symbol) elif signal == 'sell': open_orders = get_open_orders(symbol) if not open_orders: # Open Short position order = execute_order(symbol, order_type, 'SELL', quantity) if order: print(f"Opened Short position. Order ID: {order['orderId']}") else: # Close all open orders close_position(symbol) time.sleep(1) But it doesn't give me any signals
ced73aa82db5eb24fc2a6fbe895a71cd
{ "intermediate": 0.4804280698299408, "beginner": 0.3289898633956909, "expert": 0.1905820518732071 }
15,707
draw a plan of land size 42'*39'
845356d8e3c9626717985f55ff793ba0
{ "intermediate": 0.40606972575187683, "beginner": 0.33655327558517456, "expert": 0.2573769986629486 }
15,708
I used your code: import time from binance.client import Client from binance.exceptions import BinanceAPIException from binance.helpers import round_step_size import pandas as pd import json import numpy as np import pytz import datetime as dt import ccxt from decimal import Decimal import requests import hmac import hashlib import ntplib import os import ta import ta.volatility API_KEY = ‘’ API_SECRET = ‘’ API_KEY_MEXC = ‘’ API_SECRET_MEXC = ‘’ client = Client(API_KEY, API_SECRET) def sync_time(): server_time = requests.get(‘https://api.binance.com/api/v3/time’).json()['serverTime’] local_time = int(time.time() * 1000) time_difference = server_time - local_time # Set the system clock to the new time os.system(f’sudo date -s @{int(server_time/1000)}‘) print(f’New time: {dt.datetime.now()}’) # Sync your local time with the server time sync_time() # Set the endpoint and parameters for the request url = “https://fapi.binance.com/fapi/v1/klines” symbol = ‘BCH/USDT’ interval = ‘1m’ lookback = 44640 timestamp = int(time.time() * 1000) - 500 # subtract 500ms from local time to account for clock-drift recv_window = 60000 # increased recv_window value params = { “symbol”: symbol.replace(“/”, “”), “interval”: interval, “startTime”: int((time.time() - lookback * 60) * 1000), “endTime”: int(time.time() * 1000), “timestamp”: timestamp, “recvWindow”: recv_window } # Sign the message using the Client’s secret key message = “&”.join([f"{k}={v}" for k, v in params.items()]) signature = hmac.new(API_SECRET.encode(), message.encode(), hashlib.sha256).hexdigest() params[signature] = signature # Send the request using the requests library response = requests.get(url, params=params, headers={‘X-MBX-APIKEY’: API_KEY}) # Check for errors in the response response.raise_for_status() # Initialize MEXC client mexc_futures = ccxt.mexc({ ‘apiKey’: API_KEY_MEXC, ‘secret’: API_SECRET_MEXC, ‘enableRateLimit’: True, ‘options’: { ‘defaultType’: ‘future’, } }) time.sleep(1) def get_klines(symbol, interval, lookback): url = “https://fapi.binance.com/fapi/v1/klines” end_time = int(time.time() * 1000) # end time is now start_time = end_time - (lookback * 60 * 1000) # start time is lookback minutes ago symbol = symbol.replace(“/”, “”) # remove slash from symbol query_params = f"?symbol={symbol}&interval={interval}&startTime={start_time}&endTime={end_time}“ headers = { ‘User-Agent’: ‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36’ } response = requests.get(url + query_params, headers=headers) response.raise_for_status() data = response.json() if not data: # if data is empty, return None print(‘No data found for the given timeframe and symbol’) return None ohlcv = [] for d in data: timestamp = dt.datetime.fromtimestamp(d[0]/1000).strftime(‘%Y-%m-%d %H:%M:%S’) ohlcv.append({ ‘Open time’: timestamp, ‘Open’: float(d[1]), ‘High’: float(d[2]), ‘Low’: float(d[3]), ‘Close’: float(d[4]), ‘Volume’: float(d[5]) }) df = pd.DataFrame(ohlcv) df.set_index(‘Open time’, inplace=True) return df df = get_klines(symbol, interval, lookback) def signal_generator(df): if df is None: return ‘’ ema_analysis = [] candle_analysis = [] df[‘EMA5’] = df[‘Close’].ewm(span=5, adjust=False).mean() df[‘EMA20’] = df[‘Close’].ewm(span=20, adjust=False).mean() df[‘EMA100’] = df[‘Close’].ewm(span=100, adjust=False).mean() df[‘EMA200’] = df[‘Close’].ewm(span=200, adjust=False).mean() if ( df[‘EMA5’].iloc[-1] > df[‘EMA20’].iloc[-1] and df[‘EMA20’].iloc[-1] > df[‘EMA100’].iloc[-1] and df[‘EMA100’].iloc[-1] > df[‘EMA200’].iloc[-1] and df[‘EMA5’].iloc[-2] < df[‘EMA20’].iloc[-2] and df[‘EMA20’].iloc[-2] < df[‘EMA100’].iloc[-2] and df[‘EMA100’].iloc[-2] < df[‘EMA200’].iloc[-2] ): ema_analysis.append(‘golden_cross’) elif ( df[‘EMA5’].iloc[-1] < df[‘EMA20’].iloc[-1] and df[‘EMA20’].iloc[-1] < df[‘EMA100’].iloc[-1] and df[‘EMA100’].iloc[-1] < df[‘EMA200’].iloc[-1] and df[‘EMA5’].iloc[-2] > df[‘EMA20’].iloc[-2] and df[‘EMA20’].iloc[-2] > df[‘EMA100’].iloc[-2] and df[‘EMA100’].iloc[-2] > df[‘EMA200’].iloc[-2] ): ema_analysis.append(‘death_cross’) if ( df[‘Close’].iloc[-1] > df[‘Open’].iloc[-1] and df[‘Open’].iloc[-1] > df[‘Low’].iloc[-1] and df[‘High’].iloc[-1] > df[‘Close’].iloc[-1] ): candle_analysis.append(‘bullish_engulfing’) elif ( df[‘Close’].iloc[-1] < df[‘Open’].iloc[-1] and df[‘Open’].iloc[-1] < df[‘High’].iloc[-1] and df[‘Low’].iloc[-1] > df[‘Close’].iloc[-1] ): candle_analysis.append(‘bearish_engulfing’) bollinger_std = df[‘Close’].rolling(window=20).std() df[‘UpperBand’] = df[‘EMA20’] + (bollinger_std * 2) df[‘LowerBand’] = df[‘EMA20’] - (bollinger_std * 2) if ( df[‘Close’].iloc[-1] > df[‘UpperBand’].iloc[-1] and df[‘Close’].iloc[-2] < df[‘UpperBand’].iloc[-2] ): candle_analysis.append(‘upper_band_breakout’) elif ( df[‘Close’].iloc[-1] < df[‘LowerBand’].iloc[-1] and df[‘Close’].iloc[-2] > df[‘LowerBand’].iloc[-2] ): candle_analysis.append(‘lower_band_breakout’) if (‘golden_cross’ in ema_analysis and ‘bullish_engulfing’ in candle_analysis) or ‘upper_band_breakout’ in candle_analysis: return ‘buy’ elif (‘death_cross’ in ema_analysis and ‘bearish_engulfing’ in candle_analysis) or ‘lower_band_breakout’ in candle_analysis: return ‘sell’ else: return ‘’ end_time = int(time.time() * 1000) start_time = end_time - lookback * 60 * 1000 def get_futures_balance(symbol): try: balance = mexc_futures.fetch_balance() print(balance) # Add this line to inspect the balance variable futures_balance = balance[‘info’][‘data’][symbol] return futures_balance[‘total’] except Exception as e: print(f"Error getting futures balance: {e}”) return 0 futures_balance = get_futures_balance(symbol) quantity = futures_balance * 0.5 print(f"Quantity: {quantity}“) def execute_order(symbol, order_type, side, quantity): try: order = client.create_order( symbol=symbol, side=side, type=order_type, quantity=quantity ) return order except Exception as e: print(f"Error executing order: {e}”) return None def get_open_orders(symbol): try: orders = client.get_open_orders(symbol=symbol) return orders except Exception as e: print(f"Error getting open orders: {e}“) return [] def close_position(symbol): try: open_orders = get_open_orders(symbol) if open_orders: for order in open_orders: client.cancel_order( symbol=symbol, origClientOrderId=order[‘orderId’] ) print(“Position closed successfully.”) except Exception as e: print(f"Error closing position: {e}”) # Rest of the code… order_type = ‘MARKET’ while True: signal = signal_generator(df) if signal is not None: print(f"The signal time is: {dt.datetime.now().strftime(‘%Y-%m-%d %H:%M:%S’)} - Signal: {signal}“) if signal == ‘buy’: open_orders = get_open_orders(symbol) if not open_orders: # Open Long position order = execute_order(symbol, order_type, ‘BUY’, quantity) if order: print(f"Opened Long position. Order ID: {order[‘orderId’]}”) else: # Close all open orders close_position(symbol) elif signal == ‘sell’: open_orders = get_open_orders(symbol) if not open_orders: # Open Short position order = execute_order(symbol, order_type, ‘SELL’, quantity) if order: print(f"Opened Short position. Order ID: {order[‘orderId’]}") else: # Close all open orders close_position(symbol) time.sleep(1) But it doesn’t give me my any signals, give me code which will give me signals Your advices: The code you provided seems to have all the necessary functions and logic to generate trading signals based on the EMA crossover and candlestick patterns. However, there might be some issues with the data source or the parameters being used. Here are a few possible improvements you can make to the code: 1. Check data source: Ensure that the get_klines function is correctly fetching the historical data for the specified symbol and interval. You can add print statements or debug the code to see if the data is being retrieved successfully. 2. Adjust lookback period: The lookback parameter determines the number of minutes of historical data to fetch. Make sure the value is appropriate for your trading strategy. You can also experiment with different lookback periods to see if it affects the generation of signals. 3. Verify signal conditions: Double-check the conditions for generating buy and sell signals in the signal_generator function. Ensure that the conditions are correctly evaluating the moving averages and candlestick patterns. 4. Test on different symbols and intervals: Try running the code on different symbols and intervals to see if it generates signals for them. It’s possible that the current symbol and interval combination is not producing any signals due to specific market conditions. 5. Verify account balance and quantity: Double-check your account balance and ensure that you have enough funds available to place orders. Also, verify the calculation of the quantity variable to ensure that it is being set correctly for opening positions. 6. Monitor error messages: Check for any error messages or exceptions being printed in the console. These messages can provide valuable information about any issues or errors that might be occurring. Make these adjustments and run the code again to see if it successfully generates trading signals. If you encounter any specific error messages or issues, please provide those details so that I can assist you further.
9dbdb58acb5c76ad5bd5e6b0e74828d3
{ "intermediate": 0.41260284185409546, "beginner": 0.47958096861839294, "expert": 0.10781627148389816 }
15,709
import csv from bson import ObjectId import pymongo from datetime import datetime, timedelta import pytz # Create a timezone object for UTC utc = pytz.UTC client = pymongo.MongoClient("mongodb://keystone:<PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:27017/keystone") db = client["keystone"] jobstatuses = db["jobstatuses"] custom_asin_pages = db["custom-asin-pages"] jobs = db["jobs"] job_id = ObjectId('6458abcd7c09f047136908b6') # Get the current datetime in UTC current_datetime = datetime.utcnow().replace(tzinfo=utc) # Calculate the datetime for 10 days ago at midnight 12 am UTC ten_days_ago = current_datetime - timedelta(days=2, hours=current_datetime.hour, minutes=current_datetime.minute, seconds=current_datetime.second, microseconds=current_datetime.microsecond) # Retrieve the documents with the specified jobId and within the last 10 days documents = jobstatuses.find({"jobId": job_id, "createdAt": {"$gte": ten_days_ago}}, {"_id": 1}) document_ids = [str(doc["_id"]) for doc in documents] # Create a CSV file and write the header with open("missed_asins.csv", "w", newline="") as csvfile: fieldnames = ["Job ID", "Job Name", "Pipeline ID", "Source Data", "Fetched Data", "Missed Data"] writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() for document_id in document_ids: pipeline_id = document_id source_data = jobstatuses.find_one({"_id": ObjectId(document_id)}, {"source.data": 1})["source"]["data"] missed_asins = [] # Check presence of source.data in asin field for each pipeline_id for asin in source_data: pipeline_asin = custom_asin_pages.find_one({"pipeline_id": pipeline_id, "asin": asin}) if not pipeline_asin: missed_asins.append(asin) # Retrieve job name from the jobs collection job_name = jobs.find_one({"_id": job_id}, {"name": 1})["name"] document_count = custom_asin_pages.count_documents({"pipeline_id": document_id}) # Write the results to the CSV file writer.writerow({ "Job ID": str(job_id), "Job Name": job_name, "Pipeline ID": pipeline_id, "Source Data": len(source_data), "Fetched Data": document_count, "Missed Data": ", ".join(missed_asins) }) print("Results have been written to missed_asins.csv") please optimise this code
7390f20a3ac1a1d04662bcb3201f19be
{ "intermediate": 0.42381301522254944, "beginner": 0.3668985366821289, "expert": 0.20928847789764404 }
15,710
I used your signal_generator and order_execution code: import time from binance.client import Client from binance.exceptions import BinanceAPIException from binance.helpers import round_step_size import pandas as pd import json import numpy as np import pytz import datetime as dt import ccxt from decimal import Decimal import requests import hmac import hashlib import ntplib import os import ta import ta.volatility API_KEY = '' API_SECRET = '' API_KEY_MEXC = '' API_SECRET_MEXC = '' client = Client(API_KEY, API_SECRET) def sync_time(): server_time = requests.get('https://api.binance.com/api/v3/time').json()['serverTime'] local_time = int(time.time() * 1000) time_difference = server_time - local_time # Set the system clock to the new time os.system(f'sudo date -s @{int(server_time/1000)}') print(f'New time: {dt.datetime.now()}') # Sync your local time with the server time sync_time() # Set the endpoint and parameters for the request url = "https://fapi.binance.com/fapi/v1/klines" symbol = 'BCH/USDT' interval = '1m' lookback = 44640 timestamp = int(time.time() * 1000) - 500 # subtract 500ms from local time to account for clock-drift recv_window = 60000 # increased recv_window value params = { "symbol": symbol.replace("/", ""), "interval": interval, "startTime": int((time.time() - lookback * 60) * 1000), "endTime": int(time.time() * 1000), "timestamp": timestamp, "recvWindow": recv_window } # Sign the message using the Client’s secret key message = "&".join([f"{k}={v}" for k, v in params.items()]) signature = hmac.new(API_SECRET.encode(), message.encode(), hashlib.sha256).hexdigest() params[signature] = signature # Send the request using the requests library response = requests.get(url, params=params, headers={'X-MBX-APIKEY': API_KEY}) # Check for errors in the response response.raise_for_status() # Initialize MEXC client mexc_futures = ccxt.mexc({ 'apiKey': API_KEY_MEXC, 'secret': API_SECRET_MEXC, 'enableRateLimit': True, 'options': { 'defaultType': 'future', } }) time.sleep(1) def get_klines(symbol, interval, lookback): url = "https://fapi.binance.com/fapi/v1/klines" end_time = int(time.time() * 1000) # end time is now start_time = end_time - (lookback * 60 * 1000) # start time is lookback minutes ago symbol = symbol.replace("/", "") # remove slash from symbol query_params = f"?symbol={symbol}&interval={interval}&startTime={start_time}&endTime={end_time}" headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36' } response = requests.get(url + query_params, headers=headers) response.raise_for_status() data = response.json() if not data: # if data is empty, return None print('No data found for the given timeframe and symbol') return None ohlcv = [] for d in data: timestamp = dt.datetime.fromtimestamp(d[0]/1000).strftime('%Y-%m-%d %H:%M:%S') ohlcv.append({ 'Open time': timestamp, 'Open': float(d[1]), 'High': float(d[2]), 'Low': float(d[3]), 'Close': float(d[4]), 'Volume': float(d[5]) }) df = pd.DataFrame(ohlcv) df.set_index('Open time', inplace=True) return df df = get_klines(symbol, interval, lookback) def signal_generator(df): if df is None: return '' ema_analysis = [] candle_analysis = [] df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean() df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean() df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean() df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean() if ( df['EMA5'].iloc[-1] > df['EMA20'].iloc[-1] and df['EMA20'].iloc[-1] > df['EMA100'].iloc[-1] and df['EMA100'].iloc[-1] > df['EMA200'].iloc[-1] and df['EMA5'].iloc[-2] < df['EMA20'].iloc[-2] and df['EMA20'].iloc[-2] < df['EMA100'].iloc[-2] and df['EMA100'].iloc[-2] < df['EMA200'].iloc[-2] ): ema_analysis.append('golden_cross') elif ( df['EMA5'].iloc[-1] < df['EMA20'].iloc[-1] and df['EMA20'].iloc[-1] < df['EMA100'].iloc[-1] and df['EMA100'].iloc[-1] < df['EMA200'].iloc[-1] and df['EMA5'].iloc[-2] > df['EMA20'].iloc[-2] and df['EMA20'].iloc[-2] > df['EMA100'].iloc[-2] and df['EMA100'].iloc[-2] > df['EMA200'].iloc[-2] ): ema_analysis.append('death_cross') if ( df['Close'].iloc[-1] > df['Open'].iloc[-1] and df['Open'].iloc[-1] > df['Low'].iloc[-1] and df['High'].iloc[-1] > df['Close'].iloc[-1] ): candle_analysis.append('bullish_engulfing') elif ( df['Close'].iloc[-1] < df['Open'].iloc[-1] and df['Open'].iloc[-1] < df['High'].iloc[-1] and df['Low'].iloc[-1] > df['Close'].iloc[-1] ): candle_analysis.append('bearish_engulfing') bollinger_std = df['Close'].rolling(window=20).std() df['UpperBand'] = df['EMA20'] + (bollinger_std * 2) df['LowerBand'] = df['EMA20'] - (bollinger_std * 2) if ( df['Close'].iloc[-1] > df['UpperBand'].iloc[-1] and df['Close'].iloc[-2] < df['UpperBand'].iloc[-2] ): candle_analysis.append('upper_band_breakout') elif ( df['Close'].iloc[-1] < df['LowerBand'].iloc[-1] and df['Close'].iloc[-2] > df['LowerBand'].iloc[-2] ): candle_analysis.append('lower_band_breakout') if ('golden_cross' in ema_analysis and 'bullish_engulfing' in candle_analysis) or 'upper_band_breakout' in candle_analysis: return 'buy' elif ('death_cross' in ema_analysis and 'bearish_engulfing' in candle_analysis) or 'lower_band_breakout' in candle_analysis: return 'sell' else: return '' end_time = int(time.time() * 1000) start_time = end_time - lookback * 60 * 1000 def get_futures_balance(symbol): try: balance = mexc_futures.fetch_balance() print(balance) # Add this line to inspect the balance variable futures_balance = balance['info']['data'][symbol] return futures_balance['total'] except Exception as e: print(f"Error getting futures balance: {e}") return 0 futures_balance = get_futures_balance(symbol) quantity = futures_balance * 0.5 print(f"Quantity: {quantity}") def execute_order(symbol, order_type, side, quantity): try: order = client.create_order( symbol=symbol, side=side, type=order_type, quantity=quantity ) return order except Exception as e: print(f"Error executing order: {e}") return None def get_open_orders(symbol): try: orders = client.get_open_orders(symbol=symbol) return orders except Exception as e: print(f"Error getting open orders: {e}") return [] def close_position(symbol): try: open_orders = get_open_orders(symbol) if open_orders: for order in open_orders: client.cancel_order( symbol=symbol, origClientOrderId=order['orderId'] ) print("Position closed successfully.") except Exception as e: print(f"Error closing position: {e}") # Rest of the code… order_type = 'MARKET' while True: signal = signal_generator(df) if signal is not None: print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Signal: {signal}") if signal == 'buy': open_orders = get_open_orders(symbol) if not open_orders: # Open Long position order = execute_order(symbol, order_type, 'BUY', quantity) if order: print(f"Opened Long position. Order ID: {order['orderId']}") else: # Close all open orders close_position(symbol) elif signal == 'sell': open_orders = get_open_orders(symbol) if not open_orders: # Open Short position order = execute_order(symbol, order_type, 'SELL', quantity) if order: print(f"Opened Short position. Order ID: {order['orderId']}") else: # Close all open orders close_position(symbol) time.sleep(1) But it doesn't print me any signls , please tell me what I need to change in my code and how my code need to seem with your advices
3776f468fdff3c40dd09641ccadd8698
{ "intermediate": 0.46712055802345276, "beginner": 0.40771666169166565, "expert": 0.12516285479068756 }
15,711
hii
ab0c78a4096ceb2957c18a54da973227
{ "intermediate": 0.3416314125061035, "beginner": 0.27302300930023193, "expert": 0.38534557819366455 }
15,712
what is the correct format to publish joint angles into the rostopic of Iiwa/PositionController/command
2ccc1d17f678df7d847a6a7bf9a04c53
{ "intermediate": 0.4848591685295105, "beginner": 0.22118006646633148, "expert": 0.2939607501029968 }
15,713
im in windows 7 how can i check how many devices are in my network?
92bbeeff83b606ecb1e1946cba28964b
{ "intermediate": 0.45133233070373535, "beginner": 0.22994910180568695, "expert": 0.3187185227870941 }
15,714
Напиши функцию на языке python, которая имела бы на входе словарь, содержащий ключи: grandprix_name, first_run_name, second_run_name, third_run_name, fourth_run_name, fifth_run_name, first_run_time, second_run_time, third_run_time, fourth_run_time, fifth_run_time, а на выходе создавала картинку, содержащую таблицу со следующими данными: в первой строке указывается день недели, число месяца и название месяца, найденные из значения first_run_time. Следующая строка должна быть разделена на 5 разных столбцов: в первом вставляется картинка cloud.png, выравненная по центру ячейки, во второй ячейке текстом пишется значение из first_run_name, в третьей ячейке вставляется картинка water.png, выравненная по центру ячейки, в четвертой ячейке вставляется картинка heat.png, и в пятой ячейке вставляется значения из first_run_time. Если день, полученный из значения second_run_time совпадает с предыдущим, то в следующей строке в соответствующие ячейки вставляются те же значения, только first_run_name и first_run_time заменяются на second_run_time и second_run_time соответственно, и так далее. Но если же день, полученный из следующего значения run_time отличается от предыдущего, то в следующей строке пишется день недели, число месяца и название месяца соответствующее ему, а следующая строчка снова разбивается на 5 ячеек и туда добавляются значения из предыдущего шага.
fe6f7d2df3ad908df640449f7fa419a3
{ "intermediate": 0.3358306288719177, "beginner": 0.5302167534828186, "expert": 0.13395267724990845 }
15,715
hi
e18133cf5424678340b9face410e51ec
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
15,716
I've an asp.net core with react project, this is my program.cs: "using cryptotasky; using cryptotasky.Models; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; using System.Text; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddCors(options => { options.AddPolicy("AllowAll", policy => { policy.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); }); }); builder.Services.AddControllersWithViews(); builder.Services.AddTransient<IEmailService, EmailService>(); builder.Services.AddDbContext<CryptoTContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))); builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateAudience = true, ValidateLifetime = true, ValidateIssuerSigningKey = true, ValidIssuer = builder.Configuration["Jwt:Issuer"], ValidAudience = builder.Configuration["Jwt:Issuer"], IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Jwt:Key"])) }; }); builder.Services.AddHostedService<DailyResetService>(); var app = builder.Build(); // Configure the HTTP request pipeline. app.UseStaticFiles(); app.UseRouting(); app.UseCors("AllowAll"); app.UseAuthentication(); // Add this line to enable authentication app.UseAuthorization(); app.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); app.MapFallbackToFile("index.html"); app.Run();" and it's throwing that error: "Unhandled exception. System.Net.Sockets.SocketException (10049): The requested address is not valid in its context. at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName) at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions.CreateDefaultBoundListenSocket(EndPoint endpoint) at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind() at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory.BindAsync(EndPoint endpoint, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.TransportManager.BindAsync(EndPoint endPoint, ConnectionDelegate connectionDelegate, EndpointConfig endpointConfig, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<>c__DisplayClass30_0`1.<<StartAsync>g__OnBind|0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext context, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IEnumerable`1 listenOptions, AddressBindContext context, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken) at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host) at Program.<Main>$(String[] args) in C:\Users\kingk\Desktop\Cryptotaskys\cryptotasky\Program.cs:line 62 C:\Users\kingk\Desktop\Cryptotaskys\cryptotasky\bin\Debug\net7.0\cryptotasky.exe (process 14288) exited with code -532462766. Press any key to close this window . . ." find the issue and fix it.
f52c9167f84ee17f631e68a3a8bf4d0a
{ "intermediate": 0.3023141622543335, "beginner": 0.4576583206653595, "expert": 0.24002759158611298 }
15,717
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <fcntl.h> #define MAX_COMMANDS 7 #define MAX_ARGS 10 #define MAX_INPUT_LENGTH 100 void execute_command(char *command) { pid_t pid = fork(); if (pid == -1) { perror("Error forking child process"); exit(EXIT_FAILURE); } else if (pid == 0) { // Child process char *args[MAX_ARGS]; int argc = 0; // Tokenize the command into arguments char *token = strtok(command, " "); while (token != NULL && argc < MAX_ARGS) { args[argc++] = token; token = strtok(NULL, " "); } args[argc] = NULL; // Execute the command if (execvp(args[0], args) == -1) { perror("Error executing command"); exit(EXIT_FAILURE); } } else { // Parent process if (wait(NULL) == -1) { perror("Error waiting for child process"); exit(EXIT_FAILURE); } } } void execute_piped_commands(char *commands[], int num_commands) { int pipes[num_commands - 1][2]; int command_status[MAX_COMMANDS] = {0}; // Create pipes for each command for (int i = 0; i < num_commands - 1; i++) { if (pipe(pipes[i]) == -1) { perror("Error creating pipe"); exit(EXIT_FAILURE); } } // Fork child processes for each command for (int i = 0; i < num_commands; i++) { pid_t pid = fork(); if (pid == -1) { perror("Error forking child process"); exit(EXIT_FAILURE); } else if (pid == 0) { // Child process // Redirect input/output as necessary if (i == 0) { // First command, redirect output to pipe if (dup2(pipes[i][1], STDOUT_FILENO) == -1) { perror("Error redirecting output"); exit(EXIT_FAILURE); } // Close unused read end of the pipe close(pipes[i][0]); } else if (i == num_commands - 1) { // Last command, redirect input from pipe if (dup2(pipes[i - 1][0], STDIN_FILENO) == -1) { perror("Error redirecting input"); exit(EXIT_FAILURE); } // Close unused write end of the pipe close(pipes[i - 1][1]); } else { // Middle commands, redirect both input and output if (dup2(pipes[i - 1][0], STDIN_FILENO) == -1) { perror("Error redirecting input"); exit(EXIT_FAILURE); } if (dup2(pipes[i][1], STDOUT_FILENO) == -1) { perror("Error redirecting output"); exit(EXIT_FAILURE); } // Close unused ends of the pipes close(pipes[i - 1][1]); close(pipes[i][0]); } // Close all pipe ends for (int j = 0; j < num_commands - 1; j++) { close(pipes[j][0]); close(pipes[j][1]); } // Execute the command execute_command(commands[i]); exit(EXIT_SUCCESS); } } // Close all pipe ends in the parent process for (int i = 0; i < num_commands - 1; i++) { close(pipes[i][0]); close(pipes[i][1]); } // Wait for child processes to finish and collect their exit status for (int i = 0; i < num_commands; i++) { int status; if (wait(&status) == -1) { perror("Error waiting for child process"); exit(EXIT_FAILURE); } command_status[i] = WEXITSTATUS(status); } // Determine the overall exit status based on the logical operators int overall_status = 0; for (int i = 0; i < num_commands; i++) { if (command_status[i] != 0 && commands[i][0] == '&') { overall_status = 1; break; } if (command_status[i] == 0 && commands[i][0] == '|') { overall_status = 1; break; } } // exit(overall_status); } void execute_command_with_redirection(char *command, char *filename, int mode) { int fd; // Open the file for redirection if (mode == 0) { fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); } else if (mode == 1) { fd = open(filename, O_WRONLY | O_CREAT | O_APPEND, 0644); } else if (mode == 2) { fd = open(filename, O_RDONLY); } if (fd == -1) { perror("Error opening file"); exit(EXIT_FAILURE); } // Fork a child process pid_t pid = fork(); if (pid == -1) { perror("Error forking child process"); exit(EXIT_FAILURE); } else if (pid == 0) { // Child process if (mode == 0 || mode == 1) { // Output redirection if (dup2(fd, STDOUT_FILENO) == -1) { perror("Error redirecting output"); exit(EXIT_FAILURE); } } else if (mode == 2) { // Input redirection if (dup2(fd, STDIN_FILENO) == -1) { perror("Error redirecting input"); exit(EXIT_FAILURE); } } // Close the file descriptor close(fd); // Tokenize the command into arguments char *args[MAX_ARGS]; int argc = 0; char *token = strtok(command, " "); while (token != NULL && argc < MAX_ARGS) { args[argc++] = token; token = strtok(NULL, " "); } args[argc] = NULL; // Execute the command if (execvp(args[0], args) == -1) { perror("Error executing command"); exit(EXIT_FAILURE); } } // Close the file descriptor in the parent process close(fd); // Wait for the child process to finish if (wait(NULL) == -1) { perror("Error waiting for child process"); exit(EXIT_FAILURE); } } int main() { char input[MAX_INPUT_LENGTH]; while (1) { printf("mshell$ "); fgets(input, sizeof(input), stdin); // Remove the newline character from the input input[strcspn(input, "\n")] = '\0'; // Tokenize the input into commands char *commands[MAX_COMMANDS]; int num_commands = 0; char *token = strtok(input, "|"); while (token != NULL && num_commands < MAX_COMMANDS) { commands[num_commands++] = token; token = strtok(NULL, "|"); } // Check if piping is required if (num_commands > 1) { execute_piped_commands(commands, num_commands); // Remove the exit statement here } else { // Tokenize the command into individual commands char *sequential_commands[MAX_COMMANDS]; int num_sequential_commands = 0; token = strtok(commands[0], ";"); while (token != NULL && num_sequential_commands < MAX_COMMANDS) { sequential_commands[num_sequential_commands++] = token; token = strtok(NULL, ";"); } // Execute each command sequentially for (int i = 0; i < num_sequential_commands; i++) { char *command = sequential_commands[i]; // Check for redirection operators char *output_redirect = strstr(command, ">>"); char *input_redirect = strstr(command, "<"); char *output_redirect_truncate = strstr(command, ">"); if (output_redirect != NULL) { *output_redirect = '\0'; char *filename = output_redirect + 2; execute_command_with_redirection(command, filename, 1); } else if (input_redirect != NULL) { *input_redirect = '\0'; char *filename = input_redirect + 1; execute_command_with_redirection(command, filename, 2); } else if (output_redirect_truncate != NULL) { *output_redirect_truncate = '\0'; char *filename = output_redirect_truncate + 1; execute_command_with_redirection(command, filename, 0); } else { execute_command(command); // Remove the exit statement here } } } } return 0; } in the above code && and || condition is not working correctly
94427b010810bc9d123674064d893d9e
{ "intermediate": 0.4332476556301117, "beginner": 0.4227297306060791, "expert": 0.1440226286649704 }
15,718
I use Snapraid on my Openmediavault home server, how do I replace the parity drive?
e34a9bea1c9758cfa610996121d2ae27
{ "intermediate": 0.6716558933258057, "beginner": 0.14493931829929352, "expert": 0.18340471386909485 }
15,719
full C# Code for infinite voxel terrain generation
4cc4865ad0a5731236f271faed86d62e
{ "intermediate": 0.3523073196411133, "beginner": 0.20005366206169128, "expert": 0.44763901829719543 }
15,720
what is computer
f630a33bf0b73b1de0df82205a6f3d98
{ "intermediate": 0.22831615805625916, "beginner": 0.2832443416118622, "expert": 0.4884394705295563 }
15,721
how to merge json in javascript
12186474f3c96db09ac5081226dc1943
{ "intermediate": 0.424250990152359, "beginner": 0.23491165041923523, "expert": 0.34083735942840576 }
15,722
simple python code to convert list of pillow images into a video
7196a362f26858060bbda1c4b6a619bd
{ "intermediate": 0.3535255193710327, "beginner": 0.29733699560165405, "expert": 0.34913748502731323 }
15,723
how should i implement hashcode function
6f7f9753a6829229ab062cf83f6f0c6a
{ "intermediate": 0.2954860031604767, "beginner": 0.20452871918678284, "expert": 0.49998530745506287 }
15,724
please write me a paper on my family
d005c3bf2a487ef2c003d3870f0cc986
{ "intermediate": 0.3802781105041504, "beginner": 0.36892396211624146, "expert": 0.25079798698425293 }
15,725
I'm use AWS S3 replicate feature to replicate objects in one bucket to another region. I have already configured daily replication job, will S3 execute full replication or just replicate incremental changed objects?
33dec199f006e3b9de19708aadd04f9e
{ "intermediate": 0.45416170358657837, "beginner": 0.251331627368927, "expert": 0.29450666904449463 }
15,726
In flutter, I use a button in a form of SVG image with complex geometry. How to bound tapping registration only inside it's form and not the whole box (ignore transparent bits)
69084b28fbb2d0a66bcba6477b495a24
{ "intermediate": 0.5499039888381958, "beginner": 0.1825403869152069, "expert": 0.2675556242465973 }
15,727
JavaScript how to drag and drop resize image
7e8b3cd0f656598b1b429cb30db7fd19
{ "intermediate": 0.6351029276847839, "beginner": 0.17867551743984222, "expert": 0.18622158467769623 }
15,728
import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators, FormArray } from '@angular/forms'; @Component({ selector: 'comp2-component', templateUrl: './comp2.component.html', styleUrls: ['./comp2.component.css'] }) export class SecondComponent implements OnInit { hotelForm: FormGroup | undefined; constructor(private formBuilder: FormBuilder) { } ngOnInit(): void { this.hotelForm = this.formBuilder.group({ hotel: this.formBuilder.group({ name: ['', Validators.required], location: ['', Validators.required], hotelOwner: ['', Validators.required], telNumber: ['', Validators.required] }), contracts: this.formBuilder.array([]), rooms: this.formBuilder.array([]) }); } get contracts(): FormArray | null { return this.hotelForm?.get('contracts') as FormArray; } get rooms(): FormArray | null { return this.hotelForm?.get('rooms') as FormArray; } addContract(): void { this.contracts.push(this.formBuilder.group({ startDate: ['', Validators.required], endDate: ['', Validators.required], markup: ['', Validators.required] })); } addRoom(): void { this.rooms.push(this.formBuilder.group({ typeName: ['', Validators.required], price: ['', Validators.required], maxNoOfPeople: ['', Validators.required], noOfRooms: ['', Validators.required] })); } removeRoom(index: number): void { this.rooms.removeAt(index); } onSubmit(): void { if (this.hotelForm && this.hotelForm.valid) { console.log(this.hotelForm.value); // You can perform further actions here, such as submitting the form data to a server. } } } <form formGroup="hotelForm" (ngSubmit)="onSubmit()"> <!-- Hotel Information--> <div formGroupName="hotel"> <div class="form-group"> <label for="name">Hotel Name</label> <input type="text" class="form-control" id="name" formControlName="name" placeholder="Enter hotel name"> </div> <div class="form-group"> <label for="location">Location</label> <input type="text" class="form-control" id="location" formControlName="location" placeholder="Enter location"> </div> <div class="form-group"> <label for="hotelOwner">Hotel Owner</label> <input type="text" class="form-control" id="hotelOwner" formControlName="hotelOwner" placeholder="Enter hotel owner"> </div> <div class="form-group"> <label for="telNumber">Telephone Number</label> <input type="text" class="form-control" id="telNumber" formControlName="telNumber" placeholder="Enter telephone number"> </div> </div> <!-- Contracts --> <div formArrayName="contracts"> <div *ngFor="let contract of contracts.controls; let i = index" formGroupName="{{i}}"> <h4>Contract {{ i + 1 }}</h4> <div class="form-row"> <div class="form-group col-md-6"> <label for="startDate">Start Date</label> <input type="text" class="form-control" id="startDate" formControlName="startDate" placeholder="Select start date"> </div> <div class="form-group col-md-6"> <label for="endDate">End Date</label> <input type="text" class="form-control" id="endDate" formControlName="endDate" placeholder="Select end date"> </div> </div> <div class="form-group"> <label for="markup">Markup</label> <input type="text" class="form-control" id="markup" formControlName="markup" placeholder="Enter markup"> </div> </div> <button type="button" class="btn btn-secondary" (click)="addContract()">Add Contract</button> </div> <!-- Rooms --> <div formArrayName="rooms"> <div *ngFor="let room of rooms.controls; let i = index" [formGroupName]="i"> <h4>Room {{ i + 1 }}</h4> <div class="form-group"> <label for="typeName">Room Type</label> <input type="text" class="form-control" id="typeName" formControlName="typeName" placeholder="Enter room type"> </div> <div class="form-group"> <label for="price">Price</label> <input type="text" class="form-control" id="price" formControlName="price" placeholder="Enter price"> </div> <div class="form-group"> <label for="maxNoOfPeople">Maximum Number of People</label> <input type="text" class="form-control" id="maxNoOfPeople" formControlName="maxNoOfPeople" placeholder="Enter maximum number of people"> </div> <div class="form-group"> <label for="noOfRooms">Number of Rooms</label> <input type="text" class="form-control" id="noOfRooms" formControlName="noOfRooms" placeholder="Enter number of rooms"> </div> <button type="button" class="btn btn-danger" (click)="removeRoom(i)">Remove Room</button> </div> <button type="button" class="btn btn-success" (click)="addRoom()">Add Room</button> </div> <button type="submit" class="btn btn-primary">Submit</button> </form>
de3e5ace8a3349297f963b3fac50cde7
{ "intermediate": 0.34599000215530396, "beginner": 0.40910014510154724, "expert": 0.2449098378419876 }
15,729
你好,以下报错怎么解决:/Users/luoyujia/anaconda3/envs/tensorflow230/lib/python3.6/site-packages/sklearn/utils/validation.py:63: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel(). return f(*args, **kwargs)
9b83d5d1fc6bf24df0e174e62803f554
{ "intermediate": 0.45052045583724976, "beginner": 0.22004978358745575, "expert": 0.3294297456741333 }
15,730
request_threaded_irq()
668e91f8ebe87398a740794afe630a8a
{ "intermediate": 0.2805408239364624, "beginner": 0.21022355556488037, "expert": 0.509235680103302 }
15,731
implement freertos version of request_threaded_irq() as a whole function, you are only allowed to use xTask apis
955a19ac2fdf02ac343e3ddb03ae52bf
{ "intermediate": 0.4526723027229309, "beginner": 0.2842234969139099, "expert": 0.26310423016548157 }
15,732
write a code for a simple tic tac toe game in python
0180e43f0e4eb7b89f7ccbffba08d965
{ "intermediate": 0.32690274715423584, "beginner": 0.3427581191062927, "expert": 0.33033910393714905 }
15,733
I want to use retrieval agumented generation in local. Using hugging face transformer pretrained model flan-gl2, chromadb with local persistence. Give the the detailed instructions and code to do the implementation.
9597541b7ac2807833b91efa573e7d05
{ "intermediate": 0.2749060094356537, "beginner": 0.13579201698303223, "expert": 0.5893020629882812 }
15,734
Problem statement Ahmed was thinking about coding a new algorithm to get the unique values in an array A, which holds repetitive values N numbers. Moreover, Ahmed wants to solve it with a perfect approach in order to send it to Gammal Tech for the volunteering points. Can you help Ahmed to get Gammal Tech volunteering points? Input First line contains a number N (1 ≤ N ≤ 10^3) the number of elements. Second line contains N numbers (0 ≤ A[ i ]≤ 10^9). Output Print unique elements in the array. c programe use x[ ]
bc7d1729cedf13a84e04f5f3bbe4744a
{ "intermediate": 0.2157118171453476, "beginner": 0.2293396145105362, "expert": 0.554948627948761 }
15,735
Do opengl loaders allow one to use the various prefixed extensions (ARB_, etc.) in ancient opengl versions automatically, by using the not prefixed names of modern opengl versions?
6872454ea1784e1abac0116fc4e291d3
{ "intermediate": 0.4637162685394287, "beginner": 0.28024619817733765, "expert": 0.25603753328323364 }
15,736
A program that asks the user to enter a sentence with a maximum of 50 characters, and prints the number of the most frequent characters in the sentence c programe use #include <stdio.h> just
d6df81735035bef3330afade188b309b
{ "intermediate": 0.5773029327392578, "beginner": 0.17822495102882385, "expert": 0.24447213113307953 }
15,737
c برنامج يطلب من المستخدم إدخال جملة بحد أقصى 50 حرفًا ، ويطبع عدد الأحرف الأكثر تكرار في الجملة استخدم برنامج
e334036bb958753fec18a0316ba60985
{ "intermediate": 0.2785409092903137, "beginner": 0.40534508228302, "expert": 0.31611403822898865 }
15,738
где в коде это прописывать ? import io.sentry.Sentry; Sentry.configureScope(scope -> scope.setTransaction("UserListView"));
93e21c8a92e3907790d05f2beb943921
{ "intermediate": 0.45783400535583496, "beginner": 0.31227731704711914, "expert": 0.2298886477947235 }
15,739
translate css code to WPF c# * { margin: 0; padding: 0; box-sizing: border-box; } :root { --index: calc(1vw + 1vh); --transition: 1.5s cubic-bezier(.05, .5, 0, 1); } @font-face { font-family: kamerik-3d; src: url(../fonts/kamerik205-heavy.woff2); font-weight: 900; } @font-face { font-family: merriweather-italic-3d; src: url(../fonts/merriweather-regular-italic.woff2); } body { background-color: #000; color: #fff; font-family: kamerik-3d; } .logo { --logo-size: calc(var(--index) * 7.8); width: var(--logo-size); height: var(--logo-size); background-repeat: no-repeat; position: absolute; left: calc(51% - calc(var(--logo-size) / 2)); top: calc(var(--index) * 2.8); z-index: 1; } .layers { perspective: 1000px; overflow: hidden; } .layers__container { height: 100vh; min-height: 500px; transform-style: preserve-3d; transform: rotateX(var(--move-y)) rotateY(var(--move-x)); will-change: transform; transition: transform var(--transition); } .layers__item { position: absolute; inset: -5vw; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; } .layer-1 { transform: translateZ(-55px) scale(1.06); } .layer-2 { transform: translateZ(80px) scale(.88); } .layer-3 { transform: translateZ(180px) scale(.8); } .layer-4 { transform: translateZ(190px) scale(.9); } .layer-5 { transform: translateZ(300px) scale(.9); } .layer-6 { transform: translateZ(380px); } .hero-content { font-size: calc(var(--index) * 2.9); text-align: center; text-transform: uppercase; letter-spacing: calc(var(--index) * -.15); line-height: 1.35em; margin-top: calc(var(--index) * 5.5); } .hero-content span { display: block; } .hero-content__p { text-transform: none; font-family: merriweather-italic-3d; letter-spacing: normal; font-size: calc(var(--index) * .73); line-height: 3; } .button-start { font-family: Arial; font-weight: 600; text-transform: uppercase; font-size: calc(var(--index) * .71); letter-spacing: -.02vw; padding: calc(var(--index) * .7) calc(var(--index) * 1.25); background-color: transparent; color: #fff; border-radius: 10em; border: rgb(255 255 255 / .4) 3px solid; outline: none; cursor: pointer; margin-top: calc(var(--index) * 2.5); } .layer-4, .layer-5, .layer-6 { pointer-events: none; }
70a0d97d4649dbd59d97ff9ef0493792
{ "intermediate": 0.2567306458950043, "beginner": 0.4628993570804596, "expert": 0.28036996722221375 }
15,740
public static Mono<ValidRequest> create(OplRequestData oplRequestData) { switch (oplRequestData.getTypeOperation()){ case on: return CreateUpdateRequest.createCreateUpdateRequest(oplRequestData); } }
ec109b181126b63862f6e3842b1cf166
{ "intermediate": 0.3686267137527466, "beginner": 0.4420333504676819, "expert": 0.18933993577957153 }
15,741
how to make 1 slider out of 2 sliders with different ranges in WPF <Slider Minimum=“-90” Maximum=“90” Value=“{Binding ElementName=rotate, Path= Angle}” />
c37dd8ebd69da041af1f09091461e5a1
{ "intermediate": 0.4444824159145355, "beginner": 0.2926318347454071, "expert": 0.262885719537735 }
15,742
To test the API request for post request with /CheckLicense endpoint and body { "instanceType": " Developer", "webApplication": " https://org8ec9810d.crm6.dynamics.com/", "environmentId": " 3b6196c2-c722-ea44-b36f-84d353d1b0c1", "environmentFriendlyName": " DataPress Environment", "orgVersion": " 9.2.23062.168", "tenantId": " ede123e5-d464-4560-bd5f-7ee8d5807f08", "uniqueName": " unqa8c521a7a71a41c586e51f1b8d42f", "state": " Enabled", "urlName": " org8ec9810d", "geo": " OCE", "activeUsers": 6, "activeWpSites": 0, "solutions": [ { "solutionName": " Field for Test", "version": " 1.0.0.6", "publisher": " AlexaCRM Dev" } ] } response should be like this { "clientName": "Beta User", "clientEmail": "beta@alexacrm.com", "issuedOn": "2023-02-01T00:00:00", "expiresOn": "2023-07-01T00:00:00", "gracePeriodExpiresOn": null, "instanceType": " Developer", "isEnabledVirtualRequest": true, "features": [ { "name": "RetrieveView", "isEnabled": true }, { "name": "RetrieveViews", "isEnabled": true }, { "name": "RetrieveForm", "isEnabled": true }, { "name": "RetrieveForms", "isEnabled": true }, { "name": "AuthorizeUser", "isEnabled": true }, { "name": "AssociateUser", "isEnabled": true }, { "name": "RetrieveUser", "isEnabled": true }, { "name": "AuthorizeUserRef", "isEnabled": true } ], "addons": null, "licenseName": null }
db2ce235d2df24caa7a711c01a3faa74
{ "intermediate": 0.541338324546814, "beginner": 0.25534918904304504, "expert": 0.20331257581710815 }
15,743
<Slider Minimum="40" Maximum="80" /> <Slider Minimum="90" Maximum="180" /> how to make 1 slider out of 2 sliders with different ranges in WPF
fdd6277f91bb6dbc5e21432935bffa95
{ "intermediate": 0.3548508286476135, "beginner": 0.260795921087265, "expert": 0.3843532204627991 }
15,744
How can I add a stromg trasparency to this background color? background-image: url(/wp-content/uploads/2023/06/overlay.png),linear-gradient(360deg,#311a1d 0%,#50C878 3%);
3302519e74064b35bd91231072b36103
{ "intermediate": 0.3196820318698883, "beginner": 0.30411496758461, "expert": 0.3762030005455017 }
15,745
你好,我接到一个客户的项目,实现需求如下:在TensorFlow 2.3中,使用FastText进行中文文本分类,帮忙给出一个包含中文文本和对应分类、数据预处理、分词、向量化、训练、预测、评估及模型保存在内的完整例子,要求模型训练准确率达到90%以上,并且代码可直接运行。谢谢!
7313f8c3c88f38214d551da160d84a12
{ "intermediate": 0.35692286491394043, "beginner": 0.20744630694389343, "expert": 0.43563082814216614 }
15,746
switch java version powershell
014d525017852953f6c87e1a428c1f62
{ "intermediate": 0.4526107609272003, "beginner": 0.2880341112613678, "expert": 0.25935518741607666 }
15,747
int main() { long long HEX; int POWER;//存储幂 bool ZHENG;//判断是否为正数 cout << "请输入十六进制数字:"; scanf_s("%x", HEX); if (HEX >= pow(2, 31)) { ZHENG = false; HEX = (HEX - pow(16, 7)) * 2; } else { ZHENG = true; HEX *= 2; } POWER = (HEX >> 24)-127; for (int i = 0; i < 8; ++i) { HEX = HEX << 1; if (HEX >= pow(2, 32)) HEX -= pow(2, 32); } HEX += pow(2, 32); while (!(HEX % 2)) HEX /= 2; int temp1; double temp2; int k = 0, i = 0; for (; k < HEX; i++) k = pow(2, i);//i=11 temp1 = HEX >> (i - POWER - 2); temp2= HEX-temp1*pow(2, i - POWER - 2); for(int k=0;k<i - POWER - 2;++k) temp2 /= 2; if(ZHENG) cout<<"十进制数的形式为:"<<temp1 + temp2; else cout << "十进制数的形式为:" << -temp1 - temp2; return 0; }这个代码要在C环境中运行应该怎么修改
8920a5d046d2193891c133756f9bf301
{ "intermediate": 0.2344539910554886, "beginner": 0.5468157529830933, "expert": 0.21873024106025696 }
15,748
how can i write this method using spring reactive webflux mono/flux? provide me an example and explain also why it should be better: public void sendToQueue(LoginRequestElement loginRequestElement){ try { // employee = new Employee("Micheal", "Jackson", 10000L, new Date(), 24); //String jsonObj = new XmlMapper().writer().withDefaultPrettyPrinter().writeValueAsString(loginRequestElement); jmsTemplate.send(queue, messageCreator -> { TextMessage message = messageCreator.createTextMessage(); //message.setText(jsonObj); SOAPMessage message1 = soapUtilities.createSoapRequest(loginRequestElement); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { message1.writeTo(out); } catch (SOAPException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } String strMsg = new String(out.toByteArray()); message.setText(strMsg); return message; }); } catch (Exception ex) { System.out.println("ERROR in sending message to queue"); } }
beb272e6b117f711f7d42dff77681f15
{ "intermediate": 0.4921753406524658, "beginner": 0.3988914489746094, "expert": 0.10893320292234421 }
15,749
bet way to design Parent - child ui page in flutter
030c3f58479e7a26b7c743d0c861fa4f
{ "intermediate": 0.2684750556945801, "beginner": 0.2308211326599121, "expert": 0.5007038116455078 }
15,750
i have this utility class made with webflux: package com.mediaworld.apimanager.utilities; import com.mediaworld.apimanager.models.LoginRequestElement; import jakarta.xml.soap.*; import org.springframework.stereotype.Component; import reactor.core.publisher.Mono; @Component public class ReactiveSoapUtilities { public Mono<SOAPMessage> createSoapRequestReactive(Mono<LoginRequestElement> loginRequestElement){ return loginRequestElement.flatMap( requestElement -> { SOAPMessage request = null; try { MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); request = messageFactory.createMessage(); SOAPPart messagePart = request.getSOAPPart(); SOAPEnvelope envelope = messagePart.getEnvelope(); //envelope.removeNamespaceDeclaration(envelope.getPrefix()); envelope.setPrefix("SOAP-ENV"); /*SOAPHeader header = request.getSOAPHeader(); header.setPrefix("soap-env-3");*/ /*String soapAction = "/LoginService/login"; request.getMimeHeaders().addHeader("SOAPAction",soapAction);*/ SOAPBody body = envelope.getBody(); body.setPrefix("SOAP-ENV"); SOAPElement loginRequestElement1 = body.addChildElement("loginRequestElement","ns0","http://www.tibco.com/schemas/login_bw_project/login/schemas/Schema.xsd"); SOAPElement userElement = loginRequestElement1.addChildElement("user","ns0"); userElement.setTextContent(requestElement.getUser()); SOAPElement passwordElement = loginRequestElement1.addChildElement("pass","ns0"); passwordElement.setTextContent(requestElement.getPassword()); request.writeTo(System.out); return Mono.just(request); }catch (Exception e){ return Mono.error(e); } }); } } then i have this service class which calls it, but i need to modify it because it is not implemented to read a Mono<SOAPMessage>, how can i modify in order to make it work properly? package com.mediaworld.apimanager.testActiveMQ.service; import com.mediaworld.apimanager.models.LoginRequestElement; import com.mediaworld.apimanager.utilities.ReactiveSoapUtilities; import jakarta.jms.TextMessage; import jakarta.xml.soap.SOAPException; import jakarta.xml.soap.SOAPMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.jms.core.JmsTemplate; import org.springframework.stereotype.Service; import java.io.ByteArrayOutputStream; import java.io.IOException; @Service public class ReactiveProducerService { @Value("${spring.activemq.topic}") String topic; @Value("${spring.activemq.queue}") String queue; @Autowired JmsTemplate jmsTemplate; @Autowired private ReactiveSoapUtilities reactiveSoapUtilities; public void sendToQueue(LoginRequestElement loginRequestElement){ try { // employee = new Employee("Micheal", "Jackson", 10000L, new Date(), 24); //String jsonObj = new XmlMapper().writer().withDefaultPrettyPrinter().writeValueAsString(loginRequestElement); jmsTemplate.send(queue, messageCreator -> { TextMessage message = messageCreator.createTextMessage(); //message.setText(jsonObj); SOAPMessage message1 = reactiveSoapUtilities.createSoapRequest(loginRequestElement); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { message1.writeTo(out); } catch (SOAPException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } String strMsg = new String(out.toByteArray()); message.setText(strMsg); return message; }); } catch (Exception ex) { System.out.println("ERROR in sending message to queue"); } } }
ed3ab461fd9b99f84fd056e9008cf76d
{ "intermediate": 0.32544171810150146, "beginner": 0.48458975553512573, "expert": 0.18996860086917877 }
15,751
how to use xcopy to make a backup script which copy and replace the newest files and delete the deleted files for some folders.
a9efe9f975d598d2c85a92fe99ff39e1
{ "intermediate": 0.3467649817466736, "beginner": 0.28009742498397827, "expert": 0.37313753366470337 }
15,752
Assignment - Database Developer Outcome/Task/Result - Build a candidate management database schema using MYSQL OR MSSQL only. The schema contains three primary entities - ● Account ● User ● Candidate Account entity contains following fields: Column Name Description ID Unique id per Account Title Name of the Account Candidates Created count Count of candidates created on Account Candidates Deleted count Count of candidates created on Account User entity contains following fields: Column Name Description ID Unique id per User record First Name First Name of User Last Name Last Name of User Email Id Email Address of User AccountID AccountID of the User Candidates Created count Count of candidates created by User Candidates Deleted count Count of candidates created by User Candidate entity has following fields: Field Description ID Unique id per candidate record Serial Number Unique sequence number (serial number) per account. First Name First Name of candidate Last Name Last Name of candidate Email Address Email Address of candidate Gender Id Gender id of candidate Contact number Contact number of candidate(can be multiple using comma) Qualification Id Qualification id of the candidate Date of Birth Date of birth Resume File Link Link of the Resume File Resume text Extracted text from resume. Should be searchable and quick. Resume File name Resume File name Willing to relocate Does the candidate wish to relocate? 0 - no, 1 -yes Slug Unique string(can be used to mask id in urls) Linked In Url Linkedin profile url AccountID AccountID of Candidate record Created By User Id User id who has created the record Created On Time when record was created Address Full address of candidate Latitude Latitude Longitude Longitude Skills One candidate can have multiple skills Instructions & Guidelines to create the database schema in mysql that satisfies following conditions: ● Design and create tables with suitable columns, data types and normalisation. Ensure appropriate relationships, such as one-to-one, one-to-many, and many-to-many, are maintained. If necessary, create additional tables. ● Implement reference tables with relevant values for the dependent fields (shown in yellow). ● Incorporate indexes on columns that are frequently used in search or join operations. Identify the columns that are commonly queried or involved in joins, and create indexes to optimise query performance. ● Utilize triggers, procedures, views and functions where necessary to enhance functionality and maintain scalability. Document these database objects, including their purpose, input parameters, and expected output. ● Develop and implement a logging mechanism to track and record changes made to candidate records. ● Share .sql dump file while submitting the assignment. (mandatory) Assignment Tasks: Task 1: a. Document the logging mechanism, including the structure of the log table, the logged events and the information captured in the logs. b. Create comprehensive documentation for the database schema, including table definitions, column descriptions, relationships, and indexes. Document any naming conventions, data constraints, and data types used throughout the schema. c. Document any specific design decisions, such as the reasoning behind the choice of normalisation levels, table structures and relationships. (Note : You need to write the documentation along with queries, tables etc. for a, b & c to get maximum scores) Task 2: a. Write a query to delete the User record.(Mandatory) b. Write a query to search candidates based on name, email and linkedIn URLs. c. Write an optimized boolean search query to fetch candidate records using resumetext. d. Write a query to fetch comma separated User IDs against each account title. e. Write a query to fetch counts of Candidates, based on gender, on each account.
96dc5f492677c7b9b604c14161e65727
{ "intermediate": 0.3296157717704773, "beginner": 0.38350918889045715, "expert": 0.28687500953674316 }
15,753
I have three ranges H5:H38, L5:L24, P5:P14. I would like to enter a text value in P3 and have a VBA code that will search my ranges and highlight any cell that contains the text value in P3. Is it possible to do this
5aef63fe83783b673734c37cffbf8c03
{ "intermediate": 0.497422993183136, "beginner": 0.2008078694343567, "expert": 0.30176910758018494 }
15,754
Medical imaging to analyze and detect different diseases and problems now a day an emerging field. In this project we will design automated techniques and methods to analyze and detect bone fracture from X-ray images. X-ray images when examined manually it is time consuming and prone to errors. So our proposed system is able to detect fracture more accurately. images are a crucial resource for assessing the severity and prediction of bone injuries caused by trauma or accident. Fracture detection in long bones is a very challenging task due to the limited resolution of the original X-Ray images, as well as the complexity of bone structures and their possible fractures. So our proposed automated bone fracture detection system will work on these aspects. Functional Requirements: The system should have the following features: • Image Datasets are maintained • Image is selected for examine. • Image is shown as real image and then focused or noise removed image • Noise is removed from the image and image is transformed to clearer image so that system can easily detect fracture • Clearer image is used to detect fracture • System detects fracture based on the type of fracture. 1.fracture 2. Non fracture
b3a9267ffd2897782f444e38df13fee8
{ "intermediate": 0.21692590415477753, "beginner": 0.26390349864959717, "expert": 0.5191705822944641 }
15,755
How run a fast api and connection to python
229e944411a1ea65620894a70d4d0e7d
{ "intermediate": 0.7013707160949707, "beginner": 0.10720642656087875, "expert": 0.19142284989356995 }
15,756
i have parent child groups conatin 3 level of child ,every group has arabic name and english name field , how to design Parent - child ui page in flutter to recieve data from user with example : it is fine if you use 3 tabs widget to manage this
76a2513277dc8915217f739635262b8c
{ "intermediate": 0.5777782201766968, "beginner": 0.16340401768684387, "expert": 0.25881773233413696 }
15,757
как настроить мониторинг производительности sentry в spring boot приложении?
d7d4398458b653537c09a078f2fedda4
{ "intermediate": 0.3329283595085144, "beginner": 0.23331645131111145, "expert": 0.43375515937805176 }
15,758
describe the use of base128 in security
5febdc16f570ce5473c7b3fdf4685c8b
{ "intermediate": 0.1799420267343521, "beginner": 0.26495879888534546, "expert": 0.5550991296768188 }
15,759
Я напишу тебе программу на языке python, на входе которой даётся словарь с датами заездов, а на выходе рисуется картинка, содержащая таблицу из 8 строк и 5 столбцов. Программа: from PIL import Image, ImageDraw, ImageFont def draw_date_header(text, font, cell_width): cell_text = text # Находим размер текста с помощью метода font.getbbox text_bbox = font.getbbox(cell_text) text_width = text_bbox[2] - text_bbox[0] text_height = text_bbox[3] - text_bbox[1] text_x = x + (cell_width - text_width) // 2 text_y = y + (row_height - text_height) // 2 draw.text((text_x, text_y), cell_text, fill=(0, 0, 0), font=font) def find_table_width(column_widths, column_spacing): cell_width = 0 for i in range(0, len(column_widths)): cell_width = cell_width + column_widths[i] + column_spacing return cell_width def draw_table_with_dates(data): # Создаем изображение размером 1080x1350 пикселей image = Image.new("RGB", (1080, 1350), (255, 255, 255)) draw = ImageDraw.Draw(image) # Задаем параметры таблицы row_height = 75 column_widths = [75, 305, 125, 125, 150] column_spacing = 10 row_spacing = 10 font = ImageFont.truetype("arial.ttf", size=30) date_header_font = ImageFont.truetype("arial.ttf", size=50) # Вычисляем положение таблицы table_width = sum(column_widths) + column_spacing * (len(column_widths) - 1) table_height = row_height * 5 x = (image.width - table_width) // 2 y = (image.height - table_height) // 2 # Выводим даты над строками таблицы #dates = [data.get("first_day_date"), data.get("second_day_date"), data.get("third_day_date")] #date_y_positions = [y - 50, y + row_height * 2 - 50, y + row_height * 4 - 50] #for i in range(3): #date_left, date_top, date_width, date_height = font.getbbox(dates[i]) #date_x_position = (image.width - date_width) // 2 #draw.text((date_x_position, date_y_positions[i]), dates[i], fill=(0, 0, 0), font=font) current_table_row = 0 current_run = 0 # Рисуем таблицу for row in range(8): for col in range(5): if current_table_row == 0: cell_width = find_table_width(column_widths, column_spacing) draw_date_header(data[current_run], date_header_font, cell_width) continue else: if current_table_row >= 2: if data[current_run] != data[current_run - 1]: cell_width = find_table_width(column_widths, column_spacing) draw_date_header(data[current_run], date_header_font) continue else: cell_width = column_widths[col] if col == 1: cell_text = data.get("first_run_date") elif col == 2: cell_text = data.get("second_run_date") elif col == 3: cell_text = data.get("third_run_date") else: cell_text = "" # Находим размер текста с помощью метода font.getbbox text_bbox = font.getbbox(cell_text) text_width = text_bbox[2] - text_bbox[0] text_height = text_bbox[3] - text_bbox[1] text_x = x + (cell_width - text_width) // 2 text_y = y + (row_height - text_height) // 2 draw.text((text_x, text_y), cell_text, fill=(0, 0, 0), font=font) # Рисуем ячейку draw.rectangle([(x, y), (x + cell_width, y + row_height)], outline=(0, 0, 0)) x += cell_width + column_spacing # переходим к следующей ячейке if (col == 4): current_run += 1 # Переходим на новую строку x = (image.width - table_width) // 2 y += row_height + row_spacing current_table_row += 1 # Сохраняем изображение в файл image.save("table_with_dates.png") # Пример использования функции с примером словаря данных data = { "first_run_date": "29.11", "second_run_date": "29.11", "third_run_date": "30.11", "fourth_run_date": "30.11", "fifth_run_date": "31.11" } draw_table_with_dates(data) Сделай так, чтобы в первом столбце каждой строки вставлялась картинка heat.png, с автоматической подгонкой размера под размер ячейки и автоматическим выравниваем картинки в центр ячейки.
fb671806c5593eb5c4e1e0d50c076e7e
{ "intermediate": 0.3015833795070648, "beginner": 0.5663453936576843, "expert": 0.13207131624221802 }
15,760
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns0:loginRequestElement xmlns:ns0="http://www.tibco.com/schemas/login_bw_project/login/schemas/Schema.xsd"><ns0:user><PRESIDIO_ANONYMIZED_EMAIL_ADDRESS></ns0:user><ns0:pass>password</ns0:pass></ns0:loginRequestElement></SOAP-ENV:Body></SOAP-ENV:Envelope> i need to extract the user and password in java using objectmapper/xmlmapper
20e937666be0172e69e7d01e8377ab88
{ "intermediate": 0.46397289633750916, "beginner": 0.20707514882087708, "expert": 0.32895195484161377 }
15,761
generate a postgres user table query with id,token,type,createdAt and user_id(foreign key referenced from users table)
18cb36a0c28c5fc4c7312980b41fb5d7
{ "intermediate": 0.4230273365974426, "beginner": 0.3266145884990692, "expert": 0.25035804510116577 }
15,762
java code to provide a symbolic square on jpanel, that is indended to drag and drop midi data to an external app outside from java, may be as clipboard action that is dropped when releasing the mouse button
4defe7cd5cc9bc3c867a61afc6d98f59
{ "intermediate": 0.7701284885406494, "beginner": 0.07139626145362854, "expert": 0.15847526490688324 }
15,763
code nodejs upload image to google file store
4f9c2dd5056ca9ed332f22410287da51
{ "intermediate": 0.3424929082393646, "beginner": 0.2700014114379883, "expert": 0.3875057101249695 }
15,764
AttributeError: module 'string' has no attribute 'replace'. Did you mean: 'Template'?
c0791861a58907d4ee6ee28417235d73
{ "intermediate": 0.4733642637729645, "beginner": 0.31453704833984375, "expert": 0.21209868788719177 }
15,765
act as a React Native developer Task: Generate only code with files and its folder structure Requirement: An app to manage all personal details
87fa7f3f2c5345d8ea2ff60c03e993b8
{ "intermediate": 0.4578564167022705, "beginner": 0.246250718832016, "expert": 0.2958928644657135 }
15,766
use test tokens that map to the test card how to do with flutter
9cc4c6f8a6122bbe318d2a45851c7e96
{ "intermediate": 0.5085673928260803, "beginner": 0.21680337190628052, "expert": 0.27462923526763916 }
15,767
write a python code to take in 3 test inputs and give me the best two average out of three
913b7f948a6b85b0d84cd55d5d96249f
{ "intermediate": 0.2952837347984314, "beginner": 0.17872345447540283, "expert": 0.5259928703308105 }
15,768
local variables referenced from a lambda expression must be final or effectively final int freq1 = (int) Arrays.stream(rank).filter(a -> a == max1).count();
95ef85c38c4d3a5caa082933481a2f44
{ "intermediate": 0.14095696806907654, "beginner": 0.7600765228271484, "expert": 0.09896654635667801 }
15,769
code nodejs connect and upload image to google cloud storage bucket
ced110f57b25c909c03a5672ed23450c
{ "intermediate": 0.3607296943664551, "beginner": 0.24693980813026428, "expert": 0.392330527305603 }
15,770
C++ AI car traffic code for Rigs of Rods
c652fcc8d4d294a35d66a10afc34b83d
{ "intermediate": 0.10184017568826675, "beginner": 0.09419097751379013, "expert": 0.8039688467979431 }
15,771
Hi! Please tell me how do I redirect from one URL to another URL using /etc/host on macOS?
7dc8cc80bc22aed5efb04cb615c0b1ae
{ "intermediate": 0.5386624932289124, "beginner": 0.21717695891857147, "expert": 0.2441604733467102 }
15,772
what are the benefits to use chatgpt
1835c0ec15d11cf7807aa1083ad7cba9
{ "intermediate": 0.3891594707965851, "beginner": 0.16803745925426483, "expert": 0.4428030550479889 }