| Recent Questions - Arqade Posted: 25 Jun 2021 04:10 AM PDT | Can't join my minecraft server using public ip address | port forwarding problem Posted: 25 Jun 2021 02:32 AM PDT I had a problem connecting to my Minecraft Bukkit server with the public IP address (I can just join with my IPv4 address): In the previous question I asked, I realized that the problem is with the port forwarding. I use my Ipv4 address in port forwarding and 25565 port (default port of Minecraft server)  The strange thing here is that I tested on two modems with the same brand but different internet service and only one of them worked with public IP address and the 25565 is open on that modem but In another modem not worked with my public Ip address and I couldn't join my bukkit server but I can join with IPv4 Address (and the 25565 port is close)!! I know that the 25565 port is closed when I switch to Modem 2:  How can I open that port on Modem 2? I searched for a couple of hours but I didn't find a good way All I know is that this problem is definitely related to the port forwarding or modem issues (I even completely reset the modem and it didn't work!) Thanks in advance for your help  | | What is the minimal-cost enchanting order with books for the various armor pieces/tools/weapons? Posted: 25 Jun 2021 12:05 AM PDT I looked at this previous question and while it gives the general idea, the answers do not provide the exact strategy. I am looking for something like this (found here):  This is the optimal enchanting order for a pair of boots. What is the optimal one for the other armor pieces and the various weapons and tools?  | | What does 'Xbox exclusive' mean? Posted: 25 Jun 2021 04:03 AM PDT While E3 was going on, I saw articles pop-up with titles like 'Starfield will be Xbox exclusive!'. I was disappointed, because I had hoped it would come to PC, as well. Later on, when I was watching a reaction video of a Youtuber who was pretty hyped about Starfield, he mentioned it was coming to PC. I checked the articles with those titles, and they mentioned PC too. Today, I saw an ad about Scarlet Nexus which features an intro and an outro with the Xbox logo, suggesting it was for Xbox, but I saw the game featured on Steam, as well. Does Xbox exclusive always silently include PC, and is not that exclusive? It seems really confusing.  | | I have the Java edition of Minecraft on my windows 10, wondering if there is any way to show my coordinates. i have tried looking it up, nothing Posted: 25 Jun 2021 12:40 AM PDT I have also tried going into my settings to look for an option that might help, and i have not found anything so far. could you help?  | | What' going on with the backstory? Posted: 25 Jun 2021 03:03 AM PDT So "Dungeons and Dragons: Dark Alliance" was a day one release game for Xbox Game Pass, and I was interested enough to jump into it. However, the story appears to pick up from a point in time, rather from the start. It appears that the heroes have come back from a grand adventure, only to stumble into the events of this game; and even though they give me a loose idea about what is happening, I am given the feeling that I am supposed to know a lot more about the current story then what they tell me. I have done some research, and I am told this is a spiritual successor to the Baldurs Gate franchise. I have to say, while it's been a decade since I played Balduars Gate, I am still concerned with how oblivious I feel I am, to the story. I've been told it is also a sequel to a series of novels, but I don't believe such a big shot developer would base the entire story of one of their AAA games off the assumption that you had read a set of books, especially given the gross change in median. Lastly, the game takes place in Icewind Dale, and I am familiar with atleast one title that takes place in the same region; but I don't know if that is enough to assume such a correlation to consider it a prequel; and I wouldn't want to play it if it turned out that both games were completely unrelated. What media do I need to go through to be up to speed with the base story of Dungeons and Dragons: Dark Alliance?  | | How to switch accounts in Diablo Immortal? Posted: 24 Jun 2021 06:38 PM PDT I just got into the Diablo Immortal Early Access on the Google Play Store. Upon installing and playing for the first time, I accidentally tapped 'cancel' on the login screen and was assigned a random identifier. I cannot find the logout button; deleting the cache and 4GB of downloaded contents didn't help either. I have also tried Uninstall → Reboot → Install, but I never got to see the battle.net login screen again. It brings me directly to the Character Creation page, and pressing 'Back' shows that I am on an unknown battle.net account. How can I sign out and then login to my battle.net account?  | | How do I detect when a block is broken? Posted: 24 Jun 2021 05:40 PM PDT I am trying to create a command block creation. However, I want to detect when a certain block in my world is broken, without using observers, only command blocks. How do I do this?  | | Transferring builds from one Minecraft world to another on Nintendo switch? Posted: 24 Jun 2021 04:13 PM PDT I'm on Nintendo switch, there's a few builds i have scattered throughout my worlds, and I want to compile them in one world, but it would take literal years to rebuild, I don't have a computer, and nothing on YouTube works on switch, can anyone help?  | | Is there anyway to show a mobs health above their head (1.17, Java) with only command blocks? Posted: 24 Jun 2021 03:36 PM PDT I'm making a dungeon style game, and I want the mobs to have their health above their head, and update when they heal or get hurt. Is there anyway to do this with just command blocks/commands. Because all of the answers that I've found are either mods, or don't work.  | | How were Memory Cards connected to the Original Xbox? Posted: 24 Jun 2021 07:56 PM PDT I just saw a video showing every single Memory Card since the Neo Geo and I learned that the Original Xbox also had memory cards but this video didn't showed where or how they were connected to the main system. How were memory cards connected to the Original Xbox?  | | Written books - How do I make a hover event that displays a mob? Posted: 24 Jun 2021 06:13 PM PDT I was using the book editor on minecraft.tools and saw there was a mouse over hover event that displays a mob. I added the information for it and created the book in game, but nothing appeared when I hovered over the text in the book. The segment for the hover and click event was: {"text":"Spawn Test Mob","clickEvent":{"action":"run_command","value":"/execute at shaeno run summon drowned ~ ~1 ~"},"hoverEvent":{"action":"show_entity","value":" {type:drowned,name:\\"johnny sins\\",id:\\"11cdf7cf-6dc0-4b6f-9e87-e06fd2377ce8\\"}"}}, {"text":"\\n"} The hover event for displaying the items also didn't work and it just showed "Air" but I'll ask that as a separate question. Pastebin of the entire command: https://pastebin.com/bkBQqh51  | | What is the fastest Minecraft launcher for versions 1.17 or 1.16.5? Posted: 24 Jun 2021 07:46 PM PDT Which Minecraft launcher gives the best performance in lower end computers? My specs are as follows (I know pretty old...): - 3.7 GiB Ram
- Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz (1 physical processor; 2 cores; 4 threads)
- Ubuntu 20.04 (focal) Fully-Upgraded OS
- Intel® HD Graphics 3000 (SNB GT2) Graphics Card
- OpenGL 3.0
- Dell Latitude E5530 with UEFI boot
- openjdk-16-jre (removed jdk cause )
The proposed launcher must work with Java edition 1.16.5 at a minimum, though I'm looking for 1.17.  | | How to change the item type of an item in a player's inventory but keeping its NBT tag in 1.17? Posted: 24 Jun 2021 02:42 PM PDT For example, I am wearing a netherite chestplate with Protection IV and renamed to "Wing". I would like to replace the netherite chestplate that I am wearing with an elytra but it keeps the enchantment and name. So now I will be wearing an elytra that has Protection IV on it and also named as "Wing". I was thinking about the /item command and its "item modifier" thingy that was added in 1.17, perhaps it can do the trick but I'm not sure how to do that exactly. Is it even possible?  | | How can I quickly gain XP in Fornite? Posted: 24 Jun 2021 12:37 PM PDT I only have one hour each week to play Fortnite. How can I maximize my experience gains in such short bursts of time?  | | Can I make the player freeze without powdered snow? Posted: 24 Jun 2021 03:54 PM PDT I want to give players the effect where snowflakes appear on the side of the screen, their hearts turn blue, and they take constant damage. Any idea how I can do this while the player is outside of powdered snow? I tried /effect but that didn't work so I checked the NBT data of the player and of a cow using /data, and it seems that the tag that is changed while an entity is in powdered snow are Ticks Frozen. Setting this value to its natural max, 140, repeatedly on a command block did not cause the cow to take damage, and cannot be tested on players due to the way NBT data modification works.  | | Do Power Troopers revive each other? Posted: 24 Jun 2021 10:06 PM PDT I'm in Atlas HQ, using Zane and the Digi-clone, I trigger the apparently guaranteed Power Troopers that are basically guarding the first Typhon Log. And then I hide and basically send my clone to do all the work for me. Every once it a while, I get EXP, and notice a Trooper coming from their spawn point around the same time. I'm not watching my foes because I don't want to get shot, but are the Troopers respawning, so I have to kill all 5 at around the same time? I think Pink is their healer, maybe it's their power?  | | Two Bedrock severs on the same local network, access via Friends on PS4 Posted: 24 Jun 2021 02:28 PM PDT I've got two Minecraft servers running in a Docker. Each server runs on a different port: Bedrock_Server_1 on default port 19132 and the Bedrock_Server_2 on non-standard port 19140. I can access them from most devices, but not from my PS4. PS4 doesn't support servers yet. But it does support "Friends" and I can connect to one of my servers, the one that uses the default port 19132. I wonder if it would be possible to make the Server_2 appear as a separate device (with e. g. different IP) with the default port 19132? I was trying to redirect the port with the Proxy running on the Raspi but got stuck... Sorry if it is a noob question... I have attached schematics:   | | How do I get back to Fallabor after jumping over the ledge south of Meteor Falls? Posted: 25 Jun 2021 03:45 AM PDT So I was going to beat flannery and I was at the mountain where aqua runs magma out. After I talked to the scientist I left the mountain and went down a one way edge. However I don't think I can get back since Briney(the boat captain) is not at his cabin. Also the edge made me go all the way back to the Roxanne gym. I forgot the city. Anyways is there any way to get back without the boat???  | | Can I cheat to unlock the Binding of Isaac's achievements? Posted: 25 Jun 2021 02:29 AM PDT I am currently playing Binding of Isaac on my PS4. But since I just bought a new PC, I would like to switch to the PC version. I've already spent a couple of hours playing on the PS4 and achieved all 178 achievements that are available before the DLCs. If I now start on my PC, all achievements will be gone, and some will be even harder to get (e.g. Godhead). Is it possible to use the Debug Console to cheat the achievements I already earned on my PS4? If the Debug Console does not work, is there a way to get the achievments much more easily? That way I would just buy the vanilla Binding of Isaac, get all achiements again and buy the DLCs afterwards. Is there something like an "immortal" cheat?  | | What does turning off mob griefing actually do? Posted: 25 Jun 2021 12:56 AM PDT In Minecraft, there are several commands that can be employed to make the game a little easier, without actually affecting the difficulty, such as /keepInventory and /mobGriefing. However, what does /mobGriefing actually affect? The main things are creeper explosions, and Endermen picking up blocks, but does it affect any thing else? For example, would this affect farms, if a mob jumped on farmland? And does it affect hostile mobs only, or all mobs?  | | What should I do with the first puzzle in Folgunthur? Posted: 24 Jun 2021 09:18 PM PDT There are 4 pillars. I match the pillars with the stones on the wall, but nothing happens. I cleared the place without doing anything on that puzzle. I read a bunch of walkthroughs and they don't mention this puzzle at all.   | | How do I get nausea and hunger potions? Posted: 24 Jun 2021 01:01 PM PDT How do I get the hunger and nausea potions that are unavailable in the creative mode inventory? I've seen Youtubers doing it but I cannot get them with commands that I have tried. Is a mod needed to get them? If not how can I get them?  | | Is there any block that can't be shoot through but skeletons don't know it? Posted: 24 Jun 2021 03:48 PM PDT I modified my mob grinder in such way that it now collects almost dead monsters in a small 2x2 area. From this area, I allow skeletons to shoot at me. As they shoot, they hit creepers and produce nice amount of music discs. The problem is that huge portion of arrows still makes it through. I tried to reduce the damage with water, but even 3 blocks of water still aren't enough:  My question therefore is: Can I make such set-up that skeletons will fire me but will never hit me?  | | How do I spawn a Zombie with Armor [duplicate] Posted: 25 Jun 2021 03:55 AM PDT I want to make an adventure map with custom mobs, and I am unsure where to start. I want to spawn a Zombie with full leather armor and a Stone sword named Lv.1 Zombie. If you can just give me a layout of the summon command I would really appreciate it. This is what I have tried so far to try and work it out. /summon Zombie ~ ~3 ~ {CustomName:"Lv.1 Zombie"}  | | How do you apply potion effects to players? Posted: 24 Jun 2021 07:03 PM PDT I'm developing a minigame server. I just need to know what commands to use, via command block, to give players special effects infinitely such as: speed boost, regeneration, or jump boost. I know it's possible, I've played on games that use these things, or is it a mod?  | | Is there a way to start a Minecraft server when a player tries to connect to it? Posted: 25 Jun 2021 02:29 AM PDT I've been wondering whether this is possible or not, or if there's a plugin or setting for it.  | | Does the Wii still corrupt 1019 GameCube memory cards? Posted: 24 Jun 2021 03:21 PM PDT |  |
| OSCHINA 社区最新专区文章 Posted: 24 Jun 2021 12:47 PM PDT | 今日EdgeX挑战赛培训:5G云化AVG和软件定义智能物流 Posted: 23 Jun 2021 07:55 PM PDT 【今日EdgeX挑战赛培训预告】就在今天14:00-15:00现场会议还可以和演讲嘉宾Q&A! 链接: https://zoom.us/j/99970307009?pwd=NzFicjR6bVNscnRqWTZXWEhrbFhMUT09 本次主题:5G云化AVG和软件定义智能物流 主讲人:Intel方案架构师 王海涛 随着5G、AI、边缘计算的技术日益普及,5G云化AVG以物流应用场景为切入点,以软件定...  | | edgex0.7.1_1.0.1的X86编译和交叉编译 Posted: 02 Jul 2020 05:17 PM PDT 一. X86编译 1. 安装zeromq库 根据setup script安装: wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz tar xvzf zeromq-4.2.2.tar.gz cd zeromq-4.2.2 ./configure sudo make install sudo ldconfig ldconfig -p | grep zmq libzmq.so.5 (libc6,x86-64) => /usr/local/l...  |  |
| Recent Questions - English Language & Usage Stack Exchange Posted: 24 Jun 2021 12:27 PM PDT | Word for converting grades from one system to another? Posted: 24 Jun 2021 11:46 AM PDT Say I attended high score in country A, where students are given grades in the form of letters (A–F). I want to attend university in country B, where high school grades are in the form of numbers, say 1–20. I will be required to transform my grades to their equivalents in country B's system. What is this process called? Example I almost have everything ready for my university application, I just need to proceed with the ____________ of my grades. Words I considered - conversion (too broad)
- mapping (this word is used with this meaning only in mathematics and related fields)
- standardization (sounds best, but I do not have any evidence that this word is used like this)
 | | What does a "weary room" mean? Posted: 24 Jun 2021 11:53 AM PDT A Pink Floyd song titled "A Momentary Lapse of Reason" starts with this line: "A restless eye across a weary room" I started looking up the various meanings of "weary" to see what it means in combination with room, but I didn't find anything that makes sense here. I just came across the same combination used in some hotel ad and that was all. Would somebody in the know kindly help?  | | Term for when seemingly-random or loosely-related words form a unique, descriptive sentence or phrase? Posted: 24 Jun 2021 10:22 AM PDT Is there a term for when a series of words come together to form a unique, descriptive sentence or phrase? A few examples I can think of: - XKCD comic about strong passwords: As an example of a strong but easy-to-remember password, Randall Monroe uses "correct horse battery staple", which is something that was unique, possible to imagine, and rather whimsical.
- Guided by Voices song titles: The band Guided by Voices (and their frontman Bob Pollard, in particular) are beloved for their arcane song titles. Some examples: "The Goldheart Mountaintop Queen Directory", "Father Sgt. Christmas Card", and "Big Chief Chinese Restaurant".
- Early Spam Subjects: In the 2000s, a lot of spam emails had subject lines that appeared to be randomly generated and vaguely familiar to try to circumvent spam filters. (Or at least that's my theory.) Some examples: "Baby Hungry Weakness", "Her Bridal Lace to Drink", and "Bacon Aspiration".
Perhaps there is no defined term for these creations and it's just another example of our brains automatically processing words into something more meaningful. But I've always found them pleasing to read or hear. I would love to learn if there's any kind of science or culture around them. I've researched this on the Internet and this Stack Exchange but haven't gotten a clear answer, only more examples, like using a Markov chain on the song titles above to generate more.  | | What does Nope in the sentence exactly mean? [closed] Posted: 24 Jun 2021 09:42 AM PDT First of all have a look at the following passage. Getting ready every day can be a drag. Brushing your teeth, combing your hair, and that whole annoying business of showering—it's impossible to multitask while doing that stuff, right? Nope! Aside from wanting to look (and smell) your best, the time you spend getting ready is prime time to be aware of everything you're doing. If you usually zone out while brushing your pearly whites in the morning, instead try thinking of all the ways you're helping yourself by having a sparkling smile—the least of which will mean fewer trips to the dentist. The goal here is simply focusing on the task at hand. Instead of whipping your comb through your hair in the morning like a madman, just focus on the act of brushing, not thinking of the ten other things you have to do to get ready this morning. What's the rush? Okay, well, you need to make sure you don't miss the bus. But beyond that, there's a lot of merit in diligence and focusing on personal hygiene. What do you think Nope (in bold) means? - impossible
- possible
- (my wild guess) Nope to the first sentence "Getting ready every day can be a drag". I thought so because following "Nope", it talks about how getting ready every day cannot be a drag.
 | | "get" or "got" in a past tense sentence [closed] Posted: 24 Jun 2021 08:21 AM PDT Which of these sentences is correct? - She told him to wait until she gets back home.
- She told him to wait until she got back home.
In my opinion, both sentences sound normal with "gets" and "got". What do you think? Thank you for your opinion.  | | What's a word combining appease/placate and encourage? Posted: 24 Jun 2021 08:48 AM PDT There's a word in the back of my mind that I just can't quite bring to the surface. It is generally used with negative connotations and it means something along the lines of appeasing/placating/pacifying someone to the point of encouraging bad behaviour. Edit: A sample sentence: Stop [word]ing Clive, he's just going to get worse.  | | What do you call a male child of your female cousin? [duplicate] Posted: 24 Jun 2021 11:28 AM PDT OK, a nephew is a male child of your siblings. But what do you call a male child of your female cousin? - A cousin nephew?
- A nephew cousin?
- ...?
 | | What would the opposite of "orthopedic" be? Posted: 24 Jun 2021 04:38 AM PDT So, I'm wondering, what could the opposite of "orthopedic" be? More precisely, if a force is "orthopedic" in nature (so it would give a correct posture), what would a force that causes bad posture/bad bones position be called? The closest I could come up with would be "skoliopedic", but that sounds like something that would be specifically about the spine/a twisted change. I'm looking for something more general, which would mean "crooked bones" or something among those lines. "Kurtopedic" (from kurtosis) could also be an option, but again it seems to address more a twisted/curved shape than a generic badly-shaped/badly-positioned one.  | | What is the meaning of "I listened to the frogs and the crickets and the cicadas" [closed] Posted: 24 Jun 2021 01:39 AM PDT What is the meaning/logic behind this sentence? I listened to the frogs and the crickets and the cicadas.  | | Why is the word "ordinance" lowercase in this sentence? [closed] Posted: 24 Jun 2021 01:33 AM PDT The ordinance establishing the special tribunal for the trial was passed by a remnant of the House of Commons alone from which all dissentients were excluded by the army. I noticed that the name of a specific trial is not stated, so if it was, would ordinance be a proper noun then? Question: Can you state why specifically ordinance is lowercase in the sentence and how the sentence would have to be written in order for ordinance to be a proper noun?  | | breakage vs breaking in "X denotes the spontaneous breakage/breaking of rotational symmetry" Posted: 24 Jun 2021 06:07 AM PDT In the sentence " X denotes the spontaneous breakage/breaking of rotational symmetry.", which is the best word to use in its context?  | | Correct verb form of review? [closed] Posted: 24 Jun 2021 12:47 AM PDT In the following sentence which form of the word "review" would be correct? She must ensure she review/reviews the material.  | | What do you call a person who is opposed/hates the entirety of LGBTQ+? Posted: 24 Jun 2021 01:46 AM PDT Someone who hates homosexuals is a homophobe, someone who hates trans people is a transphobe, but I don't know a good word to describe the people that just hate anything related to progressive gender/sexuality. Maybe bigot, but the official definition doesn't sound fitting and it isn't restricted to just LGBTQ+  | | Relative pronoun usage [closed] Posted: 24 Jun 2021 10:49 AM PDT Is it correct to say, "we identified different types of words emerged"?  | | Better expression for the "non-increasing property" of a quantity such as negative entropy? [closed] Posted: 23 Jun 2021 11:46 PM PDT I am currently writing an academic paper in physics. In that field, it is well known that a quantity called negative entropy is non-increasing. I would like to write a sentence in my paper that means something like this Theorem 1 guarantees the non-increasing nature of the negative entropy. Unfortunately, the phrase "non-increasing nature" seems to be rarely used in academic papers; a Google scholar search yielded only 275 results. I was wondering if you could give me an alternative, more frequent and formal phrase to "non-increasing nature".  | | "As pets being welcome, she stayed at the hotel with her dog." [closed] Posted: 23 Jun 2021 11:31 PM PDT I know that the the following two sentences are validly structured. Pets being welcome, she stayed at the hotel with her dog. and As pets were welcome, she stayed at the hotel with her dog. The following sentence combines elements of the first two sentences. Is this third sentence grammatically valid, and if not, why not? As pets being welcome, she stayed at the hotel with her dog.  | | What kind of constituent grammatically is the phrase 'to Hyundai' in this sentence? Posted: 23 Jun 2021 11:18 PM PDT So important is the Australian market to Hyundai these days that we were chosen as the first in the world to receive this new SR model. Is the phrase 'to Hyundai' a complement of the adjective word 'important'? Or, is it an adverbial modifier of the verb 'is'? Thank you!  | | Reported Questions Posted: 24 Jun 2021 05:02 AM PDT I have a question about the use of reported speech. " Who were with you", asked Tom. If I have to change the above question into a reported question, should the answer be - Tom asked me who I had been with. Or
- Tom asked me who had been with me.
Thanks!  | | Term for allowing implausible scenario in argument Posted: 24 Jun 2021 08:40 AM PDT What is the term for allowing an implausible scenario in order to be as generous as possible to the claim one is about to knock down? Example: Acme Acres recorded 2,000 births last year, but the town has only 500 women. Even if they are all of child-bearing age and each had two deliveries last year, it is still virtually impossible that they gave birth to 2,000 babies. Either out-of-towners were flocking to Acme Acres to deliver or the statistic is wrong. It's a little like "giving the benefit of the doubt" "for the sake of argument", but I don't think "doubt" is the right word here (the allowed scenario is almost certainly false). There should be a precise term or expression from this kind of argumentation, at least a Latin one from law or a Greek one from rhetoric.  | | What is/are the word(s) for the overwhelming feeling of relief? Posted: 24 Jun 2021 02:04 AM PDT I am describing in a college app essay the feeling I felt when I finally did not experience overwhelming anxiety when presenting in front of the class. I have only felt this way when presenting topics surrounding math and science. I need a word that encapsulates the feeling of utter relief. One example of this could be when someone finds out their loved one is not going to die. The cold, unrelenting grip of worry is released from the shoulders and lungs and that overwhelming sense of relief is felt. The lightness of the shoulders. The newfound ease of breath. What is a good word that encapsulates this?  | | Usage of appostive phrase Posted: 24 Jun 2021 11:07 AM PDT I came across this sentence when reading a newspaper. - An information systems specialist who set up his own mobile app development company, Edward established Web Organic in 2019 and tapped contacts in the industry for help.
In this sentence, "an information systems specialist who set up his own mobile app development company" is placed at the beginning (in front of the subject) In what conditions can an appositive phrase be placed forward? For instance, are the sentences below grammatically correct? (They both sound weird to me but I couldn't figure out their difference with the aforementioned sentence) 1 The president of the United States, Trump waged a trade war against China. 2 A fan of Michael Jordan, Jack flew to the US to watch his match.  | | A technical word to describe the correct contact between a wheel and a rail Posted: 24 Jun 2021 02:01 AM PDT I am translating an Italian technical manual, and I'm having problems translating one word in particular: "planaritá". The literal translation of the word is apparently "planarity" but I've never heard of planarity before and from online research it doesn't appear to be a common engineering term for wheel/rail contact. The direct translation of the relevant section is: problem = incomplete wheel contact solution = restore wheel and/or rail planarity I wonder whether "alignment" would work instead. Is there another more technical/engineering term to describe the relationship between wheel and rail?  | | Which noun was referred to after comma? Posted: 24 Jun 2021 01:38 AM PDT I am reading a paragraph in English. English is obviously not my first language. I like to confirm my understanding of a sentence. This is the sentence. Copernicus had offered his replacement for the old Ptolemaic astronomy, moving the sun to the center of the solar system and letting the Earth, now just one of a number of similar planets, circle round it. In the sentence, "moving the sun to the center of the solar system and ....." refers to "replacement" not "the old Ptolemaic astronomy". Am I right? Could you tell me which one it is referring to?  | | Implicit "that/which is/are" in nonrestrictive relative clause Posted: 24 Jun 2021 09:03 AM PDT Is it grammatically correct to leave off "that is" or "which is" in a nonrestrictive relative clause? Is there a term for this? Is this actually a different phenomenon? It (sometimes?) seems to apply to the whole sentence, not any individual noun. For example: Today I [verb], (which is) [comparative adjective] than [gerund]. I have [object], (which is) [comparative adjective] than [object]. I have [object], (which is) [comparative adjective] than [subject].  | | Why Cosmonaut, not Astronaut? Posted: 24 Jun 2021 04:53 AM PDT An American space traveler is called in English an astronaut. A French space traveler is called in English an astronaut (not l'astronaute). A Japanese space traveler is called in English an astronaut (not uchū hikō-shi). A Chinese space traveler is usually also described in English as an astronaut. So, why are Russian space travelers called in English cosmonauts?  | | What are buildings used for recreation and lounging near marinas called? Something like a club house but only for private use Posted: 24 Jun 2021 05:11 AM PDT What are buildings used for recreation and lounging, near marinas called? Something like a club house but only for private use. Generally owned by very wealthy people with yachts. The words coming to my mind are "lounge" and "outhouse", but I'm thinking of something on a grander scale.  | | Why do we say that someone “practices” law or medicine? Posted: 24 Jun 2021 05:32 AM PDT I'm wondering why we refer to providing legal or medical services as a practice of law or medicine, respectively. For example, we say that a lawyer practices law or a doctor practices medicine. This makes these fields sound like they're some special art, but what is the historical origin of the usage of the word practice in this context?  | | What is the antonym of the prefix retro-? Posted: 23 Jun 2021 11:18 PM PDT A coworker and I are discussing the word "retromingent", which means urinating backwards. We are wondering what the opposite would be: the word that means urinating forwards. What is the opposite of the prefix "retro-"?  |  |
| Recent Questions - Unix & Linux Stack Exchange Posted: 24 Jun 2021 12:16 PM PDT | EFI logs for logging Posted: 24 Jun 2021 12:06 PM PDT Is it possible to get some logs about (U)EFI boot? Because I have a Linux entry, who used to work, but since a crash I can't boot anymore on the OS. And the OS is totally fine in chroot. So I need to know what blocks the computer from booting that entry  | | Nohup output is scrambled Posted: 24 Jun 2021 12:03 PM PDT I ran/made a pooled/multithreaded python script that outputs a bunch of stuff in an order in which it operates. When I run the regular python command in my terminal I then see as expected some markers corresponding to places in the program execution (e.g. loaded, written parameters, progress, written output, etc.). I am experimenting with nohup for a remote server and when I run it both on the local computer and remote server, the output it writes to the nohup.out file is scrambled in a random order. It looks like the lines I expect are there. I am not sure if this has to do with the way it is handling the threaded process or something else. In my remote server it seems to throw an error where it does not recognize that I am in a conda environment, and throws an error when importing a package in that environment. Does anyone has any thoughts on either of these issues?  | | Why does this KDE keyboard shortcut command not work? Posted: 24 Jun 2021 11:55 AM PDT After some digging, I managed to find that to get the name of the user's preferred terminal emulator, as set in the 'Default Applications' section of KDE5's settings, one can run this command: kreadconfig5 --file kdeglobals --group General --key TerminalApplication In my case (running Manjaro with KDE Plasma 5), this returns the string 'alacritty'. Thus, wrapping this in $(...) and typing the resulting command inside a terminal launches the user's preferred terminal emulator (I have tested that this work). Yet, when I create a custom keyboard shortcut for KDE to run this command with Meta+Return, nothing happens. I also tried putting exec in front of it in case it was necessary, but it changed nothing. If i just set up the shortcut to run the command alacritty (which is what is returned by the first command I mentioned), then it works, but of course I want to be able to run whatever is the user's preferred terminal, not a specific one. Can anyone explain to me why it is not working? Am I doing something wrong?  | | Is Debian 11 testing less stable than Debian 10 testing? Posted: 24 Jun 2021 12:15 PM PDT I downloaded a Debian install live cd off the main website and found out I got Debian 11, which is not officially released yet... Since I want to go for testing either way, what are some drawbacks of sticking with 11 vs 10? Is 10 significantly more stable?  | | Unable to install gmake command on FreeBSD Posted: 24 Jun 2021 11:45 AM PDT I am trying to install gmake on FreeBSD-9.3 machine but I am getting only errors. The things I tried: Installing it via make command (make config-recursive, make install clean) with no success. "/usr/ports/Mk/bsd.port.mk", line 1014: Unknown directive Unknown modifier 't Variable .CURDIR is recursive. Next attempt was with pkg (pkg install gmake, pkg install devel/gmake) Both of those commands provide the same error: pkg: http://pkg.FreeBSD.org/freebsd:9:x86:32/latest/digests.txz: Not Found pkg: Unable to find catalogs Everything so far returns those Errors and I am pretty new to the world of Unix so anything will be pretty much appriciated. Thanks in advance.  | | How to find the URI and repository name from which the package was installed? Posted: 24 Jun 2021 11:51 AM PDT I have a package installed locally and I want to find the zypper URI and the repository name from which the package was installed from. I could search for the package and find it: zypper info $PKG_NAME but it does give me the URI or the repository name: > zypper info tcsh Information for package tcsh: Repository: @System Name: tcsh Version: 6.18.01-9.7.1 Arch: x86_64 Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany Support Level: unknown Installed: Yes Status: up-to-date Installed Size: 1.0 MiB Summary: The C SHell Description: Tcsh is an enhanced, but completely compatible, version of the Berkeley UNIX C shell, csh(1). It is a command language interpreter usable as an interactive login shell and a shell script command processor. It includes a command-line editor, programmable word completion, spelling correction, a history mechanism, job control, and a C-like syntax. How can I get the URI and repository name from which the package was installed? I'm also familiar with the zypper repos -u command to list all the repositories and URIs. But it does not help here. I want to make it automatic at some point. So if there is a way, could it be a way so it will be easy to parse the output? Like with the rpm -qf --queryformat "[%{NAME}]" command which returns the just the package name.  | | Only half RAM memory available to linux Posted: 24 Jun 2021 11:51 AM PDT I have a problem with OS. All tools including kernel shows only half of my actual RAM memory. I have one 16G memory chip installed in my laptop and all is shown good in BIOS. Some info about configuration: System info # dmidecode 3.2 Getting SMBIOS data from sysfs. SMBIOS 2.8 present. 90 structures occupying 5605 bytes. Table at 0x000E8C20. Handle 0x0000, DMI type 0, 24 bytes BIOS Information Vendor: Dell Inc. Version: 1.14.0 Release Date: 02/13/2020 Address: 0xF0000 Runtime Size: 64 kB ROM Size: 16 MB Characteristics: PCI is supported PNP is supported BIOS is upgradeable BIOS shadowing is allowed Boot from CD is supported Selectable boot is supported EDD is supported 5.25"/1.2 MB floppy services are supported (int 13h) 3.5"/720 kB floppy services are supported (int 13h) 3.5"/2.88 MB floppy services are supported (int 13h) Print screen service is supported (int 5h) 8042 keyboard services are supported (int 9h) Serial services are supported (int 14h) Printer services are supported (int 17h) ACPI is supported USB legacy is supported Smart battery is supported BIOS boot specification is supported Function key-initiated network boot is supported Targeted content distribution is supported UEFI is supported BIOS Revision: 1.14 Handle 0x0001, DMI type 1, 27 bytes System Information Manufacturer: Dell Inc. Product Name: XPS 15 9550 Version: Not Specified Serial Number: GR1RD72 UUID: 4c4c4544-0052-3110-8052-c7c04f443732 Wake-up Type: Power Switch SKU Number: 06E4 Family: XPS Kernel $ uname -a Linux piotr-XPS-15-9550 5.11.0-22-generic #23~20.04.1-Ubuntu SMP Thu Jun 17 12:51:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux Memory shown by free $ free -h total used free shared buff/cache available Mem: 7,0Gi 2,6Gi 1,1Gi 887Mi 3,4Gi 3,3Gi Swap: 979Mi 0B 979Mi Memory show by /proc/meminfo: $ cat /proc/meminfo MemTotal: 7382044 kB MemFree: 1142512 kB MemAvailable: 3467104 kB Buffers: 201548 kB Cached: 3183760 kB SwapCached: 0 kB Active: 823272 kB Inactive: 4182420 kB Active(anon): 1924 kB Inactive(anon): 2520488 kB Active(file): 821348 kB Inactive(file): 1661932 kB Unevictable: 831044 kB Mlocked: 32 kB SwapTotal: 1003516 kB SwapFree: 1003516 kB Dirty: 104 kB Writeback: 0 kB AnonPages: 2451456 kB Mapped: 842608 kB Shmem: 908320 kB KReclaimable: 137292 kB Slab: 238076 kB SReclaimable: 137292 kB SUnreclaim: 100784 kB KernelStack: 19088 kB PageTables: 36676 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 4694536 kB Committed_AS: 9487844 kB VmallocTotal: 34359738367 kB VmallocUsed: 76280 kB VmallocChunk: 0 kB Percpu: 6176 kB HardwareCorrupted: 0 kB AnonHugePages: 0 kB ShmemHugePages: 0 kB ShmemPmdMapped: 0 kB FileHugePages: 0 kB FilePmdMapped: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB Hugetlb: 0 kB DirectMap4k: 328276 kB DirectMap2M: 6234112 kB DirectMap1G: 2097152 kB Memory shown by dmidecode $ sudo dmidecode -t memory # dmidecode 3.2 Getting SMBIOS data from sysfs. SMBIOS 2.8 present. Handle 0x0038, DMI type 16, 23 bytes Physical Memory Array Location: System Board Or Motherboard Use: System Memory Error Correction Type: None Maximum Capacity: 32 GB Error Information Handle: Not Provided Number Of Devices: 2 Handle 0x0039, DMI type 17, 40 bytes Memory Device Array Handle: 0x0038 Error Information Handle: Not Provided Total Width: 64 bits Data Width: 64 bits Size: 16384 MB Form Factor: SODIMM Set: None Locator: DIMM A Bank Locator: DIMM A Type: DDR4 Type Detail: Synchronous Speed: 2133 MT/s Manufacturer: 0793 Serial Number: 12161215 Asset Tag: 16360000 Part Number: GR2133S464L15/16G Rank: 2 Configured Memory Speed: 2133 MT/s Minimum Voltage: Unknown Maximum Voltage: Unknown Configured Voltage: 1.2 V Handle 0x003A, DMI type 17, 40 bytes Memory Device Array Handle: 0x0038 Error Information Handle: Not Provided Total Width: Unknown Data Width: Unknown Size: No Module Installed Form Factor: DIMM Set: None Locator: DIMM B Bank Locator: DIMM B Type: Unknown Type Detail: None Speed: Unknown Manufacturer: Not Specified Serial Number: Not Specified Asset Tag: Not Specified Part Number: Not Specified Rank: Unknown Configured Memory Speed: Unknown Minimum Voltage: Unknown Maximum Voltage: Unknown Configured Voltage: Unknown Output of dmesg: $ dmesg | grep -i e820 [ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dbff] usable [ 0.000000] BIOS-e820: [mem 0x000000000009dc00-0x000000000009ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000032667fff] usable [ 0.000000] BIOS-e820: [mem 0x0000000032668000-0x0000000032668fff] ACPI NVS [ 0.000000] BIOS-e820: [mem 0x0000000032669000-0x0000000036fcefff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000036fcf000-0x000000003700cfff] ACPI data [ 0.000000] BIOS-e820: [mem 0x000000003700d000-0x0000000037674fff] ACPI NVS [ 0.000000] BIOS-e820: [mem 0x0000000037675000-0x000000003fffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000e0000000-0x00000000efffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fe000000-0x00000000fe010fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000029e22cfff] usable [ 0.000000] BIOS-e820: [mem 0x000000029e22d000-0x00000004bdffffff] reserved [ 0.000767] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved [ 0.000771] e820: remove [mem 0x000a0000-0x000fffff] usable [ 0.123701] PCI: MMCONFIG at [mem 0xe0000000-0xefffffff] reserved in E820 [ 0.333546] e820: reserve RAM buffer [mem 0x0009dc00-0x0009ffff] [ 0.333548] e820: reserve RAM buffer [mem 0x32668000-0x33ffffff] [ 0.333549] e820: reserve RAM buffer [mem 0x29e22d000-0x29fffffff] Full output of dmesg: https://pastebin.com/B7qLzVvK OS: Linux Mint 20 Ulyana What I've done before posting here: - Updated bios to newest version
- Used memtest86 and dell diagnostics tool - everything fine, bios shows 16G
- Upgraded kernel to 5.11
- I've tried Ubuntu 20.04 from USB drive and it shows 16G RAM in system monitor app (somehow I could not type any characters in console form build in keyboard or from usb one :/)
Could it be because I don't use UEFI to boot? What can I do to debug and fix this? Thank you.  | | Utilizing unique passwords for scp based on user and program Posted: 24 Jun 2021 11:00 AM PDT I am running a python Flask endpoint on an Ubuntu 20.04 remote server. The script is launched by a user on the machine. The script exposes an endpoint which another end user would visit and interact with. After interacting with the endpoint, a file will be created in a shared drive on the Ubuntu 20.04 remote server. I wish to scp that file over to another server. In particular, the problem I am trying to solve is that based on the user who spins the python process, that their credentials would need to be entered for the scp call. I am not sure about best methods to store these passwords for different users. For example, consider two users: user1 and user2: /home/user1 /home/user2 user1 decides to spin the process up end user interacts with process in the code for the script there is a line somewhere which initiates the scp scp /path/to/file.txt user1@other.remote.server:/path/to/write/file.txt this would prompt for the user password credentials ... I thought that perhaps the password could be stored in /home/user1/secret_folder and /home/user2/secret_folder and then those folder's could be queried accordingly. Apologies for the ignorance on these various issues, I am still a novice Linux user and spend most of my time doing ML work. Thank you.  | | How to set spacing[tab] in bash correctly automatically? [duplicate] Posted: 24 Jun 2021 10:05 AM PDT I have a loop that checks if rpm is installed or not and displays output in tabular format, but for the rpm package with long names, the tabular format will not show as expected. Code: for package in ssh yum firewalld policycoreutils-python do rpm -qa | grep ^$package; exit_stat="$?" if [[ ${exit_stat} -eq 0 ]] then pkg_output="${pkg_output}\n ${package} \t \t \t | \t INSTALLED" else pkg_output="${pkg_output}\n ${package} \t \t \t | \t NOT INSTALLED" fi done echo -e $pkg_output The output will come like: yum | INSTALLED ssh | NOT INSTALLED firewalld | INSTALLED policycoreutils-python | INSTALLED What I am expecting is: yum | INSTALLED ssh | NOT INSTALLED firewalld | INSTALLED policycoreutils-python | INSTALLED Is there any way to show the terminal output in the expected format?  | | Passing options to lintian in pdebuild Posted: 24 Jun 2021 10:14 AM PDT debuild has an option --lintian-opts that allows to pass options to lintian. How can I pass options to lintian from pdebuild?  | | sudo: apt get: command not found in ubuntu Posted: 24 Jun 2021 09:52 AM PDT I've installed ubuntu in Window 10 from microsoft store. After launching Ubuntu, I'm trying to install softwares in Ubuntu by using "sudo apt-get" command, but got the error as "sudo: apt get: command not found". But when I checked it under /usr/bin/ I'm able to see lot of apt* files. My home directory is /home/myusername. Is there a way to call the apt-get utility from anywhere within the system just by using its name rather than entering the full path. I remember there is one file by the name bash or profile where they use to map the directories so that we can call the filenames to get the job done.  | | iptables string rules translation to nftables Posted: 24 Jun 2021 09:25 AM PDT I am migrating rules from iptable's to nftable's by following Moving from iptable to nftable I now have few IPs and ports block rule in place along with a string based iptable rules but by using the built-in iptable translation rule I am able to covert the rules from iptable to nftable but the string based rules which were in place in iptable are commented in nftables after translation. Below is the nftable rule after translation add rule ip filter INPUT tcp dport 1024-65535 counter accept add rule ip filter INPUT udp dport 1024-65535 counter accept 65535 -j DROP # -t filter -A INPUT -p udp -m udp --dport 234 -m string --string abc.exe --algo bm --to 65535 -j DROP # -t filter -A INPUT -p udp -m udp --dport 234 -m string --string def.exe --algo bm --to 65535 -j DROP # -t filter -A INPUT -p udp -m udp --dport 234 -m string --string hij.exe --algo bm --to 65535 -j DROP add rule ip filter INPUT icmp type echo-reply ct state new,related,established counter accept add rule ip filter INPUT icmp type echo-request ct state new,related,established counter accept add rule ip filter INPUT icmp type destination-unreachable ct state new,related,established counter accept add rule ip filter INPUT icmp type time-exceeded ct state new,related,established counter accept Need help on how to convert string based iptable rules to nftable rules, and if it fails like above which log do I refer to.  | | How can I su to a user with no login shell? Posted: 24 Jun 2021 10:59 AM PDT Problem In Debian 10 I want to create a user who cannot log in directly. One should only be able to access the user by using the su binary. In my Ubuntu 18.04 setup, I did exactly this and it worked like charm, but in Debian 10 I am not able to do so. Hint The user that is able to login will not have the permission to use sudo. What I've done I've setup a user with the default shell /usr/sbin/nologin. But when trying to access this user by su --shell=/bin/bash user I am not able to do so. Minimal example # useradd --shell /usr/sbin/nologin locked # passwd locked Enter new UNIX password: *secret* Retype new UNIX password: *secret* passwd: password updated successfully $ su --shell /bin/bash locked Password: *secret* This account is currently not available. Why does this no longer work in Debian?  | | Output of this command Linux Posted: 24 Jun 2021 10:25 AM PDT Please do anyone has an idea about the output of this command , I have googled a lot about it but I can't find anything useful find . -type f -exec grep -H PATH {} \; Thanks in advance  | | Set an environment variable per user shell independent Posted: 24 Jun 2021 09:24 AM PDT How can I set an permanent environment variable per user independent from the used shell (bash, zsh and fish)?  | | How do i get the 6 digits from the middle of a file path Posted: 24 Jun 2021 10:04 AM PDT I have a file pathname like /dbfs/mnt/dlg2stage/foldername/backupname/201906_load_1_20210623-151602.tar.tgz I am trying to get only the six digits 201906 digits and print them. I tried sed and awk but failed.  | | Does XON/XOFF flow control transmit through multiple terminal session hops? Posted: 24 Jun 2021 10:42 AM PDT The puzzle I am trying to solve for is where larger outputs of text eventually fall apart into scrambled text. For context I am working on an older machine (EPSON PX-8) connected to Pi3 over RS232 using terminal emulation software on the PX-8 called TEL TEL Settings - Baud: 9600, Char Bits: 8, Parity: NONE, Stop Bits: 2, RTS: ON, Flow Control: ON Initially I had observed this issue between the PX-8 and Pi3. I was able to resolve it by enabling flow control for XON/XOFF signaling. However, when I attempt to telnet or ssh to another Linux host from the Pi3 is where I get scrambled text again when attempting to output larger blocks of text. The text output below is an example of what happens when I attempt to print my command history. 1 sudo rasp-config 2 sudo raspi-config 3 sudo nano /boot/cmdline.txt 4 tail /boot/cmdline.txt 5 sudo shutdown -r now 6 sudo vim ~/boot/cmdline.txt 7 cd /./boot 8 dir 9 sudo vim cmdline.txt 10 sudo vim config.txt 11 sudo shutdown -r now 12 dfgdf 13 vim 14 sudo vim cmdline.txt 15 cd /./boot 16 sudo vim cmdline.txt 17 sudo shutdown -r now 18 cd /./boot 19 sudo vim cmdline.txt 20 sudo shutdown -r now 21 ping 8.8.8.8 2 xprt TEM=Vvj9s9ds9j3oin so nat1 machine x Rom =vos cngas-2goses9g3 -xtiet n n5 -s oiy y  | | Replace the nth-from-end occurrence of string in each line Posted: 24 Jun 2021 11:59 AM PDT Using sed, how can I replace the Nth to last occurrence of a character on each line of a given file? In this case I want to replace the 3rd to last ; with , input 1;2;3;4;5;6;7;8;9 10;20;30;40;50;60;70;80;90 100;200;300;400;500;600;700;800;900 expected output 1;2;3;4;5;6,7;8;9 10;20;30;40;50;60,70;80;90 100;200;300;400;500;600,700;800;900 I know I could replace the 6th occurrence like this sed 's/;/,/6' input_file.csv > output_file.csv Or the last one sed -r 's/(.*);/\1,/' input_file.csv > output_file.csv But in my particular case and because of some nuances, I need to start from the end. I've tried something like sed -r 's/(.*);/\1,/3' input_file.csv > output_file.csv  | | AWS libcrypto resolve messages seen when using a boto3 library, apparently after an update Posted: 24 Jun 2021 11:44 AM PDT I'm using the s4cmd package in Python which in turn uses boto3 to communicate with a (non Amazon) S3 service. I've started seeing these warning messages on stderr. I believe this happened after an auto update to OpenSSL, but that's just my best guess. AWS libcrypto resolve: searching process and loaded modules AWS libcrypto resolve: found static aws-lc HMAC symbols AWS libcrypto resolve: found static aws-lc libcrypto 1.1.1 EVP_MD symbols openssl version OpenSSL 1.1.1g 21 Apr 2020 cat /etc/os-release | head -n6 NAME="Pop!_OS" VERSION="20.10" ID=pop ID_LIKE="ubuntu debian" PRETTY_NAME="Pop!_OS 20.10" VERSION_ID="20.10" Does anyone know what these messages are, if they're ignorable, and if they are how to suppress them? The onset of these messages correlates with a lot of random SSL failures. Both in Firefox and when using boto3. I commonly see errors like [Exception] Connection was closed before we received a valid response from endpoint URL now, but when I ssh into another server I have no problem. An hour later the problems will be gone, only to reappear some apparently random time later. Additional info: I recently noticed that inside a docker container on my laptop my boto3 & s4cmd commands work while they fail on my base OS. I checked openssl version on both: # Base OS, failing openssl version OpenSSL 1.1.1g 21 Apr 2020 # Inside docker container, working openssl version OpenSSL 1.1.1 11 Sep 2018  | | Changing ip addresses of multiple servers Posted: 24 Jun 2021 09:51 AM PDT I have set of servers which are moving to another network. I have a file which has hostnames and corresponding new IP addresses . I looked across how to achieve this using Ansible but that requires unique playbook for each server. Tried to script it but same issue. Can someone suggest eg. how to change the IP address of 2+ servers from an external server assuming you can login as root. Ansible playbook is preferred.  | | Evaluate multi-line output (with comments) of another command. (pip-completion) Posted: 24 Jun 2021 11:02 AM PDT In trying to make my .zshrc neater, I stumbled over the following problem/question: "How can I run the output of another command?". While I'm sure this is a simple problem, I just don't understand what I'm doing wrong. I want to add pip-completion to my config. For this, I need to add the output of $ pip completion --zsh to .zshrc: $ pip completion --zsh # pip zsh completion start function _pip_completion { local words cword read -Ac words read -cn cword reply=( $( COMP_WORDS="$words[*]" \ COMP_CWORD=$(( cword-1 )) \ PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )) } compctl -K _pip_completion pip # pip zsh completion end Now, the lines above simply don't look nice. Instead I tried adding the following line to .zshrc: eval $(pip completion --zshrc) However, pip completion is not being "installed" (as opposed to when I add the lines themselves in .zshrc), but I also don't get any errors. I have a feeling zsh doesn't evaluate the # lines properly, but I'm not sure how to test it. when I run $ eval $(pip completion --zshrc) no errors pop out. Where am I going wrong? Is there a similar alternative to evaluating the output of $ pip completion --zsh in my .zshrc?  | | What ZSH theme does Kali use? Posted: 24 Jun 2021 12:05 PM PDT Could someone please give me the name of the default ZSH theme that Kali uses? Also, if you could please provide a link to it.  | | How to switch between headphones and speakers without disconnecting Posted: 24 Jun 2021 09:35 AM PDT When I connect my headphones into the front jack, my speakers (line-out) get muted. I would like to switch to speakers without disconnecting my headphones. I see two possible options in gnome-control-center and pavucontrol: Headphones and Line-out. But when I switch to line-out, I hear nothing. How can I set correct behaviour? I have Realtek ALC1150 with Alsa and PulseAudio installed.  | | GTK FileChooser causes crashes in several programs Posted: 24 Jun 2021 11:53 AM PDT I have repeatedly encountered a problem with several programs that use open/save file dialogues. Upon initiating these by trying to open or to save a file, the program freezes for about 10 seconds and then crashes. With libreoffice for example, I get the following error message when started from terminal: Error creating proxy: Error calling StartServiceByName for org.gtk.vfs.UDisks2VolumeMonitor: Timeout was reached (g-io-error-quark, 24) (soffice:1466): GLib-GIO-ERROR **: 19:11:38.289: Settings schema 'org.gtk.Settings.FileChooser' does not contain a key named 'show-type-column' Fatal exception: Signal 5 Stack: A stack trace follows. I have read about a similar problem on AskUbuntu.SE, but the solution (multiple versions of /usr/share/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml) does not apply to me. The file seems to have the appropriate contents (to me). Excerpt about the key mentioned in the error: <key name='show-type-column' type='b'> <default>true</default> <summary>Show file types</summary> <description> Controls whether the file chooser shows a column with file types. </description> </key> How do I fix this problem?  | | Are interrupts used to signify that output is ready or input has completed? Posted: 24 Jun 2021 10:36 AM PDT Operating System Concepts says: During I/O, the various device controllers raise interrupts when they are ready for service. These interrupts signify - that output has completed, or
- that input data are available, or
- that a failure has been detected.
Are interrupts used to signify that output is ready or input has completed? If not, do they need to be signified by some other way?  | | How do I get rid of underline when typing commands in zsh? Posted: 24 Jun 2021 11:01 AM PDT I use zsh with oh-my-zsh and it almost suits my needs. However, there is one thing I cannot figure out, namely how do I get rid of an underline of some parts of commands I type? Please have a look at the following screenshot to get an idea of what I'm talking about.   | | How can a systemd service flag that it is ready, so that other services can wait for it to be ready before they start? Posted: 24 Jun 2021 09:55 AM PDT I have a bunch of services (say C0, C1, … C9) that should only start after a service S has completed its initialization and is fully running and ready for the other services. How do I arrange that with systemd? In Ordering services with path activation and target in systemd it is assumed that service S has a mechanism for writing out some sort of flag file. Assume here, in contrast, that I have full control over the program that service S runs, and can add systemd mechanisms into it if needs be.  | | Check whether text contains non-ASCII characters in a shell script Posted: 24 Jun 2021 09:35 AM PDT I have a file, I want to determine if it contains only English ASCII characters. I thought this is a very common question, but when I googled it, there is no direct answer or related. According to some other questions, this is what I got so far, but this doesn't work. No matter ASCII or Non-ASCII chars, it will always determine as non-ascii. if (LC_ALL=C; [[ $TEXT = *[[:ascii:]]* ]]) then echo "Contain Non-ASCII" fi BTW, This is a shell script.  | | Problem running vmPlayer on Fedora 21 Posted: 24 Jun 2021 12:00 PM PDT After install the program and execute vmPlayer request the kernel headers to recompile it (I guess), after that vmP install the virtual network device, at this point show an error.  and the vmware-15092.log file is: 2015-03-27T22:51:28.154-06:00| vthread-4| I120: Preprocessed UTS_RELEASE, got value "3.19.1-201.fc21.x86_64". 2015-03-27T22:51:28.154-06:00| vthread-4| I120: The header path "/lib/modules/3.19.1-201.fc21.x86_64/build/include" for the kernel "3.19.1-201.fc21.x86_64" is valid. Whoohoo! 2015-03-27T22:51:28.158-06:00| vthread-4| I120: The GCC version matches the kernel GCC minor version like a glove. 2015-03-27T22:51:28.158-06:00| vthread-4| I120: Validating path "/lib/modules/3.19.1-201.fc21.x86_64/build/include" for kernel release "3.19.1-201.fc21.x86_64". 2015-03-27T22:51:28.158-06:00| vthread-4| I120: Failed to find /lib/modules/3.19.1-201.fc21.x86_64/build/include/linux/version.h 2015-03-27T22:51:28.158-06:00| vthread-4| I120: /lib/modules/3.19.1-201.fc21.x86_64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead. 2015-03-27T22:51:28.158-06:00| vthread-4| I120: using /usr/bin/gcc for preprocess check 2015-03-27T22:51:28.164-06:00| vthread-4| I120: Preprocessed UTS_RELEASE, got value "3.19.1-201.fc21.x86_64". 2015-03-27T22:51:28.164-06:00| vthread-4| I120: The header path "/lib/modules/3.19.1-201.fc21.x86_64/build/include" for the kernel "3.19.1-201.fc21.x86_64" is valid. Whoohoo! 2015-03-27T22:51:28.164-06:00| vthread-4| I120: Using temp dir "/tmp". 2015-03-27T22:51:28.165-06:00| vthread-4| I120: Obtaining info using the running kernel. 2015-03-27T22:51:28.165-06:00| vthread-4| I120: Setting header path for 3.19.1-201.fc21.x86_64 to "/lib/modules/3.19.1-201.fc21.x86_64/build/include". 2015-03-27T22:51:28.165-06:00| vthread-4| I120: Validating path "/lib/modules/3.19.1-201.fc21.x86_64/build/include" for kernel release "3.19.1-201.fc21.x86_64". 2015-03-27T22:51:28.165-06:00| vthread-4| I120: Failed to find /lib/modules/3.19.1-201.fc21.x86_64/build/include/linux/version.h 2015-03-27T22:51:28.165-06:00| vthread-4| I120: /lib/modules/3.19.1-201.fc21.x86_64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead. 2015-03-27T22:51:28.165-06:00| vthread-4| I120: using /usr/bin/gcc for preprocess check 2015-03-27T22:51:28.171-06:00| vthread-4| I120: Preprocessed UTS_RELEASE, got value "3.19.1-201.fc21.x86_64". 2015-03-27T22:51:28.171-06:00| vthread-4| I120: The header path "/lib/modules/3.19.1-201.fc21.x86_64/build/include" for the kernel "3.19.1-201.fc21.x86_64" is valid. Whoohoo! 2015-03-27T22:51:28.288-06:00| vthread-4| I120: found symbol version file /lib/modules/3.19.1-201.fc21.x86_64/build/Module.symvers 2015-03-27T22:51:28.288-06:00| vthread-4| I120: Reading symbol versions from /lib/modules/3.19.1-201.fc21.x86_64/build/Module.symvers. 2015-03-27T22:51:28.302-06:00| vthread-4| I120: Read 15286 symbol versions 2015-03-27T22:51:28.302-06:00| vthread-4| I120: Invoking modinfo on "vmnet". 2015-03-27T22:51:28.304-06:00| vthread-4| I120: "/sbin/modinfo" exited with status 256. 2015-03-27T22:51:28.381-06:00| vthread-4| I120: Setting destination path for vmnet to "/lib/modules/3.19.1-201.fc21.x86_64/misc/vmnet.ko". 2015-03-27T22:51:28.381-06:00| vthread-4| I120: Extracting the vmnet source from "/usr/lib/vmware/modules/source/vmnet.tar". 2015-03-27T22:51:28.385-06:00| vthread-4| I120: Successfully extracted the vmnet source. 2015-03-27T22:51:28.385-06:00| vthread-4| I120: Building module with command "/usr/bin/make -j4 -C /tmp/modconfig-3fL25O/vmnet-only auto-build HEADER_DIR=/lib/modules/3.19.1-201.fc21.x86_64/build/include CC=/usr/bin/gcc IS_GCC_3=no" 2015-03-27T22:51:29.709-06:00| vthread-4| W110: Failed to build vmnet. Failed to execute the build command. Now I don't know what to do, any idea?  |  |
| Recent Questions - Stack Overflow Posted: 24 Jun 2021 08:16 AM PDT | How do I make SwiftUI show entire vertical content on iPad? Posted: 24 Jun 2021 08:12 AM PDT I have a SwiftUI application that was laid out using an iPhone. Now when I run it on an iPad, it appears to fill the entire width of the screen, but much of the view content is cutoff on the top and bottom. The top level view contains a container (which can hold any number of different views, based on navigation) and a splash view, which times out after the animation. Is there a way to tell it to honor the size required to fit all of the vertical views, and auto-size the width? This is the top level view. I can post more, but that is a lot of code. import SwiftUI struct ContentView: View { @State var showSplash = true var body: some View { ZStack() { ContainerView() SplashView() .opacity(showSplash ? 1 : 0) .onAppear { DispatchQueue.main.asyncAfter(deadline: .now() + 3.5) { withAnimation() { self.showSplash = false splashDidFinish() } } } }.onAppear { NSLog(".onAppear()") } } func splashDidFinish() { NotificationCenter.default.post(name: NSNotification.Name(rawValue: "checkApplicationReady"), object: nil) } }  | | Determine the region of overlap after stitching in OpenCV Posted: 24 Jun 2021 08:12 AM PDT I am trying to stitching images using this blog Image Panorama Stitching with OpenCV   # Apply panorama correction width = trainImg.shape[1] + queryImg.shape[1] height = trainImg.shape[0] + queryImg.shape[0] result = cv2.warpPerspective(trainImg, H, (width, height)) result[0:queryImg.shape[0], 0:queryImg.shape[1]] = queryImg Here's Thalles Silva complete code for Image Panorama Stitching with OpenCV I would like to know how much of the area of the images actual overlap like in this post OpenCV determine area of intersect/overlap   Where and how should I alter Thalles Silva complete code to get the area of intersection, confused?  | | FFMPEG Recording Audio from Adafruit I2S MEMS Microphone Having Issues Posted: 24 Jun 2021 08:12 AM PDT I am attempting to use FFMPEG to record and stream video off a Raspberry Pi Zero using the pi camera and the Adafruit I2S MEMS Microphone. I have successfully gotten video recording, but I am having trouble getting the audio correctly added on. I followed the directions at https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout/raspberry-pi-wiring-test and using their command of arecord -D dmic_sv -c2 -r 44100 -f S32_LE -t wav -V mono -v file.wav I do get a correct audio recording with no issues. However with my FFMPEG command of ffmpeg -f alsa -ar 44100 -ac 2 -c:a pcm_s32le -i default:CARD=sndrpii2scard -vcodec h264 -framerate 30 -i - -pix_fmt yuv420p -preset ultrafast -crf 0 -vcodec copy -codec:a aac -f segment -segment_time 1800 -segment_start_number 1 /RPICRecord%04d.mkv (The last bit starting at -f segment varies depending on recording vs streaming) I get audio that sorta just has a blip and then sounds like it's resetting. The actual recorded video also seems to not play correctly locally, however it does on YouTube. Testing with streaming the video and audio does the same, but it produces a consistent pattern on the audio blips. In the stream video I also finger snap 5 or so times, but you only ever hear 2, so it's for sure not recoding everything. My limited knowledge of FFMPEG has failed me here to understand why this happens or how to debug this further to work towards a fix. Let me know if there is any additional info or logs that would be beneficial.  | | Artifactory 7.x - pypi proxy errror Posted: 24 Jun 2021 08:12 AM PDT I have a local Pypi repository with simple-default layout. It has anonymous read access granted. I am using this repository to store my libraries. After the upgrade from Artifactory 6.x to 7.x it is not possible to install any library using pip; it worked in 6.x. Following errors are returned on pip install my-python-lib: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='host', port=8081): Read timed out. (read timeout=30.0)")': /artifactory/api/pypi/my-python-repo/simple/my-python-lib/ Could not install packages due to an EnvironmentError: HTTPConnectionPool(host='host', port=8081): Max retries exceeded with url: /artifactory/api/pypi/my-python-repo/simple/my-python-lib/ (Caused by ReadTimeoutError("HTTPConnectionPool(host='host', port=8081): Read timed out. (read timeout=30.0)")) Setting longer --default-timeout doesn't work as well. When I try to open host/artifactory/api/pypi/my-python-repo/simple/my-python-lib/ in the browser, it returns following error (after about 2 minutes): 502 Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /artifactory/api/pypi/my-python-repo/simple/my-python-lib/. Reason: Error reading from remote server  | | Malvika is peculiar about color of balloons Posted: 24 Jun 2021 08:12 AM PDT This is a problem of codechef Little Malvika is very peculiar about colors. On her birthday, her mom wanted to buy balloons for decorating the house. So she asked her about her color preferences. The sophisticated little person that Malvika is, she likes only two colors — amber and brass. Her mom bought n balloons, each of which was either amber or brass in color. You are provided this information in a string s consisting of characters 'a' and 'b' only, where 'a' denotes that the balloon is amber, where 'b' denotes it being brass colored. When Malvika saw the balloons, she was furious with anger as she wanted all the balloons of the same color. In her anger, she painted some of the balloons with the opposite color (i.e., she painted some amber ones brass and vice versa) to make all balloons appear to be the same color. As she was very angry, it took her a lot of time to do this, but you can probably show her the right way of doing so, thereby teaching her a lesson to remain calm in difficult situations, by finding out the minimum number of balloons needed to be painted in order to make all of them the same color. #include <iostream> using namespace std; int main() { string s; int n; cin >> n; while (n--) { cin >> s; int count = 0; int c = 0; for(int i = 0; s[i] != '\0'; i++) { if(s[i] == 'a'){ count++; } else if (s[i] == 'b') { c++; } } if (c == count) { cout << "1" <<endl; }else if (c > count ) { cout << count << endl; }else if (c < count) { cout << c << endl; }else if (c == 0 ) { cout << count << endl; } else if (count == 0) { cout << c << endl; } } return 0; } My sample output is correct but the code is failing while submission. The sample INPUT/OUTPUT are: Input: 3 ab bb baaba Output: 1 0 2  | | Linux System Call Implementation - Linux Kernel Posted: 24 Jun 2021 08:12 AM PDT I am trying to add a new system call that returns the total number of system calls made so far. I can find the count of system calls by writing the below command in terminal. cat /proc/kallsyms |grep _x64_sys |grep -v _eil* |wc -l But i don't know how to implement this command in my new system call's C code. Any help is appreciated.  | | When is the Github Projects beta slated for general release? Posted: 24 Jun 2021 08:12 AM PDT This is the feature that builds on the existing Project implementation but which adds support for custom metadata fields. E.g. Story Points and Priority, so it's a pretty big deal. Having some idea of when it's due would give me a clue as to how much effort to put into exploring other options in the meantime.  | | must convert dd-mm-yyyy to yyyy-mm-dd in input type date Posted: 24 Jun 2021 08:12 AM PDT code <tr> <th>DOB</th> <td><input type="date" value="{{ results.DOB }}" class="form-field" ng-model="results.DOB"></td> </tr> error Error: [ngModel:datefmt] http://errors.angularjs.org/1.8.2/ngModel/datefmt?p0=2000-11-07 at angular.js:99 at Array.<anonymous> (angular.js:26870) at Object.$$format (angular.js:31244) at Object.$processModelValue (angular.js:31224) at Object.$$setModelValue (angular.js:31256) at angular.js:31295 at m.$digest (angular.js:19262) at m.$apply (angular.js:19630) at k (angular.js:13473) at v (angular.js:13730) warning The specified value "{{ results.DOB }}" does not conform to the required format, "yyyy-MM-dd". input type="date" format should be yyyy-mm-dd how to change it.  | | Laravel "where" clause with "like" comparator Posted: 24 Jun 2021 08:12 AM PDT I have an array: $box = implode(',', $ch); dd($box) That returns: "windows,linux,ios,android" (array can contain 1, 2, 3 or 4 elements like that) I have this eloquent query: $vpns = Vpns::where('systemes', 'like', '%'.$box.'%')->get(); My problem is that only works if the array contains only one element. If it contains more, it returns nothing.  | | why the image doesn't follow mousemove Posted: 24 Jun 2021 08:12 AM PDT I tried many times to find out where is the problem and I can't I followed the instructor his code was running and my code is the same but doesn't run var move = document.getElementById('move') document.addEventListener('mousemove', function(e) { move.style.left = e.clientX move.style.top = e.clientY }) <img id="move" src="img.jpg" alt="PIC" />  | | The incrementing here continues to return a 0 value Posted: 24 Jun 2021 08:11 AM PDT I was writing the solution to this codewars problem however I've ran into a bit of an issue. Problem statement: Write a function, persistence, that takes in a positive parameter num and returns its multiplicative persistence, which is the number of times you must multiply the digits in num until you reach a single digit, e.g.: persistence(39) # returns 3, because 39=27, 27=14, 1*4=4 and 4 has only one digit def persistence(n, t=1, x=0): if len(str(n)) > 1: number = [int(i) for i in str(n)] for i in number: t = t * i if len(str(t)) > 1: x += 1 return(persistence(t,x)) else: return(x) else: return 0 I can't quite figure out what the error is in this code. My hunch is that it's either a parameter error or the way the return() value is placed. In essence, the code for distilling an integer to it's multiples is correct, so I just added an extra parameter to persistence; setting x = 0 and making it so that each time the if condition was fulfilled it would increment that exact x value. Once the number was distilled, simply output x. Yet it continues to simply output 0 as the final answer. What's the problem here?  | | RuntimeError: Working outside of request context Flask Posted: 24 Jun 2021 08:12 AM PDT I am trying out a web application that captures video from the client, processes it at the server-side and prints appropriate message. I was able to capture the video in frames and process every frame. For displaying the frames back to the client, I used a code from the internet that yields the frame and renders it. However, there needs to be an if condition before yielding the frame. def gen(camera): while True: frame, persons = camera.get_frame() if persons == 2: flash('2 people detected.') yield(b'--frame\r\n' b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n') @app.route('/video_feed') def video_feed(): return Response(gen(VideoCamera()), mimetype='multipart/x-mixed-replace; boundary=frame') The if-condition needs to be evaluated and display a flash message. But, whenever there are 2 persons in the frame, the server crashes with the error: Debugging middleware caught exception in streamed response at a point where response headers were already sent. Traceback (most recent call last): File "/Users/nitin/Desktop/cheating detection system/venv/lib/python3.8/site-packages/werkzeug/wsgi.py", line 462, in __next__ return self._next() File "/Users/nitin/Desktop/cheating detection system/venv/lib/python3.8/site-packages/werkzeug/wrappers/response.py", line 49, in _iter_encoded for item in iterable: File "/Users/nitin/Desktop/cheating detection system/system/routes.py", line 273, in gen flash('2 people detected.') File "/Users/nitin/Desktop/cheating detection system/venv/lib/python3.8/site-packages/flask/helpers.py", line 389, in flash flashes = session.get("_flashes", []) File "/Users/nitin/Desktop/cheating detection system/venv/lib/python3.8/site-packages/werkzeug/local.py", line 422, in __get__ obj = instance._get_current_object() File "/Users/nitin/Desktop/cheating detection system/venv/lib/python3.8/site-packages/werkzeug/local.py", line 544, in _get_current_object return self.__local() # type: ignore File "/Users/nitin/Desktop/cheating detection system/venv/lib/python3.8/site-packages/flask/globals.py", line 33, in _lookup_req_object raise RuntimeError(_request_ctx_err_msg) RuntimeError: Working outside of request context. This typically means that you attempted to use functionality that needed an active HTTP request. Consult the documentation on testing for information about how to avoid this problem. I am new to flask and any help is appreciated.  | | c# how to get enum name with value Posted: 24 Jun 2021 08:11 AM PDT I'm trying to get enum from value like here but I get value 2 instead of 35001 or as I want sdirt public enum material{ dirt = 2 } public enum sprite{ sdirt = 35002 } sprite s = (sprite)material.dirt; output is 2 instead of sdirt full code here how to get sprite enum  | | How to query from "any"/"map" data type on Tarantool? Posted: 24 Jun 2021 08:11 AM PDT Following example from this answer. If I created map without index, how to query the inner value of the map? box.schema.create_space('x', {format = {[1] = {'id', 'unsigned'}, [2] = {'obj', 'map'}}}) box.space.x:create_index('pk', {parts = {[1] = {field = 1, type = 'unsigned'}}}) box.space.x:insert({2, {text = 'second', timestamp = 123}} box.execute [[ SELECT * FROM "x" ]] -- [2, {'timestamp': 123, 'text': 'second'}] How to fetch timestamp or text column directly from SQL without creating index? Tried these but didn't work: SELECT "obj.text" FROM "x" SELECT "obj"."text" FROM "x" SELECT "obj"["text"] FROM "x" SELECT "obj"->"text" FROM "x"  | | how does a function changes the value of a variable outside its scope? Python Posted: 24 Jun 2021 08:12 AM PDT i was coding this code and noticed something weird, after my function has been called on the variable, the value of the variable gets changed although its outside of the functions scope, how exactly is this happening? def test(my_list): if 11 in my_list and sum(my_list) > 21: my_list.remove(11) my_list.append(1) return sum(my_list) ca = [11,11] print(test(ca)) print(ca) the above code results to: 12 [11, 1]  | | Read/write file only if it exists using fstream Posted: 24 Jun 2021 08:12 AM PDT I'm handling a file using fstream, and I need to read and write to it. However, even using std::ios:in, the file continues to be created if it does not exist: std::fstream file("myfile.txt", std::ios::in | std::ios::out | std::ios::app); Any thoughts? Thanks in advance!  | | Export PDF file from Excel template with Qt and QAxObject Posted: 24 Jun 2021 08:12 AM PDT The project I am currently working on is to export an Excel file to PDF. The Excel file is a "Template" that allows the generation of graphs. The goal is to fill some cells of the Excel file so that the graphs are generated and then to export the file in PDF. I use Qt in C++ with the QAxObject class and all the data writing process works well but it's the PDF export part that doesn't. The problem is that the generated PDF file also contains the data of the graphs while these data are not included in the print area of the Excel template. The PDF export is done with the "ExportAsFixedFormat" function which has as a parameter the possibility to ignore the print area that is "IgnorePrintAreas" at position 5. Even if I decide to set this parameter to "false", so not to ignore the print area and therefore to take into account the print area, this does not solve the problem and it produces the same result as if this parameter was set to "true". I tried to vary the other parameters, to change the type of data passed in parameter or not to use any parameter but it does not change anything to the obtained result which is always the same. Here is the link to the "documentation" of the export command "ExportAsFixedFormat": https://docs.microsoft.com/en-us/office/vba/api/excel.workbook.exportasfixedformat I give you a simplified version of the command suite that is executed in the code: Rapport::Rapport(QObject *parent) : QObject(parent) { //Create the template from excel file QString pathTemplate = "/ReportTemplate_FR.xlsx" QString pathReporter = "/Report" this->path = QDir(QDir::currentPath() + pathReporter + pathTemplate); QString pathAbsolute(this->path.absolutePath().replace("/", "\\\\")); //Create the output pdf file path fileName = QString("_" + QDateTime::currentDateTime().toString("yyyyMMdd-HHmmssff") + "_Report"); QString pathDocument = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation).append("/").replace("/", "\\\\"); QString exportName(pathDocument + fileName + ".pdf"); //Create the QAxObjet that is linked to the excel template this->excel = new QAxObject("Excel.Application"); //Create the QAxObject « sheet » who can accepte measure data QAxObject* workbooks = this->excel->querySubObject("Workbooks"); QAxObject* workbook = workbooks->querySubObject("Add(const QString&)", pathAbsolute); QAxObject* sheets = workbook->querySubObject("Worksheets"); QAxObject* sheet = sheets->querySubObject("Item(int)", 3); //Get some data measure to a list of Inner class Measurement QList<Measurement*> actuMeasure = this->getSomeMeasure() ; //no need to know how it's work… //Create a 2 dimentional QVector to be able to place data on the table where we want (specific index) QVector<QVector<QVariant>> vCells(actuMeasure.size()); for(int i = 0; i < vCells.size(); i++) vCells[i].resize(6); //Fill the 2 dimentional QVector with data measure int row = 0; foreach(Measurement* m, actuMeasure) { vCells[row][0] = QVariant(m->x); vCells[row][1] = QVariant(m->y1); vCells[row][2] = QVariant(m->y2); vCells[row][3] = QVariant(m->y3); vCells[row][4] = QVariant(m->y4); vCells[row][5] = QVariant(m->y5); row++; } //Transform the 2 dimentional QVector on a QVariant object QVector<QVariant> vvars; QVariant var; for(int i = 0; i < actuMeasure.size(); i++) vvars.append(QVariant(vCells[i].toList())); var = QVariant(vvars.toList()); //Set the QVariant object that is the data measure on the excel file sheet->querySubObject("Range(QString)", "M2:AB501")->setProperty("Value", var); //Set the fileName on the page setup (not relevant for this example) sheet->querySubObject("PageSetup")->setProperty("LeftFooter", QVariant(fileName)); //Export to PDF file with options – NOT WORKING !!! workbook->dynamicCall("ExportAsFixedFormat(const QVariant&, const QVariant&, const QVariant&, const QVariant&, const QVariant&)", QVariant(0), QVariant(exportName), QVariant(0), QVariant(false), QVariant(false)); //Close workbooks->dynamicCall("Close()"); this->excel->dynamicCall("Quit()"); } A this point I really need help to find a way to solve this problem. I also wonder if this is not a bug of the QAxObject class.  | | How to get all the matching groups in a file using regex in python Posted: 24 Jun 2021 08:12 AM PDT Say I have a file that looks like this: '2021-06-23T08:02:08Z UTC [ db=dev LOG: BEGIN; '2021-06-23T08:02:08Z UTC [ db=dev LOG: SET datestyle TO ISO; '2021-06-23T08:02:08Z UTC [ db=dev LOG: SET TRANSACTION READ ONLY; '2021-06-23T08:02:08Z UTC [ db=dev LOG: SET STATEMENT_TIMEOUT TO 300000; '2021-06-23T08:02:08Z UTC [ LOG: /* hash: 8d9692aa66628f2ea5b0b9de8e4ea59b */ SELECT action, status, COUNT(*) AS num_req FROM stl_datashare_changes_consumer WHERE actiontime > getdate() - INTERVAL '1 day' GROUP BY 1,2; '2021-06-23T08:02:08Z UTC [ LOG: SELECT pg_catalog.stll_datashare_changes_consumer.action AS action, pg_catalog.stll_datashare_changes_consumer.status AS status, COUNT(*) AS num_req FROM pg_catalog.stll_datashare_changes_consumer WHERE pg_catalog.stll_datashare_changes_consumer.actiontime > getdate() - interval '1 day'::Interval GROUP BY 1, 2; '2021-06-23T08:02:08Z UTC [ LOG: COMMIT; '2021-06-23T08:02:08Z UTC [ LOG: SET query_group to '' '2021-06-23T08:02:22Z UTC [ LOG: SELECT 1 '2021-06-23T08:02:30Z UTC [ LOG: /* hash: 64f5dca78e917617f51632257854cb2f */ WITH per_commit_info AS ( SELECT date_trunc('day', startwork) AS day, c.xid, SUM(num_metadata_blocks_retained) AS sum_retained, SUM(total_metadata_blocks) AS sum_total, AVG(num_metadata_blocks_retained) AS avg_retained, AVG(total_metadata_blocks) AS avg_total FROM stl_commit_stats c, stl_commit_internal_stats i WHERE c.xid = i.xid < ...even more sql >; '2021-06-23T08:02:30Z UTC [ LOG: SELECT per_commit_info.day AS day, COUNT(*) AS commits, and I want to eventually get a data store that looks like this: [ { 'timestamp': '2021-06-23T08:02:08Z UTC', 'db': 'dev', 'query': 'LOG: BEGIN;', }, { 'timestamp': '2021-06-23T08:02:08Z UTC', 'db': 'dev', 'query': 'LOG: <Extremely long query string', }, ] Some of the problems here are that the queries can be multiline and so newlines are not nec So I have a regex pattern that looks like this: "(?P<query_date>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z UTC) \[ db=(?P<db>\w*) LOG:(?P<query_text>.*)", which I think is close to right. How do I use this to capture all of the matching groups in this file. Can anyone help with this code? Is the code something like this: import re pattern = re.compile(<my pattenr>) for i, line in enumerate(open(<my file>)): for match in re.finditer(pattern, line): <add matching group to empty array after making a dictionary> Is it something like that?  | | How to center "hue" coloring using seaborn stripplot Posted: 24 Jun 2021 08:12 AM PDT This is my plot:  I would like the coloring to be centered at 0 within the plot. While I managed to have the legend centered at 0, this does not apply to the dots in the plot (i.e. I would expect them to be gray at the zero value). This is my code which generates the plots: import matplotlib.colors as mcolors import matplotlib.cm as cm import seaborn as sns def plot_jitter(df): plot = sns.stripplot(x='category', y='overall_margin', hue='overall_margin', data=df, palette='coolwarm_r', jitter=True, edgecolor='none', alpha=.60) plot.get_legend().set_visible(False) sns.despine() plt.axhline(0, 0,1,color='grey').set_linestyle("--") #Drawing the side color bar normalize = mcolors.TwoSlopeNorm(vcenter=0, vmin=df['overall_margin'].min(), vmax=df['overall_margin'].max()) colormap = cm.coolwarm_r [plt.plot(color=colormap(normalize(x))) for x in df['overall_margin']] scalarmappaple = cm.ScalarMappable(norm=normalize, cmap=colormap) scalarmappaple.set_array(df['overall_margin']) plt.colorbar(scalarmappaple)  | | why am I getting null pointer in here? Posted: 24 Jun 2021 08:12 AM PDT Hello Please help me figure out the problem here. I've looked up it on the StackOverFlow I found some similar questions but not really helped me figure it out. if(result.isPresent() && result.get() == ButtonType.OK) { DialogController dialogController = new DialogController(); dialogController.processResult(); //Line 90 System.out.println("Ok was pressed"); } else { System.out.println("Cancel was pressed"); } this piece of code is from my main controller.java class and it refers to a dialog by pressing OK in the dialog it runs DialogController.proccessResult() which is supposed to call the proccessResult and print out the content entered in my dialog textArea and textField: SCREENSHOT OF MY DIALOG public class DialogController { @FXML private TextArea longDescription; @FXML private TextField shortDescription; public void processResult () { String ld = longDescription.getText().trim(); //Line 24 String sd = shortDescription.getText().trim(); System.Out.PrintLn (ld); System.Out.PrintLn (sd); } } but it throws a null pointer exception, what seems to be the problem? I'm new to coding though. Caused by: java.lang.NullPointerException at untitled18/ir.sepich.todolist.DialogController.processResult(DialogController.java:24) at untitled18/ir.sepich.todolist.controller.showItemNewDialog(controller.java:90) ... 54 more  | | error: A value of type 'User?' can't be returned from the method 'signInWithGoogle' because it has a return type of 'Future<void>' Posted: 24 Jun 2021 08:11 AM PDT I was trying to build a firebase google signin in my flutter project here is the code of authentication `https://pastebin.com/1ntBnBSe` and the terminal said error: A value of type 'User?' can't be returned from the method 'signInWithGoogle' because it has a return type of 'Future'. (return_of_invalid_type at [teledentistry_baksos] lib\dummy\authentication.dart:19) Im new in flutter, Please help me guys  | | Sleuth traceId and spanId not logged in activeMQ Listener Posted: 24 Jun 2021 08:12 AM PDT I'm trying to configure a microservice with Sleuth and ActiveMQ. When starting a request I can properly see appName, traceId and spanId in logs of producer, but after dequeuing the message in listener I find only appName, without traceId and spanId. How can I get this fields filled? Right now I'm working with spring.sleuth.messaging.jms.enabled=false to avoid this exception at startup: - Bean named 'connectionFactory' is expected to be of type 'org.apache.activemq.ActiveMQConnectionFactory' but was actually of type 'org.springframework.cloud.sleuth.instrument.messaging.LazyConnectionFactory'
My dependencies: Thank you all!  | | how to send an authentication mail using android studio Posted: 24 Jun 2021 08:12 AM PDT I created a signup page for my app and in that it only checks if the email pattern is correct but I want to create a method to check if the mail really exist or if the person is using someone else mail. For that I will need to send a mail to user and verify maybe by asking to click in the link or sending an OTP but idk how to do that this is my code public class SignUp extends AppCompatActivity implements AdapterView.OnItemSelectedListener { ActivitySignUpBinding binding; private FirebaseAuth mAuth; FirebaseDatabase database; ProgressDialog progressdialog; private Spinner spinner; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding=ActivitySignUpBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); spinner=findViewById(R.id.spinner3); ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,R.array.Options, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); mAuth = FirebaseAuth.getInstance(); database=FirebaseDatabase.getInstance(); progressdialog=new ProgressDialog(SignUp.this); progressdialog.setTitle("Creating Account"); progressdialog.setMessage("please wait while we create your account"); binding.SignUp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { progressdialog.show(); mAuth.createUserWithEmailAndPassword(binding.Email.getText().toString() ,binding.Password.getText().toString()).addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { progressdialog.dismiss(); if (task.isSuccessful() && !binding.Username.getText().toString().equals("") && !binding.Username.getText().toString().contains("")) { Users user=new Users(binding.Username.getText().toString(),binding.Email.getText().toString(),binding.Password.getText().toString()); String id=task.getResult().getUser().getUid(); String selectedOption = spinner.getSelectedItem().toString(); database.getReference().child("Users").child(selectedOption).child(id).setValue(user); Intent intent; if(selectedOption.contains("Driver")){ intent = new Intent(SignUp.this, HomePage.class); } else{ intent = new Intent(SignUp.this, Custhomepage.class); } startActivity(intent); } else { Toast.makeText(SignUp.this, task.getException().getMessage(), Toast.LENGTH_SHORT).show(); } } });//to check if value match } }); } @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String text=parent.getItemAtPosition(position).toString(); } @Override public void onNothingSelected(AdapterView<?> parent) { } }  | | Python - Matrix Identity multiplication Posted: 24 Jun 2021 08:12 AM PDT I have a a dataframe a which is a = [[3], [12], [15]] and I want to turn it into b = [[3, 0, 0], [0, 12,0], [0, 0, 15]] It has been a while since high school and my matrix multiplication is a little off. Any help would be great.  | | How to secure NIFI site-to-site with basic auth Posted: 24 Jun 2021 08:12 AM PDT My purpose is to collect some changed data of remote database to a nifi instance via site-to-site and internet. How could I protect the input port on the internet via user/password ? I'm not meaning ssl connection but prevent unauthorized invokation. Is site-to-site suitable for this situation ? or use http processors instead of s2s ?  | | Float graphic figure and caption around text in rmarkdown for hmtl output Posted: 24 Jun 2021 08:12 AM PDT I am trying to build an html report using knitr where there is text description with some figures mixed in. If possible, I would like to be able to float a figure to the side and have text in the unused space. I am part of the way there, but my problem is that the figure caption is now dissociated from the figure itself. See image below for example. Here is reproducible code: --- title: "caption_testing" author: "Me" date: "6/23/2021" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` Est pellentesque elit ullamcorper dignissim cras. Turpis egestas maecenas pharetra convallis posuere. Iaculis urna id volutpat lacus laoreet. Id volutpat lacus laoreet non. Vulputate dignissim suspendisse in est ante in. Elit eget gravida cum sociis natoque penatibus. Bibendum at varius vel pharetra vel turpis ### An uninteresting heading that spans the width of the page. ```{r echo=FALSE, fig.cap="**Figure 1**. This figure caption to ideally be placed underneath the figure where it will have many words and explain great things. As a bonus, the caption margins will match up with that of the figure.", out.width='60%', out.extra='style="float:right; padding:10px"', fig.align='right'} knitr::include_graphics('darwinBubble.png') ``` Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vel eros donec ac odio tempor orci dapibus ultrices in. Auctor augue mauris augue neque. Ornare arcu odio ut sem nulla pharetra diam. Enim blandit volutpat maecenas volutpat. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl. Mi ipsum faucibus vitae aliquet nec ullamcorper. Cursus euismod quis viverra nibh cras pulvinar. Eget nunc scelerisque viverra mauris. Pharetra convallis posuere morbi leo. Elit scelerisque mauris pellentesque pulvinar pellentesque. Semper risus in hendrerit gravida rutrum quisque non tellus. Massa vitae tortor condimentum lacinia quis vel eros donec. Ultrices gravida dictum fusce ut placerat orci nulla pellentesque dignissim. Nec ultrices dui sapien eget mi proin sed libero. Ac tortor vitae purus faucibus ornare suspendisse sed nisi lacus. Ultrices mi tempus imperdiet nulla. Magna ac placerat vestibulum lectus mauris ultrices. Amet dictum sit amet justo donec enim diam. Neque viverra justo nec ultrices dui sapien. Enim nulla aliquet porttitor lacus luctus accumsan tortor. Etiam non quam lacus suspendisse faucibus interdum posuere lorem. Id velit ut tortor pretium viverra suspendisse potenti nullam ac. Here is that same r chunk, but with only the essentials. I don't believe fig.align is doing any or much of the work here, but I got the idea to use out.extra from another SO post that I cannot find right now. {r echo=FALSE, fig.cap="caption", out.width='60%', out.extra='style="float:right; padding:10px"', fig.align='right'} knitr::include_graphics('darwinBubble.png') And here is what this produces for me.  Thanks in advance, any help appreciated!  | | Why does this SwiftUI code show "Empty" in the destination screen? Posted: 24 Jun 2021 08:12 AM PDT struct ContentView: View { @State var showModal = false @State var text = "Empty" var body: some View { Button("show text") { text = "Filled" showModal = true } .sheet(isPresented: $showModal) { VStack { Text(text) Button("print text") { print(text) } } } } } I thought that when the "show text" button was tapped, the value of text would be set to "Filled" and showModal would be set to true, so that the screen specified in sheet would be displayed and the word "Filled" would be shown on that screen. I thought it would show "Filled", but it actually showed "Empty". Furthermore, when I printed the text using the print text button, the console displayed "Filled". Why does it work like this? What am I missing to display the value I set when I tap the button on the destination screen? using Xcode12.4, Xcode12.5 Add the code for the new pattern. struct ContentView: View { @State var number = 0 @State var showModal = false var body: some View { VStack { Button("set number 1") { number = 1 showModal = true print("set number = \(number)") } Button("set number 2") { number = 2 showModal = true print("set number = \(number)") } Button("add number") { number += 1 showModal = true print("add number = \(number)") } } .sheet(isPresented: $showModal) { VStack { let _ = print("number = \(number)") Text("\(number)") } } } } In the above code, when I first tap "set number 1" or "set number 2", the destination screen shows "0". No matter how many times you tap the same button, "0" will be displayed. However, if you tap "set number 2" after tapping "set number 1", it will work correctly and display "2". If you continue to tap "set number 1", "1" will be displayed and the app will work correctly. When you tap "add number" for the first time after the app is launched, "0" will still be displayed, but if you tap "add number" again, "2" will be displayed and the app will count up correctly. This shows that the rendering of the destination screen can be started even when the @State variable is updated, but only when the @State variable is referenced first in the destination screen, it does not seem to be referenced properly. Can anyone explain why it behaves this way? Or does this look like a bug in SwiftUI?  | | SQL / Postgresql count multiple columns with conditions Posted: 24 Jun 2021 08:12 AM PDT I have a simple table of the form: | id | gender | a_feature (bool) | b_feature (bool) | ... | xyz_feature (bool) | and I want to sum over all feature columns dependent on gender. | metric | male | female | | a_feature | 345 | 3423 | | b_feature | 65 | 143 | | ... | ... | ... | | xyz_feature | 133 | 5536 | Is there a simple way to do this, e.g. using the information_schema. I found only the solution below, but this is very ugly: select 'a_feature' as feature_name, count(case a_feature and gender = 'male') as male, count(case a_feature and gender = 'female') as female from table union select b_feature as feature_name, count(case b_feature and gender = 'male') as male, count(case b_feature and gender = 'female') as female from table . . . select xyz_feature as feature_name, count(case xyz_feature and gender = 'male') as male, count(case xyz_feature and gender = 'female') as female from table  | | Change rectangular Qt button to round Posted: 24 Jun 2021 08:12 AM PDT I'm trying to create a round button in Qt. A simple form with a single button QPushButton was created in designer. I'm attempting to turn this into a round button using setMask(). As soon as setMask() is applied the button disappeares. Does a custom widget need to be created to make a round button? #include "mainwindow.h" #include "ui_mainwindow.h" #include <QMessageBox> #include <QtGui/QPushButton> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->pushButton->setText("Test Text"); ui->pushButton->setFixedHeight(200); ui->pushButton->setFixedWidth(200); //Set Starting point of region 5 pixels inside , make region width & height //values same and less than button size so that we obtain a pure-round shape QRegion* region = new QRegion(*(new QRect(ui->pushButton->x()+5,ui->pushButton->y()+5,190,190)),QRegion::Ellipse); ui->pushButton->setMask(*region); ui->pushButton->show(); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { QMessageBox msgbox; msgbox.setText("Text was set"); msgbox.show(); } Note: If the button is created in code and applied to a window before the window is displayed, the button is displayed. I would like to use the WYSIWIG capabilities of the Qt Designer rather than creating the entire form in code.  | | Truncate number to two decimal places without rounding Posted: 24 Jun 2021 08:12 AM PDT Suppose I have a value of 15.7784514, I want to display it 15.77 with no rounding. var num = parseFloat(15.7784514); document.write(num.toFixed(1)+"<br />"); document.write(num.toFixed(2)+"<br />"); document.write(num.toFixed(3)+"<br />"); document.write(num.toFixed(10)); Results in - 15.8 15.78 15.778 15.7784514000 How do I display 15.77?  |  |
| OSCHINA 社区最新专区文章 Posted: 24 Jun 2021 08:11 AM PDT | 从五大结构体,带你掌握鸿蒙轻内核动态内存Dynamic Memory Posted: 23 Jun 2021 08:15 PM PDT 摘要:本文带领大家一起剖析了鸿蒙轻内核的动态内存模块的源代码,包含动态内存的结构体、动态内存池初始化、动态内存申请、释放等。 本文分享自华为云社区《鸿蒙轻内核M核源码分析系列九 动态内存Dynamic Memory 第一部分》,原文作者:zhushy。 内存管理模块管理系统的内存资源,它是操作系统的核心模块之一,主要包括...  | | Linux 5.14 将支持 OpenPOWER Microwatt Soft CPU 内核 Posted: 23 Jun 2021 04:44 PM PDT 根据最新的提交显示,即将发布的 Linux 5.14 将增加对 Microwatt 的支持。 Microwatt 是一个用 VHDL 2008 编写的基于 FPGA 的小型 Open POWER ISA 软核,于 2019 年推出。其符合 Power ISA 3.0 指令集,可以在各种 FPGA 硬件上运行,而且是第一个使用开放 Power ISA 3.0 规范从头编写的处理器,并成为该规范的参考设计之...  |  |
| OSCHINA 社区最新专区文章 Posted: 24 Jun 2021 06:47 AM PDT | ES6 中的 Symbol 是什么? Posted: 24 Jun 2021 04:21 AM PDT ## 前言 记得刚找工作那会,几种数据类型是必问题,当时的答案一般都是七种——字符串(String)、数字(Number)、布尔(Boolean)、数组(Array)、对象(Object)、空(Null)、未定义(Undefined),时至今日,某些网络教程上还是这样的分类:  | | 【撸个前端脚手架】(二)脚手架的开发流程 Posted: 24 Jun 2021 04:39 AM PDT 快速搭建一个脚手架 使用 npm init 初始化项目,在 package.json文件中添加 bin 配置,我们设置脚手架的脚本命令名称为 tyro-cli,命令实际执行的文件为 bin/index.js 。 创建脚手架入口文件 bin/index.js, 并在第一行添加 #!/usr/bin/env node 使用 npm login 与 npm publish 发布脚手架 发布成功后全局安装脚手架并执...  | | 构建WEB项目的 25 个HTML建议 Posted: 24 Jun 2021 05:19 AM PDT HTML 超文本标记语言是一种用于创建网页的标准标记语言。HTML是一种基础技术,常与CSS、JavaScript一起被众多网站用于设计网页、网页应用程序以及移动应用程序的用户界面。 HTML是WEB应用程序的骨架,尽管非常容易上手,但仍有很多需要注意的规则,可能因为没有遵循这些规则导致WEB应用程序的实践受到影响,现在对于项目...  | | 前端开发过程跨域问题处理 Posted: 24 Jun 2021 03:09 AM PDT 作者:Duang 来源:恒生LIGHT云社区 同域策略是什么 同源策略是一个重要的安全策略,它用于限制一个origin的文档或者它加载的脚本如何能与另一个origin的资源进行交互。它是一个约定,也是浏览器核心也最基本的安全功能,它能帮助阻隔恶意文档,减少可能被攻击的媒介,提高安全性。同源策略会阻止一个域的javaScript脚本...  | | docker部署前端网页 Posted: 24 Jun 2021 02:27 AM PDT 纯docker部署前端网页如何部署? 不使用nginx和node, 以及其他任何中间服务  | | 如何实现地图App中附近地点搜索及聚合标记功能 Posted: 23 Jun 2021 02:38 AM PDT 在日常的应用中,经常有需要展示地图,并且在地图上显示地图标记的需求。华为HMS的Map Kit提供了这样的能力。可以先绘制地图,然后在地图上绘制标记点,并按不同比例尺实现不同的标记聚合。本文将具体展示如何结合定位、位置、地图服务的相关能力,实现附近服务搜素,并在地图上显示出来。 应用场景 旅行类应用,可以搜索...  | | JavaScript 数组操作必须熟练运用的8个方法 Posted: 23 Jun 2021 07:34 AM PDT JavaScript 提供了大量不同的处理数组的方法,这里花几分钟时间介绍 8 个项目中可以用到的数组方法。 1. Array.map() 使用.map() 方法,可以创建一个基于原始数组的修订版数组。.map() 方法接受一个函数,该函数遍历数组中的所有项并进行相应的修改。 当需要更新数组中的所有项并将其存储到一个新数组中时,.map() 方法就...  | | 值得收藏的15个JavaScript语句 Posted: 23 Jun 2021 07:31 AM PDT JavaScript 可以处理很多事情,从复杂的框架到API的处理,需要学习的东西太多了。今天来分享 15 个简单且可能常用到函数语句。 1. 两个日期间的天数 这个是一个常见的功能,在涉及统计相关的需求中基本都需要使用。 const diffDays = (startDate, endDate) => Math.ceil( Math.abs(new Date(startDate) -...  | | WordPress 5.8 Beta 3 发布 Posted: 23 Jun 2021 04:01 PM PDT WordPress 5.8 Beta 3 现已发布。该版本件仍在开发中,因此官方不建议在生产站点上运行此版本。相反,其建议用户在测试站点上运行新版本。 主要更新内容 Block Editor:将缓存移动到端点以获得独特的响应 Bundled Themes:改进小部件区域中块的显示 Coding Standards:为 wp-admin/comment.php 中的 HTML 格式提供一致性...  | | KDE Plasma 5.22.2 发布 Posted: 23 Jun 2021 03:53 PM PDT KDE Plasma 5.22.2 现已发布,该版本是 KDE Plasma 5.22 的 6 月 bug 修复版本。 主要更新内容 Flatpak:正确通知更新 Wayland:实施活动窗口规则 Scenes/opengl: 仅在渲染时更新未定型的 EffectFrame 纹理 Platforms/drm:日志记录的一些改进 XdgSurfaceClient:在构造函数中设置为当前活动和桌面 Platforms/drm:修复 ...  |  |
| Recent Questions - Arqade Posted: 24 Jun 2021 06:35 AM PDT | Custom model problems Posted: 24 Jun 2021 05:34 AM PDT I am having two problems with custom models in my resource pack. I am not sure, but I think that they are related. I have looked everywhere and found this and this. you cannot give a solid block a model like that Is there any way of fixing it? Here is a screenshot with both problems: Thanks for the help!  | | Is 8 GB RAM, 1650ti and an i5-10300H enough? [closed] Posted: 24 Jun 2021 05:13 AM PDT Okay, so I'm planning to buy a gaming laptop, and I've come down to this one -- Asus ROG G15 - Electro Pink Link to the same It has the following specs listed: - Processor - i5-10300H
- RAM - 8 GB, upgradeable to 64 GB (DDR4)
- GPU - Nvidia GTX 1650ti, 4 GB VRAM
- 144Hz display
So, my question here are: - How much FPS will I get when I'm playing Valorant at high graphics, and what max graphics can I keep to get at least 90-120 FPS constant (I'll be applying fps limit).
- What is the max FPS I can get on COD:Warzone, and what is the best graphics I can get with satisfactory FPS? Will I, on playing Warzone on low graphic settings, get >60 fps or even 60 fps constant?
- Can I stream my gameplay along with getting satisfactory performance? (both Valorant and Warzone)
I know there are system requirements posted for these games, but I don't want to be on minimum specs, and certainly can't have recommended specs, so I just want to know which settings will be the best for performance as well as graphics, and if I can stream my gameplay. Thanks.  | | How do I counter the frozen floors? Posted: 24 Jun 2021 12:25 AM PDT I have just started playing "Dungeons & Dragons: Dark Alliance", and even from the early levels, I am coming upon a lot of frozen floors. When I walk over them, I take damage, and become slowed. They clearly aren't meant to be avoided; some have treasure chests smack bang in the middle of them, others have various other treasures scattered around. At first, they were not a real problem. I was playing on the easiest level of difficulty, and I could jump over the frozen sections, or run right through them without incurring much of a penalty. However, on higher levels of difficulty, a single tick from the damage buff almost completely wipes out my character.  How to I counter the frozen floors?  | | What makes the extra music layer start playing in Mario Kart 7? Posted: 24 Jun 2021 04:27 AM PDT Sometimes if I'm in first place during a race in Mario Kart 7, an extra layer of music will start playing. You can hear it start around 2:56 in the video below. However, the extra layer doesn't always play when the player is in first. There seems to be an extra requirement needed before the extra layer kicks in. What causes the extra layer of music to start playing in Mario Kart 7?  | | reverse Objects and statues Posted: 23 Jun 2021 09:01 PM PDT So I have Jaxons Positioner and I would like to know how I can copy and reverse a pose of a statue or object to place them in a symmetrical manner. For example, I copied a Draugar Warlord trophy from my house but it looks weird when the two images are facing the same direction. I would like to have one Draugar placed facing one direction and its copy facing the opposite direction so that they face each other placed side by side. That is an example of what I'm looking for. does anyone know how to flip or reverse any object to face the opposite side from the other?  | | What is this spawn egg item, and how do I remove it? Posted: 23 Jun 2021 11:59 PM PDT I was working on a project in Minecraft Bedrock Edition, when I came across this spawn egg in the creative menu. I was curious about what it spawned, but when I tried to use it, it just spawned an odd cube thing (see image below). I am now unable to remove the spawned block, despite being in creative mode. I also unintentionally spawned several of them by misclicking. It's right in the middle of my build, and quite the inconvenience.  What is this spawn egg item, and how do I remove it?  | | Skywatcher guardians and perfect parry damage inconsistant Posted: 24 Jun 2021 05:21 AM PDT I am doing the Champions' Ballad for Mipha on hero mode and I am on the defeat of the ancient foes one, meaning I have to kill some skywatcher guardians. I've found that my perfect parry damage is changing compared to the other guardian types. Normally your parried laser blast deals 500 damage, but there are many times when my damage is only 104 which is then quickly recovered from. I have found that they have been swaying either from damage or wind, and if I am higher I will always miss with the reflected blast. However, when they are higher I am more likely to hit. I originally thought that shield values were where the damage came in, but using a steel lizal shield (35), knights shield (40), royal shield (60), and guardian shield++ (42) have not directly affected damage. So why do I sometimes get the 500 damage, but other times it's only 104?  | | How exactly has Dimond ore generation changed in 1.18? Posted: 23 Jun 2021 10:42 PM PDT So I've been watching some of the Hermitcraft "Season 8" videos on YouTube, and one of the "problems" they've come across is the change in ore distribution - particularly diamonds. Basically, they've found that diamonds are more rare than they used to be. With the addition of copper and the new "Raw" resources, it makes sense that distributions have changed somewhat. After looking on the wiki however, I am still lightly confused. When mentioning referring to obtaining the Diamond Item from Mining this remains the same - Diamond ore can be found on levels 1-15. However, the generation of Diamond Ore seems to have changed somewhat: In Java Edition 1.18 and Bedrock Edition 1.18.0, diamond ore attempts to generate in two batches. The first batch generates 6 times per chunk in blobs of 0-5 ores, from Y=14 to Y=-63, being more common as the y-level decreases. The second batch generates in 1⁄9 chunks in blobs of 0-23 ores, from Y=14 to Y=-63, being more common as the y-level decreases. Diamond ore is also less likely to be exposed to air: 50% of ore blobs from the first batch and 70% from the second batch will not generate. Diamond ore can replace stone, granite, diorite, andesite, tuff, and deepslate. Diamond ore that replaces tuff or deepslate will become deepslate diamond ore. Diamond ore generating under Y=0 or in a deepslate blob will be replaced by its deepslate variant. To me, this says that the generation of Diamond ore(s) can happen on over 70 levels now?  | | How do I change my skin? Posted: 23 Jun 2021 06:09 PM PDT I already have a skin equipped, and when I click the skins section in the Java edition, it shows the current skin as my custom skin. However, each time I join my signal player survival game, I always have the Alex skin. I purchased the Java Minecraft from the minecraft.net website. I am in the 1.17 update. How do I fix this?   | | Are there games that can legally share currencies between them? [closed] Posted: 23 Jun 2021 10:39 PM PDT Consider 2 games, A and B. In game A, I have 100 gold. I want to move that gold to game B. I have been scouring the internet for such a game; are there any games with at least similar mechanics?  | | Why is my loot table not showing up in the /loot command? Posted: 24 Jun 2021 12:00 AM PDT I've created a loot table[1] and I'm having issues using it with the loot command: loot insert ~ ~ ~ loot minecraft:op Executing the command above drops zero items. The JSON for the loot table is: { "pools": [ { "rolls": { "min": 1, "max": 2 }, "bonus_rolls": { "min": 0, "max": 2.5 }, "entries": [ { "type": "item", "name": "minecraft:", "weight": 1, "functions": [ { "function": "set_count", "count": { "min": 1, "max": 2 } } ] }, { "type": "item", "name": "minecraft:diamond", "weight": 3, "functions": [ { "function": "set_count", "count": { "min": 1, "max": 7 } } ] }, { "type": "item", "name": "minecraft:totem_of_undying", "weight": 1, "functions": [ { "function": "set_count", "count": 1 } ] }, { "type": "item", "name": "minecraft:enchanted_book", "weight": 2, "functions": [ { "function": "enchant_randomly", "enchantments": [ "protection" ] } ] }, { "type": "item", "name": "minecraft:iron_block", "weight": 3, "functions": [ { "function": "set_count", "count": { "min": 1, "max": 5 } } ] }, { "type": "item", "name": "minecraft:stick", "weight": 1, "functions": [ { "function": "enchant_randomly", "enchantments": [ "knockback" ] } ] }, { "type": "item", "name": "minecraft:gold_block", "weight": 1, "functions": [ { "function": "set_count", "count": { "min": 1, "max": 5 } } ] }, { "type": "item", "name": "minecraft:potion", "weight": 1, "functions": [ { "function": "set_nbt", "tag": "{Potion:\"minecraft:strength\"}" } ] } ] } ] } Why is my loot table not showing up for the loot command? [1]: The JSON file is located at datapackName/data/minecraft/loot_tables.  | | Can't join my server: "io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information" Posted: 23 Jun 2021 07:03 PM PDT I used to be able to connect to my bukkit server in Minecraft by my IP address, but after a while, I could not. It gives me this error when I try to join my server: Failed to connect to the server io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information  I know that my IPv4 address is 192.168.1.105, and I put this in the "server.properties" file.  When I click on the run.bat file, the server turns on, but I am not able to join it with my IP address, (I can just join with IP4 address). And Here are my port forwarding settings:  Here is firewall setting:  TIP: I can just join my server using the IPv4 address (192.168.1.105), but me and my friends can't join with my IP address. How do I resolve this problem? EDITED: I changed my modem and tried again and it worked completly! However, when I connect to another modem, I am not able to connect to my server  | | Activate lever with command block? Posted: 23 Jun 2021 05:49 PM PDT I need to use a command block to activate a lever in Bedrock edition. I thought I could use /setblock but the syntax for Bedrock edition doesn't seem to support it: /setblock <position> <tileName> [tileData] [replace¦destroy¦keep] I ran into a similar issue with trying to set the state of a redstone lamp recently and discovered that we've been provided with a lit redstone lamp object to use instead. However, no such variant exists for the lever:  How can I activate a lever with a command block in Bedrock edition?  | | Removing Tag/Scoreboard Value from Offline Players Posted: 23 Jun 2021 05:57 PM PDT For my Minecraft: Bedrock Edition Realm, I am creating a system where players can purchase access to a certain area for 24 hours. So far, I have created the purchasing system and 24-hour timer. When a player purchases access, they are given a tag so that they and only they can enter the area during the time period. After the time is up, the tag must be removed so someone else can purchase access. The problem arises if they are offline when the time is up. I currently have no way to remove the tag from them if they are offline, and waiting until they come online again means the whole system is stuck until they come back (if they do) meaning no one else can purchase access until they come back. I want a solution that will allow a reset of the system when the time ends, allowing someone else to rent soon after. I am open to using scoreboard objectives instead of tags if that seems like a better option.  | | Can a billboard be placed everywhere? Posted: 24 Jun 2021 03:04 AM PDT Billboards should distribute jobs to multiple workstation of the same type. I now place all my billboards in the same room as those workstations, but sometimes they take up precious space. Is it possible to place billboards somewhere else (for example, a distant 'billboardroom')? I never caught an employee looking at the billboard. Will the machine input zones work well with this solution?  | | How do you upload .zip to .mcpack? Posted: 23 Jun 2021 08:02 PM PDT So while I was trying to import a .zip file from planet Minecraft, I followed all the instructions to turn it into .mcpack. While I did that, I imported it to Minecraft and an error with no log comes up. .mcworld works but not .mcpack. Note: I use iPadOS v.13.6 using a iPad Pro (9.6 inch) model. I don't know if that will help.    | | Minecraft Server Failed to connect Posted: 24 Jun 2021 01:09 AM PDT Im trying to set up a minecraft server on a centos 7 vm so that my friends and I can play. I've been following a guide on how to set it up and was able to make it all the way through until the actual connecting to the server part. I've made sure there is a port exception for 25565, and when I use ss -natu it shows the the port is listening for a connecting from java... though everytime I try to connect I keep getting the io.netty.channel.abstractchannel$annotatedconnectexception connection timed out error. Not sure if I dont have the firewalld set up properly or if something else is the matter. Thanks for reading and any help is much appreciated! If you need more info just ask and I will try to get it to you as quick as possible.  | | Ways to apply bleed effect? Posted: 24 Jun 2021 05:13 AM PDT What ways are there to apply bleed effect to enemies? I've been thinking about the synergy between the three talents: - Knee Cap Leg shots have a chance to apply a bleed to the enemy.
- Sadist +20% weapon damage to bleeding targets.
- Demolitionist Grenades These have a larger radius and apply bleed, but deal a fraction of the damage of regular grenades (you carry less of them).
Are there other ways to apply bleed?  | | How to invert mouse y axis in Qube 2? Posted: 23 Jun 2021 06:05 PM PDT I know it's not possible in the game options, and it won't be developped, but is there any workaround to this ? So far I've tried a .NET Mouse inverter program, and Sakasa.exe They DO invert y axis in Windows and Qube menus, but not in game.  | | How do I make a high-level dish? Posted: 23 Jun 2021 06:08 PM PDT What makes a dish grant a low, mid, or high level buff? I can only seem to make low-level cold/heat resistance dishes by cooking five of the same ingredient. I'd like to sneak around Hebra in my Sheika armor.  | | When will the Traveler's Walk be opened in Destiny? Posted: 23 Jun 2021 11:05 PM PDT I have been looking forward to investigate the Traveler's Walk in The Tower. However it is always closed. Now a page on Destiny wiki describes it as permanently open. It is just my console's problem (Xbox 360) or is the page outdated? If the page is outdated, when will the walk be open again?  | | How do I play Minecraft with friends without being connected to the same wifi network? Posted: 23 Jun 2021 06:35 PM PDT I've had this problem a lot lately because me and my friend would like to play a map together, but the thing is we can't use LAN. She lives in California and I live 700 miles away, so we are definitely not connected to the same wifi. If you could please answer this it would be a lot of help to me because I have been searching this for a while and nothing that works have come up so far. Thanks  | | Adding extra enchantment level names Posted: 23 Jun 2021 11:18 PM PDT I need to create an enchantment higher than 10, but it displays it as enchantment.level with the level of enchantment I applied. Is there any way to work around this and have roman numerals appear instead (for example, show XI instead of enchantment.level.11)?  The command I used to get this book was: /give @s minecraft:enchanted_book{Enchantments: [{id: "minecraft:feather_falling", lvl: 11}]}  | | What are scoreboards on Diep.io? Posted: 23 Jun 2021 11:24 PM PDT What is the scoreboard on Diep.io? I am specifically talking about the thing in the top-right corner, that has the text Scoreboard and has 10 things below it.  | | What are points, builds, and stats? Posted: 23 Jun 2021 11:07 PM PDT I would like to know what these are:   | | Fallout new vegas not showing up mods Posted: 23 Jun 2021 05:43 PM PDT So I got myself a copy of fallout new vegas to play. Everything goes fine except mods. I use the Nexus Mod Manager and have followed every single step on how to download and install mods. So my problem is that everything goes fine, the NMM installs the mod but at the moment of running the game it is still vanilla. I have already checked if the .esp mod files are selected, they are installed, everything seems to be functioning correctly. Yet they won't appear in game. ¿How can I fix that?  | | How to open Minecraft_Server.jar? Posted: 24 Jun 2021 12:56 AM PDT When I downloaded minecraft_server1.8.8.jar I couldn't open it by double clicking on it, nothing would happen. I tried opening the eula.txt file and changed eula=false to eula=true so I'm still confused as to why it doesn't work. What do I need to do to open the minecraft_server.jar file?  | | TDS SFX missing from all scenes and encounters after recent patches Posted: 23 Jun 2021 09:04 PM PDT Anyone else noticed after recent patches, that the rebel encounters, the scenes in the album and maybe some other stuff too have lost their sound effects ? I mean there's no sfx anymore, and if the music is playing when you start a scene, the music doesn't cut off like it should. iPhone5 IOS 7.04 Game 1.3.2700, Data 1.4.0.0 Have rebooted the phone, tried closing the game aswell but nothing helps. Suggesting this must be a bug with some recent patching ?  | | Tiny Death Star is not showing scenes or levels via menu options. Is there a way to fix this? Posted: 23 Jun 2021 07:01 PM PDT I can no longer see the scenes or levels. Also the Bitizens log is empty. It seems to reset every time on opening; asks if I want to allow push notifications each time; plays the music even when I've set it to no music. When the bitizens with question marks appear it shows a message (scenes opened if delivered to correct level). It tells me I've achieved awards every time - such as the dream job achievement and having over $100,000. Can this be fixed? If so, how? It happened on my phone (had to reset) so started from scratch on my Nexus 7. 62 floors/85 bitizens so would rather not start over!  |  |
| OSCHINA 社区最新专区文章 Posted: 24 Jun 2021 05:54 AM PDT | 从五大结构体,带你掌握鸿蒙轻内核动态内存Dynamic Memory Posted: 23 Jun 2021 08:15 PM PDT 摘要:本文带领大家一起剖析了鸿蒙轻内核的动态内存模块的源代码,包含动态内存的结构体、动态内存池初始化、动态内存申请、释放等。 本文分享自华为云社区《鸿蒙轻内核M核源码分析系列九 动态内存Dynamic Memory 第一部分》,原文作者:zhushy。 内存管理模块管理系统的内存资源,它是操作系统的核心模块之一,主要包括...  |  |
| OSCHINA 社区最新专区文章 Posted: 24 Jun 2021 05:35 AM PDT | netty 请教一个问题,断线重连之后,channelActive 发送消息失败怎么处理 Posted: 23 Jun 2021 11:47 PM PDT netty 正常启动,可以触发 channelActive 。正常流程没有问题, 但是在断线重连之后,触发了 channelActive,但是服务端接收不到数据,但是延迟之后可以收到  | | Link 标签属性含义及其用法 Posted: 14 Jun 2021 07:51 PM PDT link元素用于链接外部css样式表等其他相关外部资源。 1 link 其中link中包括如下属性。 href:指明外部资源文件的路径,即告诉浏览器外部资源的位置 hreflang:说明外部资源使用的语言 media:说明外部资源用于哪种设备 rel:必填,表明当前文档和外部资源的关系 sizes:指定图标的大小,只对属性rel="icon"生效...  | | 卢松松博客专访胡茬:解密程序员互联网创业历程 Posted: 23 Jun 2021 11:04 PM PDT 最近卢松松博客采访了一位在松松云2021创业者线下沙龙中结识的从程序员行业切入互联网创业的朋友——胡茬。 接下来我们一起了解下他,这是胡茬在松松云2021创业者线下沙龙打卡留念合照。 访谈嘉宾介绍: 姓名:胡茬 籍贯:福建龙岩,目前已经买房定居上海 创业经历:程序员出身,草根创业者,15年开始通过互联网创业,主...  | | xxl-job 登入功能集成 OIDC 统一认证 Posted: 23 Jun 2021 10:46 PM PDT 前言 xxl-job 是一款 java 开发的、开源的分布式任务调度系统,自带了登录认证功能,不支持对接、扩展 LDAP 、OIDC 等标准认证系统,考虑到单独维护 xxl-job 自有的用户系统不方便,以及存在人员离职、调岗、权限变动等需要及时调整用户权限的情况,需要接入公司统一的 OIDC 认证系统 相关链接 xxl-job : https://github...  | | Linux基金会开源软件学园公开课第8期即将开始:CKA考前重点实战讲解 Posted: 23 Jun 2021 08:45 PM PDT 好消息! 现在报考所有Kubernetes认证考试--包括CKA、CKAD和CKS将获得价值人民币400元的两次模拟考试机会!模拟考试包括20-25个类似于考生在真实考试中可能遇到的问题,这意味着你可以在尝试实际考试之前熟悉考试环境,大大增加成功机会! 随着云开发向容器方面转移,Kubernetes 等与容器相关的技术已成为当下技术人员的必...  | | 1.3 Go语言从入门到精通:编写第一个Go程序 Posted: 23 Jun 2021 08:30 AM PDT 在开始Go语言的基本语法、函数和高级特性等之前,让我们先编写第一个Go程序"Hello World!"开始,来了解Go语言最简单程序的结构吧,看看Go程序应该包括哪些部分,每部分都位于什么位置,Go语言究竟是如何执行的。 我们依然从永恒的"hello,world"程序开始,`hello.go`源代码如下: ```go package main import "fmt" ...  | | 带你掌握4种Python 排序算法 Posted: 23 Jun 2021 06:47 PM PDT 摘要:在编程里,排序是一个重要算法,它可以帮助我们更快、更容易地定位数据。在这篇文章中,我们将使用排序算法分类器对我们的数组进行排序,了解它们是如何工作的。 本文分享自华为云社区《Python 排序算法指南》,原文作者:唐里 。 在编程里,排序是一个重要算法,它可以帮助我们更快、更容易地定位数据。在这篇文章...  | | 前端百题——通俗易懂的防抖与节流 Posted: 23 Jun 2021 06:14 PM PDT 性能一直是前端老生常谈的一个话题,其中有一个性能问题就是我们会频繁的触发一些事件,例如mousemove、scroll、resize等,虽然浏览器已经对这些事件的触发做了一些优化,但是如果在很短的时间内频繁的触发仍然会影响性能,这个时候就需要今天的主角:防抖和节流,利用它们来进行优化,提高性能。 21.1 防抖 21.1.1 定义...  | | JVM技术专题-线上解决方案(2) 网络问题分析和故障排查规划指南 Posted: 22 Jun 2021 11:14 PM PDT # 系列目录 - [🏆JVM技术专题-线上解决方案(1) GC问题分析和故障排查规划指南](https://my.oschina.net/liboware/blog/5086778 "🏆JVM技术专题-线上解决方案(1) GC问题分析和故障排查规划指南") - **[🏆JVM技术专题-线上解决方案(2) 网络问题分析和故障排查规划指南](https://my.oschina.net/liboware/blog/...  | | WordPress 5.8 Beta 3 发布 Posted: 23 Jun 2021 04:01 PM PDT WordPress 5.8 Beta 3 现已发布。该版本件仍在开发中,因此官方不建议在生产站点上运行此版本。相反,其建议用户在测试站点上运行新版本。 主要更新内容 Block Editor:将缓存移动到端点以获得独特的响应 Bundled Themes:改进小部件区域中块的显示 Coding Standards:为 wp-admin/comment.php 中的 HTML 格式提供一致性...  | | KDE Plasma 5.22.2 发布 Posted: 23 Jun 2021 03:53 PM PDT KDE Plasma 5.22.2 现已发布,该版本是 KDE Plasma 5.22 的 6 月 bug 修复版本。 主要更新内容 Flatpak:正确通知更新 Wayland:实施活动窗口规则 Scenes/opengl: 仅在渲染时更新未定型的 EffectFrame 纹理 Platforms/drm:日志记录的一些改进 XdgSurfaceClient:在构造函数中设置为当前活动和桌面 Platforms/drm:修复 ...  |  |
| OSCHINA 社区最新专区文章 Posted: 24 Jun 2021 05:16 AM PDT | APP登录账号需要重新激活,请问怎么激活 Posted: 23 Jun 2021 10:48 PM PDT 我使用APP登录,一直说要激活账号,但是没有找到激活的入口。APP上只有登录和注册,登录提示需要重新激活,注册提示账号已存在,但是找不到激活的入口。在PC端使用免密登录(手机验证码登录)成功了,但是APP死活登录不了,我该怎么操作?  | | WeitShop 是一款强大的全域集电商系统,为赋能多元化电商服务的解决方案。【支持免费试用】 Posted: 23 Jun 2021 06:53 PM PDT 官方网址:www.weitshop.com ☞了解更多资讯详情 WEITSHOP商城 论坛交流 地址:https://comment.weitshop.cn 体验后台 只需3秒钟扫描它然后带走我吧~ 运行环境 Linux+Nginx+PHP7.3+MySQL(5.6|5.7) 项目介绍 WEITSHOP 是一款强大的全域集电商系统,组合各行业应用赋能多元化电商服务解决方案,满足各种不同市场需求。 WEIT...  | | WeitShop 是一款强大的全域集电商系统,为赋能多元化电商服务的解决方案。【支持免费试用】 Posted: 23 Jun 2021 08:52 PM PDT 官方网址:www.weitshop.com ☞了解更多资讯详情 WEITSHOP商城 论坛交流 地址:https://comment.weitshop.cn 体验后台 只需3秒钟扫描它然后带走我吧~ 运行环境 Linux+Nginx+PHP7.3+MySQL(5.6|5.7) 项目介绍 WEITSHOP 是一款强大的全域集电商系统,组合各行业应用赋能多元化电商服务解决方案,满足各种不同市场需求。 WEIT...  | | python数据结构:多线程数据处理,优先级队列--Queue Posted: 23 Jun 2021 07:40 AM PDT 前言 最新内容首发在公众号【Python 集中营】。【粉丝福利】关注公众号,获取全套视频资料! 与其他的编程语言数据结构相似,python同样提供了关于队列的支持,提供了'先进先出'的数据处理方式这样的设计可以支持更多的算法业务的实现。在处理数据对象时可以被调用方进行锁定,因此更好的支撑多线程业务的实现。 Queu...  |  |
| OSCHINA 社区最新专区文章 Posted: 24 Jun 2021 04:29 AM PDT | 办公利器!用Python批量识别发票并录入到Excel表格 Posted: 24 Jun 2021 01:34 AM PDT 辰哥今天来分享一篇办公干货文章:**用Python批量识别发票并录入到Excel表格**。对于**财务专业**等学生或者**公司财务**人员来说,将报账发票等汇总到excel简直就是一个**折磨**。 尤其是到**年底**的时候,公司的财务人员面对一大堆的发票简直就是**苦不堪言**。正好我们学会了Python,我们应该将Python的优势发挥起来...  | | wpf 的webclient下载图片的问题 Posted: 23 Jun 2021 11:28 PM PDT 使用wpf的webclient下载图片,出来的图片打开没有显示图片,显示如下 图片地址:http://imgs.yunbiao.tv/imgserver/resource/common/img/yq0KXFZz8JiAWMjeAAEUJev_Rvo318.jpg  | | 该评论暂时无法显示,详情咨询 QQ 群:912889742????? Posted: 23 Jun 2021 07:51 PM PDT 这是啥特么玩意?? 该评论暂时无法显示,详情咨询 QQ 群:912889742 该评论暂时无法显示,详情咨询 QQ 群:912889742 该评论暂时无法显示,详情咨询 QQ 群:912889742 该评论暂时无法显示,详情咨询 QQ 群:912889742 该评论暂时无法显示,详情咨询 QQ 群:912889742 该评论暂时无法显示,详情咨询 QQ 群:912889742 该...  | | 程序员如何摆脱内卷 Posted: 23 Jun 2021 06:35 PM PDT  # 前言 你知道到目前为止国内程序员有多少吗? 对于这个问题,似乎没有一个准确的答案,不过据IDC保守估计500w作用。据网站创始人蒋涛透露,CSDN注册会员超过2500万,其中活跃用户...  | | dubbogo 社区负责人于雨说 Posted: 23 Jun 2021 03:18 AM PDT **1. 请简单介绍自己** 好多人以为我名字是于雨,其实是 2012 年使用微信时用的微信名字,后来入职阿里时也用作花名,现在已经成了我的常用名了。 从业十一年来一直在服务端基础架构研发一线,工作内容广泛,涵盖 RPC、NoSQL 存储、实时监控告警、即时通信、消息推送等方面。研究内容也挺广泛,2018年到2019年在 Google...  | | 三十的程序员怎么走? Posted: 22 Jun 2021 11:31 PM PDT 广州,30,java开发,目前税后19K,感觉力不从心了,如果是你,有什么好的选择  |  |
| V2EX - 技术 Posted: 24 Jun 2021 04:09 AM PDT | 不让用自己电脑开发,公司电脑不能带回去 Posted: 24 Jun 2021 03:56 AM PDT 这样的公司还可以去吗,有 V 友遇到过吗  | | 迫于远程施法,寻求一款手机 Posted: 24 Jun 2021 03:51 AM PDT 迫于雷总远程施法,手上的小米 6 承受不住,经常卡顿死机,想着也用了 4 年多,打算换台手机,预算 3500 内,轻微游戏控(第五人格,王者这些),拍照扬声这些能希望好一些,V 友们有没有推荐的  | | GET 方法有没办法传递 token Posted: 24 Jun 2021 03:50 AM PDT 有个网站,需要校验是否有权限,判断头部的 token 参数。 但是,直接在浏览器上输入网址后,能否自动头部添加 token 呢? 是不是只有 session+cookie 的方式了。  | | 内卷时代的筛选手段:面试考算法,你怎么看? Posted: 24 Jun 2021 03:48 AM PDT 现在面试太注重算法了,搞得大家都去疯狂地刷题、背题,以求通过面试的初筛。 这显然是内卷时代的一种筛选手段:行业涌入的人才越来越多,所以门槛就会不断提高。 但这会导致一个不好的现象:很多人以为刷够了题,背会了面经,就能搞好软件开发,实际上还差得远。 你怎么看这种风气?  | | 大家对开源怎么看,很多开源作者被抄袭,所以开源的意义何在? Posted: 24 Jun 2021 03:38 AM PDT | | 装个桌面版 Linux 能不能实现 IDEA 进行语言开发以及基于 docker 环境配置 Posted: 24 Jun 2021 03:36 AM PDT 找了好多资料,也没能实现我的这个想法。 1 、首先安装桌面版 Linux ( Centos/Debian/ubuntu/统信)求推荐一个系统+版本号; 2 、安装 idea 难度较低 3 、如何整合 docker 内的 mysql/maven/JDK 等给 linux 中的 idea 用。这个我不会配置,请大佬发个教程链接。 谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢 纯属个人摸鱼胡思乱想的需求,搞不定这个想法睡不好。 还有还有,我天天摸鱼没事儿干,求推荐摸鱼思路?比如说看看 Java 架构师或者什么的。  | | 服务器系统选择,都在说 Debian 好,到底好在哪? Posted: 24 Jun 2021 03:29 AM PDT 服务器选 Debian 还是 Ubuntu,无论是知乎还是 V2EX 之前的调查,大部分都在说 Debian 好,什么稳定,占用内存小之类的,这个"稳定"到底是什么稳定,我用 Ubuntu,centos 服务器跑了多年也没啥问题,感觉"稳定"是个玄学&主观的问题,Debian 我从没用过,那么 Debian 到底好在哪?和 Ubuntu 比,Debian 是优点多还是缺点多?真的是网上吹嘘的那么神乎?  | | 程序员都有哪些可实操的副业 Posted: 24 Jun 2021 03:29 AM PDT 迫于年龄(30)和房贷压力, 一直在想办法拓展一下自己的副业, 无奈由于自己的认知和人脉资源有限, 没有可交流的朋友一起探讨 希望有过实践经验的大佬能分享一些切实可行的副业案例(不与您构成竞争关系, 不暴漏您隐私, 不影响您收益的案例) 以示真诚, 我把自己实践过的案例分享一下, 为了避免广告嫌疑, 我已抹掉个人信息 1.闲鱼接单 一般每年 4-6 月份, 毕业季需求旺盛, 可接一些毕业设计、项目讲解的活 其他月份, 可接一些实习生或新手小白的 bug 修复、调试或业务逻辑梳理的活 目前这个我已实践 1 年 3 个月, 收益还可以, 只是比较累, 算是一种比较苦力的搬砖工 基本除了本职工作外, 大部分时间都在写代码或讲课 再加上最近闲鱼针对代写查的比较严, 已经判了 2 次违规, 第 1 次 7 天, 第 2 次 15 天, 目前我还处于禁言和下架所有商品的状态中 2.考拉代下单 由于网易考拉 APP 上很多商品的普通会员价格和黑卡价格差别很大, 黑卡的售价常年在 279 元, 对一些偶尔买东西的用户来说, 单独购买黑卡很不划算, 于是他们就会找各种平台寻求代下单, 恰好考拉的商品返佣比较高, 平均在 6%以上, 再加上有很多活动价格波动大, 可退差价 我从 2019 年便开始了代下单, 人多的时候一个月能赚到 3000(佣金+价保差价)左右, 后来由于考拉卖给了阿里,闲鱼上开始了大量封杀代下单, 无奈下只能改关键字, 流量也下降了很多,现在基本只剩以前沉淀的老客户还在下单 3.个人网站挂 adsense 刚开始的时候很有激情, 写了一些技术分享的文章, 搜索和实践了很多 SEO 优化的文章, 后来看到流量太小便失去了耐心, 现在基本处于放养状态, 从运营到现在, 已经满 2 年了, 前两天才提现 100 美元, 现在基本每天 0.3 美元, 勉强抵消服务器开支   | | 关于程序员如何精进细节的三个问题。 Posted: 24 Jun 2021 02:50 AM PDT 诚心请教各位三个问题 -
在学一门语言或者技术的时,候学到深入了,是否就没有视频资源了,只有看书了或者查官方文档了? -
关于技术精进这一块,难道只有看开源项目了?但是常常看不懂…比如说 powertoys 的开源项目,我觉得主要的问题是它们用的平台 api 太多了,隔个几行就得查一查…另外构建工具也是个门槛,不同的开源项目往往根目录下面各种.config,人都要麻了。所以所谓技术大牛,其实就是比谁的平台 api 记得多、数据结构用的好以及工具用得熟咯? 233 -
最后是问一下关于后续如何发展…其实我不准备以码代码为生啦,就是一个兴趣爱好,但是现在的状态是感觉自己进步很慢。想独立开发一个软件吧,磕磕绊绊几天也能做出来,用到各种功能的时候就去 stack overflow 查怎么办,最后代码就写了几千行吧,查文档查得手疼。各种性能优化也挺想学的,但是不知道切入点在哪,比如.Net 的性能优化怎么学呀?…像《 C#8.0 和.NET 3.0 高级编程》这一类的书我也看了,覆盖范围很广,但是细节不足…!!!真的很希望能看那种做大型实际项目的的教学视频(最后能偏底层)!!!能给我跟着学一学…就是有关于 cmake 怎么配置,几种构建工具怎么混合使用的,项目怎么起来的,顺便还能学一学数据结构、设计模式是怎么运用在实际项目的那种(我觉得这种教程应该是没有),因为我真的很想成为一个能独立构建类似 chrome 这种大型软件(我知道 chrome 里貌似有很多奇巧淫技)能力的人哈哈,所以最后的问题是,现在我已经到了可以磕磕碰碰写项目的阶段了,后续如何成为一个能独立构建 chrome 能力的人呢? PS:我知道 JAVA 的教学资源貌似还挺多的…但是吧,出于对安卓卡顿的愤恨,我一直觉得 Java 就是垃圾,所以不想学…如果你不同意请尽管骂我。 另外奉劝跟我一样的小白,做稍微偏底层一点的东西,C 和 C++是逃不掉的,学得越熟练越好。  | | 你们有遇到不准用自己电脑开发项目的公司? Posted: 24 Jun 2021 02:39 AM PDT 上家项目黄了,最近跳到上海某家做社交 App 的公司。原来开发都是用自己电脑的,昨天刚入职,领导看到我用自己电脑,直接跟我说不要用自己电脑,用公司的(公司电脑配置渣渣)。听出来意思是怕我偷他们项目。听到这话心里五味杂粮的吧!不明白为什么不是内网开发,有必要要求员工用公司电脑?  | | 请教一下,怎么样才能让 pdf, epub, mobi 这种可以在线阅读? Posted: 24 Jun 2021 02:30 AM PDT 想着做一个内部的电子书服务器,可以让 pdf,epub,mobi 这种格式的电子书能够通过网页阅读,最好是服务器版本的,calibr 好像要客户端来看。  | | github actions 突破 6 小时限制编译超大项目 Posted: 24 Jun 2021 02:24 AM PDT | | 关于 mysql 联表执行顺序问题 Posted: 24 Jun 2021 02:24 AM PDT user 表的记录有几百万,update_time 有索引,limit 0,20 和 limit 19999,20 的效果也是一样 SELECT * FROM USER user0_ LEFT JOIN user_statistic userstatis1_ ON user0_.user_statistic_id = userstatis1_.id LEFT JOIN language_level languagele2_ ON user0_.language_level_id = languagele2_.id LEFT JOIN user_contact usercontac3_ ON user0_.user_contact_id = usercontac3_.id LEFT JOIN user_social_info usersocial4_ ON user0_.user_social_info_id = usersocial4_.id LEFT JOIN user_detail userdetail5_ ON user0_.user_detail_id = userdetail5_.id WHERE user0_.update_time > '2021-06-23 09:40:00.019' ORDER BY user0_.update_time ASC LIMIT 0, 20 执行计划 1 SIMPLE user0_ range idx_update_time idx_update_time 6 1143267 100 Using index condition; Using temporary; Using filesort 1 SIMPLE userstatis1_ eq_ref PRIMARY PRIMARY 150 flo.user0_.user_statistic_id 1 100 1 SIMPLE languagele2_ ALL 7 100 Using where; Using join buffer (Block Nested Loop) 1 SIMPLE usercontac3_ eq_ref PRIMARY PRIMARY 150 flo.user0_.user_contact_id 1 100 1 SIMPLE usersocial4_ eq_ref PRIMARY PRIMARY 150 flo.user0_.user_social_info_id 1 100 1 SIMPLE userdetail5_ eq_ref PRIMARY PRIMARY 150 flo.user0_.user_detail_id 1 100 上面的语句很明显从索引找出符合的条件然后回表在临时表排序 不太明白 mysql 为什么不根据索引排序后的 row_id 回表进行查询,本身索引也是有序的,过滤 20 行回表不就可以了吗 难道回表的随机查询导致分析成本过高, 改写后 SELECT * FROM ( SELECT * FROM USER WHERE USER .update_time > '2021-06-23 09:40:00.019' ORDER BY USER .update_time ASC LIMIT 0, 20 ) user0_ LEFT OUTER JOIN user_statistic userstatis1_ ON user0_.user_statistic_id = userstatis1_.id LEFT OUTER JOIN language_level languagele2_ ON user0_.language_level_id = languagele2_.id LEFT OUTER JOIN user_contact usercontac3_ ON user0_.user_contact_id = usercontac3_.id LEFT OUTER JOIN user_social_info usersocial4_ ON user0_.user_social_info_id = usersocial4_.id LEFT OUTER JOIN user_detail userdetail5_ ON user0_.user_detail_id = userdetail5_.id; 执行计划 1 PRIMARY <derived2> ALL 20 100 1 PRIMARY userstatis1_ eq_ref PRIMARY PRIMARY 150 user0_.user_statistic_id 1 100 1 PRIMARY languagele2_ ALL 7 100 Using where; Using join buffer (Block Nested Loop) 1 PRIMARY usercontac3_ eq_ref PRIMARY PRIMARY 150 user0_.user_contact_id 1 100 1 PRIMARY usersocial4_ eq_ref PRIMARY PRIMARY 150 user0_.user_social_info_id 1 100 1 PRIMARY userdetail5_ eq_ref PRIMARY PRIMARY 150 user0_.user_detail_id 1 100 2 DERIVED user range idx_update_time idx_update_time 6 1143267 100 Using index condition 执行时间大大缩减了,没有临时表和文件排序。  | | 请教一个,有关 react 的 re-render 的性能小问题 Posted: 24 Jun 2021 01:22 AM PDT 有关 react 的两个小问题。 import "./styles.css"; import React, { useState } from "react"; export default function App() { const [num, setNum] = useState(0); const handleClick = () => { setNum(num + 1); }; return ( <React.Fragment> <span>{num}</span> <button className="button1" onClick={handleClick}> Click Me </button> <button className="button2" onClick={() => setNum(num + 1)}> Click Me Again </button> <div className="App"> <h1>Hello CodeSandbox</h1> <h2>Start editing to see some magic happen!</h2> </div> </React.Fragment> ); } 我忘记在哪里看到的(年纪大了,记性不太好),在以前 class component 的时代,不推荐 button2 的写法,就是把函数体直接赋值给 button's onClick 。因为这样会使得每次 button2 都有变化,会 re-render 。在大的项目 /组件多的情况下,会有性能问题。一般是建议在 class 里面定义一个函数,然后赋值给 button's click. 现在来到 function component 时代,当 button 被点击的时候,会触发 function app 被重新调用,handleClick 也会被重新生成,这个时候,button1 和 button2 的用法,还有区别么?不过,当 handleClick 比较复杂时,应该可以通过 useCallback 提高性能。虽然 const handleClick 是一个新的变量,但函数体被记忆 /缓存了。 const handleClick = useCallback(() => { ... }); 另,我还"隐约"记得,button1 的写法,当用户点击 button 时,会触发"两"次 render,我不记得为什么了?是我记错了么? 最后,有没有什么 debug 方法,能够知道,比如,我点击 button1 后,跟踪一下,触发了多少次 render ? 谢谢!  | | 生成器模式-代码的艺术系列(一) Posted: 24 Jun 2021 01:01 AM PDT 前言 看代码"文档",学设计模式 网上讲解设计模式都是基于现实生活场景举例,但作为 coder,还需要有将现实生活场景到代码实现场景的转化思维,所以我认为,了解设计模式简单,实践到对应代码场景中有难度。 so 我们的代码的艺术系列会以还原 coding 现场的方式,讲诉设计模式! 生成器模式  来看概念: 生成器模式是一种创建型设计模式,也叫建造者模式。它把对象的创建步骤抽象成生成器,并且可以通过指导类(director)对所有生成步骤的先后顺序进行控制。客户端使用指导类并传入相应的生成器,通过指导类的接口便可以得到相应的对象。 The intent of the Builder design pattern is to separate the construction of a complex object from its representation. By doing so the same construction process can create different representations. 将一个复杂对象的构建与其表示分离,使得同样的构建过程可以创建不同的表示 概括的说:有些对象的创建流程是一样的,但是因为自身特性的不同,所以在创建他们的时候需要将创建过程和个性化的属性分离出来。 基本看不懂啥意思,赞! 继续看结构~ 来看结构: - 生成器 ( Builder ) 接口声明在所有类型生成器中通用的产品构造步骤。
- 具体生成器 ( Concrete Builders ) 提供构造过程的不同实现。 具体生成器也可以构造不遵循通用接口的产品。
- 产品 ( Products ) 是最终生成的对象。 由不同生成器构造的产品无需属于同一类层次结构或接口。
- 主管 ( Director ) 类定义调用构造步骤的顺序, 这样你就可以创建和复用特定的产品配置。
- 客户端 ( Client ) 必须将某个生成器对象与主管类关联。 一般情况下, 你只需通过主管类构造函数的参数进行一次性关联即可。 此后主管类就能使用生成器对象完成后续所有的构造任务。
 实战学习 概念性描述你懂了么?不懂就对了,程序员先理解概念不如直接上代码来的刺激。 这里贯彻下我们前言中的宗旨: - 不要生活场景的举例,要产品需求的案例。
- 不要纯图文的描述,要可阅读的代码。
上实战~ 产品需求 没有产品思维的程序员不是好销售,此需求纯属虚构 pm 要在自家的电商网站电脑产品垂类下增加报价功能。 PRD 描述当用户进入 mac 品牌的详情页,他可以选择 I7 CPU,500G 内存,1T 磁盘的配置,查看报价。 不同品牌的部件价格不相同,并且不同品牌在同一时刻有不同的优惠折扣。 需求目标: 实时计算出用户选择的电脑配置折后价钱。 需求收益: 提高下单率 50% 技术文档 技术脑爆时刻到了! 乍一听感觉很简单,没什么复杂逻辑。 其实真的很简单。但是问题是不同品牌的部件配置价格不同,而且不同品牌的折扣也是不同的。用户选择了 A,B,C-Z 一坨配置,我的代码要这么写么? var cpuPrice map[string]float { xxx : 100, xxxx : 200 } // 电脑有 N 个部件,我的函数入参就要有 N 个么? // 这个函数谁敢用? getMaxPrice(type= '', cpu='',mem='',ram='',disk=''...一堆配置){ if type == 'mac' { price := 0 if(cpu == '') { cpu="默认配置" } price += cpuPrice[cpu] if(mem == '') { mem="默认配置" } price += memPrice[mem] ... } elseif (type == 'huawei') { ... } } 这样看这坨代码的代码量绝对高,并且大部分是重复代码,而且当电脑配置越来越多,getMaxPrice 函数入参也跟着变多,参数顺序谁能保证?有的产生是必填有的是非必填,怎么帮助必填的没有被漏掉? 这样的代码时间久了,逻辑看着很简单,但是没人敢用吧。 怎么办呢? 使用生成器模式来解决是不是好一点,每个部件作为一个生成步骤,每次执行一个步骤即添加一个部件配置,最终生成一个完整的电脑报价,并且设置部件、获取折扣、计数报价这些步骤本身是有序的,是可以通过生成器模式中的 Director 小干部来统一操作的。 好,来看代码吧! 代码"文档" Tips: 代码 + 注释。 自我要求:注释覆盖率 > 60% 1.先定义一个电脑报价的配置总类,即我们要生成的产品:Computer package builder // 产品: 这个是我们的目标,computer 要有这些配置 // computer 可以理解成我们要制作一个什么产品 // 结构体字段 可以理解为我们要做的产品都要哪些配置,对应上文 生成函数的 N 多个入参 type Computer struct { name string // 电脑类型 比如 mac/华为 cpuModel CPU_MODEL // cpu 型号 gpuModel GPU_MODEL // gpu 型号 memorySize MEM_SIZE // 内存大小 diskSize DISK_SIZE // 磁盘大小 discount float64 // 折扣 price float64 // 整体报价 } 2.再定义一个电脑生成的步骤规范接口 package builder // 生成器接口: 产品的生成器接口 // 可以理解为这个产品生成 必须要有哪些具体的步骤和行为, 后面每一个抽象的产品生成对象都要继承这个生成器接口 type builder interface { setCpuModel(CPU_MODEL) // 设置 cpu 型号 setGpuModel(GPU_MODEL) // 设置 gpu 型号 setMemorySize(MEM_SIZE) // 设置 内存型号 setDiskSize(DISK_SIZE) // 设置磁盘型号 setDiscount() // 设置折扣粒度, 这个折扣粒度是系统内置的,不需要客户端设置也就是说此功能不是给前台用户询价时自定义的。 calculatePrice() // 计算报价 getComputer() *Computer // 给主管(director)使用 } 3.开始定义各个电脑品牌抽象生成器 先看 Mac 的 package builder import ( "time" ) // 抽象的产品生成器 // 可以理解为 computer 这个产品中某一类型产品的生成器 // 抽象生成器即包含了产品(computer)的所有配置,也继承了 builder 公共生成器的所有生成步骤 type MacComputerBuilder struct { c *Computer } // 实力化一个 Mac 电脑报价 func NewMacComputerBuilder() builder { return &MacComputerBuilder{ c: &Computer{name: "mac"}, } } // 返回*Computer func (mc *MacComputerBuilder) getComputer() *Computer { return mc.c } // 设置 CPU 型号 // 设置配置的时候要判断,如果客户端已经配置了,那么跳过 // 这块是因为 director 会在最后编译的时候统一整体执行一遍,防止客户端漏掉配置,走默认配置 func (mc *MacComputerBuilder) setCpuModel(m CPU_MODEL) { // demo if mc.c.cpuModel != "" { return } if price, ok := partsCpuPriceMap[m]; ok { mc.c.cpuModel = m mc.c.price += price } else { mc.c.cpuModel = MAC_CPU_I5 // 此为 mac 电脑默认 cpu 配置 mc.c.price += partsCpuPriceMap[MAC_CPU_I5] } } // 设置 GPU 型号 // 设置配置的时候要判断,如果客户端已经配置了,那么跳过 // 这块是因为 director 会在最后编译的时候统一整体执行一遍,防止客户端漏掉配置,走默认配置 func (mc *MacComputerBuilder) setGpuModel(m GPU_MODEL) { // demo if mc.c.gpuModel != "" { return } if price, ok := partsGpuPriceMap[m]; ok { mc.c.gpuModel = m mc.c.price += price } else { mc.c.gpuModel = MAC_GPU_NVIDIA // 此为 mac 电脑默认 gpu 配置 mc.c.price += partsGpuPriceMap[MAC_GPU_NVIDIA] } } // 设置内存大小 // 设置配置的时候要判断,如果客户端已经配置了,那么跳过 // 这块是因为 director 会在最后编译的时候统一整体执行一遍,防止客户端漏掉配置,走默认配置 func (mc *MacComputerBuilder) setMemorySize(s MEM_SIZE) { // demo if mc.c.memorySize != "" { return } if price, ok := partsMemPriceMap[s]; ok { mc.c.memorySize = s mc.c.price += price } else { mc.c.memorySize = MAC_MEM_8G // 此为 mac 电脑默认 内存 配置 mc.c.price += partsMemPriceMap[MAC_MEM_8G] } } // 设置 磁盘大小 // 设置配置的时候要判断,如果客户端已经配置了,那么跳过 // 这块是因为 director 会在最后编译的时候统一整体执行一遍,防止客户端漏掉配置,走默认配置 func (mc *MacComputerBuilder) setDiskSize(s DISK_SIZE) { // demo if mc.c.diskSize != "" { return } if price, ok := partsDiskPriceMap[s]; ok { mc.c.diskSize = s mc.c.price += price } else { mc.c.diskSize = MAC_DISK_500G // 此为 mac 电脑默认 磁盘 配置 mc.c.price += partsDiskPriceMap[MAC_DISK_500G] } } // 设置折扣 // 不同产品策略不一样 // 此操作为内置操作,不需要外部设置 func (mc *MacComputerBuilder) setDiscount() { // 2021-06-24 00:17:33 // 如果大于这个时间,那么 mac 电脑整体打 5 折 // 否则 整体打 8 折 if time.Now().Unix() > 1624465043 { mc.c.discount = 0.5 } else { mc.c.discount = 0.8 } } // 计数价格 // 注意看,这块就是需要时序的地方,需要先 setDiscount 才能进行报价 // 所以 需要通过 指挥者来统一进行构建,保证各个行为执行顺序 func (mc *MacComputerBuilder) calculatePrice() { mc.c.price = (mc.c.price * mc.c.discount) } 在看一个 huawei 的。 package builder import "C" // 抽象的产品生成器 // 可以理解为 computer 这个产品中某一类型产品的生成器 // 抽象生成器即包含了产品(computer)的所有配置,也继承了 builder 公共生成器的所有生成步骤 type HuaweiComputerBuilder struct { c *Computer } func NewHuaweiComputerBuilder() builder { return &HuaweiComputerBuilder{ c: &Computer{name: "huawei"}, } } func (hc *HuaweiComputerBuilder) getComputer() *Computer { return hc.c } /** * 以下设置各个配置方法和 Mac 逻辑一样,当然也可以自定义策略,不过 demo 就这样了,保证篇幅,所以就不写了 */ // 设置 CPU 型号 func (hc *HuaweiComputerBuilder) setCpuModel(m CPU_MODEL) {} // 设置 GPU 型号 func (hc *HuaweiComputerBuilder) setGpuModel(m GPU_MODEL) {} // 设置内存大小 func (hc *HuaweiComputerBuilder) setMemorySize(s MEM_SIZE) {} // 设置 磁盘大小 func (hc *HuaweiComputerBuilder) setDiskSize(s DISK_SIZE) {} // 设置优惠折扣,这块是内部逻辑,不需要外部调用方定义,而且不同产品策略不一样 func (hc *HuaweiComputerBuilder) setDiscount() { // 华为机器不打折,国产赞。 这块就是和 mac 差异化的地方 hc.c.discount = 1 } // 既然华为不打折,那么直接输出就好了 func (hc *HuaweiComputerBuilder) calculatePrice() { } 看到区别了吧,两个品牌生成器的优惠策略不同,计数价格方法不同,但是统一生成步骤一样,所以需要主管来统一调度执行 来看主管director package builder // director 主管,负责整体 build 执行 // 可以理解为总指挥,他来负责计算报价 type director struct { builder builder } // 实例化一个主管 func NewDirector(b builder) *director { return &director{ builder: b, } } // 手动重置主管,方便进行多次不同产品生成构建 func (d *director) resetBuilder(b builder) { d.builder = b } // 执行编译生成,这块就是要严格统一管理编译的步骤和顺序 // 当前这个 demo , 因为时计算报价的例子而不是生成电脑配置的例子,所以前置的那些 setXXX 都在客户端自定义执行了 // 但是有可能前台用户没有选择某些配置,所以需要主管统一兜底 // 1. 兜底每个电脑配置 // 2. 根据当前时间选择折扣粒度 // 3. 计算报价 func (d *director) buildComputer() *Computer { // 第一步,兜底每一个电脑配置 d.builder.setCpuModel(DIRECTOR_CHECK_PARAMS) d.builder.setGpuModel(DIRECTOR_CHECK_PARAMS) d.builder.setMemorySize(DIRECTOR_CHECK_PARAMS) d.builder.setDiskSize(DIRECTOR_CHECK_PARAMS) // 第二步设置折扣 d.builder.setDiscount() // 第三步 计算报价 d.builder.calculatePrice() // 返回产品对象 return d.builder.getComputer() } 到这块是不是差不多看懂了?最后我们看下客户端是如何调用实现的: package builder import "fmt" // 客户端询问报价 // 即用户在前台页面选择了 mac 电脑 // CPU i7 // GPU xxx func getPrice() { // 先实例化抽象生成器对象,即 mac 电脑 mcb := NewMacComputerBuilder() // 设置我想询问的配置 mcb.setCpuModel(MAC_CPU_I7) mcb.setGpuModel(MAC_GPU_NVIDIA) mcb.setMemorySize(MAC_MEM_16G) // 磁盘我不选了,用默认的 //mcb.setDiskSize() // 然后实例化一个主管,来准备生成报价 d := NewDirector(mcb) // 执行编译,生成最终产品 product := d.buildComputer() // ok 搞定了,我们可以看看最终这个产品的配置和报价 fmt.Printf("current computer name: %s\n", product.name) fmt.Printf("choose config cpuModel: %s\n", product.cpuModel) fmt.Printf("choose config gpuModel: %s\n", product.gpuModel) fmt.Printf("choose config memorySize: %s\n", product.memorySize) fmt.Printf("choose config diskSize: %s\n", product.diskSize) fmt.Printf("give you discount: %f\n", product.discount) fmt.Printf("final offer: %f\n", product.price) fmt.Printf("---------------询问下一个电脑---------------\n") // 下面 我们再生成一个华为的电脑报价 hwcb := NewHuaweiComputerBuilder() hwcb.setCpuModel(HW_CPU_I7) hwcb.setGpuModel(HW_GPU_ATI) hwcb.setMemorySize(HW_MEM_16G) hwcb.setDiskSize(HW_DISK_1T) d.resetBuilder(hwcb) // 执行编译,生成最终产品 product2 := d.buildComputer() // ok 搞定了,我们可以看看最终这个产品的配置和报价 fmt.Printf("current computer name: %s\n", product2.name) fmt.Printf("choose config cpuModel: %s\n", product2.cpuModel) fmt.Printf("choose config gpuModel: %s\n", product2.gpuModel) fmt.Printf("choose config memorySize: %s\n", product2.memorySize) fmt.Printf("choose config diskSize: %s\n", product2.diskSize) fmt.Printf("give you discount: %f\n", product2.discount) fmt.Printf("final offer: %f\n", product2.price) } 上线效果 === RUN TestGetPrice current computer name: mac choose config cpuModel: maci7 choose config gpuModel: mac-NVIDIA choose config memorySize: mac-16g choose config diskSize: mac-500g give you discount: 0.500000 final offer: 600.000000 ---------------询问下一个电脑--------------- current computer name: huawei choose config cpuModel: hwi7 choose config gpuModel: hw-ATI choose config memorySize: hw-16g choose config diskSize: hw-1t give you discount: 1.000000 final offer: 2800.000000 --- PASS: TestGetPrice (0.00s) PASS 还是符合预期的! Demo 源码:https://github.com/xiaoxuz/design-pattern/tree/main/create/builder 生成器优缺点 - 优点
- 你可以分步创建对象,
暂缓创建步骤或递归运行创建步骤。 - 生成不同形式的产品时, 你可以
复用相同的制造代码。 *单一职责原则*。 你可以将复杂构造代码从产品的业务逻辑中分离出来。 - 缺点
- 由于该模式需要新增多个类, 因此代码整体
复杂程度会有所增加。 思考 认识我们的职业,不是码农,是软件工程师!  收工 打完收工,感谢阅读! ** [点击] 关注再看,您的关注是我前进的动力~!**   | | Windows-server2008 设 DNS 解析, active directory 勾选是灰色的,怎么办? Posted: 24 Jun 2021 12:56 AM PDT 设正向解析以及反向解析 发现不管正向还是反向建立区域向导,正向搜索区域 /右键 /新建区域,"主要区域"并选中"在 Active Directory 中存储区域(只有 DNS 服务器是可写域控制器时才可用)"复选框是灰色的。。。无法和 Active Directory 活动目录集成 它要求 DNS 是域控制器,要怎么具体配置的?网上没搜到相关内容 T_T  | | 求助: apache 的所有网站上不去 Posted: 24 Jun 2021 12:22 AM PDT 最近要用到 echarts 和 xerces,现在才发现 apache 域名的所有网站都上不去。。。 挂梯子也上不去,但是群里面北京那边的就可以上,我这里是湖北的。 求支招。  | | 有关 Python 的一个问题。 Posted: 23 Jun 2021 11:39 PM PDT 为什么 try 放在 function 里面就没有作用了,可以拿什么代替? def theUpdate(bookName, addQuantity): | try: | | str(bookName) | | int(addQuantity) | Except........(省略) 这里的 try 并不能起到把 bookName 改成字符串, 也不能把 addQuantity 改成一个数字。不知道有没有更好的方法。  | | UWP App 在外置显示器上显示异常 Posted: 23 Jun 2021 11:13 PM PDT 不知道为何,我的 Windows 上面所有的 UWP 应用都出现了或多或少的渲染问题,很多区块没有办法正常显示。譬如 OneNote for Windows 10 变成了下边这样⬇️️  如果我将鼠标移动到这些渲染失败的区块上,如果区块中的按钮更新了其内容,那些空白就会被刷新过的视图覆盖,按钮就会回来了。 奇怪的是,这些渲染问题只会在我的电脑的外接显示器上出现。如果通过本机的显示器就不会出现一样的问题。 我的电脑配置如下:联想拯救者 R9000P RTX3060,Window 版本为 21H1 19043.1055 。出现问题的时候是工作在混合模式下的,但是似乎无论是指定 AMD 集成显示卡还是 nVDIA 显示卡运行,都一样会出现这个问题。  | | Samba 在共享的时候,如何比较好的设定:可写但不允许删除目录? Posted: 23 Jun 2021 10:38 PM PDT 为什么会有这种需求呢,我共享了几个目录给大家用。主要是共享的东西比较重要,怕被误删除。 所以我在每个目录下用 git 做定期备份,所以.git 目录是不能被删除,同理.git 上一级目录也不能被删除。 这样即使其它文件他们怎么折腾都可以,我都可能通过 git 去还原。(关联的帖子: https://v2ex.com/t/785482 )  | | webkit 如何监听网页加载状态 Posted: 23 Jun 2021 10:09 PM PDT 这个状态包括 ajax 请求的状态,因此类似于 onPageFinished()是无效的  | | git 如何根据文件大小进行忽略,想跳过大文件。 Posted: 23 Jun 2021 08:11 PM PDT git 提交的时候能不能自动忽略大文件(比如超过 100M ),然后给个提示消息就好了。  | | 一大波 Android 构建的迭代 Posted: 23 Jun 2021 07:45 PM PDT 我的博客原文:https://2bab.me/2021/06/17/google-io-21-agp-recap 距离 Google I/O 2021 已经过去了将近一个月,最近捋了捋关于 Android Gradle Plugin ( AGP )方面的东西,主要集中在 "What's new in Android Gradle plugin" 这个 session 。不过由于 2020 年没有 Google I/O,线下的活动也因为疫情全部暂停,所以这个 session 短短 11 分钟,信息量却相当大,几乎可当作是这两年更新的重点浓缩(前后看了三遍)。也因此,这篇文章里我会放出很多额外的参考资料,挖了下最近一两年大家可能忽略了的 talks/posts/repos 。文章整体脉络仍按这个 session 的 agenda 来。 性能提升 Configuration Cache Gradle 的生命周期分为大的三个部分:初始化阶段( Initialization Phase),配置阶段( Configuration Phase ),执行阶段( Execution Phase )。其中任务执行的部分只要处理恰当,已经能够很好的进行缓存和重用——重用已有的缓存是加快编译速度十分关键的一环,如果把这个机制运用到其他阶段当然也能带来一些收益。仅次于执行阶段耗时的一般是配置阶段,而今年 AGP 给我们带来的 Gradle Configuration Cache 的支持,一项自 Gradle 6.6 起开始孵化的新功能。它使得配置阶段的主要产出物——Task Graph 可以被重用,在示例的项目中这个优化可以带来 8s 左右的不必要等待(如果 Gradle 脚本配置并没有改变)。  想体验这项优化只需要在执行 Gradle 命令时加入 --configuration-cache,例如 ./gradlew --configuration-cache help。由于 Configuration Cache 现在还未完全稳定,如果你想一直开启(包括享受 IDE Sync 时的优化),需要使用如下 properties: org.gradle.unsafe.configuration-cache=true 第一次使用时会看到计算 Task Graph 的提示: Calculating task graph as no configuration cache is available for tasks: :test-app:assembleDebug 成功后会在 Build 结束时提示: Configuration cache entry stored. 之后 Cache 就可以被下一次构建复用(如果没有构建脚本修改): Reusing configuration cache. ... 51 actionable tasks: 2 executed, 49 up-to-date Configuration cache entry reused. 作为插件使用者,发现常用插件出现不支持的情况,可先搜索是否有相同的问题已经出现,例如下面这个 Kotlin 1.4.32 插件和 Gradle 7.0 配合时出现的问题:  在这个 YouTrack issue 下我们可以简单看到通过升级 Kotlin 插件版本至 1.5.0 以上即可解决。 事实上 AGP/Kotlin/Gradle 核心的几个插件(主要是背后的 Tasks )在最近的版本都已经支持 Configuration Cache,通过这几篇文档 /issue 可以了解大概: 而作为插件开发者,则还要关心 Configuration Cache 的适配工作。其重点在于:Task 的参数和内部实现需要避开直接传入 /使用 Gradle 的几个 Context 及一些无法序列化的类。以我维护的 Seal 插件为例,它是一个解决 AndroidManifest.xml 冲突的小插件,我们执行 /gradlew --configuration-cache :test-app:assembleDebug 会发现有两个问题待修复:  通过构建结束时输出的 Configuration Cache HTML Report 我们可以查看到详细的堆栈:  针对这个错误,其实仅仅需要把 project.logger 改成 this.logger 的引用即可:  对于更复杂的规则和用例,可以参考 Gradle 的文档以及 AGP 兼容 Configuration Cache 的心路历程(修复了 400 多个 issues ): 最后,有个 Gradle 官方维护的 android-cache-fix-gradle-plugin ,一些 AGP build cache 、configuration cache 的特殊问题,可以在此处查阅下,说不定正好是你项目碰到的。 Non-transitive R-classes 事实上 R 文件的这类特性已经发展了很多年,可以参考这篇按时间顺序整理的文章。但是最新的 nonTransitiveAppRClass 特性需要 AGP 7.0 及以上,目前资料较少,在 Android Studio Arctic Fox 版本发布说明中有部分提及: 非传递性 R 类重构:在 Android Gradle 插件中使用非传递性 (non-transitive) R 类,可以为具有多个模块的应用带来更快的构建速度。它通过确保每个模块只包含对其自身资源的引用,而不从依赖关系中提取引用来防止资源的重复。您可以通过重构 (Refactor) > 迁移到非传递性 R 类 (Migrate to Non-transitive R Classes) 来使用此功能。 开启方式如下:  这个操作帮助你自动添加两行特性开启的代码到 gradle.properties,并重新 build project:  Cacheable Lint Task Lint 的运行一直是耗时大户,在 AGP 7.0 后(最早计划于是 3.5,见这篇文档),终于正式成为可缓存的 Task 。 其他 另外 AS + AGP 自 4.x 以来还有一些提升的点: - Gradle Kotlin DSL 体验和性能提升,可以看到 Google I/O Android App 项目已经全部改成
*.gradle.kts 脚本; - AAPT2 的性能提升;
- JDK 11 引入的性能提升;
- ...
可以在 AGP/AS 的 Release Notes 里找到这些信息。  新的 DSL 旧的 AGP DSL 文档 从 3.4 之后就不再更新了。新的文档迁移至 android.com,更加统一。依旧可按版本查看: - 当前版本( Current Release ):即稳定版本 4.2 ;
- 预览版本( Preview Releases ):即 beta 7.0 和 alpha 7.1 测试版;
- 之前的版本( Past Releases ):即之前所有的老版本,但由于中间的更迭 /切换,所以其实 3.5 -> 4.0 版本的文档都没有;
 这个变化也反映在了 google source 的 tag 上,对于 AGP 源码来说 gradle-x.y.z 的 tag 自 3.4.0 之后就没有了,目前你可以使用 studio-x.y.z 例如 studio-4.2.0 来反向定位 AGP 的版本。 Android Studio 提供的 AGP 升级助手 为了让开发者便捷流畅地升级 AGP,AGP 配合 AS 的推出了升级助手功能。这个新特性已经迭代了几个版本,目前对 Gradle Groovy DSL 脚本的升级十分有用,当你看到升级提示时(一般发生在刚打开一个工程时):  点击 Upgrade 还会有预览功能(截图自 session 的 slide ):  不过对于 Gradle Kotlin DSL 的支持还有待补齐,例如基础的 compileSdkVersion 等废弃 DSL 的迁移也未支持:  当然,复杂的对象引用也无法帮你直接修改,例如 classpath(Deps.agp),这已经超过该工具能做的范围。你可以把其当成类似 Java 转 Kotlin 的辅助工具,先用它快速升级和整理基础的 DSL,然后再手动对照 DSL 文档修改出错的小部分。 新的 Variant API Variant API 是这两年 Android 与插件开发相关的最重要更新,如果之前没有针对 AGP 生态开发过协同插件的朋友可以通过下面这张图"了解什么是 Variant"?  Variant API 的更新可以概括:为了使协同插件的开发者依赖于更稳定的 API,将原来的 com.android.tools.build:gradle 包拆分成 gradle 和 gradle-api 两个包,做到接口和实现的隔离。实战角度来看我们可以关注两部分:Variant 遍历入口变更和部分自定义 Task 的简化。 Variant 遍历入口变更 大部分 AGP 生态的协同插件都需要注册 Variant aware 的 Task,即遍历 Variant 注册与其对应的自定义 Task,例如上面提到的 Seal 插件的 postUpdateDebugManifest postUpdateReleaseManifest。你一定看到过这样的代码( Groovy ): def android = project.extensions.android android.applicationVariants.all { variant -> def variantName = variant.name.capitalize() createTask(project, variantName) } 或者 Kotlin 的版本: val androidExtension = project.extensions.findByType(AppExtension::class.java)!! androidExtension.applicationVariants.all { variant -> val variantName = variant.name.capitalize() createTask(project, variantName) } 如果是适用于 library 的插件则需要 LibraryExtension 和 libraryVariants。 这类 API 现在改成了 gradle-api 内的新 API 调用: val androidExtension = project.extensions.getByType<ApplicationAndroidComponentsExtension>() androidExtension.onVariants { variant -> ... } 这里获取到的 Variant 是 com.android.build.api.variant.ApplicationVariant,Extension 则来自于 com.android.build.api.extension.ApplicationAndroidComponentsExtension。另外一个可能会用到的接口是 beforeVariants(...),用来控制 Variant 的构建,例如全局修改一些 Variant 的属性等。从这段 Snippet 我们可能看不出来 Variant 具体的变化,但这变化背后包含了规范的 Variant 状态流转,公开的 API 等。 部分自定义 Task 的简化 这类简化指 Task 插入点和 Task 参数获取(注入)的简化,提供这类特性的 API 也称之为 Artifact APIs 。在比较经典的模式里:对于插入点,一般我们会手动找到 Task 的前后依赖关系,使用 Gradle API 进行依赖关系重新梳理(甚至可能要自定义一些新的生命周期锚点 Task 辅助);对于 Task 的参数,就使出各种奇技淫巧,从已有 Task 里的参数 /中间产物 /私有对象等找到我们需要的数据,再注入到自定义的 Task 中。而现在 Artifact APIs 规范了一套标准操作,使得我们可以简易地和已有的数据、中间产物进行交互,实战角度来看我们可以分为两种模式: 复杂的 Transform/Append/Create 操作:插入 Task 到特定节点和 Task 参数注入一条龙服务,一般适用于需要定义某个具体的插入点; androidComponents { val gitVersionProvider = tasks.register<GitVersionTask>("gitVersionProvider") { gitVersionOutputFile.set( File(project.buildDir, "intermediates/gitVersionProvider/output")) outputs.upToDateWhen { false } } onVariants { variant -> val manifestProducer = tasks.register<ManifestProducerTask>("${variant.name}ManifestProducer") { gitInfoFile.set(gitVersionProvider.flatMap(GitVersionTask::gitVersionOutputFile)) } variant.artifacts.use(manifestProducer) .wiredWith(ManifestProducerTask::outputManifest) .toCreate(SingleArtifact.MERGED_MANIFEST) } } 纯粹的 Get:主动获取 intermediates,一般适用于较为独立的 Task,没有严苛的插入位置要求(但是藉由 Provider 的传递会有隐式的 Task 依赖),没有需要替换等操作: androidComponents { onVariants { variant -> project.tasks.register<DisplayApksTask>("${variant.name}DisplayApks") { apkFolder.set(variant.artifacts.get(SingleArtifact.APK)) builtArtifactsLoader.set(variant.artifacts.getBuiltArtifactsLoader()) } } } 更多 从实用的角度来说,新的 Variant 接口、Extension 接口公开的 API 比之前少了,但更加规范。Artifacts 作为手动获取 Task input/output 的补充,目前的公开 API 也还比较少,希望插件开发者们在遇到合理的需要公开的 API 但目前还没有时,给 AGP team 多提点 issue :)。 另外,限于篇幅我无法在这里介绍全部的 Variant API 更新,包括新的 Provider<T> API 引入( Lazy Configuration ),Variant 状态流转,更多种的 Artifacts API 的使用,如何借鉴它的设计来自己动手解决那些还没有被封装、公开的接口等等。你可以从下面几份资料中获得更多的灵感: 新的 ASM API  ASM API 是之前 Transform API 的替代品,旨在更低成本地提供一个 Class -> Dex 之间的插入点用以修改字节码。它没有了之前 Transform API 的灵活性,比如目前看起来它和 ASM 字节码工具是绑定的,不支持 Javassist 或者 Aspect 等。但同时,它拥有更好的性能,更低的使用成本(指实现 transform 本身,因为 ASM 实际上是相对 Javasssist Aspect 更底层的 API,更灵活、学习成本也更高),以及更容易适配 Gradle 的新特性。目前刚刚开始孵化,从 API Doc 来看还不推荐开发者使用它来构建一个生产环境的插件。 abstract class ExamplePlugin : Plugin<Project> { override fun apply(project: Project) { val androidComponents = project.extensions.getByType(AndroidComponentsExtension::class.java) androidComponents.onVariants { variant -> variant.transformClassesWith(ExampleClassVisitorFactory::class.java, InstrumentationScope.ALL) { it.writeToStdout.set(true) } variant.setAsmFramesComputationMode(FramesComputationMode.COPY_FRAMES) } } interface ExampleParams : InstrumentationParameters { @get:Input val writeToStdout: Property<Boolean> } abstract class ExampleClassVisitorFactory : AsmClassVisitorFactory<ExampleParams> { override fun createClassVisitor( classContext: ClassContext, nextClassVisitor: ClassVisitor ): ClassVisitor { return if (parameters.get().writeToStdout.get()) { TraceClassVisitor(nextClassVisitor, PrintWriter(System.out)) } else { TraceClassVisitor(nextClassVisitor, PrintWriter(File("trace_out"))) } } override fun isInstrumentable(classData: ClassData): Boolean { return classData.className.startsWith("com.example") } } } 上面代码用到的 API 可以参考如下说明: 对经典的 Transform 不熟悉的朋友可以看下几个知名的 Transform 库封装(挺巧都是中国公司的开源项目): 总结 从开发者的角度来看,Android 工具团队在 AGP & AS 上更加注重 Engineering Experience 的东西了。在解决了很多历史遗留问题的同时,这次的 Session 还透露出对 AGP 周边生态的建设的长远计划,希望明年可以看到这些东西真的被更多 Android 开发者接受,到时候我也一定再写一篇 22 年版的总结和前瞻。 我的 Github / 公众号 。  | | 请教熟悉 WinRAR 的老哥一个问题,详见下文。 Posted: 23 Jun 2021 07:23 PM PDT 准备补票 WinRAR,但支付时候除了本体还看到有个 WinRAR Maintenance: The WINRAR Maintenance Package includes: -
Upgrade Assurance: You are supporting the continuous Improvement of WINRAR and we make sure that you can always get the latest version during this one-year period of your subscription. -
One Year Premium Support: Any WINRAR related support questions youmay have will be treated by us with priority for one full year from the date ofpurchase. Please note that we offer support in English and German. -
Lost Key Support: Don't worry if you have lost your WINRAR key, we will re-send it to you via e-mail within 48 hours of receiving your request Premium Support 和 Lost Key Support 没什么用,重点似乎是 Upgrade Assurance,时效一年。 (可我似乎没找到 WinRAR Maintenance 的续费链接... 我看 chiphell 上有老哥说 WinRAR 买正版后可以一直使用最新版本,那这个 WinRAR Maintenance 是怎么回事? 我只买本体?还是连 WinRAR Maintenance 一起买?一年以后更新版本怎么办?  | | 关于在一个服务端 urlencode 编码后传递的 post 参数请求时候 在 nodejs 接收时报错 Posted: 23 Jun 2021 06:08 PM PDT 报错内容是:[INFO] console - { inspect: [Function: inspect] } 因为用的 koa-bodyparser 对方描述说希望我这边(node)接收时解码就行了 不知道在哪个地方解码.. 有没有大神指点一下啊..  | | 输出推送不到 server 酱上 Posted: 23 Jun 2021 06:02 PM PDT import requests SCKEY = '666' url2 = ' https://api.tokyo.biliob233.com/user/check-in'cookie2 = 666' def it(): headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', 'cookie': cookie2 } res = requests.post(url=url2, headers=headers).text print(res) # 微信推送 def pushWechat(desp, nowtime): ssckey = SCKEY send_url = ' https://sc.ftqq.com/' + ssckey + '.send' if '登录' in desp: params = { 'text': 'bilibiliob 签到失败提醒' + nowtime, 'desp': desp } else: params = { 'text': 'bilibiliob 签到提醒' + nowtime, 'desp': desp } requests.post(send_url, params=params) f = open('bilibiliob.txt', 'w+', encoding='utf-8') f.write(res) f.close() desp2 = 'bilibiliob.txt' desp = desp2.read() # 读取数据 pushWechat(desp, nowtime) return desp def main_handler(event, context): return it() if __name__ == '__main__': it() 已签到时:{"code":-1,"msg":"已经签过到了"} 失效时:{"code":-1,"msg":"未登录"} 我想让程序检测到"登录"这个词出现时,发送失败提醒,否则签到成功提醒,不知道是不是因为没写入还是 desp 没读取,反正没有推送  | | 有没有比较安全、好用的纯净版 win7/win10 gho? Posted: 23 Jun 2021 03:14 PM PDT 原版安装较慢,很多驱动需要手工打,较麻烦。请大虾们告知一些安全、好用的纯净版 win7/win10 gho 下载点,感谢。  | | 介绍自己搭的一个 Go Web 脚手架项目 Posted: 23 Jun 2021 12:51 PM PDT Gen Web - 基于 Gin 框架封装的脚手架结构,便于快速开发 API https://github.com/wangbjun/gen 介绍 主要使用以下开源组件: 项目目录结构清晰明了,简单易用,快速上手,包含了一个用户注册、登录、文章增删改查等功能的 Restful API 应用,仅供参考! 主要包含以下 API: | METHOD | URI | DESCRIPTION | | GET | / | 默认首页 | | POST | /api/v1/user/register | 用户注册 | | POST | /api/v1/user/login | 用户登录 | | POST | /api/v1/user/logout | 用户登出 | | GET | /api/v1/articles | 文章列表 | | POST | /api/v1/articles | 发布文章 | | GET | /api/v1/articles/:id | 文章详情 | | PUT | /api/v1/articles/:id | 修改文章 | | DELETE | /api/v1/articles/:id | 删除文章 | | POST | /api/v1/articles/:id/comments | 添加文章评论 | 架构 项目采用了依赖注入的方式贯穿全局,我们可以把 DB 、缓存、HTTP API 等功能看作是项目的一个服务,通过 facebook 开源的 inject 库,我们在启动项目把这些Service注入进去,解决各自之间的依赖关系。 type ArticleService struct { SQLStore *SQLService `inject:""` Cache *cache.CacheService `inject:""` } func init() { registry.RegisterService(&ArticleService{}) } func (r ArticleService) Init() error { return nil } 既灵活,也不影响性能,因为虽然依赖注入使用了反射,但是我们只在程序启动之前做这件事,而且只需要进行一次。 启动流程 main文件是程序的入口,主要功能是解析命令行参数,只有一个参数,那就是配置文件,默认配置文件是当前目录下的app.ini 紧接着,创建一个Server实例: // Server is responsible for managing the lifecycle of services. type Server struct { context context.Context shutdownFn context.CancelFunc childRoutines *errgroup.Group log *zap.Logger cfg *config.Cfg // 项目配置 shutdownOnce sync.Once shutdownFinished chan struct{} isInitialized bool mtx sync.Mutex serviceRegistry serviceRegistry // 注册的服务 } 这个 Server 实例是管理所有服务的中心,其主要工作就是加载配置文件,然后根据配置文件初始化日志配置,日志库采用 zap log,主要文件在zap/zap_logger.go里面 然后还有一个最重要是就是初始化所有注册过服务,执行其Init方法做一些初始化工作,最后执行后台服务。 如果一个服务实现了Run方法,就是一个后台服务,会在项目启动时候运行,结束时候优雅关闭,其中最好的例子就是HTTPServer,我们可以把 API 服务认为是一个后台服务,在整个项目启动的时候就会运行。 type HTTPServer struct { log *zap.Logger gin *gin.Engine context context.Context Cfg *config.Cfg `inject:""` ArticleService *article.ArticleService `inject:""` UserService *user.UserService `inject:""` } HTTPServer 的代码在api/http_server.go文件里面,其主要作用就是初始化一些服务配置,然后启动 HTTP 服务,使用了 Gin 框架。 代码介绍 在services文件夹下包含了一些服务的代码文件。 项目整体是一个 3 层架构,即控制器层、Service 层、模型层。 个人理解,控制器层主要做一些接口参数校验等工作,模型层主要是数据操作,Service 层才是主要的业务逻辑。 数据库相关配置在models/db.go里面,也是一个服务,主要作用是根据配置,初始化数据库连接,支持多数据库配置。 type SQLService struct { Cfg *config.Cfg `inject:""` conns map[string]*gorm.DB log *zap.Logger } func DB(dbName ...string) *gorm.DB { if len(dbName) > 0 { if conn, ok := sqlStore.conns[dbName[0]]; ok { return conn } } return db } 项目使用了 Gorm ( 2.0 版本),具体详细用法可以参考官方文档。 路由文件位于api/api.go,可以多层嵌套,中间件在middleware文件夹。 config/config.go是配置文件的一些加载逻辑,可以根据自己需求适当的修改优化。 关于接口参数,建议 POST 、PUT 统一使用 JSON 形式,在模型层里面定义好相应的结构体,参数的校验采用了go-playground/validator/v10库,直接在结构体 Tag 里面标记即可,详细用法请参考其官方文档。 type CreateArticleCommand struct { Id int UserId int Title string `form:"title" json:"title" binding:"gt=1,lt=100"` Content string `form:"content" json:"content" binding:"gt=1,lt=2000"` } type UpdateArticleCommand struct { Id int UserId int Title string `form:"title" json:"title" binding:"gt=1,lt=100"` Content string `form:"content" json:"content" binding:"gt=1,lt=2000"` } 。。。 。。。 。。。  | | 使用共享协议(NFS、SMB、FTP、WebDav 等)实现的 NAS 存储需要哪些软硬件支持? Posted: 23 Jun 2021 11:42 AM PDT 如题,前段时间买了一款网络摄像头,到手后发现不支持 nas,但同个品牌的其他价格更高的摄像头可以支持,关于 nas 存储的实现,只知道怎么搭建,但不清楚其底层协议的实现是否需要附加的软硬件环境(厂家需要更多成本)支持。想问一下各位大佬,这里是因为增加 nas 存储功能相应也一定幅度的提高了生产成本(软硬件环境相差比较大)?产家为了降低成本不予支持?还是明明可以支持,故意砍掉,让买家去购买更高价格的产品?另外如果需要的话,具体是哪些软硬件环境才支持? PS:当然一个产品加多一个功能,需要多消耗一份人力去维护。不过站在开发者的角度讲,跟基本相差无几的同类产品相比,几乎等于维护同一份功能开发支出。谢谢大家回复。  | | 通过点击 Sublime Text 的付费提示的确认按钮继续使用算不算破解和盗版? Posted: 23 Jun 2021 11:33 AM PDT | | Linux kernel 4.4 模块编译 提示 module PLT section(s) missing Posted: 23 Jun 2021 09:34 AM PDT [ 1854.285430] nfs: module PLT section(s) missing [ 1854.317509] nfs: module PLT section(s) missing 请问 如何解决.  | | 面试经典题目--公交路线 Posted: 23 Jun 2021 06:34 AM PDT 不得不说,刷题已经和爬山、溜娃一样,成为湾区三俗,基本几个湾区的工程师碰在一起,讨论的话题总跳不出这个圈。爬山,哦不,刷题作为一个贯穿码农整个职业生涯的必须品(就算是我目前呆的微软谷歌这种养老公司也总得跳一跳,毕竟雪花的大包裹是真香啊),几年来基本每天不间断的刷,算是对这一块略有心得。帖子的前半部分想分享一些我作为面试官的常出的一些经典题目,以及题目思路的解析以及一些同类题的归纳,帖子的后半部分我会参考坛友们的留言和拍砖,来决定后面的走向 帖子会长期保持更新,只要是带娃的间隙就会偷偷上来更一下,尽量保持每周两更。 本期我们分享 面试经典题目--公交路线 感兴趣的可以关注公众号--大牛门徒  | | Python 客户端方案, orm 还是 http? Posted: 23 Jun 2021 06:33 AM PDT 大家好。 数据都在数据库里面,想做一个客户端( library )给用户,又可以调用数据,又能使用这个客户端里的功能。客户端里面有一些复杂的 class,包含了业务逻辑,这样用户可以用 oop 的界面去做更高层次的研究。 刚开始想用 http 的,但是 django 这边做一遍,客户端又要解析 json 、写逻辑,显得非常麻烦。突发奇想直接把 django 的 orm 和 drf (用来序列化)剥离出来放到客户端里,用户提供一个数据库的 read-only 账号就能完成全部操作。我在客户端里写逻辑也比较容易,因为有了 django model 后 ide 提示很不错 ( http json 反序列化后还要写一遍 attribute 就太蛋疼了) 因为客户端里逻辑全写完了,以后我自己 django 后端给网页写 api 也是直接可以复用,把这些 object 直接序列化就行了。 网上看了下,好像这种用法不多见?有什么隐藏的问题吗? 然后就是有没有办法低成本迁移带有业务逻辑的 python class 到前端的 javascript class ?  |  |
No comments:
Post a Comment