Canvas arc() - getting coords before and after Posted: 23 Oct 2021 07:56 AM PDT I am working on a function that can resolve the coordinates ( X and Y ) of arc function before it started to drawing ( where the arc begins ) and after it is finished ( where the arc ends ). I tried this code: export const arcEndCoords = (coordX: number, coordY: number, radius: number, angle: number) => { angle = angle * Math.PI / 180; return [coordX + Math.cos(angle) * radius, coordY + Math.sin(angle) * radius]; } but it doesn't have the startAngle and endAngle ( Without startAngle this code won't show the right results ) Could someone write functions for getting the start coords and end coords of the arc function in canvas? |
How to combine two lists in one with key and value to be duplicated in Asp.net Core MVC Posted: 23 Oct 2021 07:56 AM PDT I have two list that come from form one contains people name and the other one city Like this public IActionResult Index([FromForm] List<string> people,[FromForm] List<string> city) { } Now let's say that I have three people John, Sarah and tom And i have four cities London, Paris, DC, Rome So, if the user choose John and Sarah and London, Paris, DC for city This means John have all three cities and also Sarah have all three cities What I want is combine the two lists (people and city) together to get this result which for each person chosen they will have all cities chosen like the example I provided above I tried using Dictionary but since it must have unique key it didn't work and tried also ZIP but it doesn't do what I want. Is there a way I can achieve this !! |
I need to see if there is a way to end this loop when a criteria is met else where Posted: 23 Oct 2021 07:56 AM PDT |
SwiftUI - Matched Geometry Effect synchronize child views size Posted: 23 Oct 2021 07:55 AM PDT I'm implementing custom menu view with transition appearance from top trailing position. I'm using matchedGeometryEffect on views background. The problem is with child views of second view. They appears before animation ends. You can see below: How synchronize these button views with animation of parent view? Below my code: struct ContentView: View { @State var show = false @Namespace var namespace var body: some View { VStack(spacing: 0) { HStack(spacing: 0) { Spacer() Button(action: { withAnimation(.linear(duration: 1.2)) { // Longer duration for demo of issue show.toggle() } }) { Image(systemName: "ellipsis.circle") .font(.title3) .background( !show ? Color.clear .matchedGeometryEffect(id: "topMenuToggle", in: namespace, properties: .position) : nil ) } } .padding() Color.clear .overlay( show ? MenuView(namespace: namespace) : nil , alignment: .topTrailing ) } .foregroundColor(.white) .background(Color.black.ignoresSafeArea()) } } struct MenuView: View { let namespace: Namespace.ID var body: some View { VStack(spacing: 0) { Button(action: { }) { HStack(spacing: 0) { Text("Save video") .font(.body) Spacer(minLength: 0) Image(systemName: "arrow.down.circle") .resizable() .aspectRatio(contentMode: .fit) .frame(height: 20) } } .padding(.top, 18) .padding(.bottom, 18) .padding(.horizontal, 14) Rectangle() .fill(Color.white.opacity(0.1)) .frame(maxWidth: .infinity, maxHeight: 1) Button(action: { }) { HStack(spacing: 0) { Text("Report") .font(.body) Spacer(minLength: 0) Image(systemName: "exclamationmark.bubble") .resizable() .aspectRatio(contentMode: .fit) .frame(height: 20) } } .padding(.top, 16) .padding(.bottom, 18) .padding(.horizontal, 14) } .foregroundColor(.white) .frame(width: 250) .background( Color.white.opacity(0.2) .matchedGeometryEffect(id: "topMenuToggle", in: namespace, anchor: .bottomLeading) ) .cornerRadius(12) } } |
React Native: Not starting debugger since process cannot load the jdwp agent Posted: 23 Oct 2021 07:55 AM PDT My React Native app-release.apk is crashing when I opened it. The app-debug.apk is working absolutely fine. So, I run this command adb logact <my app package name>:V *:S . After running this command I opened the app and in the console I got this message. Can anyone tell what might be the problem? |
Python Numpy how to change the data types inside an array Posted: 23 Oct 2021 07:55 AM PDT I am trying to calculate information from an array that contains integers, however when I do a calculation the results are foat's. How do I change the ndarry to accept 0.xxx numbers as a input. Currently I am only getting 0's. Here is the code I have been trying to get working: ham_fields = np.array([], dtype=float) # dtype specifies the type of the elements ham_total = np.array([], dtype=float) # dtype specifies the type of the elements ham_fields = data[data[:, 0] == 0] # All the first column of the dataset doing a check if they are true or false ham_sum = np.delete((ham_fields.sum(0)),0) # Boolean indices are treated as a mask of elements to remove none Ham items ham_total = np.sum(ham_sum) ham_len = len(ham_sum) for i in range(ham_len): ham_sum[i] = (ham_sum[i] + self.alpha) / (ham_total + (ham_len * self.alpha)) |
How can I extract values that have opening and closing brackets with regular expression? Posted: 23 Oct 2021 07:55 AM PDT I am trying to extract [[String]] with regular expression. Notice how a bracket opens [ and it needs to close ]. So you would receive the following matches: [[String]] [String] String If I use \[[^\]]+\] it will just find the first closing bracket it comes across without taking into consideration that a new one has opened in between and it needs the second close. Is this at all possible with regular expression? Note: This type can either be String, [String] or [[String]] so you don't know upfront how many brackets there will be. |
PostgreSQL SSL full or ca verification does not work Posted: 23 Oct 2021 07:56 AM PDT we are running a Windows Server 2019 with PostgreSQL. I want to use SSL so the connection between our database and another server within the domain is secure. I configured the postgresql.conf and pg_hba.conf and provided a .cert and .key file (postgresql.conf) and the ip adress for the hostssl in the pg_hba.conf. The other server finds the configuration and also the certificate - if the SSL seetibgs are set to "require". When I change it to "ca" or "full" I get an error message that the certificate cant be found or is not valid. My question(s): Do I need to provide a CA File aswell? I have a RootCA2015 file - is it that one? Do I maybe need to name it "root.crt" specifically? Can it be at any place as long I configure the path or does it need to be in a specific path? What else could be a reason a certificate is not valid in that case? Initially I got a .cer file which I converted to a .crt file with openssl. Is it possible to use the Trust Store of the OS directly? The certificates are installed but the other server cant find them... |
Read a online cvs file generated by a script Posted: 23 Oct 2021 07:56 AM PDT I am trying to read a cvs file generated by some kind of script (I guess) and write the data on to two different worksheets labled "LT" and "ST", i.e. Long term and Short term. The Workbooks.open function is not working here, I think because the url doen't points to the cvs file directly. I found this url by clicking on a download link on "https://www.nseindia.com/reports/asm". The the download manager shows "https://www.nseindia.com/api/reportASM?csv=true" as the download link. Please note that I do not want to save the online cvs file. Any help would be highly appreciated. Thanks Here is my code: Sub Get_NSE_ASM_Data() On Error GoTo ErrHandler Application.ScreenUpdating = False Dim NSE_ASM_File As Workbook Set NSE_ASM_File = Workbooks.Open("https://www.nseindia.com/api/reportASM?csv=true", 0, True, 2) Dim Row_Counter As Integer Dim Serial_Number As Integer Dim Worksheet_Name As String Do While True Row_Counter = 1 MsgBox NSE_ASM_File.Worksheets(1).Range("A" & Row_Counter).Value If IsEmpty(NSE_ASM_File.Worksheets(1).Range("A" & Row_Counter).Value) Then Exit Do ElseIf NSE_ASM_File.Worksheets(1).Range("A" & Row_Counter).Value = "Long Term" Then Worksheet_Name = "LT" Serial_Number = 1 ElseIf NSE_ASM_File.Worksheets(1).Range("A" & Row_Counter).Value = "Short Term" Then Worksheet_Name = "ST" Serial_Number = 1 ElseIf IsNumeric(NSE_ASM_File.Worksheets(1).Range("A" & Row_Counter).Value) Then Worksheets(Worksheet_Name).Range("A" & Serial_Number).Value = NSE_ASM_File.Worksheets(1).Range("A" & Row_Counter).Value Worksheets(Worksheet_Name).Range("B" & Serial_Number).Value = NSE_ASM_File.Worksheets(1).Range("B" & Row_Counter).Value Worksheets(Worksheet_Name).Range("C" & Serial_Number).Value = NSE_ASM_File.Worksheets(1).Range("C" & Row_Counter).Value Worksheets(Worksheet_Name).Range("D" & Serial_Number).Value = NSE_ASM_File.Worksheets(1).Range("D" & Row_Counter).Value Row_Counter = Row_Counter + 1 Serial_Number = Serial_Number + 1 End If Loop Exit Sub ErrHandler: MsgBox "Error : " & Err.Description End Sub Private Sub Workbook_Open() Get_NSE_ASM_Data End Sub |
How can I display a bitmap in Compose Image Posted: 23 Oct 2021 07:54 AM PDT I have a function that returns a bitmap (which "contains" a QR code) and I wanted to display that bitmap inside an Image (composable function) but I didn't find any way to either convert the bitmap into a ImageBitmap or just displaying that bitmap. |
Matrix to vector conversions, In scheme, I'm trying to convert a matrix to a vector, in this example the output should be '(4 6 8) Posted: 23 Oct 2021 07:56 AM PDT (define (matrix-to-vector op mat) (foldl op (car mat) (lambda(x) (map (op (car x)) (cdr mat))) )) (matrix-to-vector + '((1 2 3) (3 4 5))) Output should be '(4 6 8), I keep getting error . . foldl: contract violation expected: list? given: #<procedure:....rkt:90:22> argument position: 3rd other arguments...: Any advice would be greatly appreciated. |
How to find the second most frequent character in java? Posted: 23 Oct 2021 07:54 AM PDT What I am trying to achieve is, when there is a given word, I need to find out the second most frequent character within that string. In additions to that, there is some more options I want to achieve. For example, If a string, "ababababd" is given, there are four 'a's, four 'b's, and one 'd', so in this case, I need to printout 'd'. If a string is "ababababdc" is given, there are four 'a's, four 'b's, one 'd' and 'c', I need to printout 'dc' public class MemorizeWorld { public static void main(String[] args) { Solution solution = new Solution(); String a = "ababababd"; solution.solution(a); } } class Solution { public void solution(String a) { int[] array = new int[26]; char[] char_array = a.toCharArray(); for(int i = 0; i < char_array.length; i++) { int index = char_array[i] - 'a'; array[index]++; } int max = 0; for(int i = 0; i < array.length; i++) { if(array[i] > max) { max = array[i]; } } } } This is what I have done so far and I am stuck on getting a solution. I know how to get the second most frequent character by following the post from geeksforgeeks, but I don't know how I should apply those two options above to that. Is there anyone who can help me with this problem? |
Flutter AnimatedContainer / AnimatedOpacity Delay animation Posted: 23 Oct 2021 07:55 AM PDT How do you delay animation in Flutter. The below provides an animation of the opacity of a container. I have used a bool _reduced in this case to change the speed of the animation based on that bool variable. But I don't want to change the speed, I want to simply delay the animation one way round by 500 milliseconds. I can't see anyway of easily making an animation delay. AnimatedOpacity( duration: _reduced ? Duration(milliseconds: 120) : Duration(milliseconds: 800), opacity: _reduced ? 0 : 1, child: Text('hi di hi), } There is obviously more to what this does than I have shown above but essentially I want to do something like this: AnimatedOpacity( duration: _reduced ? Duration(milliseconds: 120) : Duration(milliseconds: 120, delay: 500), opacity: _reduced ? 0 : 1, child: Text('hi di hi), } |
All comment forms submit the same docId Posted: 23 Oct 2021 07:55 AM PDT I have a react app (a sort of twitter clone) that uses firestore for storing posts and comments on posts. Each post is rendered as an element from an array using array.map(). Each post has a comment button that opens a form to take in a comment and add it to the post. When I enter a comment and submit it, the topmost post is always the one commented on no matter which post contained the comment button that was clicked(docId for the most recently saved firestore document is always submitted by the comment button instead of the docId corresponding to that instance of the component). The map of the posts (called "howls"): <div className="timeline"> {sortedHowls && sortedHowls.map((howl) => ( <Howl key={howl.id} image={howl.image} text={howl.text} time={howl.time} userId={howl.userId} docId={howl.id} comments={howl.comments} likes={howl.likes} /> ))} </div> The Howl Component looks like this: import React, { useEffect, useState } from "react"; import { useSelector } from "react-redux"; import { useFirestoreConnect } from "react-redux-firebase"; import { firestore } from "../../../firebase-store"; // styles import "./Howl.scss"; // components import Avatar from "../Avatar/Avatar"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; // functions import timeCalc from "./timeCalc"; // icons import { faStar, faComment } from "@fortawesome/free-solid-svg-icons"; const Howl = ({ docId, userId, text, image, time, comments, likes }) => { useFirestoreConnect([{ collection: "users" }]); const [commenting, toggleCommenting] = useState(false); const [newComment, setNewComment] = useState(""); const [users, setUsers] = useState(null); const [user, setUser] = useState(null); const getUsers = useSelector((state) => state.firestore.ordered.users); useEffect(() => { if (!users) { setUsers(getUsers); } else { setUser(users.find((doc) => doc.uid === userId)); } }, [users, user, userId, getUsers]); const handleLike = () => { const newLikesTotal = likes + 1; firestore.collection("howls").doc(docId).update({ likes: newLikesTotal }); }; const handleComment = () => { toggleCommenting(!commenting); }; const handleChange = (event) => { setNewComment(event.currentTarget.value); }; const submitComment = (event) => { event.preventDefault(); const { id } = event.currentTarget; console.log(event.currentTarget); const resetComment = () => { toggleCommenting(!commenting); setNewComment(""); }; if (comments) { firestore .collection("howls") .doc(id) .update({ comments: [...comments, newComment], }) .then(() => resetComment()); } else { firestore .collection("howls") .doc(id) .update({ comments: [newComment] }) .then(() => resetComment()); } }; return ( <div className="howl"> <div className="avatar-container"> <Avatar photoURL={user ? user.photoURL : ""} displayName={user ? user.displayName : ""} /> </div> <div className="name-text-img-container"> <p className="userName"> {user && user.displayName} - {timeCalc(Date.now(), time)} </p> <p className="howl-text">{text}</p> <div className="img-container"> {image ? ( <img src={image} alt="user uploaded" className="img" /> ) : null} </div> <div className="buttons-container"> <form action="" className="buttons"> <label htmlFor="comment-button"> <FontAwesomeIcon icon={faComment} className="image-icon" /> </label> <input id="comment-button" type="checkbox" onClick={handleComment} style={{ display: "none" }} /> <label htmlFor="like-button"> <FontAwesomeIcon icon={faStar} className="image-icon" /> </label> <input id="like-button" type="checkbox" onClick={handleLike} style={{ display: "none" }} /> <label htmlFor="like-button">{likes > 0 && likes}</label> </form> </div> {commenting && ( <div className="comment-form"> <form action="submit" onSubmit={submitComment} id={docId}> <input type="text" name="comment-input" className="comment-input" maxLength={128} onChange={handleChange} value={newComment} placeholder="Enter comment" /> <div className="buttons"> <button type="submit">Submit</button> <button onClick={() => toggleCommenting(!commenting)}> Cancel </button> </div> </form> </div> )} <div className="comments"> {comments ? comments.map((comment, index) => { return ( <p key={index} className="comment"> {comment} </p> ); }) : null} </div> </div> </div> ); }; export default Howl; How can I get the comment button to specify the correct document to update? Link to my full repo. |
Attach UIView to LottieFiles View Posted: 23 Oct 2021 07:56 AM PDT I've been trying to add LottieFiles animation to my new project. I've created animation successfully but I have a problem about replacement. I'll describe with screenshots. Screenshot 1 As you see, I've created UIView for my animation in Interface Builder and I created some constraint. Screenshot 2 Problem is here, I've already set location for UIView but when I set .frame(CGRect) for my animationView It looks weird. Here is my code; let animationView = AnimationView() @IBOutlet var weatherAnimationView: UIView! func startAnimation() { animationView.animation = Animation.named("cloudy") animationView.frame = CGRect(x: 0, y: 0, width: 350, height: 175) animationView.contentMode = .scaleAspectFit animationView.loopMode = .loop animationView.play() view.addSubview(animationView) } |
Ending a response inside custom error handler in expressjs the right way Posted: 23 Oct 2021 07:56 AM PDT The official documentation of expressjs at https://expressjs.com/en/guide/error-handling.html states the following: Notice that when not calling "next" in an error-handling function, you are responsible for writing (and ending) the response. Otherwise those requests will "hang" and will not be eligible for garbage collection. Their example for the last custom handler is as follows: ... app.use(logErrors) app.use(clientErrorHandler) app.use(errorHandler) function errorHandler (err, req, res, next) { res.status(500) res.render('error', { error: err }) } At this point I am not sure if this example actually ended the response. Is it already ended when the last custom error handler calls .status() and .render() ? The documentation further states res.end([data] [, encoding]) Ends the response process. This method actually comes from Node core, specifically the response.end() method of http.ServerResponse. Use to quickly end the response without any data. If you need to respond with data, instead use methods such as res.send() and res.json(). This implies to me, that e.g. send() will end the response. In restify, which is built on express, the documentation states Unlike other REST frameworks, calling res.send() does not trigger next() automatically. In many applications, work can continue to happen after res.send(), so flushing the response is not synonymous with completion of a request. This is why unsure, whether just calling send(),json() or status is really enough to release those resources to garbage collection I would have expected that we either have to - call next() with no parameter that (so that the default handler will eventually end it) or
- res.end() to end manually
after we have written a response to the client by - res.status() or
- res.status(...).res.send(...) or
- res.send(...) or
What is the proper way to end the response in a custom error handler? |
CMake can´t find Boost and its COmponents Posted: 23 Oct 2021 07:56 AM PDT again.. First: Plattform: Windows Cmake: 3.20 (Clion Bundled) Kit: Mingw64 (msys2-Mingw64) Boost Version: 1.69 - 1.77 (from boost.org) Following Situation: I want to find_package boost via Cmake. Therefor, i downloaded the boost zip, extracted it and set the BOOST_ROOT. This is my current CMakeLists.txt: cmake_minimum_required(VERSION 3.5) project(Tester LANGUAGES CXX) set(TEST_PROJECT ${PROJECT_NAME}) project(Runtime LANGUAGES CXX) set(RUNTIME_PROJECT ${PROJECT_NAME}) project(Game_Lib LANGUAGES CXX) set(LIB_PROJECT ${PROJECT_NAME}) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) SET(CMAKE_BUILD_TYPE Debug) #=============================================================== Fetch GoogleTest include(FetchContent) FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.zip ) # For Windows set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) #=============================================================== Setup Paths list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(PROJ_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src) set(PROJ_INC ${CMAKE_CURRENT_SOURCE_DIR}/include) set(PROJ_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/libs ${CMAKE_CURRENT_SOURCE_DIR}) set(PROJ_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/tests) set(PROJ_TST ${CMAKE_CURRENT_SOURCE_DIR}/test) set(PROJ_SHADES ${CMAKE_CURRENT_SOURCE_DIR}/../TileGameStudio_Editor_Build_Debug/Shipped/Data/InitProj/shaders) set(ANGLE_INCLUDE_PATH "D:/angle/include") set(ANGLE_LIBRARY_PATH ${PROJ_LIBS}) include(FindPkgConfig) pkg_check_modules(SDL2 REQUIRED sdl2) pkg_check_modules(SDL2_IMAGE REQUIRED SDL2_image) pkg_check_modules(SDL2_TTF REQUIRED SDL2_ttf) pkg_check_modules(SDL2_MIXER REQUIRED SDL2_mixer) find_package(Freetype REQUIRED) find_package(LuaJIT REQUIRED) find_package(FLAC REQUIRED) find_package(OGG REQUIRED) find_package(THEORA REQUIRED) find_package(OpenSSL REQUIRED) set(Boost_DEBUG ON) set(BOOST_ROOT "D:/boost") find_package(Boost REQUIRED COMPONENTS filesystem) #=============================================================== OUTPUT <LIB>_FOUND if (NOT PKG_CONFIG_FOUND) message(STATUS "PKG-CONFIG: NO") else () message(STATUS "PKG-CONFIG: YES - under: ${PKG_CONFIG_EXECUTABLE} >> used to find packages") endif () if (NOT SDL2_FOUND) message(STATUS "SDL2: NO") else () message(STATUS "SDL2: YES - under: ${SDL2_INCLUDE_DIRS} >> included and linked") include_directories( ${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS} ${SDL2_TTF_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIRS}) link_directories( ${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS} ${SDL2_TTF_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIRS} ${SDL2_LIBRARY_DIRS} ${SDL2_IMAGE_LIBRARY_DIRS} ${SDL2_TTF_LIBRARY_DIRS} ${SDL2_MIXER_LIBRARY_DIRS}) endif () if (NOT FREETYPE_FOUND) message(STATUS "freetype2: NO") else () message(STATUS "freetype2: YES - under: ${FREETYPE_INCLUDE_DIR_ft2build} >> included and linked") include_directories(${FREETYPE_INCLUDE_DIR_ft2build}) link_directories(${FREETYPE_INCLUDE_DIR_ft2build}) endif () if (NOT LUAJIT_FOUND) message(STATUS "LuaJit: NO") else () message(STATUS "LuaJit: YES - under: ${LUA_INCLUDE_DIR} >> included and linked") include_directories(${LUA_INCLUDE_DIR}) link_directories(${LUA_INCLUDE_DIR}) endif () if (NOT FLAC_FOUND) message(STATUS "FLAC: NO") else () message(STATUS "FLAC: YES - under: ${FLAC_INCLUDE_DIR} >> included and linked") include_directories(${FLAC_INCLUDE_DIR}) link_directories(${FLAC_INCLUDE_DIR}) endif () if (NOT OGG_FOUND) message(STATUS "OGG: NO") else () message(STATUS "OGG: YES - under: ${OGG_INCLUDE_DIR} >> included and linked") include_directories(${OGG_INCLUDE_DIR}) link_directories(${OGG_INCLUDE_DIR}) endif () if (NOT THEORA_FOUND) message(STATUS "THEORA: NO") else () message(STATUS "THEORA: YES - under: ${THEORA_INCLUDE_DIR} >> included and linked") include_directories(${THEORA_INCLUDE_DIR}) link_directories(${THEORA_INCLUDE_DIR}) endif () if (NOT OPENSSL_FOUND) message(STATUS "OpenSSL: NO") else () message(STATUS "OpenSSL: YES - under: ${OPENSSL_INCLUDE_DIR} >> included and linked") include_directories(${OPENSSL_INCLUDE_DIR}) link_directories(${OPENSSL_INCLUDE_DIR}) endif () if (NOT BOOST_FOUND) message(STATUS "Boost: NO") else () message(STATUS "Boost: YES - under: ${Boost_INCLUDE_DIR} >> included and linked") include_directories(${Boost_INCLUDE_DIR} ${Boost_LIBRARY_DIR}) link_directories(${Boost_INCLUDE_DIR} ${Boost_LIBRARY_DIR}) endif () #=============================================================== Include Directories include_directories( ${PROJ_INC} ${PROJ_SRC} ${PROJ_LIBS} ${PROJ_SHADES} ${ANGLE_INCLUDE_PATH} ${ANGLE_LIBRARY_PATH} gtest/ ) link_directories( ${PROJ_INC} ${PROJ_SRC} ${PROJ_LIBS} ${PROJ_SHADES} ${ANGLE_INCLUDE_PATH} ${ANGLE_LIBRARY_PATH} gtest/ ) #=============================================================== Find GLES Libraries message("Looking for GLES Libraries") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" ".dll.lib") find_library(D3D_Lib NAMES d3dcompiler_47 PATHS ${PROJ_LIBS} REQUIRED) find_library(GLES2_Lib NAMES libGLESv2 PATHS ${PROJ_LIBS} REQUIRED) message("Done: Looking for GLES Libraries") #=============================================================== Find GTest and GMock Libraries #find_library(GTEST_LIBRARIES NAMES libgtest_main libgtest libgmock libgmock_main REQUIRED) #=============================================================== Collect Sources, Tests and Headers file(GLOB PROJECT_SOURCES CONFIGURE_DEPENDS ${PROJ_SRC}/*.cpp ) file(GLOB PROJECT_TESTS CONFIGURE_DEPENDS ${PROJ_TST}/*.cpp ) file(GLOB PROJECT_HEADERS CONFIGURE_DEPENDS ${PROJ_INC}/*.h ) file(GLOB PROJECT_SHADERS CONFIGURE_DEPENDS ${PROJ_SHADES}/*.glsl ) #=============================================================== Create STATIC Lib of Engine Sources if (NOT PROJECT_SOURCES) message("No Sources available to build static Library!") else () set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../TileGameStudio_Editor_Build_Debug/Shipped/Data/InitProj/Libs") add_library(${LIB_PROJECT} STATIC ${PROJECT_HEADERS} ${PROJECT_SOURCES}) set_target_properties(${LIB_PROJECT} PROPERTIES OUTPUT_NAME "GameLib") message("Added Sources to the Library and created it in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}!") endif () #=============================================================== Build App set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../TileGameStudio_Editor_Build_Debug/Shipped/Data/InitProj") set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/res.rc") add_executable(${RUNTIME_PROJECT} ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_SHADERS} ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/res.rc ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../TileGameStudio_Editor_Build_Debug/Shipped/Data/InitProj/Tests") add_executable(${TEST_PROJECT} ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_SHADERS} ${PROJECT_TESTS} ) #=============================================================== Set Building Target set_target_properties(${RUNTIME_PROJECT} PROPERTIES OUTPUT_NAME "Game" SUFFIX ".exe") set_target_properties(${TEST_PROJECT} PROPERTIES OUTPUT_NAME "Tests" SUFFIX ".exe") #=============================================================== Link Libraries target_link_libraries(${RUNTIME_PROJECT} ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} ${SDL2_TTF_LIBRARIES} ${SDL2_MIXER_LIBRARIES} ${FREETYPE_LIBRARIES} ${LUA_LIBRARY} ${GLES2_Lib} ${D3D_Lib} ${FLAC_LIBRARY} ${OGG_LIBRARY} ${THEORA_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY} ${OPENSSL_LIBRARIES} ${Boost_LIBRARIES} ) target_link_libraries(${TEST_PROJECT} ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} ${SDL2_TTF_LIBRARIES} ${SDL2_MIXER_LIBRARIES} ${FREETYPE_LIBRARIES} ${LUA_LIBRARY} ${GLES2_Lib} ${D3D_Lib} ${FLAC_LIBRARY} ${OGG_LIBRARY} ${THEORA_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY} ${OPENSSL_LIBRARIES} ${Boost_LIBRARIES} gtest_main ) enable_testing() include(GoogleTest) #=============================================================== Add GoogleTests message("") message("Adding Tests to ${TEST_PROJECT}") message("") if (NOT PROJECT_TESTS) message("No Tests available!") else () gtest_add_tests(TARGET ${TEST_PROJECT} TEST_LIST var) message("Tests were added to ${TEST_PROJECT}. The List:") foreach (X ${var}) message("- ${X}") endforeach () endif () message("") And this, results in this Outlog: -- Found Ogg: C:/msys64/mingw64/lib/libogg.dll.a -- Found Ogg: C:/msys64/mingw64/lib/libogg.dll.a -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1673 ] _boost_TEST_VERSIONS = "1.77.0;1.77;1.76.0;1.76;1.75.0;1.75;1.74.0;1.74;1.73.0;1.73;1.72.0;1.72;1.71.0;1.71;1.70.0;1.70;1.69.0;1.69;1.68.0;1.68;1.67.0;1.67;1.66.0;1.66;1.65.1;1.65.0;1.65;1.64.0;1.64;1.63.0;1.63;1.62.0;1.62;1.61.0;1.61;1.60.0;1.60;1.59.0;1.59;1.58.0;1.58;1.57.0;1.57;1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;1.50;1.49.0;1.49;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1674 ] Boost_USE_MULTITHREADED = "TRUE" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1675 ] Boost_USE_STATIC_LIBS = <unset> -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1676 ] Boost_USE_STATIC_RUNTIME = <unset> -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1677 ] Boost_ADDITIONAL_VERSIONS = <unset> -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1678 ] Boost_NO_SYSTEM_PATHS = <unset> -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1710 ] BOOST_ROOT = "D:/boost" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1711 ] ENV{BOOST_ROOT} = <unset> -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1712 ] BOOST_INCLUDEDIR = <unset> -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1713 ] ENV{BOOST_INCLUDEDIR} = <unset> -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1714 ] BOOST_LIBRARYDIR = <unset> -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1715 ] ENV{BOOST_LIBRARYDIR} = <unset> -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1787 ] _boost_INCLUDE_SEARCH_DIRS = "D:/boost/include;D:/boost;PATHS;C:/boost/include;C:/boost;/sw/local/include" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1788 ] _boost_PATH_SUFFIXES = "boost-1_77_0;boost_1_77_0;boost/boost-1_77_0;boost/boost_1_77_0;boost-1_77;boost_1_77;boost/boost-1_77;boost/boost_1_77;boost-1_76_0;boost_1_76_0;boost/boost-1_76_0;boost/boost_1_76_0;boost-1_76;boost_1_76;boost/boost-1_76;boost/boost_1_76;boost-1_75_0;boost_1_75_0;boost/boost-1_75_0;boost/boost_1_75_0;boost-1_75;boost_1_75;boost/boost-1_75;boost/boost_1_75;boost-1_74_0;boost_1_74_0;boost/boost-1_74_0;boost/boost_1_74_0;boost-1_74;boost_1_74;boost/boost-1_74;boost/boost_1_74;boost-1_73_0;boost_1_73_0;boost/boost-1_73_0;boost/boost_1_73_0;boost-1_73;boost_1_73;boost/boost-1_73;boost/boost_1_73;boost-1_72_0;boost_1_72_0;boost/boost-1_72_0;boost/boost_1_72_0;boost-1_72;boost_1_72;boost/boost-1_72;boost/boost_1_72;boost-1_71_0;boost_1_71_0;boost/boost-1_71_0;boost/boost_1_71_0;boost-1_71;boost_1_71;boost/boost-1_71;boost/boost_1_71;boost-1_70_0;boost_1_70_0;boost/boost-1_70_0;boost/boost_1_70_0;boost-1_70;boost_1_70;boost/boost-1_70;boost/boost_1_70;boost-1_69_0;boost_1_69_0;boost/boost-1_69_0;boost/boost_1_69_0;boost-1_69;boost_1_69;boost/boost-1_69;boost/boost_1_69;boost-1_68_0;boost_1_68_0;boost/boost-1_68_0;boost/boost_1_68_0;boost-1_68;boost_1_68;boost/boost-1_68;boost/boost_1_68;boost-1_67_0;boost_1_67_0;boost/boost-1_67_0;boost/boost_1_67_0;boost-1_67;boost_1_67;boost/boost-1_67;boost/boost_1_67;boost-1_66_0;boost_1_66_0;boost/boost-1_66_0;boost/boost_1_66_0;boost-1_66;boost_1_66;boost/boost-1_66;boost/boost_1_66;boost-1_65_1;boost_1_65_1;boost/boost-1_65_1;boost/boost_1_65_1;boost-1_65_0;boost_1_65_0;boost/boost-1_65_0;boost/boost_1_65_0;boost-1_65;boost_1_65;boost/boost-1_65;boost/boost_1_65;boost-1_64_0;boost_1_64_0;boost/boost-1_64_0;boost/boost_1_64_0;boost-1_64;boost_1_64;boost/boost-1_64;boost/boost_1_64;boost-1_63_0;boost_1_63_0;boost/boost-1_63_0;boost/boost_1_63_0;boost-1_63;boost_1_63;boost/boost-1_63;boost/boost_1_63;boost-1_62_0;boost_1_62_0;boost/boost-1_62_0;boost/boost_1_62_0;boost-1_62;boost_1_62;boost/boost-1_62;boost/boost_1_62;boost-1_61_0;boost_1_61_0;boost/boost-1_61_0;boost/boost_1_61_0;boost-1_61;boost_1_61;boost/boost-1_61;boost/boost_1_61;boost-1_60_0;boost_1_60_0;boost/boost-1_60_0;boost/boost_1_60_0;boost-1_60;boost_1_60;boost/boost-1_60;boost/boost_1_60;boost-1_59_0;boost_1_59_0;boost/boost-1_59_0;boost/boost_1_59_0;boost-1_59;boost_1_59;boost/boost-1_59;boost/boost_1_59;boost-1_58_0;boost_1_58_0;boost/boost-1_58_0;boost/boost_1_58_0;boost-1_58;boost_1_58;boost/boost-1_58;boost/boost_1_58;boost-1_57_0;boost_1_57_0;boost/boost-1_57_0;boost/boost_1_57_0;boost-1_57;boost_1_57;boost/boost-1_57;boost/boost_1_57;boost-1_56_0;boost_1_56_0;boost/boost-1_56_0;boost/boost_1_56_0;boost-1_56;boost_1_56;boost/boost-1_56;boost/boost_1_56;boost-1_55_0;boost_1_55_0;boost/boost-1_55_0;boost/boost_1_55_0;boost-1_55;boost_1_55;boost/boost-1_55;boost/boost_1_55;boost-1_54_0;boost_1_54_0;boost/boost-1_54_0;boost/boost_1_54_0;boost-1_54;boost_1_54;boost/boost-1_54;boost/boost_1_54;boost-1_53_0;boost_1_53_0;boost/boost-1_53_0;boost/boost_1_53_0;boost-1_53;boost_1_53;boost/boost-1_53;boost/boost_1_53;boost-1_52_0;boost_1_52_0;boost/boost-1_52_0;boost/boost_1_52_0;boost-1_52;boost_1_52;boost/boost-1_52;boost/boost_1_52;boost-1_51_0;boost_1_51_0;boost/boost-1_51_0;boost/boost_1_51_0;boost-1_51;boost_1_51;boost/boost-1_51;boost/boost_1_51;boost-1_50_0;boost_1_50_0;boost/boost-1_50_0;boost/boost_1_50_0;boost-1_50;boost_1_50;boost/boost-1_50;boost/boost_1_50;boost-1_49_0;boost_1_49_0;boost/boost-1_49_0;boost/boost_1_49_0;boost-1_49;boost_1_49;boost/boost-1_49;boost/boost_1_49;boost-1_48_0;boost_1_48_0;boost/boost-1_48_0;boost/boost_1_48_0;boost-1_48;boost_1_48;boost/boost-1_48;boost/boost_1_48;boost-1_47_0;boost_1_47_0;boost/boost-1_47_0;boost/boost_1_47_0;boost-1_47;boost_1_47;boost/boost-1_47;boost/boost_1_47;boost-1_46_1;boost_1_46_1;boost/boost-1_46_1;boost/boost_1_46_1;boost-1_46_0;boost_1_46_0;boost/boost-1_46_0;boost/boost_1_46_0;boost-1_46;boost_1_46;boost/boost-1_46;boost/boost_1_46;boost-1_45_0;boost_1_45_0;boost/boost-1_45_0;boost/boost_1_45_0;boost-1_45;boost_1_45;boost/boost-1_45;boost/boost_1_45;boost-1_44_0;boost_1_44_0;boost/boost-1_44_0;boost/boost_1_44_0;boost-1_44;boost_1_44;boost/boost-1_44;boost/boost_1_44;boost-1_43_0;boost_1_43_0;boost/boost-1_43_0;boost/boost_1_43_0;boost-1_43;boost_1_43;boost/boost-1_43;boost/boost_1_43;boost-1_42_0;boost_1_42_0;boost/boost-1_42_0;boost/boost_1_42_0;boost-1_42;boost_1_42;boost/boost-1_42;boost/boost_1_42;boost-1_41_0;boost_1_41_0;boost/boost-1_41_0;boost/boost_1_41_0;boost-1_41;boost_1_41;boost/boost-1_41;boost/boost_1_41;boost-1_40_0;boost_1_40_0;boost/boost-1_40_0;boost/boost_1_40_0;boost-1_40;boost_1_40;boost/boost-1_40;boost/boost_1_40;boost-1_39_0;boost_1_39_0;boost/boost-1_39_0;boost/boost_1_39_0;boost-1_39;boost_1_39;boost/boost-1_39;boost/boost_1_39;boost-1_38_0;boost_1_38_0;boost/boost-1_38_0;boost/boost_1_38_0;boost-1_38;boost_1_38;boost/boost-1_38;boost/boost_1_38;boost-1_37_0;boost_1_37_0;boost/boost-1_37_0;boost/boost_1_37_0;boost-1_37;boost_1_37;boost/boost-1_37;boost/boost_1_37;boost-1_36_1;boost_1_36_1;boost/boost-1_36_1;boost/boost_1_36_1;boost-1_36_0;boost_1_36_0;boost/boost-1_36_0;boost/boost_1_36_0;boost-1_36;boost_1_36;boost/boost-1_36;boost/boost_1_36;boost-1_35_1;boost_1_35_1;boost/boost-1_35_1;boost/boost_1_35_1;boost-1_35_0;boost_1_35_0;boost/boost-1_35_0;boost/boost_1_35_0;boost-1_35;boost_1_35;boost/boost-1_35;boost/boost_1_35;boost-1_34_1;boost_1_34_1;boost/boost-1_34_1;boost/boost_1_34_1;boost-1_34_0;boost_1_34_0;boost/boost-1_34_0;boost/boost_1_34_0;boost-1_34;boost_1_34;boost/boost-1_34;boost/boost_1_34;boost-1_33_1;boost_1_33_1;boost/boost-1_33_1;boost/boost_1_33_1;boost-1_33_0;boost_1_33_0;boost/boost-1_33_0;boost/boost_1_33_0;boost-1_33;boost_1_33;boost/boost-1_33;boost/boost_1_33" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1803 ] location of version.hpp: D:/boost/boost/version.hpp -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1843 ] Boost_VERSION = "106900" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1844 ] Boost_VERSION_STRING = "1.69.0" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1845 ] Boost_VERSION_MACRO = "106900" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1846 ] Boost_VERSION_MAJOR = "1" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1847 ] Boost_VERSION_MINOR = "69" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1848 ] Boost_VERSION_PATCH = "0" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1849 ] Boost_VERSION_COUNT = "3" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1873 ] Boost_LIB_PREFIX = "" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1874 ] Boost_NAMESPACE = "boost" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:953 ] _boost_COMPILER = "-mgw112" (guessed) -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1910 ] _boost_MULTITHREADED = "-mt" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1988 ] _boost_ARCHITECTURE_TAG = "" (detected) -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1992 ] _boost_RELEASE_ABI_TAG = "-" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:1993 ] _boost_DEBUG_ABI_TAG = "-d" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:2053 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = "D:/boost/lib;D:/boost/stage/lib;D:/boost/lib;D:/boost/../lib;D:/boost/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:2054 ] _boost_LIBRARY_SEARCH_DIRS_DEBUG = "D:/boost/lib;D:/boost/stage/lib;D:/boost/lib;D:/boost/../lib;D:/boost/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib" -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:2239 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-mgw112-mt-1_69;boost_filesystem-mgw112-mt;boost_filesystem-mgw112-mt;boost_filesystem-mt-1_69;boost_filesystem-mt;boost_filesystem-mt;boost_filesystem-mt;boost_filesystem -- [ D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:2294 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-mgw112-mt-d-1_69;boost_filesystem-mgw112-mt-d;boost_filesystem-mgw112-mt-d;boost_filesystem-mt-d-1_69;boost_filesystem-mt-d;boost_filesystem-mt-d;boost_filesystem-mt;boost_filesystem CMake Error at D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Boost (missing: filesystem) (found version "1.69.0") Call Stack (most recent call first): D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE) D:/CLion/bin/cmake/win/share/cmake-3.20/Modules/FindBoost.cmake:2360 (find_package_handle_standard_args) CMakeLists.txt:53 (find_package) -- Configuring incomplete, errors occurred! Yeahi.. I searched myself through the Net for 3 Days now and stumbled accros different approaches to fix that.. From, building the libs, to installing thing.. doing stuff and other stuff.. and so on.. i don´t really know what i´ve done there, cause the Manuals and Fixes are more Cryptic than logic to me as Hobby programmer... I changed the FindBoost.cmake to an updated one, supporting Boost 1.77.. tried to set Hinbt Paths like BOOST_INCLUDEDIR and BOOST_LIBRARYDIR.. nothing changed anything.. I tried Boost Versions: 1.77.0, 1.76.0, 1.69.0 (current) So.. i´ve no clue what i can do more, to make it possible to link boost to my project... I hope someone can help me out here.. |
Model form is not able to save in database Posted: 23 Oct 2021 07:56 AM PDT I am a beginner in Django I want to save a form data in database but i am not able to save, followed some tutorials also. form.py: from django.forms import ModelForm from .models import * class listsForm(ModelForm): class Meta: model = todo fields = "__all__" views.py: from django.shortcuts import render from .models import * from .form import * def index(request): lists = todo.objects.all() form = listsForm() context = { 'lists':lists, 'form':form, } if request.method == 'POST': form = listsForm(request.POST) if form.is_valid: form.save() return render(request, 'index.html', context) models.py: from django.db import models class todo(models.Model): title = models.CharField(max_length=200) description = models.TextField(null=True, blank=True) created = models.DateField(auto_now_add=True) def __str__(self): return self.title |
Inline ASM for C with M1 Posted: 23 Oct 2021 07:55 AM PDT I'm use MacBookPro M1, I'm trying to run this simple code in inline asm: #include <stdio.h> #include <stdlib.h> int main(void) { unsigned int x = 1; unsigned int y = 4; __asm__ volatile("add %0, %1": "=r" (x) : "r" (y)); return 0; } but i have these errors: test_debug_printf.c:27:52: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths] __asm__ volatile("add %0, %1": "=r" (x) : "r" (y)); ^ test_debug_printf.c:27:31: note: use constraint modifier "w" __asm__ volatile("add %0, %1": "=r" (x) : "r" (y)); ^~ %w1 test_debug_printf.c:27:22: error: too few operands for instruction __asm__ volatile("add %0, %1": "=r" (x) : "r" (y)); ^ <inline asm>:1:2: note: instantiated into assembly here add x9, x9 ^~~~~~~~~~ 2 warnings and 1 error generated. |
Is Nested aggregate queries possible with Django queryset Posted: 23 Oct 2021 07:55 AM PDT I want to calculate the monthly based profit with the following models using django queryset methods. The tricky point is that I have a freightselloverride field in the order table. It overrides the sum of freightsell in the orderItem table. An order may contain multiple orderItems. That's why I have to calculate order based profit first and then calculate the monthly based profit. Because if there is any order level freightselloverride data I should take this into consideration. Below I gave a try using annotate method but could not resolve how to reach this SQL. Does Django allow this kind of nested aggregate queries? select sales_month ,sum(sumSellPrice-sumNetPrice-sumFreighNet+coalesce(FreightSellOverride,sumFreightSell)) as profit from ( select CAST(DATE_FORMAT(b.CreateDate, '%Y-%m-01 00:00:00') AS DATETIME) AS `sales_month`, a.order_id,b.FreightSellOverride ,sum(SellPrice) as sumSellPrice,sum(NetPrice) as sumNetPrice ,sum(FreightNet) as sumFreighNet,sum(FreightSell) as sumFreightSell from OrderItem a inner join Order b on a.order_id=b.id group by 1,2,3 ) c group by sales_month I tried this result = (OrderItem.objects .annotate(sales_month=TruncMonth('order__CreateDate')) .values('sales_month','order','order__FreightSellOverride') .annotate(sumSellPrice=Sum('SellPrice'),sumNetPrice=Sum('NetPrice'),sumFreighNet=Sum('FreightNet'),sumFreightSell=Sum('FreightSell')) .values('sales_month') .annotate(profit=Sum(F('sumSellPrice')-F('sumNetPrice')-F('sumFreighNet')+Coalesce('order__FreightSellOverride','sumFreightSell'))) ) but get this error Exception Type: FieldError Exception Value: Cannot compute Sum('<CombinedExpression: F(sumSellPrice) - F(sumNetPrice) - F(sumFreighNet) + Coalesce(F(ProjectId__FreightSellOverride), F(sumFreightSell))>'): '<CombinedExpression: F(sumSellPrice) - F(sumNetPrice) - F(sumFreighNet) + Coalesce(F(ProjectId__FreightSellOverride), F(sumFreightSell))>' is an aggregate from django.db import models from django.db.models import F, Count, Sum from django.db.models.functions import TruncMonth, Coalesce class Order(models.Model): CreateDate = models.DateTimeField(verbose_name="Create Date") FreightSellOverride = models.FloatField() class OrderItem(models.Model): SellPrice = models.DecimalField(max_digits=10,decimal_places=2) FreightSell = models.DecimalField(max_digits=10,decimal_places=2) NetPrice = models.DecimalField(max_digits=10,decimal_places=2) FreightNet = models.DecimalField(max_digits=10,decimal_places=2) order = models.ForeignKey(Order,on_delete=models.DO_NOTHING,related_name="Item") |
Split variable column with multiple values into separate columns using python [closed] Posted: 23 Oct 2021 07:55 AM PDT I have a dataframe that has string in which there is data and numbers I need. I wanna split using python. On the left in red is the current dataset and on the right is the desired result. I need it to create new columns with the values next to the different columns Anyone know how to do this? I've tried; *df.column.split(' ')* *new_columns = re.split("[{} ]",df.column)* enter image description here |
REGEX with letters and underscores in SPARQL Posted: 23 Oct 2021 07:55 AM PDT in my SPARQL I have the following bind BIND(STRAFTER(?ng, "tilastot_") AS ?subj) It worked when I had string "tilastot_teul" in "?ng" and I needed to set the ending "teul" into "?subj" But if there are several underscores in "?ng" (like "tilastot_luke_yri_teul") I'll need regex to extract the string after the last underscore. I tried the following: BIND(STRAFTER(?ng, regex(?ng,([a-z]*_)*) AS ?subj) But jena-fuseki UI didn't accept it. Can you help ? |
Why does my Intel Skylake / Kaby Lake CPU incur a mysterious factor 3 slowdown in a simple hash table implementation? Posted: 23 Oct 2021 07:55 AM PDT In short: I have implemented a simple (multi-key) hash table with buckets (containing several elements) that exactly fit a cacheline. Inserting into a cacheline bucket is very simple, and the critical part of the main loop. I have implemented three versions that produce the same outcome and should behave the same. The mystery However, I'm seeing wild performance differences by a surprisingly large factor 3, despite all versions having the exact same cacheline access pattern and resulting in identical hash table data. The best implementation insert_ok suffers around a factor 3 slow down compared to insert_bad & insert_alt on my CPU (i7-7700HQ). One variant insert_bad is a simple modification of insert_ok that adds an extra unnecessary linear search within the cacheline to find the position to write to (which it already knows) and does not suffer this x3 slow down. The exact same executable shows insert_ok a factor 1.6 faster compared to insert_bad & insert_alt on other CPUs (AMD 5950X (Zen 3), Intel i7-11800H (Tiger Lake)). # see https://github.com/cr-marcstevens/hashtable_mystery $ ./test.sh model name : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz ============================== CXX=g++ CXXFLAGS=-std=c++11 -O2 -march=native -falign-functions=64 tablesize: 117440512 elements: 67108864 loadfactor=0.571429 - test insert_ok : 11200ms - test insert_bad: 3164ms (outcome identical to insert_ok: true) - test insert_alt: 3366ms (outcome identical to insert_ok: true) tablesize: 117440813 elements: 67108864 loadfactor=0.571427 - test insert_ok : 10840ms - test insert_bad: 3301ms (outcome identical to insert_ok: true) - test insert_alt: 3579ms (outcome identical to insert_ok: true) The Code // insert element in hash_table inline void insert_ok(uint64_t k) { // compute target bucket uint64_t b = mod(k); // bounded linear search for first non-full bucket for (size_t c = 0; c < 1024; ++c) { bucket_t& B = table_ok[b]; // if bucket non-full then store element and return if (B.size != bucket_size) { B.keys[B.size] = k; B.values[B.size] = 1; ++B.size; ++table_count; return; } // increase b w/ wrap around if (++b == table_size) b = 0; } } // equivalent to insert_ok // but uses a stupid linear search to store the element at the target position inline void insert_bad(uint64_t k) { // compute target bucket uint64_t b = mod(k); // bounded linear search for first non-full bucket for (size_t c = 0; c < 1024; ++c) { bucket_t& B = table_bad[b]; // if bucket non-full then store element and return if (B.size != bucket_size) { for (size_t i = 0; i < bucket_size; ++i) { if (i == B.size) { B.keys[i] = k; B.values[i] = 1; ++B.size; ++table_count; return; } } } // increase b w/ wrap around if (++b == table_size) b = 0; } } // instead of using bucket_t.size, empty elements are marked by special empty_key value // a bucket is filled first to last, so bucket is full if last element key != empty_key uint64_t empty_key = ~uint64_t(0); inline void insert_alt(uint64_t k) { // compute target bucket uint64_t b = mod(k); // bounded linear search for first non-full bucket for (size_t c = 0; c < 1024; ++c) { bucket_t& B = table_alt[b]; // if bucket non-full then store element and return if (B.keys[bucket_size-1] == empty_key) { for (size_t i = 0; i < bucket_size; ++i) { if (B.keys[i] == empty_key) { B.keys[i] = k; B.values[i] = 1; ++table_count; return; } } } // increase b w/ wrap around if (++b == table_size) b = 0; } } My analysis I've tried various modifications to the loop C++, but inherently it's so simple, the compiler will produce the same assembly. It's really not obvious from the resulting assembly what the factor 3 loss might cause. I've tried measuring with perf, but I can't seem to pinpoint any meaningful difference. Comparing the assembly of the 3 versions which are all just relatively small loops, there is nothing that suggests anything close that may cause a factor 3 loss between these versions. Hence, I presume the 3x slow down is a weird effect of automatic prefetching, or branch prediction, or instruction/jump alignment or maybe a combination of those. Does anybody have better insights or ways to measure what effects might actually be at play here? Details I've created a small working C++11 example that demonstrates the problem. The code is available at https://github.com/cr-marcstevens/hashtable_mystery This also includes my own static binaries that demonstrate this problem on my CPU, as different compilers may produce different code. As well as dumped assembly code for all three hash table versions. perf event measurements Here are a lot of perf event measurements. I've focused on ones that include the word miss and stall . Each event has two lines: - the first line corresponds to
insert_ok which has the slowdown - the second line corresponds to
insert_alt which has an additional loop and additional work, but ends up faster === L1-dcache-load-misses === insert_ok : 171411476 insert_alt: 244244027 === L1-dcache-loads === insert_ok : 775468123 insert_alt: 1038574743 === L1-dcache-stores === insert_ok : 621353009 insert_alt: 554244145 === L1-icache-load-misses === insert_ok : 69666 insert_alt: 259102 === LLC-load-misses === insert_ok : 70519701 insert_alt: 71399242 === LLC-loads === insert_ok : 130909270 insert_alt: 134776189 === LLC-store-misses === insert_ok : 16782747 insert_alt: 16851787 === LLC-stores === insert_ok : 17072141 insert_alt: 17534866 === arith.divider_active === insert_ok : 26810 insert_alt: 26611 === baclears.any === insert_ok : 2038060 insert_alt: 7648128 === br_inst_retired.all_branches === insert_ok : 546479449 insert_alt: 938434022 === br_inst_retired.all_branches_pebs === insert_ok : 546480454 insert_alt: 938412921 === br_inst_retired.cond_ntaken === insert_ok : 237470651 insert_alt: 433439086 === br_inst_retired.conditional === insert_ok : 477604946 insert_alt: 802468807 === br_inst_retired.far_branch === insert_ok : 1058138 insert_alt: 1052510 === br_inst_retired.near_call === insert_ok : 227076 insert_alt: 227074 === br_inst_retired.near_return === insert_ok : 227072 insert_alt: 227070 === br_inst_retired.near_taken === insert_ok : 307946256 insert_alt: 503926433 === br_inst_retired.not_taken === insert_ok : 237458763 insert_alt: 433429466 === br_misp_retired.all_branches === insert_ok : 36443541 insert_alt: 90626754 === br_misp_retired.all_branches_pebs === insert_ok : 36441027 insert_alt: 90622375 === br_misp_retired.conditional === insert_ok : 36454196 insert_alt: 90591031 === br_misp_retired.near_call === insert_ok : 173 insert_alt: 169 === br_misp_retired.near_taken === insert_ok : 19032467 insert_alt: 40361420 === branch-instructions === insert_ok : 546476228 insert_alt: 938447476 === branch-load-misses === insert_ok : 36441314 insert_alt: 90611299 === branch-loads === insert_ok : 546472151 insert_alt: 938435143 === branch-misses === insert_ok : 36436325 insert_alt: 90597372 === bus-cycles === insert_ok : 222283508 insert_alt: 88243938 === cache-misses === insert_ok : 257067753 insert_alt: 475091979 === cache-references === insert_ok : 445465943 insert_alt: 590770464 === cpu-clock === insert_ok : 10333.94 msec cpu-clock:u # 1.000 CPUs utilized insert_alt: 4766.53 msec cpu-clock:u # 1.000 CPUs utilized === cpu-cycles === insert_ok : 25273361574 insert_alt: 11675804743 === cpu_clk_thread_unhalted.one_thread_active === insert_ok : 223196489 insert_alt: 88616919 === cpu_clk_thread_unhalted.ref_xclk === insert_ok : 222719013 insert_alt: 88467292 === cpu_clk_unhalted.one_thread_active === insert_ok : 223380608 insert_alt: 88212476 === cpu_clk_unhalted.ref_tsc === insert_ok : 32663820508 insert_alt: 12901195392 === cpu_clk_unhalted.ref_xclk === insert_ok : 221957996 insert_alt: 88390991 insert_alt: === cpu_clk_unhalted.ring0_trans === insert_ok : 374 insert_alt: 373 === cpu_clk_unhalted.thread === insert_ok : 25286801620 insert_alt: 11714137483 === cycle_activity.cycles_l1d_miss === insert_ok : 16278956219 insert_alt: 7417877493 === cycle_activity.cycles_l2_miss === insert_ok : 15607833569 insert_alt: 7054717199 === cycle_activity.cycles_l3_miss === insert_ok : 12987627072 insert_alt: 6745771672 === cycle_activity.cycles_mem_any === insert_ok : 23440206343 insert_alt: 9027220495 === cycle_activity.stalls_l1d_miss === insert_ok : 16194872307 insert_alt: 4718344050 === cycle_activity.stalls_l2_miss === insert_ok : 15350067722 insert_alt: 4578933898 === cycle_activity.stalls_l3_miss === insert_ok : 12697354271 insert_alt: 4457980047 === cycle_activity.stalls_mem_any === insert_ok : 20930005455 insert_alt: 4555461595 === cycle_activity.stalls_total === insert_ok : 22243173394 insert_alt: 6561416461 === dTLB-load-misses === insert_ok : 67817362 insert_alt: 63603879 === dTLB-loads === insert_ok : 775467642 insert_alt: 1038562488 === dTLB-store-misses === insert_ok : 8823481 insert_alt: 13050341 === dTLB-stores === insert_ok : 621353007 insert_alt: 554244145 === dsb2mite_switches.count === insert_ok : 93894397 insert_alt: 315793354 === dsb2mite_switches.penalty_cycles === insert_ok : 9216240937 insert_alt: 206393788 === dtlb_load_misses.miss_causes_a_walk === insert_ok : 177266866 insert_alt: 101439773 === dtlb_load_misses.stlb_hit === insert_ok : 2994329 insert_alt: 35601646 === dtlb_load_misses.walk_active === insert_ok : 4747616986 insert_alt: 3893609232 === dtlb_load_misses.walk_completed === insert_ok : 67817832 insert_alt: 63591832 === dtlb_load_misses.walk_completed_4k === insert_ok : 67817841 insert_alt: 63596148 === dtlb_load_misses.walk_pending === insert_ok : 6495600072 insert_alt: 5987182579 === dtlb_store_misses.miss_causes_a_walk === insert_ok : 89895924 insert_alt: 21841494 === dtlb_store_misses.stlb_hit === insert_ok : 4940907 insert_alt: 21970231 === dtlb_store_misses.walk_active === insert_ok : 1784142210 insert_alt: 903334856 === dtlb_store_misses.walk_completed === insert_ok : 8845884 insert_alt: 13071262 === dtlb_store_misses.walk_completed_4k === insert_ok : 8822993 insert_alt: 12936414 === dtlb_store_misses.walk_pending === insert_ok : 1842905733 insert_alt: 933039119 === exe_activity.1_ports_util === insert_ok : 991400575 insert_alt: 1433908710 === exe_activity.2_ports_util === insert_ok : 782270731 insert_alt: 1314443071 === exe_activity.3_ports_util === insert_ok : 556847358 insert_alt: 1158115803 === exe_activity.4_ports_util === insert_ok : 427323800 insert_alt: 783571280 === exe_activity.bound_on_stores === insert_ok : 299732094 insert_alt: 303475333 === exe_activity.exe_bound_0_ports === insert_ok : 227569792 insert_alt: 348959512 === frontend_retired.dsb_miss === insert_ok : 6771584 insert_alt: 93700643 === frontend_retired.itlb_miss === insert_ok : 1115 insert_alt: 1689 === frontend_retired.l1i_miss === insert_ok : 3639 insert_alt: 3857 === frontend_retired.l2_miss === insert_ok : 2826 insert_alt: 2830 === frontend_retired.latency_ge_1 === insert_ok : 9206268 insert_alt: 178345368 === frontend_retired.latency_ge_128 === insert_ok : 2708 insert_alt: 2703 === frontend_retired.latency_ge_16 === insert_ok : 403492 insert_alt: 820950 === frontend_retired.latency_ge_2 === insert_ok : 4981263 insert_alt: 85781924 === frontend_retired.latency_ge_256 === insert_ok : 802 insert_alt: 970 === frontend_retired.latency_ge_2_bubbles_ge_1 === insert_ok : 56936702 insert_alt: 225712704 === frontend_retired.latency_ge_2_bubbles_ge_2 === insert_ok : 10312026 insert_alt: 163227996 === frontend_retired.latency_ge_2_bubbles_ge_3 === insert_ok : 7599252 insert_alt: 122841752 === frontend_retired.latency_ge_32 === insert_ok : 3599 insert_alt: 3317 === frontend_retired.latency_ge_4 === insert_ok : 2627373 insert_alt: 42287077 === frontend_retired.latency_ge_512 === insert_ok : 418 insert_alt: 241 === frontend_retired.latency_ge_64 === insert_ok : 2474 insert_alt: 2802 === frontend_retired.latency_ge_8 === insert_ok : 528748 insert_alt: 951836 === frontend_retired.stlb_miss === insert_ok : 769 insert_alt: 562 === hw_interrupts.received === insert_ok : 9330 insert_alt: 3738 === iTLB-load-misses === insert_ok : 456094 insert_alt: 90739 === iTLB-loads === insert_ok : 949 insert_alt: 1031 === icache_16b.ifdata_stall === insert_ok : 1145821 insert_alt: 862403 === icache_64b.iftag_hit === insert_ok : 1378406022 insert_alt: 4459469241 === icache_64b.iftag_miss === insert_ok : 61812 insert_alt: 57204 === icache_64b.iftag_stall === insert_ok : 56551468 insert_alt: 82354039 === idq.all_dsb_cycles_4_uops === insert_ok : 896374829 insert_alt: 1610100578 === idq.all_dsb_cycles_any_uops === insert_ok : 1217878089 insert_alt: 2739912727 === idq.all_mite_cycles_4_uops === insert_ok : 315979501 insert_alt: 480165021 === idq.all_mite_cycles_any_uops === insert_ok : 1053703958 insert_alt: 2251382760 === idq.dsb_cycles === insert_ok : 1218891711 insert_alt: 2744099964 === idq.dsb_uops === insert_ok : 5828442701 insert_alt: 10445095004 === idq.mite_cycles === insert_ok : 470409312 insert_alt: 1664892371 === idq.mite_uops === insert_ok : 1407396065 insert_alt: 4515396737 === idq.ms_cycles === insert_ok : 583601361 insert_alt: 587996351 === idq.ms_dsb_cycles === insert_ok : 218346 insert_alt: 74155 === idq.ms_mite_uops === insert_ok : 1266443204 insert_alt: 1277980465 === idq.ms_switches === insert_ok : 149106449 insert_alt: 150392336 === idq.ms_uops === insert_ok : 1266950097 insert_alt: 1277330690 === idq_uops_not_delivered.core === insert_ok : 1871959581 insert_alt: 6531069387 === idq_uops_not_delivered.cycles_0_uops_deliv.core === insert_ok : 289301660 insert_alt: 946930713 === idq_uops_not_delivered.cycles_fe_was_ok === insert_ok : 24668869613 insert_alt: 9335642949 === idq_uops_not_delivered.cycles_le_1_uop_deliv.core === insert_ok : 393750384 insert_alt: 1344106460 === idq_uops_not_delivered.cycles_le_2_uop_deliv.core === insert_ok : 506090534 insert_alt: 1824690188 === idq_uops_not_delivered.cycles_le_3_uop_deliv.core === insert_ok : 688462029 insert_alt: 2416339045 === ild_stall.lcp === insert_ok : 380 insert_alt: 480 === inst_retired.any === insert_ok : 4760842560 insert_alt: 5470438932 === inst_retired.any_p === insert_ok : 4760919037 insert_alt: 5470404264 === inst_retired.prec_dist === insert_ok : 4760801654 insert_alt: 5470649220 === inst_retired.total_cycles_ps === insert_ok : 25175372339 insert_alt: 11718929626 === instructions === insert_ok : 4760805219 insert_alt: 5470497783 === int_misc.clear_resteer_cycles === insert_ok : 199623562 insert_alt: 671083279 === int_misc.recovery_cycles === insert_ok : 314434729 insert_alt: 704406698 === itlb.itlb_flush === insert_ok : 303 insert_alt: 248 === itlb_misses.miss_causes_a_walk === insert_ok : 19537 insert_alt: 116729 === itlb_misses.stlb_hit === insert_ok : 11323 insert_alt: 5557 === itlb_misses.walk_active === insert_ok : 2809766 insert_alt: 4070194 === itlb_misses.walk_completed === insert_ok : 24298 insert_alt: 45251 === itlb_misses.walk_completed_4k === insert_ok : 34084 insert_alt: 29759 === itlb_misses.walk_pending === insert_ok : 853764 insert_alt: 2817933 === l1d.replacement === insert_ok : 171135334 insert_alt: 244967326 === l1d_pend_miss.fb_full === insert_ok : 354631656 insert_alt: 382309583 === l1d_pend_miss.pending === insert_ok : 16792436441 insert_alt: 22979721104 === l1d_pend_miss.pending_cycles === insert_ok : 16377420892 insert_alt: 7349245429 === l1d_pend_miss.pending_cycles_any === insert_ok : insert_alt: === l2_lines_in.all === insert_ok : 303009088 insert_alt: 411750486 === l2_lines_out.non_silent === insert_ok : 157208112 insert_alt: 309484666 === l2_lines_out.silent === insert_ok : 127379047 insert_alt: 84169481 === l2_lines_out.useless_hwpf === insert_ok : 70374658 insert_alt: 144359127 === l2_lines_out.useless_pref === insert_ok : 70747103 insert_alt: 142931540 === l2_rqsts.all_code_rd === insert_ok : 71254 insert_alt: 242327 === l2_rqsts.all_demand_data_rd === insert_ok : 137366274 insert_alt: 143507049 === l2_rqsts.all_demand_miss === insert_ok : 150071420 insert_alt: 150820168 === l2_rqsts.all_demand_references === insert_ok : 154854022 insert_alt: 160487082 === l2_rqsts.all_pf === insert_ok : 170261458 insert_alt: 282476184 === l2_rqsts.all_rfo === insert_ok : 17575896 insert_alt: 16938897 === l2_rqsts.code_rd_hit === insert_ok : 79800 insert_alt: 381566 === l2_rqsts.code_rd_miss === insert_ok : 25800 insert_alt: 33755 === l2_rqsts.demand_data_rd_hit === insert_ok : 5191029 insert_alt: 9831101 === l2_rqsts.demand_data_rd_miss === insert_ok : 132253891 insert_alt: 133965310 === l2_rqsts.miss === insert_ok : 305347974 insert_alt: 414758839 === l2_rqsts.pf_hit === insert_ok : 14639778 insert_alt: 19484420 === l2_rqsts.pf_miss === insert_ok : 156092998 insert_alt: 263293430 === l2_rqsts.references === insert_ok : 326549998 insert_alt: 443460029 === l2_rqsts.rfo_hit === insert_ok : 11650 insert_alt: 21474 === l2_rqsts.rfo_miss === insert_ok : 17544467 insert_alt: 16835137 === l2_trans.l2_wb === insert_ok : 157044674 insert_alt: 308107712 === ld_blocks.no_sr === insert_ok : 14 insert_alt: 13 === ld_blocks.store_forward === insert_ok : 158 insert_alt: 128 === ld_blocks_partial.address_alias === insert_ok : 5155853 insert_alt: 17867414 === load_hit_pre.sw_pf === insert_ok : 10840795 insert_alt: 11072297 === longest_lat_cache.miss === insert_ok : 257061118 insert_alt: 471152073 === longest_lat_cache.reference === insert_ok : 445701577 insert_alt: 583870610 === machine_clears.count === insert_ok : 3926377 insert_alt: 4280080 === machine_clears.memory_ordering === insert_ok : 97177 insert_alt: 25407 === machine_clears.smc === insert_ok : 138579 insert_alt: 305423 === mem-stores === insert_ok : 621353009 insert_alt: 554244143 === mem_inst_retired.all_loads === insert_ok : 775473590 insert_alt: 1038559807 === mem_inst_retired.all_stores === insert_ok : 621353013 insert_alt: 554244145 === mem_inst_retired.lock_loads === insert_ok : 85 insert_alt: 85 === mem_inst_retired.split_loads === insert_ok : 171 insert_alt: 174 === mem_inst_retired.split_stores === insert_ok : 53 insert_alt: 49 === mem_inst_retired.stlb_miss_loads === insert_ok : 68308539 insert_alt: 18088047 === mem_inst_retired.stlb_miss_stores === insert_ok : 264054 insert_alt: 819551 === mem_load_l3_hit_retired.xsnp_none === insert_ok : 231116 insert_alt: 175217 === mem_load_retired.fb_hit === insert_ok : 6510722 insert_alt: 95952490 === mem_load_retired.l1_hit === insert_ok : 698271530 insert_alt: 920982402 === mem_load_retired.l1_miss === insert_ok : 69525335 insert_alt: 20089897 === mem_load_retired.l2_hit === insert_ok : 1451905 insert_alt: 773356 === mem_load_retired.l2_miss === insert_ok : 68085186 insert_alt: 19474303 === mem_load_retired.l3_hit === insert_ok : 222829 insert_alt: 155958 === mem_load_retired.l3_miss === insert_ok : 67879593 insert_alt: 19244746 === memory_disambiguation.history_reset === insert_ok : 97621 insert_alt: 25831 === minor-faults === insert_ok : 1048716 insert_alt: 1048718 === node-loads === insert_ok : 71473780 insert_alt: 71377840 === node-stores === insert_ok : 16781161 insert_alt: 16842666 === offcore_requests.all_data_rd === insert_ok : 284186682 insert_alt: 392110677 === offcore_requests.all_requests === insert_ok : 530876505 insert_alt: 777784382 === offcore_requests.demand_code_rd === insert_ok : 34252 insert_alt: 45896 === offcore_requests.demand_data_rd === insert_ok : 133468710 insert_alt: 134288893 === offcore_requests.demand_rfo === insert_ok : 17612516 insert_alt: 17062276 === offcore_requests.l3_miss_demand_data_rd === insert_ok : 71616594 insert_alt: 82917520 === offcore_requests_buffer.sq_full === insert_ok : 2001445 insert_alt: 3113287 === offcore_requests_outstanding.all_data_rd === insert_ok : 35577129549 insert_alt: 78698308135 === offcore_requests_outstanding.cycles_with_data_rd === insert_ok : 17518017620 insert_alt: 7940272202 === offcore_requests_outstanding.demand_code_rd === insert_ok : 11085819 insert_alt: 9390881 === offcore_requests_outstanding.demand_data_rd === insert_ok : 15902243707 insert_alt: 21097348926 === offcore_requests_outstanding.demand_data_rd_ge_6 === insert_ok : 1225437 insert_alt: 317436422 === offcore_requests_outstanding.demand_rfo === insert_ok : 1074492442 insert_alt: 1157902315 === offcore_response.demand_code_rd.any_response === insert_ok : 53675 insert_alt: 69683 === offcore_response.demand_code_rd.l3_hit.any_snoop === insert_ok : 19407 insert_alt: 29704 === offcore_response.demand_code_rd.l3_hit.snoop_none === insert_ok : 12675 insert_alt: 11951 === offcore_response.demand_code_rd.l3_miss.any_snoop === insert_ok : 34617 insert_alt: 40868 === offcore_response.demand_code_rd.l3_miss.spl_hit === insert_ok : 0 insert_alt: 753 === offcore_response.demand_data_rd.any_response === insert_ok : 131014821 insert_alt: 134813171 === offcore_response.demand_data_rd.l3_hit.any_snoop === insert_ok : 59713328 insert_alt: 50254543 === offcore_response.demand_data_rd.l3_miss.any_snoop === insert_ok : 71431585 insert_alt: 83916030 === offcore_response.demand_data_rd.l3_miss.spl_hit === insert_ok : 244837 insert_alt: 6441992 === offcore_response.demand_rfo.any_response === insert_ok : 16876557 insert_alt: 17619450 === offcore_response.demand_rfo.l3_hit.any_snoop === insert_ok : 907432 insert_alt: 45127 === offcore_response.demand_rfo.l3_hit.snoop_none === insert_ok : 787567 insert_alt: 794579 === offcore_response.demand_rfo.l3_hit_e.any_snoop === insert_ok : 496938 insert_alt: 173658 === offcore_response.demand_rfo.l3_hit_e.snoop_none === insert_ok : 779919 insert_alt: 50575 === offcore_response.demand_rfo.l3_hit_m.any_snoop === insert_ok : 128627 insert_alt: 25483 === offcore_response.demand_rfo.l3_miss.any_snoop === insert_ok : 16782186 insert_alt: 16847970 === offcore_response.demand_rfo.l3_miss.snoop_none === insert_ok : 16782647 insert_alt: 16850104 === offcore_response.demand_rfo.l3_miss.spl_hit === insert_ok : 0 insert_alt: 1364 === offcore_response.other.any_response === insert_ok : 137231000 insert_alt: 189526494 === offcore_response.other.l3_hit.any_snoop === insert_ok : 62695084 insert_alt: 51005882 === offcore_response.other.l3_hit.snoop_none === insert_ok : 62975018 insert_alt: 50217349 === offcore_response.other.l3_hit_e.any_snoop === insert_ok : 62770215 insert_alt: 50691817 === offcore_response.other.l3_hit_e.snoop_none === insert_ok : 62602591 insert_alt: 50642954 === offcore_response.other.l3_miss.any_snoop === insert_ok : 74247236 insert_alt: 139212975 === offcore_response.other.l3_miss.snoop_none === insert_ok : 75911794 insert_alt: 141076520 === other_assists.any === insert_ok : 1 insert_alt: 3 === page-faults === insert_ok : 1048719 insert_alt: 1048718 === partial_rat_stalls.scoreboard === insert_ok : 530950991 insert_alt: 539869553 === ref-cycles === insert_ok : 32546980212 insert_alt: 12930921138 === resource_stalls.any === insert_ok : 21923576648 insert_alt: 5205690082 === resource_stalls.sb === insert_ok : 397908667 insert_alt: 402738367 === rs_events.empty_cycles === insert_ok : 1173721723 insert_alt: 1880165720 === rs_events.empty_end === insert_ok : 87752182 insert_alt: 160792701 === sw_prefetch_access.t0 === insert_ok : 20835202 insert_alt: 20599176 === task-clock === insert_ok : 10416.86 msec task-clock:u # 1.000 CPUs utilized insert_alt: 4767.78 msec task-clock:u # 1.000 CPUs utilized === tlb_flush.stlb_any === insert_ok : 1835393 insert_alt: 1835396 === topdown-fetch-bubbles === insert_ok : 1904143421 insert_alt: 6543146396 === topdown-slots-issued === insert_ok : 7538371393 insert_alt: 14449966516 === topdown-slots-retired === insert_ok : 5267325162 insert_alt: 5849706597 === uops_dispatched_port.port_0 === insert_ok : 1252121297 insert_alt: 1489605354 === uops_dispatched_port.port_1 === insert_ok : 1379316967 insert_alt: 1585037107 === uops_dispatched_port.port_2 === insert_ok : 1140861153 insert_alt: 1785053149 === uops_dispatched_port.port_3 === insert_ok : 1187151423 insert_alt: 1828975838 === uops_dispatched_port.port_4 === insert_ok : 1577171758 insert_alt: 1557761857 === uops_dispatched_port.port_5 === insert_ok : 1341370655 insert_alt: 1653599117 === uops_dispatched_port.port_6 === insert_ok : 1856735970 insert_alt: 4387464794 === uops_dispatched_port.port_7 === insert_ok : 508351498 insert_alt: 603583315 === uops_executed.core === insert_ok : 7225522677 insert_alt: 12716368190 === uops_executed.core_cycles_ge_1 === insert_ok : 3041586797 insert_alt: 5168421550 === uops_executed.core_cycles_ge_2 === insert_ok : 2017794537 insert_alt: 3653591208 === uops_executed.core_cycles_ge_3 === insert_ok : 1225785335 insert_alt: 2316014066 === uops_executed.core_cycles_ge_4 === insert_ok : 657121809 insert_alt: 1143390519 === uops_executed.core_cycles_none === insert_ok : 22191507320 insert_alt: 6563722081 === uops_executed.cycles_ge_1_uop_exec === insert_ok : 3040999757 insert_alt: 5175668459 === uops_executed.cycles_ge_2_uops_exec === insert_ok : 2015520940 insert_alt: 3659989196 === uops_executed.cycles_ge_3_uops_exec === insert_ok : 1224025952 insert_alt: 2319025110 === uops_executed.cycles_ge_4_uops_exec === insert_ok : 657094113 insert_alt: 1141381027 === uops_executed.stall_cycles === insert_ok : 22350754164 insert_alt: 6590978048 === uops_executed.thread === insert_ok : 7214521925 insert_alt: 12697219901 === uops_executed.x87 === insert_ok : 2992 insert_alt: 3337 === uops_issued.any === insert_ok : 7531354736 insert_alt: 14462113169 === uops_issued.slow_lea === insert_ok : 2136241 insert_alt: 2115308 === uops_issued.stall_cycles === insert_ok : 23244177475 insert_alt: 7416801878 === uops_retired.macro_fused === insert_ok : 410461916 insert_alt: 735050350 === uops_retired.retire_slots === insert_ok : 5265023980 insert_alt: 5855259326 === uops_retired.stall_cycles === insert_ok : 23513958928 insert_alt: 9630258867 === uops_retired.total_cycles === insert_ok : 25266688635 insert_alt: 11703285605 Background I'm implementing a cryptanalytic attack in C++11 and need to find many collisions between two large lists (both generated on the fly). A crucial part of the attack thus just consists of two critical loops: - first populating a hash table with one list
- then matching the other list against the hash table.
The hash table operations are thus performance critical, and a factor 3 slow down means the attack is 3x slower. Regarding design: Besides trying to minimize memory usage, I'm also trying to have a typical hash table operation operate on just a single cacheline. As I expect that will increase overall attack performance, especially when running the attack on all CPU cores. |
Can I use chartJS for drawing a stock map with rectangle? Posted: 23 Oct 2021 07:55 AM PDT I'm looking for a solution to represent a map of a stock with rectangles like on the image just below. Is it possible with ChartJS or should I use another library? enter image description here |
How to properly build a Clio Power Query custom connector for Power BI? Posted: 23 Oct 2021 07:56 AM PDT I am building a custom Power Query connector for Clio. It is my first PQ custom connector so I need to know 2 things: - How do I work in the token handling in the Token Handling section?
- Once I get that working, how do I make the Client ID and Secret a dynamic reference to a separate file? I don't like the idea of hardcoding that into something.
Here is my code: section Clio; [DataSource.Kind="Clio", Publish="Clio.Publish"] shared Clio.Contents = (optional message as text) => let _message = if (message <> null) then message else "(no message)", a = "Hello from Clio: " & _message in a; OAuthBaseUrl = "https://app.clio.com/api/v4"; // Data Source Kind description Clio = [ Authentication = [ OAuth = [ StartLogin = StartLogin, FinishLogin = FinishLogin ] ], Label = Extension.LoadString("DataSourceLabel") ]; // Data Source UI publishing description Clio.Publish = [ Beta = true, Category = "Other", ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") }, LearnMoreUrl = "https://powerbi.microsoft.com/", SourceImage = Clio.Icons, SourceTypeImage = Clio.Icons ]; StartLogin = (resourceUrl, state, display) => let AuthorizeUrl = OAuthBaseUrl & "/oauth/authorize?" & Uri.BuildQueryString([ response_type = "code", client_id = client_id_code, redirect_uri = "https://app.clio.com/oauth/approval", state = state ]) in [ LoginUri = "https://app.clio.com", CallbackUri = "https://app.clio.com/oauth/approval", WindowHeight = 1080, WindowWidth = 720 ]; FinishLogin = (context, callbackUri, state) => let Parts = Uri.Parts(callbackUri)[Query] in TokenMethod(Parts[code], "authorization_code", context); //Token Handling TokenMethod = (grant_type, optional verifier) => let query = [ client_id = client_id_code, client_secret = client_secret_code, grant_type = "refresh_token", refresh_token = I_don't_know_what_to_put_here ], ManualHandlingStatusCodes= {400,403}, Response = Web.Contents(OAuthBaseUrl & "/token", [ Content = Text.ToBinary(Uri.BuildQueryString(query)), Headers = [ #"Content-type" = "application/x-www-form-urlencoded", #"Accept" = "application/json" ], ManualStatusHandling = ManualHandlingStatusCodes ]), Parts = Json.Document(Response) in // check for error in response if (Parts[error]? <> null) then error Error.Record(Parts[error], Parts[message]?) else Parts; Refresh = (resourceUrl, refresh_token) => TokenMethod(refresh_token, "refresh_token"); Clio.Icons = [ Icon16 = { Extension.Contents("Clio16.png"), Extension.Contents("Clio20.png"), Extension.Contents("Clio24.png"), Extension.Contents("Clio32.png") }, Icon32 = { Extension.Contents("Clio32.png"), Extension.Contents("Clio40.png"), Extension.Contents("Clio48.png"), Extension.Contents("Clio64.png") } ]; |
How to execute a Cloud Function after Dataflow job has succeeded? Posted: 23 Oct 2021 07:56 AM PDT I want to trigger Cloud Function only if Dataflow job execution completed successfully. Cloud Function should not be triggered if Dataflow job is failed. I am running a Dataflow job using a Dataflow template (jdbc to BigQuery) from the the Dataflow UI. There is no option to trigger any Cloud Function or something after job execution. Also, I can't make changes in template code. What's the way to trigger Cloud Function? |
How to quickly update the code on App Engine after its first deployment? Posted: 23 Oct 2021 07:55 AM PDT It takes so long to deploy an app to App Engine by this command gcloud app deploy After I updated my source code, even if it's just one line of change, I had to issue this command again to upload the changes to App Engine. Again it will take a long time to deploy for just one line of code change. Is there a way to quickly update the code on App Engine instead of doing this time consuming deploy again? I am looking for options that can speed up the code update after it's first deployment to App Engine. Since I am using flex, would using standard make it faster to update the code? Is it true that there is no way around it on App Engine and the only way to do it is to use another service such as Compute Engine? |
Express js form data Posted: 23 Oct 2021 07:56 AM PDT Can someone please tell me the recommended (up to date) way to get POSTed form data in express. So many tutorials/ posts etc talk about bodyParser but this is no longer bundled with Express and other blogs etc recommend using urlencoded directly, but now this is not available either. Trying to find accurate information on these frameworks or technologies is doing my head in. BTW what I am intrerested in is very simple and small form data |
Interleave multiple lists of the same length in Python Posted: 23 Oct 2021 07:55 AM PDT In Python, is there a good way to interleave two lists of the same length? Say I'm given [1,2,3] and [10,20,30] . I'd like to transform those into [1,10,2,20,3,30] . |
How can I find and run the keytool Posted: 23 Oct 2021 07:55 AM PDT I am reading an development guide of Facebook Developers at here It says that I must use keytool to export the signature for my app such as: keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64 I do not know how to find the keytool in order to run it. I tried to open a Windows command prompt and paste the above command, but it did not work. |
No comments:
Post a Comment