texts
sequence
tags
sequence
[ "SetExpressCheckout with tax, The totals of the cart item amounts do not match order amounts", "I have the code below to get the token from paypal but somehow paypal keeps on sending me an error saying that the total of cart item does not match the order amounts. What am I doing wrong in here?\n\n <ebl:PaymentDetails>\n <ebl:OrderTotal currencyID=\"USD\">21.70</ebl:OrderTotal>\n <ebl:TaxTotal currencyID=\"USD\">1.70</ebl:TaxTotal>\n <ebl:ButtonSource>PayPal_SDK</ebl:ButtonSource>\n <ebl:PaymentDetailsItem>\n <ebl:Name>Product A</ebl:Name>\n <ebl:Quantity>1</ebl:Quantity>\n <ebl:Tax currencyID=\"USD\">1.70</ebl:Tax>\n <ebl:Amount currencyID=\"USD\">20.00</ebl:Amount>\n </ebl:PaymentDetailsItem>\n </ebl:PaymentDetails>\n\n\nIf I combine the tax and amount, it works as expected ( see example below ). I want to separate tax so that the user will know how much tax they are paying for the product.\n\n <ebl:PaymentDetails>\n <ebl:OrderTotal currencyID=\"USD\">21.70</ebl:OrderTotal>\n <ebl:ButtonSource>PayPal_SDK</ebl:ButtonSource>\n <ebl:PaymentDetailsItem>\n <ebl:Name>Product A</ebl:Name>\n <ebl:Quantity>1</ebl:Quantity>\n <ebl:Amount currencyID=\"USD\">21.70</ebl:Amount>\n </ebl:PaymentDetailsItem>\n </ebl:PaymentDetails>" ]
[ "java", "paypal" ]
[ "How to add dynamic Texbox in GridView at RunTime?", "I would like to add controls like textBox in GridView from code on the fly.\n\nIn my project i have one Grid in that i can't decide how many rows and columns are there. so that i just give it DataSource. This working fine. \n\nGridView G = new GridView();\nG.DataSourse = dt;\nG.DataBind();\n\n\nnow i want to do such thing that in Gridview all the controls are Textbox control so that i can write in that textbox.\n\nTextBox t= new TextBox();\nG.Contorls.Add(t);\n\n\nThis will throw exception...\n\ndo anyone have any idea about this???\n\nThanks in advance..\n\nRegards\nAmit Vyas" ]
[ "c#", "asp.net", "vb.net", "gridview" ]
[ "Why do we sometimes prefer having data structures over objects?", "As Robert Martin's Clean Code said:\n\n\n Objects hide\n their data behind abstractions and expose functions that operate on that data. Data structure\n expose their data and have no meaningful functions.\n\n\nBut he also mentioned that:\n\n\n Procedural code (code using data structures) makes it easy to add new functions without\n changing the existing data structures. OO code, on the other hand, makes it easy to add\n new classes without changing existing functions.\n\n\nand:\n\n\n ...\n Such hybrids make it hard to add new functions but also make it hard to add new data\n structures. They are the worst of both worlds. Avoid creating them.\n\n\nHybrid above means the hybrid between data structure and objects. \n\nBut it seems there is a conflict for data structure: the pros of using data structure is for adding functions easier, but for data structure we'd better never add functions in it. Then what's the point of having data structure? E.g. DTO(data transfer object) are one of the examples of using data structure instead of using objects. And it's always a good practice to not add a lot of logic out of getters in it. -- But why?" ]
[ "oop", "design-patterns", "language-agnostic" ]
[ "MVC 3 Razor Dropdown Change Simple Javascript", "I have an MVC3 Razor application which I'm trying to execute simple Javascript on a dropdown list change.\nMy view uses a custom helper which return the proper object depending on the data type (dropdown list for enumerated lists, radio buttons for binaries, etc.)\nThe following helper:\[email protected](model => model.Coating_Mode)\n\nwhich renders the following selectlist in html:\n<div class="form-line">\n <div class="editor-field">\n <select id="Coating_Mode" name="Coating_Mode">\n <option value="1">Adhesive</option>\n <option selected="selected" value="2">SR</option>\n <option value="3">Inspection</option>\n </select>\n </div>\n</div>\n\nI want to have a simple Javascript execute whenever the value of the select list is changed:\n<script type="text/javascript">\n $('#Coating_Mode').change(function () {\n alert("hello");\n }); \n</script> \n\nI will gladly provide any other code as needed to help answer the problem..." ]
[ "jquery", "asp.net-mvc-3", "razor", "jquery-events" ]
[ "Value for SWIFT_VERSION cannot be empty", "I have installed swift pods for the obj c project. I got this error when I was trying to build it. \n\n\n\nI have gone through all the solutions like deleting derived data, cleaning the build folder. Swift Compiler_Language also missing in the XCode 10.\nAdded user-defined setting too, even it didn't work." ]
[ "swift", "xcode10" ]
[ "C++ Typedefs and operator overloading", "If you define a type like typedef int MY_INT; and go on to overload, say, the adition operator of MY_INT like\n\n\nMY_INT operator+(MY_INT a, MY_INT b);\n\n\nwill\n\n\nMY_INT a, b;\na + b;\n\n\nbe different from\n\n\nint A, B;\nA + B;\n\n\n?\n\nSorry for any syntax errors. I'm not near a compiler and I want to ask this before I forget about it." ]
[ "c++", "operator-overloading", "typedef" ]
[ "How to associate a subclass Object with a superclass object?", "I have a question on how I can create a new object and associate it with another already initialized object from its parent class in java.\nTo be clearer, I have a superclass Profile, then a subclass Contract which extends Profile and then two other subclasses HomePhone and MobilePhone that both extend Contract.\nTwo of the options of my menu are:\n\nNew profile.\nNew contract(HomePhone or MobilePhone contract).\n\nSuppose that the user has already created a profile without a contract and has entered some personal information. I initialize a Profile object and then i store it to an ArrayList.\nProfile p = new Profile();\n/*\nPromt the user to enter his information\nand when he has finished add the object to the array list.\n*/ \nprofiles.add(p);\n\nI'm okay until here.\nNext suppose that a user who has already a profile (which is already stored in the ArrayList), decides to press 2 to buy a new contract.\nI think that the most appropriate manner to do this is :\nProfile c = new MobilePhone();\n\nBut I will not have access to the appropriate user's profile in that way.\nSo I wonder how could I implement it. All I want is to associate the new contract with an already existed profile based on an id of the user.\nAny ideas on how to implement it?" ]
[ "java", "inheritance" ]
[ "Having a map with paths how to compare tham to given path?", "We have map of boost path to string pairs like name:location (absolute location paths a la usr/myfolder/). We are given with some location a la usr/myfolder/mysubfolder/myfile. How to find which of maps location fit to given url most?\n\nExample we have a map like which we can resort if we need:\n\nservice1:myfolder/\nservice2:myfolder/mysubfolder/\nservice3:myfolder/myothersubfolder/\nservice4:myfolder/mysubfolder/myfile\n\n\nWe are given value myfolder/mysubfolder/myfile/blablabla/ (path).\nWe want to find out to which item in our map it relates the most.\nSearch result shall be service4 as map item with most related content.\n\nSo how to find by given string value to which map element it relates the most?\n\nSo original question was about general string case but I had some reconfiguration so no I just work on boost paths." ]
[ "c++", "search", "boost", "path", "boost-filesystem" ]
[ "Rejusting UI with candidateview visible in custom keyboard", "I'm working on custome keyboard .I have set setCandidatesViewShown(true) function in onCreateCandidatesView() , problem is the UI doesnt get readjusted properly.\n\nAny assistance would be greatful.. below is what I have done\n\n@Override \npublic View onCreateCandidatesView() { \n\n LayoutInflater li = (LayoutInflater) getApplicationContext()\n .getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n View wordBar = li.inflate(R.layout.wordbar, null);\n LinearLayout ll = (LinearLayout) wordBar.findViewById(R.id.words);\n Button voiceCmd = (Button) wordBar.findViewById(R.id.voiceword);\n LinearLayout ll1 = null;\n Button voiceCmd1 = null;\n //comment this block in the event of showing only one keyboard so that we can only\n //one autocorrect bar\n if (isLargeScreen) {\n ll1 = (LinearLayout) wordBar.findViewById(R.id.words1);\n voiceCmd1 = (Button) wordBar.findViewById(R.id.voiceword1);\n }\n\n voiceCmd.setOnClickListener(voiceClickListener);\n\n mCandidateView = new CandidateView(this);\n mCandidateView.setService(this);\n setCandidatesViewShown(true);\n mCandidateView.setLayoutParams(new LayoutParams(\n LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));\n\n ll.addView(mCandidateView); \n\n return wordBar;\n\n}" ]
[ "android", "android-softkeyboard" ]
[ "google places review api is not showing reviews/rating in the response", "I am currently trying to use Places api for the getting place reviews, but it is not returning all the reviews/ratings for the place (as it show in maps/google+ for the same place).\n\nfor example-\n\nIf i get the review of \"St Joseph's Hospital and Medical Center\" google maps shows it has two reviews. but when i get the json response it doesn't show any reviews/ratings.\n\nThanks in advance\nShiv" ]
[ "google-maps", "google-places-api" ]
[ "Differentiate between zoom in and out in scalegesturedetector android", "Cant differentiate if user is zooming in or out using scaleGestureDetector\n\nmZoomGestureDetector = new ScaleGestureDetector(getActivity(), new OnScaleGestureListener()\n {\n\n int intFactor=0;\n boolean firstVisited = false;\n\n private float mScaleFactor2;\n private float currectScale= -100;\n private float startScale;\n private float endScale;\n\n @Override\n public void onScaleEnd(ScaleGestureDetector detector)\n {\n endScale = detector.getScaleFactor();\n\n//this condition does not pass. not > or < succeeds\n if (startScale > endScale) {\n Log.i(\"onScaleEnd\", \"Pinch Dection\");\n } else if (startScale < endScale) {\n Log.i(\"onScaleEnd\", \"Zoom Dection\");\n } \n setFontSize(intFactor);\n\n }\n\n\n @Override\n public boolean onScaleBegin(ScaleGestureDetector detector)\n {\n\n startScale = detector.getScaleFactor();\n\n return true;\n }\n\n @Override\n public boolean onScale(ScaleGestureDetector detector)\n {\n //Log.i(\"ScaleFactor\", \"Scale Factor original \" + detector.getScaleFactor());\n\n mScaleFactor = detector.getScaleFactor() * 100;\n\n\n\n Log.i(\"ScaleFactor\", \"Scale Factor : On \" + mScaleFactor);\n\n intFactor = (int) mScaleFactor;\n\n\n return true;\n }\n });\n ;" ]
[ "android", "pinchzoom" ]
[ "Catching Json exceptions with play-json library", "play-json's Json.parse() method may throw a JsonMappingException. It may also throw a JsonParseException. In order to catch these exceptions, does one have to reach into com.fasterxml.jackson?\n\nI understand from the documentation that play-json is built on top of Jerkson which is a wrapper around Jackson.\n\nIt seems much saner to catch an exception thrown by the play library rather than by a package that it uses which feels like reaching down through the abstraction. Is there a better way? Should the play-json library wrap these errors for better abstraction?\n\nThis question is for Scala." ]
[ "scala", "playframework" ]
[ "JavaMail SMTP credentials verification, without actually sending an email", "Is there a way to check user SMTP server credentials without sending email, or connecting to POP/IMAP.\nSome code I tried to write, fails at it.\nCan you find what is missing there.\n\nDon't worry about Email / password. I know it's there.\n\nNOTE : If you are trying out the code. The case 1 should pass when supplying the correct credentials.\nIf it fails, then someone changed the password. You should use some other email address.\n\n\n\nimport java.util.Properties;\n\nimport javax.mail.Authenticator;\nimport javax.mail.MessagingException;\nimport javax.mail.PasswordAuthentication;\nimport javax.mail.Session;\nimport javax.mail.Transport;\n\npublic class EmailTest {\n\n public static void main(String[] args) {\n EmailHelper eh = new EmailHelper();\n\n /* GMail Setting for SMTP using STARTTLS */\n String name = \"AAA\";\n String email = \"[email protected]\";\n String smtpHost = \"smtp.gmail.com\";\n String serverPort = \"587\";\n String requireAuth = \"true\";\n String dontuseAuth = \"false\";\n String userName = email; // same as username for GMAIL\n String password = \"zaq12wsx\";\n String incorrectPassword = \"someRandomPassword\";\n String enableSTARTTLS = \"true\";\n String dontenableSTARTTLS = \"false\";\n\n try {\n /* only valid case */\n eh.sendMail(name, email, smtpHost, serverPort, requireAuth,\n userName, password, enableSTARTTLS);\n System.out.println(\"Case 1 Passed\");\n\n /* should fail since starttls is required for GMAIL. */\n eh.sendMail(name, email, smtpHost, serverPort, requireAuth,\n userName, password, dontenableSTARTTLS);\n System.out.println(\"Case 2 Passed\");\n\n /* should fail since GMAIL requires authentication */\n eh.sendMail(name, email, smtpHost, serverPort, dontuseAuth, \"\", \"\",\n dontenableSTARTTLS);\n System.out.println(\"Case 3 Passed\");\n\n /* should fail. password is incorrect and starttls is not enabled */\n eh.sendMail(name, email, smtpHost, serverPort, requireAuth,\n userName, incorrectPassword, dontenableSTARTTLS);\n System.out.println(\"Case 4 Passed\");\n } catch (MessagingException e) {\n e.printStackTrace();\n }\n }\n\n}\n\nclass EmailHelper {\n\n private Properties properties = null;\n private Authenticator authenticator = null;\n private Session session = null;\n\n public void sendMail(String name, String email, String smtpHost,\n String serverPort, String requireAuth, String userName,\n String password, String enableSTARTTLS) throws MessagingException {\n properties = System.getProperties();\n properties.put(\"mail.smtp.host\", smtpHost);\n properties.put(\"mail.smtp.port\", serverPort);\n properties.put(\"mail.smtp.starttls.enable\", enableSTARTTLS);\n properties.put(\"mail.smtp.auth\", requireAuth);\n properties.put(\"mail.smtp.timeout\", 20000);\n\n authenticator = new SMTPAuthenticator(userName, password);\n\n session = Session.getInstance(properties, authenticator);\n\n // session.setDebug(true);\n\n Transport tr = session.getTransport(\"smtp\");\n tr.connect();\n /*\n * do I need more than just connect? Since when i try to send email with\n * incorrect credentials it fails to do so. But I want to check\n * credentials without sending an email. Assume that POP3/IMAP username\n * is not same as the SMTP username, since that might be one of the\n * cases\n */\n }\n}\n\nclass SMTPAuthenticator extends Authenticator {\n\n private String userName = null;\n private String password = null;\n\n public SMTPAuthenticator(String userName, String password) {\n this.userName = userName;\n this.password = password;\n\n }\n\n @Override\n public PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(userName, password);\n }\n}" ]
[ "java", "smtp", "jakarta-mail" ]
[ "How to implement a short-circuit with IO monad in Scala", "I use a standard IO monad.\n\nAnd at some point, i need to shortcircuit. On a given condition, i don't want to run the following ios.\n\nHere is my solution, but I found it too verbose and not elegant :\n\n def shortCircuit[A](io: IO[A], continue: Boolean) =\n io.map(a => if (continue) Some(a) else None)\n\n for {\n a <- io\n b <- shortCircuit(io, a == 1)\n c <- shortCircuit(io, b.map(_ == 1).getOrElse(false))\n d <- shortCircuit(io, b.map(_ == 1).getOrElse(false))\n e <- shortCircuit(io, b.map(_ == 1).getOrElse(false))\n } yield …\n\n\nFor example, for 3rd, 4th and 5th line, I need to repeat the same condition.\n\nIs there a better way ?" ]
[ "scala", "monads" ]
[ "Javascript validation inside gridview cell", "I have a single entry master with country name in a gridview . I have to edit the data in a grid view in asp.net c#. I want to validate the textbox inside edit template to see if the user enters invalid characters. I want to validate that using simple javascript code.\n\nI tried [a-zA_Z] in regular expression validator...it is causing slow down in my app. so i am prefering JS.\n\nI tried to get the value of client id using row data bound event in c# but it is interrupting the work flow of the program. :(" ]
[ "c#", "javascript", "asp.net", "gridview", "databound" ]
[ "What to do when server don't support SMTP and mail?", "I check now my server support, they say that they currently don't support SMTP, and also mail() function won't work.\n\nI see that some wordpress plugins, as newsletter plugin can send mails, some others can't, and also i can't send mail outside wordpress.\n\nWhat i can to do?\nIf there is some free smtp server how can i configure it to phpmailer script?" ]
[ "php", "smtp", "server", "phpmailer" ]
[ "Trigger is not working until i went to my path object", "I have a style for my path object this path is surrounded by a border when I'm writing a trigger that is not working until I went on to actual path object. \n\nStyle\n\n<Style TargetType=\"Path\">\n <Setter Property=\"Stroke\" Value=\"{DynamicResource CloseButtonClr}\"></Setter>\n <Setter Property=\"Stretch\" Value=\"Uniform\"></Setter>\n <Setter Property=\"StrokeThickness\" Value=\"3\"></Setter>\n <Style.Triggers>\n <Trigger Property=\"Border.IsMouseOver\" Value=\"True\">\n <Setter Property=\"Stroke\" Value=\"{DynamicResource LableClr}\"/>\n </Trigger>\n </Style.Triggers>\n </Style>\n\n\n\n<Border Width=\"20\" Grid.Column=\"2\" Background=\"Transparent\" Margin=\"0,0,5,0\" >\n <Path Data=\"M0,0 L1,1 M0,1 L1,0\" />\n </Border>\n\n\nthis is my code if I went on the path object then the trigger is working if went in between border and path object the trigger is not working, please help me wt I'm missing thanks" ]
[ "wpf", "styles" ]
[ "Using helm client on google cloud", "Hello I want to use helm on google cloud console.\nTiller is already installed.\n\nI did the following steps:\n\n wget https://storage.googleapis.com/kubernetes-helm/helm-v2.7.2-linux-amd64.tar.gz\n\n\nThen:\n\ntar zxfv helm-v2.7.2-linux-amd64.tar.gz\n\n\nNow I can use helm within the folder helm is with:\n\n./helm init --client-only\n\n\nBut I want just type helm to use it. What's needed to use it directly from cmd." ]
[ "kubernetes", "google-kubernetes-engine", "kubernetes-helm", "google-cloud-console" ]
[ "Bitcore multisig - how to sign a partially signed multisig bitcoin transaction", "I am trying to figure out what is the correct way to sign a partially signed multisig bitcoin transaction using bitpay's opensource Bitcore library (http://bitcore.io)?\n\nFor multisig bitcoin transaction, one person may sign the transaction with his private key. Pass that transaction to another person to sign using another private key. \n\nIf a bitcoin transaction is created using bitcore, we can use bitcore's TransactionBuilder to build the transaction and sign by calling sign(). However, if someone else has a transaction that is already signed by him and pass it to you to sign. How should we use bitcore library to sign? Is there a way to translate the transaction into bitcore TransactionBuilder object and call sign() method?\n\nThank you very much for your help." ]
[ "javascript", "bitcoin" ]
[ "the complications in javascript node.js?", "I've learned node.js and javascript lately. I loved node.js a lot, but I am working on a project coded in node.js, mongodb, cordova etc. I notice that I needed to use Promise Object in the code a lot.\n\nI create a module in the project to query the db and bring results. In every exported function I need to declare a local function, then use promise, for example: \n\nI have the following local functions in the Module: \n\nvar Initialize = function() {\n return new Promise(function(resolve, reject) {\n try {\n MongoClient.connect(\"db_url_conn\", function(err, database) {\n if (err) return console.log(err)\n db = database;\n return resolve(db);\n })\n } catch (e) {\n console.error(e);\n }\n });\n};\n\n\nthen in every exported function in the module I needed to use:\n\nmongoOperation.prototype.getLength = function() {\n Initialize(function(db) {\n return db;\n }).then(function(db) {\n getSize(db).then(function(length) {\n console.log(length);\n });\n });\n}\n\n\nThe Question is:\n\n\nIs that normal according to the nature of node.js and JavaScript nature to use promise a lot?\nDo I have any other choices to fulfill that?" ]
[ "javascript", "node.js", "mongodb" ]
[ "Incorrect syntax near the keyword 'select' in web application", "I am pretty new to SQL. I used FlySpeed SQL builder to write this query and it works there but when I use this code in web application I get an error: \n\n\n Incorrect syntax near the keyword 'select'\n\n\nBasically, I want to write this: If count is below 20 it returns nothing, if it is over 20 it triggers notification system.\n\nSelect\n sr.status,\n sr.assetsiteid\nFrom\n sr\nWhere\n sr.status = 'pending' And\n sr.assetsiteid = 'gp'\nGroup By\n sr.status, sr.assetsiteid\nHaving\n count(*) > 20\nOrder By\n count(*) Desc" ]
[ "mysql", "sql-server" ]
[ "Using a parameter's name inside its own default value - is it legal?", "enum class E {\n One,\n Two\n};\n\nvoid foo(E value = decltype(value)::One) {\n}\n\n\nIt can be compiled with Clang (3.9), but cannot be compiled with GCC 6.1: value was not declared in this scope.\n\nWhat compiler is right?" ]
[ "c++", "parameters", "language-lawyer", "default-parameters" ]
[ "Second parameter of e (event interface) in onChange = (type) => (e) => How is this being passes from the OnChange (is it by default)", "const onChange = (type) => (e) => {\n\n const [value, setValue] = useState({\n StartDate : new Date("2021-03-24T23:59:59"),\n EndDate : new Date("2021-03-24T23:59:59"),\n Seperate : false\n });\n\n\n if (type == "StartDate" || type == "EndDate") {\n console.clear();\n setValue({\n ...value,\n [type]: new Date(e),\n });\n } else {\n setValue({\n ...value,\n [type]: e.target.value == "on" ? !value[type] : e.target.value,\n });\n }\n };\n\n\n <Form.Control as="select" onChange={onChange("Consolidation")}>\n <DateTimePicker onChange={onChange("StartDate")}\n onChange={onChange("StartDate")}\n\nAttempting to understand %100 the above. And I am confused by one item in the above.\n\nWhat is the purpose of the second (e) in the above function? I know this is the event handler, yet how is this passed to the onChange function from the form controls, being it is only defined with the type parameter.\nI guess the additional => (e) is confusing me. Thanks for your time." ]
[ "javascript", "reactjs", "ecmascript-6" ]
[ "How frequently should I rotate my encryption keys? Can I use Cloud KMS to automatically rotate keys?", "With my on-prem KMS, I rotate keys monthly. Can I also do that with Cloud KMS? Is there a better recommended frequency compared to my on-prem use? Is data re-encrypted when I rotate a key?" ]
[ "google-cloud-kms" ]
[ "Piecemeal bzcompression for large files in PHP", "Creating bzip2 archived data in PHP is very easy thanks to its implementation in bzcompress. In my present application I cannot in all reason simply read the input file into a string and then call bzcompress or bzwrite. The PHP documentation does not make it clear whether successive calls to bzwrite with relatively small amounts of data will yield the same result as when compressing the whole file in one single swoop. I mean something along the lines of\n$data = file_get_contents('/path/to/bigfile');\n$cdata = bzcompress($data);\n\nI tried out a piecemeal bzcompression using the routines shown below\nfunction makeBZFile($infile,$outfile)\n{\n $fp = fopen($infile,'r');\n $bz = bzopen($outfile,'w');\n while (!feof($fp)) \n {\n $bytes = fread($fp,10240);\n bzwrite($bz,$bytes);\n }\n bzclose($bz);\n fclose($fp);\n}\n\nfunction unmakeBZFile($infile,$outfile)\n{\n $bz = bzopen($infile,'r');\n while (!feof($bz))\n {\n $str = bzread($bz,10240);\n file_put_contents($outfile,$str,FILE_APPEND);\n }\n}\n\nset_time_limit(1200);\nmakeBZFile('/tmp/test.rnd','/tmp/test.bz');\nunmakeBZFile('/tmp/test.bz','/tmp/btest.rnd'); \n\nTo test this code I did two things\n\nI used makeBZFile and unmakeBZFile to compress and then decompress a SQLite database - which is what I need to do eventually.\nI created a 50Mb filled with random data dd if=/dev/urandom of='/tmp.test.rnd bs=50M count=1\n\nIn both cases I performed a diff original.file decompressed.file and found that the two were identical.\nAll very nice but it is not clear to me why this is working. The PHP docs state that bzread(bzpointer,length) reads a maximum length bytes of UNCOMPRESSED data. If my code below is woring it is because I am forcing the bzwite and bzread size to 10240 bytes.\nWhat I cannot see is just how bzread knows how to fetch lenth bytes of UNCOMPRESSED data. I checked out the format of a bzip2 file. I cannot see tht there is anything there which helps easily establish the uncompressed data length for a chunk of the .bz file.\nI suspect there is a gap in my understanding of how this works - or else the fact that my code below appears to perform a correct piecemeal compression is purely accidental.\nI'd much appreciate a few explanations here." ]
[ "php", "large-files", "bzip2" ]
[ "How to pass a PHP variable to an another .JS file for using it in JQUERY?", "I'm a JQUERY begginner. I'm trying to pass a PHP variable to a js file so that i can use it in JQUERY! But found no resource to learn to do so. I'm able to pass a JQUERY variable to a different php file but I coundn't pass PHP variable to a jquery file. Is really possible to do so?\nfunction.php:\n<?php $variable = $fetch['username']; ?>\nhow can use this variable in app.js?\n$(document).ready(function(){\nvar flwbtn = $(".findrowpplfollowbtn");\nflwbtn.click(function(){\n var selectflwusername = $(this).parent().prev().last().find(".findpplrowusername").text();\n \n $.post("../php/flw.php",{flwusernameselected:selectflwusername})\n \n});\n});" ]
[ "php", "jquery", "ajax", "variables", "methods" ]
[ "Odd issue with scriptblock in Powershell ISE: pasting its string representation into Notepad reveals unexpected character", "I am trying to create a dynamic scriptblock, so I can use variables in the scriptblock.\n\nThis is my code:\n\n$Servers = \"server1\", \"server2\"\n\n$Command = \"c:\\plink -t user@\" + $Servers[0] + \" -pw 'password'\"\n$Command = [Scriptblock]::Create($Command) \n\n$Command2 = {c:\\plink -t user@server1 -pw 'password'}\n\n$command\n$command2\n\n\nRunning the script in the PowerShell ISE produces, what I would expect:\n\nc:\\plink -t user@server1 -pw 'password'\nc:\\plink -t user@server1 -pw 'password'\n\n\nBoth $command and $command2 present identical output, and both are valid scriptblocks when checked with Get-Member -Verbose.\n\nMy problem is that executing the first line produces a connection error, where the identical output from $command2 works just fine and connects to the server.\n\nLooking into the issue, I found that copy/pasting the two produced lines in the output window of the ISE to a Notepad reveals the problem:\n\n\n\nAs you can see in the JPG, an odd character is added, right after the '@' sign, which causes the command to fail...\n\nAny idea why this happens (and how I can solve it)?!?" ]
[ "powershell", "scriptblock" ]
[ "Convert binary data to its ASCII equivalent without using String object in Arduino", "I am using Arduino. I have the following code which converts binary data to its ASCII equivalent. It uses the String object.\n\nstatic uint16_t index = 0;\nstatic char buffer[1600]; //contains binary data 0x11, 0x22, 0x1, 0xa ...\n\nString msg;\nindex = strlen(buffer);\nfor (i=0; i < index; i++)\n{\n //Produce a zero in front for single digits. Examples, 0x5 transforms into 05, 0xa transforms into 0a\n if (buffer[i] <= 0x0F)\n {\n msg += \"0\";\n }\n\n msg += String(buffer[i], HEX); //msg contains the ASCII equivalent of buffer \n}\n\n\nHow can the code be modified such that the String object is not used but the same objective is accomplished?" ]
[ "c++", "c", "string", "arduino" ]
[ "Update HTML when change is noticed in MySQL Database", "So sorry if this is a total newbie question, but I can't seem to find any answers to my question out here on the great web...\n\nI'm building a site, where it depends that some of the data on the page needs to be updated automatically....\n\nMore specific, when a change is made in the MySQL Database. Let's say for instance that the value of a row in the database is 10, and that changes to 11, I need the page to automatically get this from the database, and update it on the site. Also, if possible, is there any way I could make the numbers \"pop out\" a little bit, when the actual data is changing?\n\n<div class=\"container hero-unit\">\n <h1>Test Data Change</h1>\n <p>231</p>\n <p>7</p>\n <p>14532</p>\n</div>\n\n\nLet' say that these numbers are fetched from the database, how would I use 'AJAX' to auto change this data when a change is made to the database?\n\nIf this is possible at all, I would appreciate every contribution....." ]
[ "php", "mysql", "ajax", "html" ]
[ "How to get logged in user in windows server using C# when \"Application owner\" is admin and not a logged in user?", "I am writing an application that will run on windows server.\nThe scenario is that user will login using normal domain account and application will run using administrator account.\nI need to get the user currently logged in to windows to do some processing.\nwhen I get user name using following method it gives me the admin account used to run the exe and not the account logged in to windows current session.\nstring username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;\n\nThen I tried following method to get the logged in user\nManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT UserName FROM Win32_ComputerSystem");\nManagementObjectCollection collection = searcher.Get();\n\nstring username = (string)collection.Cast<ManagementBaseObject>().First()["UserName"];\n\nThis code is working fine on windows 10 and giving me the user currently logged in to windows. But on windows server 2012 it is returning empty string.\nHow can I get the logged in user when running the exe on windows server??\nI dont want to know how many sessions are running on windows server. i want to know the current logged in user." ]
[ "c#", "windows-server-2012-r2" ]
[ "Bootstrap Equal Column", "We were told to use this to get a question answered.\n\nThe following is a breakdown of our Menu; we apologize for the shape of the CSS/HTML/JS but were unaware as to how present it otherwise.\n\nWe're attempting to have all column/rows on the same height.\nWe're aware of row-eq-height but are apparently doing it wrong.\n\nThe code is as below:\n\nFull Clip:\nhttps://pastebin.com/Kc9KTkZU\n\nExerp:\n\n<div class=\"row-eq-height\">\n <div class=\"col-md-6 col-md-offset-3\">\n <!-- Tab panes -->\n <div class=\"tab-content faq-cat-content\">\n <div class=\"tab-pane active in fade\" id=\"faq-cat-1\">\n <div class=\"panel-group\" id=\"accordion-cat-1\">\n <div class=\"panel panel-default panel-faq\">\n <div class=\"panel-heading\">\n <a data-parent=\"#accordion-cat-1\" data-toggle=\"collapse\" href=\"#faq-cat-1-sub-1\">\n <h4 class=\"panel-title\">Sharable Appetizers <span><i class=\"glyphicon glyphicon-plus\"></i></span>\n <span><img src=\"images/menu-top-a.png\" style=\"width:100%;\"></span></h4></a>\n </div>\n <div class=\"panel-collapse collapse\" id=\"faq-cat-1-sub-1\">\n <div class=\"panel-body\">\n <div class=\"row-eq-height form-group\">" ]
[ "javascript", "html" ]
[ "Is it possible to create a submenu from the top Tab Bar in tvOS?", "Does anyone know if there is built in functionality of UITabBarController to achieve a submenu that drops down after you highlight a section in the main top Tabbed navigation bar? This is for tvOS." ]
[ "ios", "uitabbar", "tvos", "television", "apple-tv" ]
[ "How do I use super-sed's Perl regex dot match?", "I'm trying to use super-sed's Perl regex /S, but can't get it to work at all. This flag makes dots match newlines. This would be a very handy tool, if only I could understand how it's used! For example, I expect the following command will match and replace the pattern which spans across a newline to be replaced with Xs: \n\necho \"(123) 456-7890\\n(212) 567-9050\" | ssed -R -e \"s/78.*?5/x/S\"\n\n\nSo, I am expecting this output: \n\n(123) 456-XXXX\nXXXXXXX67-9050\n\n\nInstead I get (no match): \n\n(123) 456-7890\n(212) 567-9050" ]
[ "regex", "sed" ]
[ "Create new row in specific sheet of the excel document VS C#", "I know that this problem may be addressed in another asked question, is not cause I lost 2 days trying them all.\nLets start the topic:\n-I have an desktop app made in Visual Studio Express 2017, C# code used.\n-I take 3 variables that I want to store in an excel document that has multiple sheets: Overtime nr. of hours, Day, comment.\nEvery sheet belongs to an individual that is based on pc username.\nstring datforOV = monthCalendar1.SelectionRange.Start.ToShortDateString(); //data string\n double hours = decimal.ToDouble(numericUpDown1.Value) + decimal.ToDouble(numericUpDown2.Value) * 0.1; //number of hours\n string box = richTextBox1.Text; //content of text box\n\n Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();\n Microsoft.Office.Interop.Excel.Worksheet xlsht = new Microsoft.Office.Interop.Excel.Worksheet(); \n string path = @"Z\\OLP.xlsx";\n xlsht = xlApp.Application.Workbooks.Open(path).Worksheets[Environment.UserName];\n\nI need to add a new row, in the sheet named already after the Username, and fill the first column with nr of hours, second column with the day, and the next one with the comment.\nPlease help me cause I started losing my minds. Thank in advance." ]
[ "c#", "excel", "visual-studio" ]
[ "Apply different Color to Image using CSS", "I have the following image: http://imgur.com/FqQtNSt. If I wanted to change this image so that I could apply different color (to say for example the iphone screen) via CSS properties what would I need to change in the image/how would i go about doing it ?" ]
[ "css" ]
[ "Using Ruby's ri tool can I get a list of classes that inherit the same method(s)?", "Using Ruby's ri tool can I get a list of classes that implement the same method(s)? For example\nLet's say that I wanted to know what classes implement freeze how would I find that out us ri?" ]
[ "ruby" ]
[ "Django 1.8: Annotation of the queryset members count WITHOUT filtering", "How can I use the Django 1.8 ORM to count, how many members an object has? \n\nFor example: \nHow can I SORT all workers by the count of the software, their company is using?\n\n\nBill 3 (Windows, Office, Visio)\nTom 2 (Windows, Office)\nAnton 1 (Office)\nPeter 0\nStephan 0\n\n\nCode:\n\ndef Software(model.Model):\n name = models.CharField(max_length=200)\n\ndef Company(models.Model):\n software = models.ManyToManyField(Software)\n\ndef Worker(models.Model):\n company = models.ForeignKey(Company)\n\nsoftware = Software.objects.filter(price>60) # [<Software: Windows>,...] \nworkers = Worker.objects.filter(company__software__in=software).\n annotate(software_count=Count('company__software‘))\n\nfor worker in workers:\n print „%s %s (%s)\" % (worker.name, worker.software_count, ...)\n\n\nThe tricky part is that I don’t want to filter BUT ONLY want to annotate the count of the software, used of the given list.\n\nAny help is appreciated :-)" ]
[ "django-models", "django-queryset", "data-annotations", "django-orm", "django-1.8" ]
[ "Remove NSArrayControllers selectedObjects on creation", "I have a NSArrayController which gets populated using Cocoa Bindings from a CoreData NSMangedObject Model. When I check the contents of the controllers array the first model object is always present in selectedObjects.\n\nThis is a problem because I bind this ArrayController to a CollectionView and allow its items to be selectable by checking the 'Selectable' checkbox in Interface Builder. So when the CollectionView loads the first item can not be selected (causing an event to fire) as according to the array its already selected.\n\nI have tried removing the selectedObjects in awakefromNib but its always empty as it seems that the Cocoa Binding is the last thing to happen somewhere after awakefromNib.\n\nMaybe im going about this the wrong way but any ideas on this one would be much appreciated." ]
[ "objective-c", "cocoa", "core-data" ]
[ "Smooth Scrolling - Not scrolling all the way to the anchor tag", "I'm working on a website that I've decided to use smooth scrolling with a fixed sidebar navigation. But suddenly when I started adding content it does not scroll all the way down to my #contact anchor tag. Any ideas why it would do this? It seems to be an issue across IE, FF, and Chrome. \n\nhttp://encorevisions.com/proofsites/finaldrive/" ]
[ "javascript", "html" ]
[ "Import txt file into database need formatting and styling the data", "I am very new to database, I will try my best to explain myself clearly.\n\nI need to import a txt file into my database for my product descriptions, in the file has 4 different languages, but I only need English to be import, and it also require some formatting and styling the data such as to use HTML table, what could be the best way to do this?\n\nAny help will be much appreciate.\n\nKind regards" ]
[ "database", "database-design" ]
[ "How can my android app detect a dropped call?", "I am writing an app that is meant to be run during a call. After the user makes a call, and starts my app, I want my app to be able to know if the call is dropped from bad connection. Is this possible? Thanks" ]
[ "android" ]
[ "How to make one task run after a collection of tasks has finished in C#?", "I have a collection of tasks that have to finish before one last task is run. Specifically:\nprotected override async Task ExecuteAsync(CancellationToken stoppingToken)\n {\n var task1 = Task.Run(() =>\n {\n Thread.Sleep(5000);\n Console.WriteLine("Task1");\n });\n\n var task2 = Task.Run(() =>\n {\n Thread.Sleep(5000);\n Console.WriteLine("Task2");\n });\n\n var task3 = Task.Run(() =>\n {\n Thread.Sleep(5000);\n Console.WriteLine("Task2");\n });\n\n var last = Task.Run(() =>\n {\n Console.WriteLine("Last");\n });\n\n var tasks = new List<Task>();\n tasks.Add(task1);\n tasks.Add(task2);\n tasks.Add(task3);\n\n await Task.WhenAll(tasks).ContinueWith(t => last);\n }\n\nCurrently they finish like this:\nLast\nTask2\nTask3\nLast1\n\nI want them to finish like this:\nTask1\nTask2\nTask3\nLast\n\nThe order of first 3 does not matter, what matters is that Last task finishes last.\nI cannot block the thread or wait for the collection to finish and similar stuff, only the Last task has to perform after first three are done." ]
[ "c#", "asp.net", ".net", "asynchronous", "task" ]
[ "preg_replace, regex getting Text Parts", "I have the following problem:\n\nI have a Text with the e.g. the following Format:\n\nmin: 34.0 max: 79.0383 lifetime: 17% code:iweo7373333\n\n\nIt's not a fixed text Type, means min can also be -7.94884444 or so. How can i extract the parts in e.g. an array like \n\n$result['min'] = 34.0;\n$result['max'] = 79.0383\nand so on...\n\n\nI did it at the moment with replacing spaces, then replace \"min:\" with nothing, \"max:\", \"lifetime:\", ... with \",\" and then an explode... The main Problem is that sometimes other variables are between min, max, .... so the positions do not hold the correct values.\n\nAlso - i think - it's not a really good coding style or? Is this possible with regex or preg_replace?\n\nThanks,\nSascha" ]
[ "php", "regex", "preg-replace" ]
[ "EXCEL Search Data and complete data in a Row", "Good day guys! I would like to ask, I have this Macro code that I use in encoding data to another sheet in the excel\n\nSub RoundedRectangle1_Click()\nDim i, lastrow As Long\nIf ActiveSheet.Range(\"d6\") = \"\" Or ActiveSheet.Range(\"g6\") = \"\" Or ActiveSheet.Range(\"c9\") = \"\" Then\n MsgBox \"Please complete all fields!\"\n Exit Sub\nEnd If\n\nlastrow = Sheets(\"database\").Cells(Cells.Rows.Count, 2).End(xlUp).Row + 1\ni = 9\nDo While Cells(i, 3) <> \"\" And i < 29\n Sheets(\"Database\").Cells(lastrow, 2) = ActiveSheet.Range(\"g6\") ' Date\n Sheets(\"Database\").Cells(lastrow, 3) = ActiveSheet.Range(\"d6\") ' Ref\n Sheets(\"Database\").Cells(lastrow, 4) = ActiveSheet.Cells(i, 3) ' Code\n Sheets(\"Database\").Cells(lastrow, 5) = ActiveSheet.Cells(i, 4) ' Description\n Sheets(\"Database\").Cells(lastrow, 6) = ActiveSheet.Cells(i, 5) ' U/M\n Sheets(\"Database\").Cells(lastrow, 7) = ActiveSheet.Cells(i, 6) ' Qty\n Sheets(\"Database\").Cells(lastrow, 8) = ActiveSheet.Cells(i, 7) ' Price\n Sheets(\"Database\").Cells(lastrow, 9) = \"IN\" ' Transaction\n i = i + 1\n lastrow = lastrow + 1\nLoop\nMsgBox \"Saved Succesfully!\"\nThisWorkbook.Save\nCall RoundedRectangle2_Click\nEnd Sub\n\n\nwhat I want to achieve is that there is already an initial data that has been encoded in the target sheet and the macro will just find it and will fill out the data on it's respective columns" ]
[ "vba", "excel" ]
[ "Store AES key in Android", "i want to store AES key in AndroidKeyStore on pre-M device\n\ni tried to use key generated with KeyGenerator\n\nKeyGenerator keyGen = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES);\nkeyGen.init(256);\nSecretKey secretKey = keyGen.generateKey();\n\n\nbut i cannot access to that key from KeyStore, later i tried to use KeyPairGenerator\n\nKeyPairGenerator kpg = KeyPairGenerator.getInstance(\n KeyProperties.KEY_ALGORITHM_AES, \"AndroidKeyStore\");\nkpg.initialize(new KeyPairGeneratorSpec.Builder(this)\n .setAlias(\"alias\")\n .build());\nKeyPair kp = kpg.genKeyPair();\n\n\nbut \n\n\n java.security.NoSuchAlgorithmException: KeyPairGenerator AES implementation not found" ]
[ "android", "encryption", "keystore", "android-keystore" ]
[ "Touch to Stop scrolling on listview does not work", "Suppose that I have 100 item in my listView. When I scroll up and down, and I try to touch to stop the scrolling. But it's not work. It scroll until it reach the item of the first scroll touch. \n\nIs it the phone problem or my app missing some implementing ?" ]
[ "android", "listview", "scroll" ]
[ "When comparing characters, is ischar(x) && x == 'b' equivalent to strcmp(x, 'b')?", "In MATLAB, I often use this to check if a variable contains a certain single character:\n\nif ischar(x) && x == 'b'\n\n\nto reduce clutter I'm thinking of changing it to this:\n\nif strcmp(x, 'b')\n\n\nbecause if x isn't a character or isn't equivalent to 'b', the comparison returns false as you would expect. Are these statements equivalent in this case or are there gotchas?\n\nMore info: x == 'b' isn't enough because this returns true when x == 98, but in certain cases (like validating user input), 98 may be invalid input while b is valid input. Also, the first one fails if x isn't a standard data type (if it's an object for example). Take this (stupid) example:\n\nx = table();\nx == 'b'\n\n\nThis throws an error because eq isn't defined for tables, but strcmp(x, 'b') returns 0 because it appears that strcmp also performs a type check. Whether or not this exception handling is desirable probably depends on the circumstances though." ]
[ "matlab" ]
[ "Choosing between Critical Sections, Mutex and Spin Locks", "What are the factors to keep in mind while choosing between Critical Sections, Mutex and Spin Locks? All of them provide for synchronization but are there any specific guidelines on when to use what?\n\nEDIT: I did mean the windows platform as it has a notion of Critical Sections as a synchronization construct." ]
[ "c++", "multithreading" ]
[ "Custom UISlider doesn't go to end", "I have created a UISlider that has tick marks and snaps to each tick when the value is changed. The problem is that the slider doesn't naturally go to the ends and the left and right tick are visible outside of the circle. I have extended the UISlider class to go to the ends but the animation conflicts with moving the slider to the next tick and the circle ends up off the screen. How can I keep the snap to tick animation and have the circle in the slider go all the way to the end? Here is my code\n\nclass CustomSlider: UISlider {\n\n override func thumbRect(forBounds bounds: CGRect, trackRect rect: CGRect, value: Float) -> CGRect\n {\n let unadjustedThumbrect = super.thumbRect(forBounds: bounds, trackRect: rect, value: value)\n let thumbOffsetToApplyOnEachSide:CGFloat = unadjustedThumbrect.size.width / 2.0\n let minOffsetToAdd = -thumbOffsetToApplyOnEachSide\n let maxOffsetToAdd = thumbOffsetToApplyOnEachSide\n let offsetForValue = minOffsetToAdd + (maxOffsetToAdd - minOffsetToAdd) * CGFloat(value / (self.maximumValue - self.minimumValue))\n var origin = unadjustedThumbrect.origin\n origin.x += offsetForValue\n return CGRect(origin: origin, size: unadjustedThumbrect.size)\n }\n}\n\n@IBOutlet weak var slider: CustomSlider!\n\nlet tickArray : [Float] = [Float(18),Float(20),Float(22),Float(24),Float(26),Float(28),Float(30)]\n\n override func viewDidLoad() {\n super.viewDidLoad()\n\n self.slider.value = tickArray[0]\n self.slider.minimumValue = tickArray[0]\n self.slider.maximumValue = tickArray[6]\n self.slider.isContinuous = false\n\n\n\n var tick : UIView\n for i in 0..<tickArray.count-1 {\n tick = UIView(frame: CGRect(x: (self.slider.frame.size.width/6) * CGFloat(i), y: (slider.frame.size.height - 13) / 2, width: 2, height: 13))\n tick.backgroundColor = \"8E8E93\".hexColor\n slider.insertSubview(tick, belowSubview: slider)\n }\n\n tick = UIView(frame: CGRect(x: self.slider.frame.size.width-2, y: (slider.frame.size.height - 13) / 2, width: 2, height: 13))\n tick.backgroundColor = \"8E8E93\".hexColor\n slider.insertSubview(tick, belowSubview: slider)\n\n }\n\n @IBAction func sliderValueChanged(_ sender: UISlider) {\n\n\n if sender.value > tickArray[5] {\n slider.value = tickArray[6]\n } else if sender.value > tickArray[4] {\n slider.value = tickArray[5]\n } else if sender.value > tickArray[3] {\n slider.value = tickArray[4]\n } else if sender.value > tickArray[2] {\n slider.value = tickArray[3]\n } else if sender.value > tickArray[1] {\n slider.value = tickArray[2]\n } else if sender.value >\n tickArray[0] {\n slider.value = tickArray[1]\n } else {\n slider.value = tickArray[0]\n }\n }" ]
[ "ios", "swift", "animation", "uislider" ]
[ "Problem in Saving data in excel file in python", "I need to save my result into excel file. I am executing these lines of code but the abc.xlsx is empty. why can anyone help me?\ndata1= data[data.columns[df.isnull().mean() < 0.8]]\ndata1.to_excel('abc.xlsx')\n\n\nimport matplotlib.pyplot as plt\nimport openpyxl\ndata = pd.read_csv('/kaggle/data/mydata.csv')\ndata.head(3)\ndata.dtypes\n\ndata1= data[data.columns[df.isnull().mean() < 0.8]]\ndata1.to_excel('abc.xlsx')\n\nWhile executing data1.to_excel('abc.xlsx') this .. the generated excel file is only 0KB why?" ]
[ "python", "openpyxl" ]
[ "Wpf ComboboxEdit from binding global list", "<dxg:GridColumn.EditTemplate>\n <ControlTemplate>\n <dxe:ComboBoxEdit \n HorizontalContentAlignment=\"Left\"\n ItemsSource=\"{Binding HizmetSaglayiciList}\"\n SelectedItem=\"{Binding Hiz_Sag_Id, Mode=TwoWay}\"\n ValueMember=\"Hiz_Sag_Id\"\n IsTextEditable=\"False\"\n AllowNullInput=\"False\" \n AutoComplete=\"False\" \n ImmediatePopup=\"False\" \n EditMode=\"InplaceActive\"/>\n </ControlTemplate>\n </dxg:GridColumn.EditTemplate>\n\n\nI have global list called HizmetSaglayiciList, but \nThe combobox does not open when I press the edit button.\n\nI am writing missing any place." ]
[ "c#", "wpf", "xaml", "combobox", "devexpress" ]
[ "Does Context need to be explicitly set for a ImageButtons when they are created in an array?", "So I'm trying to dynamically create ImageButton in an Android app. I'm at a point where I'm creating them in an array like so:\n\nint size = 10; //you can pretend that this is actually dynamic\nImageButton[] imageButtons = new ImageButton[size]\nfor(ImageButton imageButton: ImageButtons)\n{ imageButton.setId(id);\n imageButton.setCropToPadding(true);\n imageButton.setAdjustViewBounds(true);\n imageButton.setScaleType(ImageView.ScaleType.FIT_XY);\n imageButton.setBackground(null);\n //etc....\n}\n\n\nDoes the Context that is required for the ImageButton constructor assume the correct Context when they are created like this or do I need explicitly create each ImageButton with the correct Context and then add them to an Array or ArrayList?" ]
[ "java", "android", "arrays" ]
[ "Blank lines on text box widget", "I have an issue with getting the contents of a tkinter text box. If I paste information into it from Excel (for example), it always adds an empty line at the bottom. I would like to remove that line automatically. This is what I use to get the contents:\n\ncontents = inputText.get(1.0, \"end-1c\")\nfor line in contents.split(\"\\n\"):\n line = line.strip()\n\n\nI initially added a '[:-1]' on the end of that, which works, but only on text that is pasted into the text box. If you type text in manually, then obviously there's no trailing '\\n' on the end, so it ends up removing the last character that was typed. Not good!\n\nHow can I get it to remove (or ignore) the trailing empty lines? The 'line = line.strip()' in the code further down seems to have no effect.\n\nThanks, Chris." ]
[ "windows", "python-2.7", "tkinter" ]
[ "JavaEE @Injection / @EJB returns null", "I'm new to JavaEE programming and I'm having difficulties with @Injection. To familiarize mysels with databases, I decided to create a simple CRUD application and followed this example: https://code.google.com/p/javaee6-crud-example/source/browse/ I created basically same files but somehow, I'm getting a null exception after @EJB. \n\n@RequestScoped\n@ManagedBean\npublic class MainUcenci {\n private List<Ucenec> ucenci;\n\n @EJB\n private ServletDAO servletDao;\n\n\n @PostConstruct\n public void init(){\n ucenci = servletDao.getUcenci();\n }\n\n public List<Ucenec> getUcenci(){\n return ucenci;\n }\n\n}\n\n\nafter testing I found out that when init() is called, servletDao is still null despite the fact that it should have been injected by then (isn't the whole point of init method that it's called after all injections?).\n\nHere is also the relevant part of ServletDao code\n\n@Stateless\npublic class ServletDAO {\n EntityManagerFactory emf = Persistence.createEntityManagerFactory(\"$objectdb/db/sola_ucenec.odb\");\n EntityManager ucenecEm = emf.createEntityManager();\n\n public List<Ucenec> getUcenci() {\n\n List<Ucenec> ucenecList = null;\n\n ucenecList = ucenecEm.createQuery(\"SELECT g FROM Ucenec g\", Ucenec.class).getResultList();\n\n return ucenecList;\n }\n\n}\n\n\nP.S. In JSF I call it like: \n\n<ui:repeat value=\"#{mainUcenci.ucenci}\" var=\"item\">" ]
[ "java", "jakarta-ee", "ejb" ]
[ "unknown database with mysql-connector in python", "I'm new to dealing with databases. I created a simple database in phpmyadmin and joined it with another database. Now I'm trying to access the database in python with the mysql-connector module, but python doesn't seem to be able to detect it. I've named and saved my database as the one below, but I have no idea if this even connects or can find it. I converted the DB to a .sql, but I don't know what to do with it.\nimport mysql.connector\n\nmydb = mysql.connector.connect(\n host='localhost',\n user='root',\n password='',\n database='python_sql',\n )\n\nFurthermore, I have practically no knowledge of PHP, so I wasn't able to write some fancy script as some do. I see in the tutorials people get through this step no problem even when they make the program in phpmyadmin, so I don't know whats wrong with my code. When I run it, I get the following error.\nTraceback (most recent call last):\n File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 216, in _open_connection\n self._cmysql.connect(**cnx_kwargs)\n_mysql_connector.MySQLInterfaceError: Unknown database 'python_sql'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/Users/johnminton/Documents/Python/Python database internal/mysql-db.py", line 7, in <module>\n database='python_sql'\n File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mysql/connector/__init__.py", line 264, in connect\n return CMySQLConnection(*args, **kwargs)\n File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 80, in __init__\n self.connect(**kwargs)\n File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mysql/connector/abstracts.py", line 966, in connect\n self._open_connection()\n File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 219, in _open_connection\n sqlstate=exc.sqlstate)\nmysql.connector.errors.ProgrammingError: 1049 (42000): Unknown database 'python_sql'\n\nEDIT: when I remove the 'database=python_sql' I get no error, so it seems to connect fine to my localhost" ]
[ "python", "mysql", "database", "mysql-connector" ]
[ "xml to c++: handling escape characters <=", "I am using xsl to convert data from xml into C++ code. I am running into problems when I have &lt;= or >= in the xml file that needs to be converted to C++ code.\n\nFor example if I have (in .xml file)\n\n \n&lt;Check&gt;max(x,y) &lt;= 20 &lt;/Check&gt;\n \n\nand the .xsl file is \n\n\n\nif(&lt;xsl:value-of select=\"Check\"/&gt;\") {\n...\n}\n\n\n\nBut this does not compile as XML errors out on seeing &lt;=. \n\nI tried &amp;lt;= in xml file but I don't get &lt;= in C++ file but I get &amp;lt;=. To be user friendly I need to have &lt;= in xml file rather than &amp;lt;=.\n\nHow can I fix the code within if() condition so that I can handle all the escape characters in xml and properly output them to a C++ file?\n\nThanks\nAnand" ]
[ "c++", "xml" ]
[ "Python: How to change text of a message widget to a user input", "So I'm making a program which requires a user to enter in a value. I want the value to be displayed via the message widget (or label widget) and updates whenever a new input is enter.\n\ndef Enter():\n s = v.get()\n print (v.get())\n\n e.delete(0, END)\n e.insert(0, \"\")\n\n#Code, Code, Code\n...\n\n# Area To Enter Text\nv = StringVar()\ne = Entry(root, textvariable=v)\ne.pack()\n\nm = Message(root, text = \"Your Input\")\nm.pack()\n\n# Enter Button\nb = Button(root, text=\"OK\", command=Enter)\nb.pack()\n\n\nIs there a way for the variable of v to replace the text of Message Widget??\n\nNote:\n\nIf I replace text with textvariable, it updates the text after every character key is pressed, where as I need it to update when the user presses the button.\n\n\n\nMy complete code:\n\nfrom tkinter import *\nimport os\n\n# All Functions Below\ndef callback():\n print (\"HI\")\n\ndef Exit():\n os._exit(0)\n\ndef Enter():\n s = e.get()\n print (e.get())\n m.configure(text=s)\n e.delete(0, END)\n e.insert(0, \"\")\n\ndef Population():\n root = Tk\n\n root.mainloop()\n\ndef SurvivalRate():\n root = Tk\n\n root.mainloop()\n\ndef BirthRate():\n root = Tk\n\n root.mainloop()\n\ndef NewGen():\n root = Tk\n\n root.mainloop()\n\nroot = Tk()\n\n\ngeneration = 0\n\nmenubar = Menu(root)\nmenubar.add_command(label=\"Hello!\", command=callback)\nmenubar.add_command(label=\"Quit!\", command=Exit)\n\n\n# Area To Enter Text\ne = Entry(root)\ne.pack()\n\nm = Message(root, text = e)\nm.pack()\n\n# Enter Button\nb = Button(root, text=\"OK\", command=Enter)\nb.pack()\n\nPop = Button(root, text=\"Population\", command=Population)\nPop.pack()" ]
[ "python", "tkinter" ]
[ "The Error message \"\"index\" argument is expected to be a number, but it was number\" is unclear", "While writing automated test for a website I got the following very odd error in here are the relovent lines of code: \n\n 68 let selected\n 69 if( params.includes('-RB') ){\n 70 let books = Selector('.actions &gt; .link-learn &gt; div').withText('VIEW PRODUCT')\n 71 const index = books.count\n 72 selected = books.nth( Math.floor(Math.random() * index) );\n 73 }\n\n\nand testcafe is making the following complaint at line 72.\n\n \"index\" argument is expected to be a number, but it was number.\n\n\nAnd there are no strings, variables, etc. named with name number in my program. So what does this error mean and maybe this error should throw a different message that is slightly more clear. \n\nthanks" ]
[ "javascript", "testing", "automated-tests", "e2e-testing", "testcafe" ]
[ "AWS s3 and minio incompatibility signature checking if url params contains ;", "I have a problem with incompatibility between minio(RELEASE.2019-07-17T22-54-12Z) and AWS S3\n\n\nI request the generation of pre-signed URL for download file from minio\nFrom minio I got pre-signed URL that contains part response-content-disposition=attachment%3Bfilename%3D%22test.zip%22\nThen Google-HTTP-Java-Client/1.25.0 make the request to get this file\nminio return below error:\n\n\n&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;Error&gt;\n &lt;Code&gt;SignatureDoesNotMatch&lt;/Code&gt;\n &lt;Message&gt;The request signature we calculated does not match the signature you provided. Check your key and signing method.\n &lt;/Message&gt;\n ...\n&lt;/Error&gt;\n\n\n\nI have found out that signature is wrong because Google-HTTP-Java-Client/1.25.0 before send request encode %3B to ; that change signature\n\n\nMy question is why AWS S3 can handle this case without problems?" ]
[ "amazon-s3", "minio" ]
[ "Can we pull non measure columns from Fact Table of a Multidimensional cube", "Can we get non measure columns from Fact Table of a Multidimensional cube because while building cube i am not able to get non measure columns" ]
[ "ssas", "olap-cube" ]
[ "Java networking server-client error", "I'm trying to program a (simple, for starters) server-client thingy, just to establish a connection and see if it works. And it does. As long as I stay inside my own four walls/network. As soon as I try to go via my routers IP the client produces a mighty fine error message. All the usual suspects have been eliminated: Router Port forwarding is on, the firewall doesn't interfere (well, it still doesn't work when I turn it off), and canyouseeme.org says that it can establish a connection to my chosen port when the server runs.\n\nHere is the source code for the server, since I figured out it was possible to just go via the command line with a little telnetting.\nWhen I try to establish a connection, it just says Could not open connection to the host, on port 49163:Connection failed\n\nServer:\n\nimport java.net.*;\nimport java.io.*;\n\npublic class ChatServer {\n public static void main(String[] args) throws IOException {\n\n ServerSocket server = null;\n\n try {\n System.setProperty(\"java.net.preferIPv4Stack\" , \"true\");\n server = new ServerSocket(49163);\n } catch (IOException e) {\n System.err.println(\"Could not listen on port: 49163.\");\n System.exit(1);\n }\n\n Socket client = null;\n try {\n client = server.accept();\n } catch (IOException e) {\n System.err.println(\"Accept failed.\");\n System.exit(1);\n }\n\n PrintWriter out = new PrintWriter(client.getOutputStream(), true);\n BufferedReader in = new BufferedReader(newInputStreamReader(client.getInputStream()));\n String inputLine;\n String outputLine;\n\n out.println(\"Connection established\");\n while ((inputLine = in.readLine()) != null) {\n if (inputLine.equals(\"exit\")) {\n break;\n }\n outputLine = inputLine;\n out.println(outputLine);\n }\n out.close();\n in.close();\n client.close();\n server.close();\n System.out.println(\"Server offline\");\n }\n}\n\n\nOh yeah, preferIP4vStack was something I picked up on Stackoverflow, but it doesn't seem to work for me.\n\nFor some reason I'm not able to inlcude the code for the client, I keep getting messages about formatting, and I just can't figure it out. But the way I see it is that I'm not even able to connect via the command line (when I try to connect to the \"real\" IP), so the client doesn't have to get involved. But for you who want to see the error anyway:\n\n\njava.net.ConnectException: Connection refused: connect\n at java.net.PlainSocketImpl.socketConnect(Native Method)\n at java.net.PlainSocketImpl.doConnect(Unknown Source)\n at java.net.PlainSocketImpl.connectToAddress(Unknown Source)\n at java.net.PlainSocketImpl.connect(Unknown Source)\n at java.net.SocksSocketImpl.connect(Unknown Source)\n at java.net.Socket.connect(Unknown Source)\n at java.net.Socket.connect(Unknown Source)\n at java.net.Socket.&lt;init&gt;(Unknown Source)\n at java.net.Socket.&lt;init&gt;(Unknown Source)\n at ChatClient.main(ChatClient.java:12)" ]
[ "java", "networking", "connection" ]
[ "Pass a variable to Ajax URL", "I'm trying to add a variable (integer) in URL to be used in an Ajax request:\n\nIn my HTML, I have:\n\n&lt;span class=\"user\"&gt;15&lt;/span&gt;\n\n\nAnd the script:\n\n$('#fileupload').click(function () {\n $(this).fileupload({\n dataType: 'json',\n done: function (e, data) {\n $.each(data.result.files, function (index, file) {\n if (file.error != null) {\n $console.text(file.error);\n }\n var user = parseInt($(\".user\").text(), 10);\n //Open the uploaded file//\n $.ajax({\n url: \"files/\" + user + '/' + file.name,\n dataType: 'json',\n type: 'GET',\n success: function (res) {\n handsontable.loadData(res.data);\n $console.text('Loaded file: ' + file.name);\n }\n });\n });\n }\n });\n});\n\n\nHowever, the variable (15) isn't being passed to the URL, I get the error:\n\n/files/NaN/data.json\n\n\nI know I'm doing something stupid, and searched everywhere, but what is it?" ]
[ "javascript", "jquery", "ajax" ]
[ "Differences in iteration between PHP's foreach and for", "I'm able to iterate over a PHP array using foreach, but not with a for loop:\n\nthis does not work:\n\nfor($j = 0; $j &lt; sizeof($jobsFilterA); $j++) {\n echo $j . $jobsFilterA[$j] . \"&lt;br&gt;\";\n}\n\n\nthis does:\n\nforeach($jobsFilterA as $job) {\n echo $job . \"&lt;br&gt;\";\n}\n\n\nI've got 5 different arrays, some of which were simply built from database extract, others built then trimmed by removing specific indices.\n\nGetting the feeling I've just got empty indices due to use of the unset function now that I type this all out.\n\nCan I remove unset indices or how would be the proper way of rebuilding the array?\n\nThanks in advance!\n\nTried iterating over multiple different arrays in different ways.\n\nCode is above.\n\nUnset indices in the for loop throw an undefined offset exception/error.\n\nIn the end, these 5 arrays need to be echoed into a table.\nI've been doing that via a for loop like so:\n\n/*\n* Echo data into a table\n*/\necho '&lt;tbody&gt;';\nfor($i=0; $i &lt; sizeof($jobsFilterA); $i++){\n echo \"&lt;tr&gt;&lt;td&gt;\" . strtoupper(substr($custLastNames[$i], 0, 4)) . \"&lt;/td&gt;\";\n echo \"&lt;td width='100'&gt;\" . $jobsFilterA[$i] . \"&lt;/td&gt;\";\n echo \"&lt;td&gt;\" . $waxDueDates[$i] . \"&lt;/td&gt;\";\n echo \"&lt;td&gt;\" . $dayDifferences[$i] . \"&lt;/td&gt;\";\n echo \"&lt;td&gt;\" . $revisedETAs[$i] . \"&lt;/td&gt;&lt;/tr&gt;\";\n}\necho '&lt;/tbody&gt;'\n\n\nwhich is why I'm hoping I can reorganize the arrays so that their data is indexed in alignment/with continuity." ]
[ "php" ]
[ "check if array has this value and then grab it and place it an a variable", "I have a string like the one below\n\n20Nov 18:14:xxxxxxxxxx has given 10 points to xxxxx. New bitcoin collection Balance:XXXXXXXX. Ref:675743957424\n\nI will explode it and it will then be turned into an array.\n\nBut I want to check if the array has Ref:675743957424 and then place it inside a variable like for example $a.\n\nI want to do this since the string might change from one point to another so the position of Ref is not fixed.\n\nHow Can i obtain such thing?\n\nThanks.\n\nEdited\n\nI tried not exploding it but instead try grabbing the data see code below\n\n&lt;?php\n $line = \"20Nov 18:14:xxxxxxxxxx has given 10 points to xxxxx. New bitcoin collection Balance:XXXXXXXX. Ref:675743957424\";\n // perform a case-Insensitive search for the word \"Vi\"\n\n if (preg_match(\"/\\bRef\\b/i\", $line, $match)) :\n print \"Match found!\";\n //how can I grab the Ref part?\n endif;\n\n\n?>" ]
[ "php", "arrays" ]
[ "Interactive Batch File", "How to proceed with an interactive batch file?\n\nEg.,\n\nDO you want to continue? [y/n]\n\nIf 'y' Goto Label1\n\nElse Goto Label2\n\nThanks" ]
[ "batch-file", "dos" ]
[ "Why doesn't my FlowDocument use the whole width?", "I am converting HTML to XAML and loading it in a StackPanel with FlowDocumentScrollViewer. The content is rendering correctly from the HTML. My issue is the content or the FlowDocument does not appear to use the whole width.\n\nThe html to xaml conversion looks like this \n\n&lt;FlowDocument xml:space=\"preserve\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"&gt;\n&lt;Paragraph&gt;Central Contractor Registration Is Free It Shouldn't Cost You A Dime &lt;/Paragraph&gt;\n&lt;Paragraph&gt;Central Contractor Registration is free. The federal government does not charge a fee to register your business in the central contractor registration database. I am telling you that central contractor registration is free because there is some confusion out there and I want to [...] &lt;/Paragraph&gt;\n&lt;/FlowDocument&gt;\n\nDim conversionhtml As String = \"&lt;FlowDocument xml:space=\"\"preserve\"\" xmlns=\"\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\"&gt;&lt;Paragraph&gt;Central Contractor Registration Is Free It Shouldn't Cost You A Dime &lt;/Paragraph&gt;&lt;Paragraph&gt;Central Contractor Registration is free. The federal government does not charge a fee to register your business in the central contractor registration database. I am telling you that central contractor registration is free because there is some confusion out there and I want to [...]&lt;/Paragraph&gt;&lt;/FlowDocument&gt;\"\nDim fd As FlowDocument = DirectCast(Markup.XamlReader.Parse(conversionhtml), FlowDocument)\nDim fdr As New FlowDocumentScrollViewer()\nfdr.Document = fd\nFeedsDisplay.Children.Add(fdr)\n\n\nfeedsdisplay is a normal stackpanel. The issue is the flowdocumentscrollviewer uses the whole width but it looks like the flow document only uses about 40 %\n\nWhat am I overlooking? Thanks in advance!" ]
[ "c#", "wpf", "vb.net", "flowdocument" ]
[ "Reusing UITableViewCell with GCD", "I'm using Grand Central Dispatch to load images of a UITableViewCell asynchronously. This works well except in some border cases in which the cell is reused, and a previous block loads the wrong image.\n\nMy current code looks like this:\n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n static NSString *CellIdentifier = @\"Cell\";\n\n UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];\n if (!cell) {\n cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];\n }\n\n NSString *imagePath = [self imagePathForIndexPath:indexPath]; \n dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);\n\n dispatch_async(queue, ^{\n UIImage *image = [UIImage imageWithContentsOfFile:imagePath];\n\n dispatch_sync(dispatch_get_main_queue(), ^{\n cell.imageView.image = image;\n [cell setNeedsLayout];\n });\n });\n\n return cell;\n}\n\n\nAs far as I know GCD queues cannot be stopped. How can this border case be prevented then? Or should I be using something else instead of GCD to solve this problem?" ]
[ "iphone", "ios", "uitableview", "grand-central-dispatch" ]
[ "Find number with optional leading zeros but not starting with another digit", "I need to find a specific number with optional leading zeros but not starting or ending with another digit.\n\nSample line:\n\n\"123456, 123456A, A123456, A123456A, 0123456, 9123456, 1234567, ABCD0000123456 or /123456\"\n\n\nRegex I'm currently using:\n\n\"0*?[^1-9]123456(?!\\d)\"\n\n\nCurrent matches: \n\n 123456\nA123456\nA123456\n0123456\n0000123456\n/123456\n\n\nHow to avoid the 123456,A123456 and /123456 matches (want to match only 123456 from these). A or ABCD can be any other character except digits!\n\nDesired matches:\n\n123456\n123456\n123456\n123456\n0123456\n0000123456\n123456\n\n\nWhat's the best regex for this?\nThanks in advance" ]
[ "regex", "python-3.x" ]
[ "Error with multiple for loop with if statement", "I am trying to create a function in R that will produce a table of results from uni-variate and multivariate regression models \n\n\nPlease see my function code below:\n\nloganalmv&lt;- function(preds, preds2, resp, data){\n\n #create empty variables\n\n uni&lt;- NA\n unic&lt;- NA\n mvc&lt;- NA\n r&lt;- NA\n\n #create models\n mv&lt;- loganal(preds, resp, data)\nfor(i in 1:length(preds)){\n preds[i]&lt;- preds2[i]\n uni[i]&lt;- loganaluni(preds[i], resp, data)\n\n\n#create loop to call model information and create table rows\n for(j in 1:length(uni[[i]][[1]][[1]]$Text)){\n for(k in 1:length(mv[[1]][[1]]$Text)){\n #univariate models\n\n unic1[j]&lt;-uni[[i]][[1]][[1]]$Text[j] #Coef name\n unic2[j]&lt;-uni[[i]][[1]][[2]]$Text #n\n unic3[j]&lt;-uni[[i]][[1]][[3]]$Text[j] #OR\n unic4[j]&lt;-uni[[i]][[1]][[4]]$Text[j] #CI\n unic5[j]&lt;-uni[[i]][[1]][[5]]$Text[j] #P-value\n\n #multivariate model\n\n mvc1[k]&lt;- mv[[1]][[1]]$Text[k] #Coef name\n mvc2[k]&lt;- mv[[1]][[2]]$Text #n\n mvc3[k]&lt;- mv[[1]][[3]]$Text[k] #OR\n mvc4[k]&lt;- mv[[1]][[4]]$Text[k] #CI\n mvc5[k]&lt;- mv[[1]][[5]]$Text[k] #P-value\n\n #create rows\n if (!is.na(unic1[j]) || !is.na(mvc1[k])) {\n if(!is.na(unic1[j]) == !is.na(mvc1[k])){ #If the covariate names match add multivariate data\n r[j] &lt;- cbindTable(unic1, unic2, unic3, unic4, unic5, '', mvc2[k], mvc3[k], mvc4[k], mvc5[k], '') #last is comments column\n }else{\n #if not put '-' in multivariate columns\n r[j] &lt;- cbindTable(unic1, unic2, unic3, unic4, unic5, '', rep('-', 5), '') \n }\n\n #combine rows\n }\n out&lt;- rbindTable(r[j])\n } \n }\n}\n #print table\n\n return(out)\n}\n\n\npreds is the group of covariates to call individually\n\npreds2 is the group of covariates to call in the multivariate model. In this example I have used: \n\ndemog &lt;- c(\"gpid\", \"age\")\n\n\nresp is the response variable, data is my dataframe, loganaluni is the univariate function to create a glm model, loganal is the multivariate glm model function.\n\nWhen I call my function:\n\n loganalmv(demog,demog, 'excepted', anal)\n\nI get this output\n\n&gt; loganalmv(demog, demog, 'excepted', anal)\n[[1]]\n[[1]][[1]]\n[[1]][[1]]$Text\n[1] \"age \" \"gpid C\" \"gpid D\" \"gpid E\"\n\n\n[[1]][[2]]\n[[1]][[2]]$Text\n[1] 354 354 354 354\n\n\n[[1]][[3]]\n[[1]][[3]]$Text\n[1] \"1.05\" \"1.81\" \"1.70\" \"17.26\"\n\n\n[[1]][[4]]\n[[1]][[4]]$Text\n[1] \"(1.02, 1.08)\" \"(0.82, 3.99)\" \"(0.19, 15.22)\" \"(2.21, 135.04)\"\n\n\n[[1]][[5]]\n[[1]][[5]]$Text\n[1] \"&lt; 0.001\" \"0.141\" \"0.636\" \"0.007\" \n\n\n[[1]][[6]]\n[[1]][[6]]$Text\n[1] \"\"\n\n\n[[1]][[7]]\n[[1]][[7]]$Text\n[1] 354\n\n\n[[1]][[8]]\n[[1]][[8]]$Text\n[1] \"1.04\"\n\n\n[[1]][[9]]\n[[1]][[9]]$Text\n[1] \"(1.02, 1.07)\"\n\n\n[[1]][[10]]\n[[1]][[10]]$Text\n[1] \"0.002\"\n\n\n[[1]][[11]]\n[[1]][[11]]$Text\n[1] \"\"\n\n\nI would expect there to be data for 'gpid B' uni-variate model in rows 1:5 and also data from the multivariate model in rows 6 to 11 for the gpid levels - only age is as shown here.\n\nAny help is greatly appreciated!\n\nThank you in Advance!" ]
[ "r", "function", "output", "regression" ]
[ "Data conversion from byte array to String", "I'm trying to convert Byte Array to String with Following code snippet. But for some reasons, when i convert the byte[] to string, it changes the some content in in file\n\nCode\n\npublic String convertToString(byte[] byteArr)\n {\n public static final int BYTE_MASK = 0xFF;\n StringBuilder strBldr = new StringBuilder();\n\n for(int i = 0; i &lt; byteArr.length; i++ ) {\n strBldr.append((char) (byteArr[i] &amp; BYTE_MASK));\n }\n\n return strBldr.toString();\n }\n\n\nI have added the data of two files called expected file and generated file \n\nExpected File:\n\n00 39 00 00 46 91 00 00 00 17 16 02 16 16 39 31\n0b 00 3a 00 78 09 60 40 26 64 50 41 50 20 48 49\n47 20 52 4d 20 20 04 00 80 4b 02 00 a0 ea 01 00\n64 00 ec 05 00 00 00 00 00\n\n\nGenerated File:\n\n00 39 00 00 46 3f 00 00 00 17 16 02 16 16 39 31\n0b 00 3a 00 78 09 60 40 26 64 50 41 50 20 48 49\n47 20 52 4d 20 20 04 00 3f 4b 02 00 a0 ea 01 00\n64 00 ec 05 00 00 00 00 00\n\n\nif you see both files, then expected file data should be \"91\"(First row,sixth element) and its 3f in generated file.\n\nAny idea how would get a correct output?" ]
[ "java" ]
[ "Filtering data for grouped bar chart", "I'm trying to filter my dataset to just one year (1979) to display in my grouped bar chart which is based off Mike Bostock's example.\n\nSample:\n\n1979,Colorectal cancer,20378,19178\n1979,Lung cancer,63925,21093\n1979,Prostate cancer,6403,43923\n1979,Acute myocardial infarction,161723,45470\n1979,Cerebrovascular diseases,35719,29415\n1979,All stroke,31951,27062\n1979,Unintentional injuries,316585,98160\n1979,Suicides,89943,27078\n1980,Colorectal cancer,20065,18100\n1980,Lung cancer,65650,21993\n1980,Prostate cancer,6180,43938\n1980,Acute myocardial infarction,155525,44623\n1980,Cerebrovascular diseases,32367,28014\n1980,All stroke,28780,25437\n1980,Unintentional injuries,292815,95622\n...\n\n\nIn an earlier experiment I tried a piece of my dataset without Year and it was working fine. \n\nColorectal cancer,20378,19178\nLung cancer,63925,21093\nProstate cancer,6403,43923\nAcute myocardial infarction,161723,45470\nCerebrovascular diseases,35719,29415\nAll stroke,31951,27062\nUnintentional injuries,316585,98160\n1979,Suicides,89943,27078\n\n\nIt seems using my full dataset with the addition of Year is causing some problems in my code and I can't seem to pinpoint where things are broken. If anyone could help it'd be fantastic.\n\nLink to jsfiddle: http://jsfiddle.net/vyab4kcf/2/" ]
[ "d3.js" ]
[ "How to get a separate class to read a(n) string array from the main method", "first time doing this but ill try to be brief, currently I am trying to get my code to display names from another class that gets its information from the main method as part of the assignment for my class (confusing I know). basically this is what I have so far:\n\npublic class Main {\n\n\n public static void main(String[] args) {\n String[] Names = {\n \"Array 1\",\n \"Array 2\",\n \"Array 3\",\n \"Array 4\",\n \"Array 5\",\n \"Array (...)\",\n \"Array 40\",\n };\n\n\n\n for (String z : Names) {\n //instantiated\n String[] Name = null;\n\n //instantiated\n int minutes = 0; \n //instantiated\n int seconds = 0; \n\n Class1 object = new Class1(Names, minutes, seconds);\n seconds = object .getSeconds();\n minutes = object .getMinutes();\n Name = object .getName(Names);\n\n\n System.out.println(Name + \": \" + minutes +\" m \" + seconds + \" s.\");\n }\n\n }\n\n}\n\n\nand this is the separate class:\n\npublic class Class1{\n private String Name[];\n private double minutes;\n private double seconds;\n\n public int getMinutes() {\n minutes = Math.random() * 15;\n return (int) this.minutes;\n }\n\n public int getSeconds() {\n seconds = Math.random() * 59;\n return (int) this.seconds;\n }\n\n public void setMinutes(int minutes) {\n this.minutes = minutes;\n }\n\n public void setSeconds(int seconds) {\n this.seconds = seconds;\n }\n\n public String[] getName(String[] Names) {\n return Names;\n }\n\n\n\n public Song(String[] Names, int minutes, int seconds) {\n this.minutes = getMinutes();\n this.getName(Names);\n this.seconds = getSeconds();\n }\n}\n\n\nThat's it for my code. Currently the math.random for the seconds and minutes are working perfectly right now but the only this that is eluding me is the Names variable as it is printing out either null or [Ljava.lang.String; on the console. any help would be appreciated." ]
[ "java", "arrays", "class", "main" ]
[ "Node.js RangeError: Maximum call stack size exceeded", "I am trying to generate all possible combination of a name from my array productsDeduped and then store the generated combination as productTags array. Here is my code: \n\n//function to generate all possible combinations\nfunction getCombinations(array) {\n var i,\n result = [];\n for (i = 0; i &lt; array.length; i++) {\n result.push(\n array[i],\n ...getCombinations(array.filter((_, j) =&gt; i !== j)).map(v =&gt; array[i] + \" \" + v)\n );\n }\n\n return result;\n}\n\nfor (var i = 0; i &lt; arrLength; i++) {\n var productNameStrings = getCombinations(productsDeduped[i].tags);\n\n productsDeduped[i].productTags = productNameStrings \n}\n\n\nI get this error: \n\n result.push(\n ^\n\nRangeError: Maximum call stack size exceeded\n at getCombinations (/Users/farhadam/Silobee/Inventory/categories/execute.js:1006:16)\n at Object.&lt;anonymous&gt; (/Users/farhadam/Silobee/Inventory/categories/execute.js:1016:30)\n at Module._compile (internal/modules/cjs/loader.js:1156:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)\n at Module.load (internal/modules/cjs/loader.js:1000:32)\n at Function.Module._load (internal/modules/cjs/loader.js:899:14)\n at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)\n\n\nAny idea how I can fix this; I assume its because of the high volume of request?\n\nEDIT:\nI just looked deeper and when I limit my productNameStrings array of strings to only 9 elements the code works no problem; but if it has 10 or more strings in the array it starts giving me this error! Still dont know how to fix it." ]
[ "javascript", "arrays", "node.js", "loops", "stack-size" ]
[ "Can I color the first bar in \"Bart Char\" differently?", "View the example\n\nI would like to give a different color for \"Your score\". I tried doing 2 datasets: one including only the score, second one with other ones, but it didn't work.\n\nIs this even possible?" ]
[ "chart.js" ]
[ "Objective-c - syntax for addObserver that returns a boolean value", "I am trying to add an sdk call to my Xcode project, and in their documentation, they say:\n\n\n \"If you are using these API's you can become an observer for the following events:\n NOTIFICATION_COMPLETED True/False - mail has completed with success/failure.\"\n\n\nI managed to get this far:\n\n[[NSNotificationCenter defaultCenter] addObserver: rootViewController\n selector: @selector(_NotificationCompleted:)\n name: NOTIFICATION_COMPLETED\n object: nil];\n\n\nor, I assume that is correct... I am not sure about the nil on the end though.\n\nanyway, I have no idea how to format my _NotificationCompleted function...\n\nthis is what I wrote:\n\nvoid _NotificationCompleted(Boolean WasSuccessfullySent)\n{\n if(WasSuccessfullySent)\n {\n // YAY!\n } else {\n // Boo!\n {\n}\n\n\nWhat am I doing wrong?" ]
[ "objective-c", "parameters", "callback", "nsnotification", "addobserver" ]
[ "Full Outer Join Returns the correct results but the Order by is incomplete", "I am joining sales data source A with sales data source D. I want to order the net results by date, store and category. In some cases there is a match on store and category, in others no match on a store, etc.\n\nHere is the desired result set:\n\n\n\nHere is script to build the test data:\n\n-- drop table #ASales\nCREATE TABLE #ASales(\n[Store] [varchar](50) NULL,\n[SaleDate] [datetime] NULL,\n[ACategory] [varchar](20) NULL,\n[ATotalGallons] [numeric](38, 4) NULL\n);\n\n-- drop table #DSales\nCREATE TABLE #DSales (\n [Store] [varchar](20) NULL,\n [SaleDate] [date] NULL,\n [DCategory] [varchar](40) NULL,\n [DTotalGallons] [decimal](38, 3) NULL\n);\n\n INSERT #ASales ([Store], [SaleDate], [ACategory], [ATotalGallons]) VALUES (N'0009', CAST(N'2020-01-16T00:00:00.000' AS DateTime), N'D', CAST(643.0040 AS Numeric(38, 4)))\n INSERT #ASales ([Store], [SaleDate], [ACategory], [ATotalGallons]) VALUES (N'0009', CAST(N'2020-01-16T00:00:00.000' AS DateTime), N'G', CAST(4534.1350 AS Numeric(38, 4)))\n INSERT #DSales ([Store], [SaleDate], [DCategory], [DTotalGallons]) VALUES (N'10', CAST(N'2020-01-16' AS Date), N'G', CAST(1444.512 AS Decimal(38, 3)))\n INSERT #DSales ([Store], [SaleDate], [DCategory], [DTotalGallons]) VALUES (N'12', CAST(N'2020-01-16' AS Date), N'G', CAST(1417.343 AS Decimal(38, 3)))\n INSERT #DSales ([Store], [SaleDate], [DCategory], [DTotalGallons]) VALUES (N'9', CAST(N'2020-01-16' AS Date), N'G', CAST(4506.082 AS Decimal(38, 3)))\n INSERT #DSales ([Store], [SaleDate], [DCategory], [DTotalGallons]) VALUES (N'9', CAST(N'2020-01-16' AS Date), N'O', CAST(6.000 AS Decimal(38, 3)))\n INSERT #DSales ([Store], [SaleDate], [DCategory], [DTotalGallons]) VALUES (N'12', CAST(N'2020-01-16' AS Date), N'O', CAST(7.000 AS Decimal(38, 3)))\n INSERT #DSales ([Store], [SaleDate], [DCategory], [DTotalGallons]) VALUES (N'10', CAST(N'2020-01-16' AS Date), N'AD', CAST(471.373 AS Decimal(38, 3)))\n INSERT #DSales ([Store], [SaleDate], [DCategory], [DTotalGallons]) VALUES (N'12', CAST(N'2020-01-16' AS Date), N'AD', CAST(230.340 AS Decimal(38, 3)))\n INSERT #DSales ([Store], [SaleDate], [DCategory], [DTotalGallons]) VALUES (N'9', CAST(N'2020-01-16' AS Date), N'AD', CAST(617.909 AS Decimal(38, 3)))\n INSERT #DSales ([Store], [SaleDate], [DCategory], [DTotalGallons]) VALUES (N'10', CAST(N'2020-01-16' AS Date), N'O', CAST(1.000 AS Decimal(38, 3)))\n\n SELECT Store,\n SaleDate,\n ACategory,\n ATotalGallons\n FROM #ASales\n Order by SaleDate,cast(Store as int), ACategory;\n\nSELECT Store,\n SaleDate,\n DCategory,\n DTotalGallons\n FROM #DSales \n Order by SaleDate, cast(Store as int), DCategory;\n\n\nIf I use the power of a FULL OUTER JOIN, I successfully bring back the rows for each store from each source, but I cannot get them to order as a unit. Here's the statement that almost returns what I want, however store 9 shows up twice, after ordering first by sales source a--then again from sales source D. Close, but not exactly what I want. I need the stores to show up in order once, inclusive of both sources. What do I need to do to fix this?\n\n SELECT COALESCE(a.Store,d.Store) AS store,\n COALESCE(A.SaleDate,d.SaleDate) AS saledate,\n A.ACategory,\n A.ATotalGallons,\n D.DCategory,\n D.DTotalGallons\n FROM #ASales A\n FULL OUTER JOIN #DSales D \n ON D.Store = A.Store \n AND D.SaleDate = A.SaleDate\n Order by COALESCE(A.SaleDate,d.SaleDate),COALESCE(a.Store,d.Store), a.ACategory,D.DCategory;" ]
[ "sql", "sql-server" ]
[ "read tiff image tesseract and leptonica", "I want to read tiff file. And I save txt each .png files which is in tiff file. If I use below code, I cannot save each page with its name. How can I do ? (Cpp code)\n\n// Open input image with leptonica library\nPix *image = pixRead(\"/usr/src/tesseract-3.02/phototest.tif\");\napi-&gt;SetImage(image);\n// Get OCR result\nchar *outText;\noutText = api-&gt;GetUTF8Text();" ]
[ "c++", "tesseract", "leptonica" ]
[ "Eclipse CDT \"Symbol NULL could not be resolved\"", "I just installed Eclipse CDT with MinGW.\nAll the environment variables are set, includes, etc. Tried running a hello world and everything seems to be fine.\n\nI tried loading a C project that I had before in my computer, it seems to load everything fine, yet I get the following error with the NULL symbol :\n\nSymbol 'NULL' could not be resolved\n\n\nAny insights? Thanks!" ]
[ "c", "eclipse", "windows", "mingw", "eclipse-cdt" ]
[ "Why does Programming Perl use local (not my) for filehandles?", "When I read through Programming Perl, 2nd Edition, Page 51, something confuses me :\n\nsub newopen {\n my $path = shift;\n local *FH; #not my!\n open (FH, $path) || return undef;\n return *FH;\n}\n\n$fh = newopen('/etc/passwd');\n\n\nMy I know, why we are not recommenced to use my? So far, I cannot see anything will go wrong if we use my().\n\nThanks!" ]
[ "perl", "filehandle", "lexical" ]
[ "How to apply WPF ScrollBar style to a particular listview?", "Ok, here is my scrollbar style.\n\n&lt;Style x:Key=\"{x:Type ScrollBar}\" TargetType=\"{x:Type ScrollBar}\"&gt; \n &lt;Setter Property=\"Background\" Value=\"#D5E0FF\" /&gt;\n&lt;/Style&gt;\n\n\nIf I apply this, all scrollbars in my application will get affected, undoubtedly.\n\nNow I have 2 listview(s) in my application, I need to apply this style to only a particular listview, while another one remain default scrollbar, any idea?\n\nThis is driving me crazy.\n\nThanks." ]
[ "wpf", "listview", "scrollbar", "styles", "apply" ]
[ "Objects and lists, python", "I'm new to python/pygame. I want to define my own class. This class takes a list within a list and a acceleration function. I want to call these functions in another class so that they can be changed/ manipulated. \n\nThis is what i have:\n\nClass baddie():\n def __init__(self):\n self._list=([random.randint(100,210),530])\n def accelaration(self,acc):\n clock=300-(acc)\n\n\nI then want the baddie class to be called in the space class. So the user can manipulate the two above functions.\n\nClass space():\n b = baddie()\n b.accelaration(203)\n\n\nI also want the user to be able to call the list which takes a random integer and another number, but I don't understand how. \n\nAny suggestions." ]
[ "python", "class" ]
[ "Firefox CSS white-space:nowrap not being honoured", "I have a nav menu that has a dropdown, and in that dropdown there can be an indeterminate number of &lt;ul&gt; that need to sit left of each other and the parent li grow and shrink dependent on the number of &lt;ul&gt;.\n\nThis works fine in chrome but in Firefox the &lt;ul&gt; sit beneath each other, what am I doing wrong?\n\nHere is a fiddle, to see the drop down hover over brand\n\nhttp://jsfiddle.net/QUK8C/" ]
[ "html", "css", "google-chrome", "firefox" ]
[ "python - output from if and elif write to json file", "I am trying to find the difference between the files and getting the output as well. but if someone could help me on how can i write that to new json file again.\nHere is my code \n\ndef check(a,b):\n diff = False\n for a_key in a:\n if a_key not in b:\n diff = True\n #print \"key %s in a, but not in b\" %a_key\n print a_key,a[a_key]\n elif a[a_key] != b[a_key]:\n diff = True\n #print \"key %s in a and in b, but values differ (%s in a and %s in b)\" %(a_key, a[a_key], b[a_key])\n print a_key,b[a_key]\n if not diff:\n print \"both files are identical\"\n\n\nI would like to write the output to json file instead of printing on console. \nI tried this after print but not desired o/p. Any help is appreciated.\n\nres=a_key,b[a_key]\nout_file = open(\"out.json\",\"a\")\njson.dump(res,out_file, indent=4)\nout_file.close()\n\n\nHere are the Sample files. file1:\n\n{\n\"abc\": [\n \"build=1.0.44.0\", \n \"proxy=none\"\n], \n\"xyz\": [\n \"proxy=none\", \n \"build=1.0.129.0\"\n], \n\"lmn\": [\n \"build=1.0.127.0\", \n \"proxy=none\"\n], \n\"test\": [\n \"build=1.0.144.0\", \n \"proxy=http\"\n], \n\"alfa\": [\n \"build=1.0.22.0\", \n \"proxy=http\"\n], \n\"beta\": [\n \"proxy=http\",\n \"build=1.0.17.0\"\n]\n}\n\n\nHere is the File2:\n\n{\n\"abc\": [\n \"build=1.0.43.0\", \n \"proxy=none\"\n], \n\"xyz\": [\n \"proxy=none\", \n \"build=1.0.128.0\"\n], \n\"lmn\": [\n \"build=1.0.127.0\", \n \"proxy=none\"\n], \n\"test\": [\n \"build=1.0.141.0\", \n \"proxy=http\"\n], \n\"alfa\": [], \n\"beta\": [\n \"proxy=http\",\n \"build=1.0.17.0\"\n]\n}\n\n\nFINAL Expected output:\n\n{\n\"abc\": \"1.0.44.0\", \n\"xyz\": \"1.0.129.0\",\n\"test\":\"1.0.144.0\", \n\"alfa\":\"1.0.22.0\"\n}" ]
[ "python", "json" ]
[ "How to get the Facebook \"HashTag\" feeds/Posts etc using the Facebook Graph API ? I want to get all the posts of a particular #HashTag", "I have suitation, where i have to get all the posts of Particular HashTag of Facebook. eg #ILovePhp . I have done some R&amp;D and got my own profile hashtag posts/comments in format of JSON. But i want all the Posts of the particular HashTag(i.e a user who is not friend at all to me in facebook still he posted some message using the hash tag #ILovePhp) . I want to get all the posts in Facebook related to a particulat HashTag. Please help me." ]
[ "facebook", "facebook-graph-api", "hashtag" ]
[ "Trigger functions with other tables, but not this one. Msg 102", "I'm pulling over from a previous post of mine, MSSQL Msg 102 &#39;.&#39; and column name begins with number.\nI keep getting a Msg 102 incorrect syntax within a stored procedure, when I try to run an UPDATE.\nOK, I think I have found where the issue is at. It is in a TRIGGER, for insert, update, delete:\nDECLARE\n@bit INT ,\n@field INT ,\n@maxfield INT ,\n@char INT ,\n@fieldname VARCHAR(64) ,\n@TableName VARCHAR(64) ,\n@PKCols VARCHAR(1000) ,\n@sql VARCHAR(2000) ,\n@UpdatedDate VARCHAR(21) ,\n@UserName VARCHAR(64) ,\n@TYPE CHAR(1) ,\n@PKSelect VARCHAR(1000) ,\n@OldValueSQL VARCHAR(128) ,\n@NewValueSQL VARCHAR(128) ,\n@fieldtype VARCHAR(32) ,\n@compatible_triggerfield BIT\n\nselect @TableName = 'tblItems'\n\nSELECT @UserName = dbo.fnGetContextInfoString() ,@UpdateDate = CONVERT(VARCHAR(8), GETDATE(), 112)\n+ ' ' + CONVERT(VARCHAR(12), GETDATE(), 114)\n\nIF EXISTS (SELECT * FROM inserted)\nIF EXISTS (SELECT * FROM deleted)\nSELECT @Type = 'U'\nELSE\nSELECT @Type = 'I'\nELSE\nSELECT @Type = 'D'\n\nSELECT [ID],[ResourceName],[DevItemNum],[Email],[ItemOrg],[ItemPOC],[24_7POC],[ItemDesc],[Active],[EntryArea],[Entry] INTO #ins FROM inserted\nSELECT [ID],[ResourceName],[DevItemNum],[Email],[ItemOrg],[ItemPOC],[24_7POC],[ItemDesc],[Active],[EntryArea],[Entry] INTO #del FROM deleted\n\nSELECT @PKCols = COALESCE(@PKCols + 'and', 'on')\n + ' i.' + cu.COLUMN_NAME + ' = d.' + cu.COLUMN_NAME\n FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS pk ,\n INFORMATION_SCHEMA.KEY_COLUMN_USAGE cu\n WHERE pk.TABLE_NAME = @TableName\n AND CONSTRAINT_TYPE = 'PRIMARY_KEY'\n AND cu.TABLE_NAME = pk.TABLE_NAME\n AND cu.CONSTRAINT_NAME = pk.CONSTRAINT_NAME\n\nSELECT @PKSelect = COALESCE(@PKSelect+'+'.'')\n + '''&lt;' + COLUMN_NAME\n + '=''convert(varchar(100), coalesce(i.' + COLUMN_NAME + ',d.' + COLUMN_NAME + '))+''&gt;'''\n FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS pk,\n INFORMATION_SCHEMA.KEY_COLUMN_USAGE cu\n WHERE pk.TABLE_NAME = @TableName\n AND CONSTRAINT_TYPE = 'PRIMARY_KEY'\n AND cu.TABLE_NAME = pk.TABLE_NAME\n AND cu.CONSTRAINT_NAME = pk.CONSTRAINT_NAME\nIF @PKCols IS NULL\nBEGIN\n RAISERROR('no PK on table %s', 16, -1, @TableName)\n RETURN\nEND\nIF @Type = 'I' or @ Type = 'D'\nBEGIN\nSET @maxfield = 1\nSET @field = 0\nEND\nELSE\nBEGIN\nSELECT field = 0,\n @maxfield = MAX(ORDINAL_POSITION)\n FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = @TableName\nEND\nWHILE @field &lt; @maxfield\nBEGIN\nSELECT @field = MIN(ORDINAL_POSITION)\n FROM INFORMATION_SCHEMA.COLUMNS\n WHERE TABLE_NAME = @TableName\n AND ORDINAL_POSITION &gt; @field\nSELECT @bit = (@field -1)% 8 + 1\nSELECT @bit = POWER(2,@bit -1)\nSELECT @char = ((@field - 1) / 8) + 1\nIF SUBSTRING(COLUMNS_UPDATED(),@char, 1) &amp; @bit &gt; 0\n OR @Type IN ('I','D')\nBEGIN\nSELECT @fieldname = COLUMN_NAME, @fieldtype = DATA_TYPE\n FROM INFORMATION_SCHEMA.COLUMNS\n WHERE TABLE_NAME = @TableName\n AND ORDINAL_POSITION = @field\nIF @fieldtype = 'text' or @fieldtype = 'ntext' or @fieldtype = 'image' SET @compatible_triggerfield = 0 else SET @compatible_triggerfield = 1\nSET @OldValueSQL = ',convert(varchar(1000),d.' + @fieldname + ')'\nSET @NewValueSQL = ',convert(varchar(1000),i.' + @fieldname + ')'\nIF @compatible_triggerfield = 0\nSET @OldValueSQL = ',''n/a'''\nSET @NewValueSQL = ',''n/a'''\nEND\nSELECT @sql = '\ninsert Audit ( Type,\n TableName,\n PrimaryKeyField,\n FieldName,\n FieldType,\n OldValue,\n NewValue,\n UpdateDate,\n UserName)\nselect ''' + @Type + ''','''\n+ @TableName + ''',' + @PKSelect\n+ ',''' + @fieldname + ''''\n+ ',''' + @fieldtype + ''''\n+ @OldValueSQL\n+ @NewValueSQL\n+ ',''' + @UpdateDate + ''''\n+ ',''' + @UserName + ''''\n+ ' from #ins i full outer join #del d'\n+ @PKCols\nIF @compatible_fieldtrigger = 1\nBEGIN\n SET @sql = @sql\n + ' where i.' + @fieldname + '&lt;&gt; d.' + @fieldname\n + ' or (i.' + @fieldname + ' is null and d.'\n+ @fieldname\n+ ' is not null)'\n + ' or (i.' + @fieldname + ' is not null and d.'\n+ @fieldname\n+ ' is null)'\nEND\nEXEC(@sql)\nEND\nEND\n\nHere's the kicker. If I comment out the SELECT @PKSELECT = ... statement, it seems to run fine.\nAnymore help here, would be nice." ]
[ "sql-server", "triggers" ]
[ "Can't convert birthday into string facebook php sdk", "I'm testing facebook php sdk.\nI have permissions for 'user_birthday,email'and default user profile.\nHere is the code. \n\n&lt;?php\nif(isset($session)) {\n\n try {\n\n$user_profile = (new FacebookRequest(\n $session, 'GET', '/me/'\n))-&gt;execute()-&gt;getGraphObject(GraphUser::className());\n\n var_dump ($user_profile);\n echo $user_profile-&gt;getEmail();\n $_SESSION['user']=$user_profile-&gt;getName();\n $_SESSION['user_id']=$user_profile-&gt;getId();\n\n $_SESSION['profile_pic']=\"http://graph.facebook.com/\".$_SESSION['user_id'].\"/picture\";\n $_SESSION['gender']=$user_profile-&gt;getGender();\n\n $vars = get_object_vars ( $user_profile-&gt;getBirthday() );\n\n\n print_r ( $vars );\n\n\n } catch(FacebookRequestException $e) {\n\necho \"Exception occured, code: \" . $e-&gt;getCode();\necho \" with message: \" . $e-&gt;getMessage();\n\n } \n\n} \n?&gt;\n\n\nAnd Output is\n\n object(Facebook\\GraphUser)[6]\n protected 'backingData' =&gt; \n array (size=12)\n 'id' =&gt; string 'xxxxxxxxxxx' (length=15)\n 'birthday' =&gt; string '01/12/1990' (length=10)\n 'email' =&gt; string '[email protected]' (length=19)\n 'first_name' =&gt; string 'xxxx' (length=10)\n 'gender' =&gt; string 'male' (length=4)\n 'last_name' =&gt; string 'xxxx' (length=4)\n 'link' =&gt; string 'https://www.facebook.com/app_scoped_user_id/xxxxxx/' (length=60)\n 'locale' =&gt; string 'en_US' (length=5)\n 'name' =&gt; string 'xxxxx xxxxx' (length=15)\n 'timezone' =&gt; int -8\n 'updated_time' =&gt; string '2015-02-22T07:48:23+0000' (length=24)\n 'verified' =&gt; boolean true\n\n [email protected] ( [date] =&gt; 1993-04-22 00:00:00 [timezone_type] =&gt; 3 [timezone] =&gt; UTC ) \n\n\nProblem is,I can't use the birthday object.\nwhen I checked the birthday with echo,\n\n echo $user_profile-&gt;getBirthday();\n\n\nI got this error.\n\n Catchable fatal error: Object of class DateTime could not be converted to string\n\n\nwhen I dumped the $user_profile->getBirthday();\noutput is.\n\n object(DateTime)[9]\n public 'date' =&gt; string '1993-04-22 00:00:00' (length=19)\n public 'timezone_type' =&gt; int 3\n public 'timezone' =&gt; string 'UTC' (length=3)\n\n\nHow can I get the Birthday as string?\n I'm new to php.\n Any help would be greatly appreciated." ]
[ "php", "facebook", "object", "facebook-php-sdk" ]
[ "Pandas filter or delete rows multiple conditions", "I have this dataframe boroughCounts with these sample values:\n\n From To Count\n9 None Manhattan 302\n10 Bronx Bronx 51\n11 Bronx Manhattan 244\n12 None Brooklyn 8\n13 Bronx Queens 100\n14 None None 67\n\n\nTrying to filter out None values in \"From\" and \"To\" columns using this approach as described here or here:\n\nboroughCounts = boroughCounts[(boroughCounts.From != None) &amp; (boroughCounts.To != None)]\n\nboroughCounts = boroughCounts[(boroughCounts[\"From\"] != None) &amp; (boroughCounts[\"To\"] != None)]\n\n\nBut it doesn't work, and all values remained as is.\nAm I using it wrong, or is there a better way to do it?" ]
[ "python", "pandas", "dataframe" ]
[ "Sort a list of tuples by the first element of the tuple without removing duplicates", "I have a list of tuples where the first element in each tuple is an integer and the second is another type of object. I need to sort this list, which usually isn't a problem. I understand that the sorted() function sorts by the first element normally, but here when it finds duplicates of the first element, it compares the second element of those tuples, which are not numbers, so I get the error:\n\nTypeError: '&lt;' not supported between instances of 'Vertex' and 'Vertex'\n\n\nHere is what my list looks like: \n\n[(80579631349660530, &lt;__main__.Vertex object at 0x10bf38470&gt;), \n(1, &lt;__main__.Vertex object at 0x10bf384a8&gt;),\n(80223811214564369, &lt;__main__.Vertex object at 0x10bf384e0&gt;),\n(36780432574096242, &lt;__main__.Vertex object at 0x10bf38518&gt;), \n(43016924753647361, &lt;__main__.Vertex object at 0x10bf38550&gt;), \n(40771682387809932, &lt;__main__.Vertex object at 0x10bf38588&gt;), \n(32096957875591460, &lt;__main__.Vertex object at 0x10bf385c0&gt;),\n(1, &lt;__main__.Vertex object at 0x10bf385f8&gt;)]\n\n\nAs you can see, two of the tuples have their first element as 1." ]
[ "python", "list", "duplicates", "tuples" ]
[ "different result from git log and git rev-list", "I am trying to get commits that exist in branch A, but does not exist in branch B. I thought these two commands will give me the same result, but they don't. \n\ngit rev-list A ^B --no-merges | wc -l\ngit log A ^B --no-merges | wc -l\n\n\nThe first one gives me 370, while log returns 8000. What is the difference between these two?" ]
[ "bash", "git" ]
[ "How to achieve \"Send by email\" functionality in \"Quotations\" and \"Sales Order\" module in ODOO?", "I am developing ODOO application in iOS.\nI want to achieve \"Send by email\" functionality in \"Quotations\" and \"Sales Order\" module in ODOO.\n\nSo is there any API available to achieve this functionality ?\n\nOr shall i generate PDF programmatically in iOS and send this by using MFMailComposeViewController class ?\n\nThanks" ]
[ "openerp", "odoo", "openerp-8", "odoo-8" ]
[ "SQL assign read/write access to all users on PC", "I'm installing an SQL database and our application on a single PC. Under Vista this needs to be installed by an administrator account, but this means that the regular user account(s) can run our program, but it can't access the database it needs.\n\nWhat I need is a simple way of allowing all NT logins on the PC to have access to the database.\n\nI thought I'd solved it: In SSMS I can manually assign db_datareader/writer roles to BUILTIN\\Users, and it works perfectly.\n\nHowever, if my installer programmatically executes the following, it doesn't work:\n\nUSE [OurDatabase]\nGO\nEXEC sp_addrolemember N'db_datawriter', N'BUILTIN\\Users'\nGO\nEXEC sp_addrolemember N'db_datareader', N'BUILTIN\\Users'\nGO\n\n\nThe users get assigned the roles, but they still can't access the database. The only difference I can see in SSMSE is that in the latter case, they also gain ownership of a new \"BUILTIN\\Users\" schema, which I suspect may be screwing things up. Clearly SSMS does something slightly different...\n\nCan anyone suggest a way to get this working programmatically?" ]
[ "sql-server" ]
[ "Transactional (In-Memory) Edits with Entity Framework", "In the olden days of the DataSet (and related objects), the in-memory representations of the data objects--DataRow and DataRowView--supported transactional edits through BeginEdit, EndEdit, and CancelEdit. Having both in place allowed more than simply being able to \"undo\" changes made to an object and reverting it back to its retrieved (or uninitialized) values; the DataRowView object allowed a developer to begin a single editing operation on a DataRow in any state and undo those changes without undoing other changes that might have been made.\n\nFor example,\n\nDataRow retrieved as:\n\nCol1 | Col2\n----------------\n1 2\n\n\nDataRow Modified to:\n\nCol1 | Col2\n----------------\n1 3\n\n\nBeginEdit called on a DataRowView object for this row.\n\nDataRowView modified to:\n\nCol1 | Col2\n----------------\n2 3\n\n\nCancelEdit called on the DataRowView, reverting the values to\n\nCol1 | Col2\n----------------\n1 3\n\n\nSo the change was undone, but the values present before the edit--even though they were in-memory changes and not the retrieved values--are preserved.\n\nIs there any similar facility in the Entity Framework? I have a sneaking suspicion that the answer is \"no\", considering that it looks like an Entity uses simple backing variables for column values rather than a \"property bag\" approach like the DataRow uses (or WPF's DependencyProperty infrastructure uses)." ]
[ "entity-framework", ".net-3.5" ]
[ "captcha not working in ubuntu 10.10?", "I recently changed to ubuntu OS and my captcha is no longer working. But it works fine in linux server... I am using codeignitor.\n\nError in imagettfbbox function i am getting this error..." ]
[ "codeigniter" ]
[ "How to install/ solve No model pkg-resource issue python", "I have multiple issue\n\nFirst issue:\n\nI have a server which is so secure that is running\nREDHAT_BUGZILLA_PRODUCT=\"Red Hat Enterprise Linux 7\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.4\n\nThere is no internet connectivity there and I want to download some packages like\n\n\npysnmp\npandas\nnumpy\npsutil\nsome others\n\n\nAs per my research, the best way to download from server that has internet and transfer the file to the server that does not have an internet.\n\nI tried of things, like download tar.gz of the package or use basket or take full package but no use\n\nSecond issue:\n\nWhile I am trying, I am getting No module named pkg_resources error.Hhow can I solve that first in-order to proceed?\n\nmy python version is \n\npython2 is 2.7.5\npython3 is 3.4.9\n\ni am tried pip install pysnmp-4.4.12.tar.gz to the main package. it mention to be no Module pk_resource.\n\ni tried also to use basket as per the website https://pythonhosted.org/Basket/\nand i used easy_install -f ~/.basket -H None pyramid\nand i got pkg_resource module error.\n\nHowever When i download setuptools through the website https://pypi.org/project/setuptools/0.9.8/#installation-instructions \n\nand i use python eazy-setup.py --user the Error is\n[Errno 13] Permission denied: '/usr/lib64/python2.7/site-packages/XlsxWriter-1.1.2.dist-info'\n\nUpdated !!!!\n\nI managed to do it Thanks for the help" ]
[ "python", "pip" ]
[ "Why android sdk hasn't support for many new elements?", "In the last few days, i was trying to study the android's new Material Design. In the official doc, they suggest new element and various interactions.\n\nBut, for example, why don't they provide some simple support to raised/floating action buttons? Same to many other things, seems like they just want to suggest you the way to do it without providing real support on how to do them.\n\nThis way i end using tons of third libraries to support many of the new elements style and feels a bad idea.\n\nSorry for my bad english but just want to understand why can't they supply some support to the design they suggest." ]
[ "android", "material-design" ]
[ "Preg_replace() removing all but the end of query", "Before everything, sorry for my bad english.\n\nI have this query:\n\nSELECT t1.*,(SELECT COUNT(*) FROM table_a t2 WHERE t1.id=t2.id_c AND t2.status=1) AS aula \nFROM table_c t1 \nWHERE t1.status=1 \nAND t1.id IN (SELECT t3.id_c FROM table_cu t3 WHERE t3.id_c=t1.id AND t3.id_u=1) \nAND t1.id IN (SELECT t4.id_c FROM table_cp t4 WHERE t4.id_c=t1.id AND t4.id_p=3) \nLIMIT 0,25\n\n\nThis query returns me a set of results, no problems until now, but I have a pagination class with a very basic process: It counts how many entries I got, then it breaks the entries into pieces, then with this values I paginate.\n\nThe issue is inside this method in the 'pagination class', here's the code:\n\nfunction total_entries()\n{\n\n $db = new db(DB_USER, DB_PASS, DB_NAME, DB_HOST);\n\n $qtdEntries = 0;\n\n $queryQtd = $this-&gt;sql;\n $queryQtd = preg_replace(\"/SELECT (.*) FROM /sei\", \"'SELECT COUNT(*) as qtd FROM '\", $queryQtd);\n $queryQtd = preg_replace(\"/ORDER BY (.+)/\", \"\", $queryQtd);\n $queryQtd = preg_replace(\"/LIMIT (.+)/\", \"\", $queryQtd);\n\n $resultAll = $db-&gt;get_row($queryQtd); //Gets the result, in this case, it returns the number of entries\n\n if($resultAll){\n $qtdEntries = $resultAll-&gt;entries; //Number of entries\n }\n\n return $qtdEntries;\n}\n\n\nBasically when I run this method, the query inside of it returns like this:\n\nSELECT COUNT(*) as qtd FROM table_cp t4 WHERE t4.id_c=t1.id AND t4.id_p=3)\n\n\nWhen it should return something like this:\n\nSELECT COUNT(*) as qtd FROM table_c t1 WHERE t1.status=1\n\n\nAny ideas how to correct this issue?" ]
[ "php", "mysql", "regex", "pagination" ]
[ "Serialize HashMap like a Collection Property", "Here I got two classes \"Student\" and \"Course\":\n\n@XmlRootElement\nclass Student {\n private String name;\n private HashMap&lt;String, Course&gt; courses;\n\n public Student() {}\n public Student(String name, HashMap&lt;String, Course&gt; courses) {\n super();\n this.name = name;\n this.courses = courses;\n }\n // -------------------------getters\n @XmlAttribute(name=\"name\")\n public String getName() {\n return name;\n }\n\n @XmlElement(name = \"course\")\n public HashMap&lt;String, Course&gt; getCourses() {\n return courses;\n }\n\n //---------------------------setters\n\n public void setName(String name) {\n this.name = name;\n }\n public void setCourses(HashMap&lt;String, Course&gt; courses) {\n this.courses = courses;\n }\n\n}\n\n\n\n@XmlRootElement\nclass Course {\n private String id;\n private String name;\n\n public Course() {}\n public Course(String id, String name) {\n super();\n this.id = id;\n this.name = name;\n }\n\n @XmlID\n @XmlAttribute(name = \"id\")\n public String getId() {\n return id;\n }\n @XmlAttribute(name = \"name\")\n public String getName() {\n return name;\n }\n public void setId(String id) {\n this.id = id;\n }\n public void setName(String name) {\n this.name = name;\n }\n\n}\n\n\nI want to serialize the Student class using JaxB annotations to something like the following:\n\n&lt;Student name=\"David\"&gt;\n &lt;courses&gt;\n &lt;Course id=\"1\" name=\"Fundamentals of Programming\"/&gt;\n &lt;Course id=\"2\" name=\"Advanced Programming\"&gt;\n &lt;/courses&gt;\n&lt;/Student&gt;\n\n\nNote that I want courses field of the Student to be HashMap and when unmarshalling the serialized Object use id as the key for each Course." ]
[ "jaxb", "hashmap" ]
[ "Numeric to String conversion in Perl", "According to my knowledge when ever a string like \n\n$a=\"120.43sunil\"+5; \n\n\nit will give a result like \n\n$a=125.43 \n\n\nsince string is not a number the \"sunil\" part will be omitted.\nwhat if we get some thing like \n\n$a=\"12fred34\"*\" 3\" \n\n\nwill the string be converted to 1234 or 12034 ?\nim kind a new to perl programming." ]
[ "string", "perl", "numeric", "data-conversion" ]
[ "How do I rewrite struts application which returns jsp pages using react?", "I have a web service written in Java using Struts2, struts controller returns jsp pages, now I want to rewrite frontend using react components, what is the best way to start?" ]
[ "javascript", "java", "reactjs", "struts2", "templating" ]
[ "Get mysql results from table with date_time more than 30 minutes", "I have a MySQL query, the target is to get all profile IDs from a table that contains profiles in which user's last activity 30 minutes or more, or there was no activity recorded from that user at all (activity log recorded in another table).\n\nThe problem is: the results are 0 even there are records of more than 30 minutes old, I have checked few answers here, and followed the instructions and yet there are no results return, I think there's something wrong with the structure of the query.\n\nbelow is the query, please note that profiles are stored in profile_table and activities are stored in activity_table and both share the same ID.\n\n$sql = \"select ID from profile_table where status = 'Active' AND (ID in (select ID from activity_table where date_time &lt; DATE_SUB(NOW(),INTERVAL 30 MINUTE)) or ID NOT IN (select ID from activity_table))\"\n\n\nThanks for the help." ]
[ "php", "mysql" ]