Using type casting to convert string into integer   string str="123456"; int buffer[str.length()]; for (int i=0; i&lt;str.length();i++) {     buffer[i]=(int)str[i];     cout &lt;&lt; buffer[i]; }   Getting following result    495051525354  which is DEC form of Symbol 123456  But i want "123456" as a result. Please help!!
What's the C++ way of parsing a string (given as char *) into an int? Robust and clear error handling is a plus (instead of ).
Is it possible to produce such design hints (on elements padding, spacing, width, height) automatically in photoshop? Is there any plugin that can potentially do this? The "proper" way to test if a service is running in a script My problem:  I'm writing a bash script and in it I'd like to check if a given service is running.  I know how to do this manually, with $ service [service_name] status.  But (especially since the move to systemd) that prints a whole bunch of text that's a little messy to parse. I assumed there's a command made for scripts with simple output or a return value I can check.  But Googling around only yields a ton of "Oh, just ps aux | grep -v grep | grep [service_name]" results. That can't be the best practice, is it? What if another instance of that command is running, but not one started by the SysV init script?  Or should I just shut up and get my hands dirty with a little pgrep? I've been playing Agar for some time now, and lately I've noticed there was a new XP system in Agar. Since then I've been wondering what variables chance the XP gained. I've tried googling it, but with no luck.  I'm looking for how the XP system works in these game modes:   FFA Teams Experimental Plot draws list of curves in same color when not using Evaluate Using VHDL code to design a JK Flip Flop I'm using quartus II to design a JK Flip Flop. However, my results show unknown output. Why is it?  Intended design circuit:    VHDL code:  library IEEE;  use IEEE.STD_LOGIC_1164.ALL;  entity JKFlipFlopGate is     port(         J,K,Clk : in std_logic;             --JK Flip-Flop gate input 1 &amp; 2         Q,Qbar : out std_logic              --JK Flip-Flop gate output     ); end JKFlipFlopGate;  architecture result of JKFlipFlopGate is         signal out1,out2,out3,out4 : std_logic;  begin     out1    &lt;= NOT(J AND Clk AND out4);                      out2    &lt;= NOT(K AND Clk AND out3);      out3    &lt;= out1 NAND out4;     out4    &lt;= out2 NAND out3;      Q       &lt;= out3;     Qbar    &lt;= out4;     end result; If verification is quality control, what is a validation? How to conduct an Accent Sensitive search in MySql I have a MySQL table with utf8 general ci collation. In the table, I can see two entries:  abad abád  I am using a query that looks like this:  SELECT *  FROM `words` WHERE `word` = 'abád'   The query result gives both words:  abad abád  Is there a way to indicate that I only want MySQL to find the accented word? I want the query to only return    abád    I have also tried this query:  SELECT *  FROM `words` WHERE BINARY `word` = 'abád'   It gives me no results. Thank you for the help. When is it correct to use upper case letters for nouns that may only be unique in a given context? Please help me to draw the following diagram:  \begin{displaymath} \xymatrix{ H\ar[r]&amp;H .1={}_HI_Q\supset 1.Q&amp;Q\ar[l]_\epsilon^{\cong}  \\  &amp;R\ar[u]\ar[r]&amp;R\ar[u] } \end{displaymath} Improve alignment of "Learn more" button in "Newest badge" popup The popup when you click on your newest badge in your user profile has a &quot;Learn more&quot; button, but its alignment is suboptimal; it's too close to the top of its container:  It looks better with a 4px top margin: Show all inbox items (notifications) in app The SE app currently only shows some inbox items:   Answers Comments Chats   When I see those I assume I'm all caught up, but it turns out there are more on the web which aren't displayed in the app:   Bounty expiration Elections Edits on your own posts Maybe others?   I was about to tag this  but realized it's probably intentional.  I imagine the reason for not showing them is because they're not something you can act on from within the app. Bounties can't be offered or awarded1 and elections can't be voted on.  But then again chats can't be replied to either. Badge descriptions can't be viewed (on the Achievements side). Selecting those launches the browser. Why then shouldn't bounties or elections launch the browser too? Hiding them just means I'll miss it if I haven't visited in browser recently.  1 Though accepting answers does award the bounty Where does Google Chrome for Linux store user specific data? Duplicate application icons in Ubuntu dock upon launch Just that. By good I mean something at the level of SolidWorks, AutoCAD, or similar. This is a complete limitation for me (and many others) to use Ubuntu. Unique constraint that allows empty values in MySQL Need for a side book for E. Soper's Classical Theory Of Fields I am reading now E. Soper, Classical Theory Of Fields, now and sometimes it is very hard to follow the equations. So I need a side book on  to read it comfortably. Landau &amp; Lifshitz's book is not helping as its content and topics are very much different. What is a substitute for red or white wine in a recipe? I am working to build a reinforcement agent with DQN. The agent would be able to place buy and sell orders for a day trading purpose. I am facing a little problem with that project. The question is "how to tell the agent to maximize the profit and avoid the transaction where the profit is less than 100$".  I want to maximize the profit inside a trading day and avoid to place the pair (limit buy order, limit sell order) if the profit on that transaction is less than 100$. The idea here is to avoid the little noisy movements. Instead, I prefer long beautiful profitable movements. Be aware that I thought using the "Profit &amp; Loss" as the reward.  "I want the minimal profit per transaction to be 100$" ==> It seems this is not something that is enforceable. I can train the agent to maximize profit per transaction, but how that profit is cannot be ensured.  At the beginning, I wanted to tell the agent, if the profit of a transaction is 50 dollars, I will remove 100 dollars, then It becomes a penalty of 50 dollars for the agent. I thought it was a great way to tell the agent to not place a limit buy order if you are not sure it will give us a minimal profit of 100$. It seems that all I would be doing there is simply shifting the value of the reward. The agent only cares about maximizing the sum of rewards and not taking care of individual transactions.   How to tell the agent to maximize the profit and avoid the transaction where the profit is less than 100$? With that strategy, what guarantee that the agent will never make a buy/sell decision that results in less than 100 dollars profit? Does the sum of reward - # transaction * 100 can be a solution? According to , the only restriction on self-deleting an answer is that you can't delete an answer that's been accepted.  But I've also heard of users getting in trouble for deleting (non-accepted) answers, and there's the CC-SA license to consider, so -- quite aside from what is technically possible -- my question is when it's permitted to delete your own answer.  Some cases to consider:   You now believe the answer is incorrect. Your answer is correct, but another answer covers the same territory better. You aren't satisfied with the quality/rigor of your answer, e.g. it's speculative and you didn't back it up (on a site that expects that). Something in the answer embarrasses you and you'd rather just make it go away. Your answer wasn't well-received by the community (whether that's "meh" or "make the rep bleeding stop please"). (I'm sure there are others; this isn't meant to be an exhaustive list.)   Does voting matter, either in absolute terms or in comparison to other answers?  For example, maybe it's ok to delete a lower-voted one but not the top-voted answer, or one with score > N??  There is a badge, Disciplined, for deleting your own post of score 3 or higher.  This tells me that it's sometimes ok to delete upvoted answers.  But I'm not sure how much policy we can infer from badges.  Could we have some clarification please? What i did?   [root@mdfdevha1 ~]# Group_ID=`/opt/keycloak/bin/kcadm.sh get groups -r TEST`  [root@mdfdevha1 ~]# echo $Group_ID [ { "id" : "57c86153-11ba-4d19-aafb-9903ee00086b", "name" : "Admin_UserGroup", "path" : "/Admin_UserGroup", "subGroups" : [ ] } ] [root@mdfdevha1 ~]# SURE_USER_ID=`echo $Group_ID | cut -d : -f2 | awk -F\" '{print $2}'` [root@mdfdevha1 ~]# echo $SURE_USER_ID 57c86153-11ba-4d19-aafb-9903ee00086b   In this case i am able to get the id but my requirement little bit complex  I run below command   [root@mdfdevha1 ~]#  Group_ID=`/opt/keycloak/bin/kcadm.sh get groups -r My_Realm`   and then   [root@mdfdevha1 ~]# echo $Group_ID   Output was multiple record in JSON format  [ { "id" : "e27206c0-aeb6-43db-acda-c4ba43233071", "name" : "A1", "path" : "/A1", "subGroups" : [ ] },  { "id" : "89f3bd6a-33a9-4e02-9fe3-eae660c5a6cf", "name" : "Admin_UserGroup", "path" : "/Admin_UserGroup", "subGroups" : [ ] },  { "id" : "cdc2bce5-c3bb-4b88-bdaf-d87b8bb6c644", "name" : "Group104", "path" : "/Group104", "subGroups" : [ ] },  { "id" : "a0d749f2-ab6c-4c27-ad55-3357eaab9527", "name" : "Group105", "path" : "/Group105", "subGroups" : [ ] },  { "id" : "fbf99c34-d50d-408b-8d19-9713f9af3e3a", "name" : "Group106", "path" : "/Group106", "subGroups" : [ ] },  { "id" : "ebd8336f-4017-4fb1-8035-153ae1d9ba37", "name" : "Group201", "path" : "/Group201", "subGroups" : [ ] },  { "id" : "38f4aef7-caf0-4430-9e61-1ae7026e872f", "name" : "Group202", "path" : "/Group202", "subGroups" : [ ] },  { "id" : "436a0f4a-8b1b-4d7d-a014-fcec3513644e", "name" : "Group203", "path" : "/Group203", "subGroups" : [ ] },  { "id" : "41962c5f-e7e9-4748-b81f-e3f1880b78de", "name" : "Sure_Groups", "path" : "/Sure_Groups", "subGroups" : []}]   Now from the above output i want to get the ID where name = Admin_UserGroup.  How can this will achieve ?