texts
sequence
tags
sequence
[ "Angular Web App & Web API with Windows Authentication for Intranet users", "I have intranet web application developed using pure angular and the API app is web api 2\n\ni want to give the windows authentication for the web application and web api\n\nBut the angular App i cannot have the server side code to get the useridentity \n\nhow to implement that." ]
[ "angularjs", "asp.net-web-api2", "windows-authentication" ]
[ "Importing string from HTML into markdown parser", "I am using a markdown parser that works great if I pass it a string like this:\n\nel.innerHTML = marked('#Introduction:\\nHere you can write some text.');\n\n\nBut if I have that string inside HTML and send it to parser like\n\nel.innerHTML = marked(otherEl.innerHTML);\n\n\nit does not get parsed. Why is this? Does the string format of .innerHTML do something I am missing?\n\njsFiddle: http://jsfiddle.net/5p8be1b4/\n\nMy HTML:\n\n<div id=\"editor\">\n <div class=\"contentTarget\"></div>\n <div class=\"contentSource\">#Introduction:\\nHere you can write some text.</div>\n</div>\n\n\ndiv.contentTarget should receive HTML, parsed markdown. But it receives a un-parsed string only.\n\nIn the image bellow is the jsFiddle output. A unformated div.contentTarget, the original div.contentSource where I get the innerHTML to use in div.contentTarget and in the bottom, a working parsed div#tester which received a string directly into the parser." ]
[ "javascript", "html" ]
[ "Redshift - Case insensitive grouping", "Is there a way to make 'group by' in redshift case insensitive. I have contents in a table which have values like below. I'm trying to figure out a way to make the following 2 fields get grouped as one.\nPricewaterhousecoopers LLP\nPricewaterhouseCoopers LLP\nThanks" ]
[ "grouping", "amazon-redshift", "case-insensitive" ]
[ "How to add previous and next buttons in video.js", "I hope to know how to add previous and next buttons around play button on video.js controlBar. \n\nWhen I check the controlBar functions, it seems there are not functions to point the position of custom button which added, and only exists such as addChild or appendChild functions, so now I am only writing as below.\n\nthis.controlBar.el().appendChild(nextButton.el());\n\n\nSo I am eager to know how to add custom button such as previous or next button into certain order, in my case, just before or after play button. \n\nPlease help me!!!" ]
[ "javascript", "video.js" ]
[ "Parsing date with arrabic or chinese char", "I have to parse date like the following :\n\n[\"2014-11-28T午後6:04:16.952+0900\" ,\n \"2014-11-29T4:00:47,458 p.m.-0500\" ,\n \"٢٠١٤-١١-٢٨T٠٤:١٤:٥٢.١٧٤+0300\" ]\n\n\nFor the two first date, I can write something like :\n\nDateTime.strptime(date, '%Y-%m-%dT午後%H:%M:%S').to_time.to_s]\nDateTime.strptime(date, '%Y-%m-%dT%H:%M:%S').to_time.to_s]\n\n\nBut it make me lost PM and zone information. For the last date in arrabic, i don't know how i can process.\n\nAny idea?" ]
[ "ruby-on-rails", "ruby" ]
[ "Trying to get a loop running concurrently with web.py", "At this stage in my little project, I want to get web.py to display some information retrived from some sensors attached to my Raspberry Pi. I want the information to get retrieved regularly, so I put a loop at the bottom of my code that refreshes the sensors using my library, sticks the readings in a dict and sleeps for 10 seconds.\n\nwhile True:\n onewiretemp.refreshSensor()\n temperatures = onewiretemp.sensorTemp\n time.sleep(10)\n\n\nUnfortunately, the side effect of this is that when I run my program and try loading a page, my loop runs and the page never loads. I also have to manually kill the process to stop it. I assume this is because the loop is running indefinitely.\n\nThe rest of my code is basically the tutorial and some templating stuff from the web.py website. That part works when I disable the loop and manually add in the data formatted the same as the output from my onewiretemp module. \n\nIs there a better way of doing this that doesn't break everything?" ]
[ "python" ]
[ "how to use common less variable with styled component?", "Say I have a styled component, in index.jsx \n\nimport './index.less';\nclass Input extends React.Component {\n ...\n}\n\n\nand my index.less files looks:\n\n.input{\n color: @whiteColor;\n}\n\n\nThis index.less has to work with the mixin.less that imported in the root project.\n\nSo my question is, even though I imported the mixin.less, it prompts variable @whiteColor not found. Any idea to solve this?" ]
[ "reactjs", "styled-components" ]
[ "Flutter with an SQL database", "I want to create a Flutter Android app for an existing project created using the WAMP stack (Apache, MySQL, PHP) and we used PHPmyAdmin to manage the SQL database. It is currently a web-app that lets registered vendors sell tokens/coupons that can be used by customers to make purchases in their stores.\n\nThat being said, I am open to suggestions involving any kind of database, language, framework and/or service, as long it fulfills our need, i.e, security and linking Flutter to an existing SQL database.\n\nP.S. I know how to wire-up Firebase with a Flutter project but don't exactly know if I can link the Cloud Firestore with the SQL database. Suggestions are welcome!" ]
[ "mysql", "sql", "flutter" ]
[ "Magento display multiple single products", "I need to display a single product inside some blocks. \nMy problem is: If I use the code in two blocks, each one with its own product ID, the first block will show correctly but the second block will show the same product and not the ID that I have chosen for the second block. \n\nThis is what I have so far:\n\nAt the block: \n\n{{block type=\"catalog/product_view\" product_id=\"xx\" template=\"catalog/product/single.phtml\"}}\n\n\nAt Template/catalog/product/single.phtml:\n\n <?php\n $_helper = $this->helper('catalog/output');\n $_product = $this->getProduct(); \n $productId = $this->getProduct_id();\n $product = Mage::getModel('catalog/product')->load($productId); \n ?>\n<a href=\"<?php echo $product->getProductUrl() ?>\" ><div class=\"menu_product\">\n\n<h2><?php echo $_helper->productAttribute($_product, $this->htmlEscape($_product->getName()), 'name') ?></h2>\n\n<span><b><?php echo $this->getPriceHtml($_product) ?></b></span>\n\n<img class=\"product-img\" src=\"<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(145, 145); ?>\" width=\"145\" height=\"145\" alt=\"<?php echo $this->htmlEscape($product->getName()) ?>\" />\n\n</div></a>" ]
[ "php", "magento", "block", "product" ]
[ "Date Comparison in Dynamic Where Clause in Linq Gives Overload Exception", "I'm trying to inject a dynamic where clause in my Linq to SQL query and I get an overload exception. The same expression work when added in the query proper?\n\n qry.Where(Function(c) c.CallDate < Date.Now.AddDays(-1))\n\n\nAny thoughts on how to this to work?\n\nThe exception reads:\n\nOverload resolution failed because no accessible 'Where' can be called with these arguments:\nExtension method 'Public Function Where(predicate As System.Func(Of Calls, Integer, Boolean)) As System.Collections.Generic.IEnumerable(Of Calls)' defined in 'System.Linq.Enumerable': Nested function does not have the same signature as delegate 'System.Func(Of Calls, Integer, Boolean)'.\nExtension method 'Public Function Where(predicate As System.Func(Of Calls, Boolean)) As System.Collections.Generic.IEnumerable(Of Calls)' defined in 'System.Linq.Enumerable': Option Strict On disallows implicit conversions from 'Boolean?' to 'Boolean'.\nExtension method 'Public Function Where(predicate As System.Linq.Expressions.Expression(Of System.Func(Of Calls, Integer, Boolean))) As System.Linq.IQueryable(Of Calls)' defined in 'System.Linq.Queryable': Nested function does not have the same signature as delegate 'System.Func(Of Calls, Integer, Boolean)'.\nExtension method 'Public Function Where(predicate As System.Linq.Expressions.Expression(Of System.Func(Of Calls, Boolean))) As System.Linq.IQueryable(Of Calls)' defined in 'System.Linq.Queryable': Option Strict On disallows implicit conversions from 'Boolean?' to 'Boolean'. C:\\Projects\\Test Projects\\Encore\\EncoreData.vb 59 9 Encore\n\n\nThanks" ]
[ "vb.net", "linq-to-sql" ]
[ "Redirecting from domain to category in wordpress", "I am running a multisite WoprdPress install where I have configured my install to use sub-domains.\n\n\n I have registered and added one domain domain-a which is my main site.\n \n I have recently registered two main domains, domain-a and domain-c, and I have pointed their DNS records IP address of my multisite.\n\n\nI need kazisport.co.za and kazisportsoccer.co.za to redirect to a category in phakathi.co.za.\n\ni.e:\n\nkazisport.co.za and kazisportsoccer.co.za\n\nredirect to:\n\n\n http://phakathi.co.za/category/sport/\n\n\nThe first option I tried was creating a second site in my multisite network and mapped the two domains to the site. Then I activated a theme. In the theme I used PHP redirect code to redirect to the category in domain-a like this:\n\n<?php\nif($_SERVER['HTTP_HOST'] == 'domain-b.co.za' || $_SERVER['HTTP_HOST'] == 'domain-c.co.za')\n{\n header(\"Location: http://domain-a.co.za/category/sport/\");\n exit;\n}\n\n?>\n\n\nThat resulted in a hit and miss in a sense that sometimes the redirection would work and sometimes it wouldn’t work.\n\nThen I replaced the the PHP redirect code with JavaScript like this:\n\n<html>\n<head>\n<script>\nfunction gotoPage()\n{\n var dns1 = \"domain-b.co.za\";\n var dns2 = \"domain-c.co.za\";\n var urlloc = location.href;\n var loc = urlloc.toLowerCase();\n\n if (loc.indexOf(dns1) != -1){\n location.href=\"http://domain-a.co.za/category/sport/\";\n }\n else if (loc.indexOf(dns2) != -1){\n location.href=\"http://domain-a.co.za/category/sport/\"; \n }\n}\n</script>\n<body onLoad=\"gotoPage()\">\n</body>\n</html>\n\n\nThat also resulted in hit and miss. Sometimes the redirection would work and sometimes it would not work.\nThen I tried htaccess redirect like this:\n\n# BEGIN WordPress\n<IfModule mod_rewrite.c>\nRewriteEngine On\nRewriteBase /\nRewriteCond %{HTTP_HOST} ^domain-b.co.za$\nRewriteRule ^$ http://domain-a.co.za/category/sport/$1 [L,R=301]\nRewriteRule ^(server-info|server-status) - [L]\nRewriteRule ^index\\.php$ - [L]\n\n# add a trailing slash to /wp-admin\nRewriteRule ^wp-admin$ wp-admin/ [R=301,L]\nRewriteCond %{REQUEST_FILENAME} -f [OR]\nRewriteCond %{REQUEST_FILENAME} -d\nRewriteRule ^ - [L]\nRewriteRule ^(wp-(content|admin|includes).*) $1 [L]\nRewriteCond %{REQUEST_URI} !^/php5.fastcgi/*\nRewriteRule ^(.*\\.php)$ $1 [L]\nRewriteCond %{REQUEST_URI} !^/php5.fastcgi/*\nRewriteRule . index.php [L]\n</IfModule>\n# END WordPress\n\n\nThat did not work at all. I am at a loss and I do not know what I need to do for the redirection to work. I would really appreciate any feedback.\n\nOh, I need to mention that I am using Varnish Cache." ]
[ "php", "wordpress", "apache", ".htaccess", "redirect" ]
[ "Scala Actors: \"Event Based programming\" vs \"thread-based programming\"", "I am currently reading myself into the world of the actor model and its implementation with the programming language Scala. I have found two approaches to this. On the one hand the newer \"AKKA Framework\" and on the other hand \"Scala Actors\". There is also a published paper on \"Scala Actors\" by Philipp Haller and Martin Odersky in which they describe their implementation. This is obviously based on a combination of \"thread based\" and \"event based programming\". This raises for me the question what is the difference between \"thread based\" and \"event based\" and how to combine it or how it is combined in \"Scala Actors\" ?\n\nHas anyone had any experience with this ?\n\nThanks for every answer :)" ]
[ "scala", "events", "concurrency", "akka", "actor" ]
[ "BeautifulSoup returning None", "I am attempting to scrape airbnb with Beautifulsoup. name is returning None when there should be text present. Am I doing something wrong? I have only just started learning this so there is a high chance I'm missing somethi\nng simple.\nfrom bs4 import BeautifulSoup\nimport requests\nfrom requests_html import HTMLSession\nimport lxml\n\n\ndef extract_features(listing_html):\n features_dict = {}\n name = listing_html.find('div', {'class': '_xcsyj0'})\n features_dict['name'] = name\n return features_dict\n \ndef getdata(url):\n s = requests.get(url)\n soup = BeautifulSoup(s.content, 'html.parser')\n return soup\n\ndef getnextpage(soup):\n page = 'https://www.airbnb.com' + str(soup.find('a').get('href'))\n return page\n\nurl = 'https://www.airbnb.com/s/Bear-Creek-Lake-Dr--Jim-Thorpe--PA--USA/homes?tab_id=home_tab'\nsoup = getdata(url)\nlistings = soup.find_all('div','_8s3ctt')# (type of tag, name)\n\nfor listing in listings[0:2]: \n full_url = getnextpage(listing)\n ind_soup = getdata(full_url)\n features = extract_features(ind_soup)\n print(features)\n print("-----------")" ]
[ "python", "beautifulsoup" ]
[ "DFT of sine(x) using FFTW in Fortran muddled output", "The following is the code I have written to find the DFT of sine(x) over a period.\n\nprogram fftw_test\n\nimplicit none\n\nINTEGER FFTW_MEASURE\n PARAMETER (FFTW_MEASURE=0)\nINTEGER FFTW_ESTIMATE\n PARAMETER (FFTW_ESTIMATE=64)\nINTEGER FFTW_FORWARD\n PARAMETER (FFTW_FORWARD=-1)\n\ninteger, parameter :: n = 8\ninteger :: i\ndouble complex, dimension(0:n-1) :: input, output\ndouble precision, parameter :: pi = 3.141592653, h = 2.0d0*pi/(n)\ninteger*8 :: plan\n\ncall dfftw_plan_dft_1d(plan, n, input, output, fftw_forward, fftw_measure)\n\ndo i = 0, n-1\n input(i) = cmplx(sin(h*i), 0)\nend do\n\ncall dfftw_execute_dft(plan, input, output)\n\noutput = output/n \n\noutput(0) = cmplx(0,0) ! setting oddball wavenumber to be 0\n\ncall dfftw_destroy_plan(plan)\n\ndo i = -n/2, n/2-1, 1\n write(*, *) i, output(i+(n/2))\nend do\n\nend program\n\n\nI am aware of the r2c (real to complex) function in the FFTW library. But I was advised to use the normal c2c function. So I defined the input function as a complex number with real part = sine(x) and complex part 0. \n\nThe DFT of sine(x) is supposed to be fk(-1) = cmplx(0, -0.5) and fk(1) = cmplx(0, 0.5) where fk(k) means the fourier coefficient of the k wavenumber\n\nThe output I received is as follows.\n\n -4 ( 0.0000000000000000 , 0.0000000000000000 )\n -3 ( 3.2001271327131496E-008,-0.49999998518472011 )\n -2 ( -1.0927847071684482E-008, 1.4901161193847656E-008)\n -1 ( -1.0145577183762535E-008, 1.4815279864022202E-008)\n 0 ( -1.0927847071684482E-008, 0.0000000000000000 )\n 1 ( -1.0145577183762535E-008, -1.4815279864022202E-008)\n 2 ( -1.0927847071684482E-008, -1.4901161193847656E-008)\n 3 ( 3.2001271327131496E-008, 0.49999998518472011 )\n\n\nI am getting fk(-3) = cmplx(~0, -0.5) and fk(3) = cmplx(~0, 0.5). If I increase the grid size to 16, 32 or so I get -n/2 -1 and n/2 -1 wavenumbers with the required values instead of the -1 and 1 wavenumbers. \n\nDoes this have something to do with the way FFTW stores the output in the output array ? Or am I going wrong anywhere else ?\n\nAlso, I don't seem to be getting 'proper 0' where I should be. It is instead numbers of the order of 10^(-8) which I believe is the smallest my datatype double can hold. Is that something I should be worried about ?" ]
[ "fortran", "fft", "fftw", "dft" ]
[ "accessing variable value outside of function", "I have 2 functions in my script. The purpose of function #1 is to produce a url called \"mapsURL\" \n\nThe purpose of the second function is to run an .ajax request with \"mapsURL\" \n\nHowever I am having issues with accessing \"mapsURL\" in the second function. I declared \"mapsURL\" in the first function without a \"var\" in fornt of it. From my understanding, this should make the this the value global and I should be able to access it form inside other functions. Is my understanding incorrect or what am I missing here? \n\nhere's my js: \n\nnote: I removed my API key for this post, so that's not the issue\n\n\r\n\r\n$(document).ready(function (){\r\n\r\n\r\n navigator.geolocation.getCurrentPosition(function (position) {\r\n var positionLat = position.coords.latitude\r\n var positionLon = position.coords.longitude\r\n mapsURL = \"https://maps.googleapis.com/maps/api/geocode/json?latlng=\" + positionLat + \",\" + positionLon + \"&key=***mykeygoeshere***\";\r\n });\r\n\r\n\r\n function getData (){\r\n $.ajax({\r\n url: mapsURL,\r\n dataType: 'json',\r\n success: function(response){\r\n console.log(response);\r\n }\r\n });\r\n };\r\n\r\n getData();\r\n\r\n});" ]
[ "javascript", "scope", "global-variables" ]
[ "Mapping python flask website to a domain name", "I have a domain, domain_name.com. On my local machine, a website is made using python flask. In the home directory of the server for domain_name.com, I put all the files in a folder 'school' and in the python3 virtual environment execute the command ./main.py runserver, which gives:\n\n* Serving Flask app \"memorizer.application\" (lazy loading)\n * Environment: production\n WARNING: This is a development server. Do not use it in a production deployment.\n Use a production WSGI server instead.\n * Debug mode: off\n * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\n\nHow do I map this to domain_name.com/school? The local machine is on ubuntu 18.04 and the server is linux millennium. I have access to the cpanel.\n\nBelow is the sequence to run the script on the server:\n\n. cd school/\n\n. ls\napp.py memorizer.db Pipfile.lock setup.cfg\nLICENSE migrations public tests\nmain.py passenger_wsgi.py questions tmp\nmemorizer Pipfile README.md tox.ini\n\n. pwd\n/home/user_name/school\n\n. cat main.py\n\n#!/usr/bin/env python3\nfrom memorizer.application import manager\nif __name__ == '__main__':\n manager.run()\n\n. source /home/user_name/virtualenv/school/3.5/bin/activate\n\n(school:3.5). ./main.py runserver\n * Serving Flask app \"memorizer.application\" (lazy loading)\n * Environment: production\n WARNING: This is a development server. Do not use it in a production deployment.\n Use a production WSGI server instead.\n * Debug mode: off\n * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)" ]
[ "python", "flask", "deployment", "cpanel" ]
[ "0x800a1391 - JavaScript runtime error: '__doPostBack' is undefined", "I am dynamically adding some check boxes in a page using javascript. While i click on the submit button after checking a check box i am getting an error \" 0x800a1391 - JavaScript runtime error: '__doPostBack' is undefined\". Please help. My java script code is below\n\nfunction SendEmailScheduleFn() {\n var Operation = \"SendSchedule\";\n var Length = \"<%= countEmployee%>\";\n var Data = \"\";\n for (var i = 0; i < Length; i++) {\n var check = \"Checkbox\" + i;\n if (document.getElementById(check).checked == true) {\n Data += document.getElementById(check).name + ',';\n }\n }\n\n var pageId = '<%=Page.ClientID %>';\n __doPostBack(pageId,Data + \",\" + Operation);\n }" ]
[ "javascript", "jquery", "asp.net" ]
[ "Double Vector issue in c++", "So I was looking to make basically a double array but have it be dynamic via vectors. However I guess I do not fully understand this as I am doing something wrong causing my vector to be subscript out of range. Here below is my code:\n\nstd::vector<std::vector<std::string>> m_menuList;\nm_menuList[0].push_back(menuType);\nm_menuList[0].push_back(location);\n\n\nThis might be a stupid mistake or something completely wrong, it does compile correctly, just always crashes.\n\nThanks!" ]
[ "c++", "vector" ]
[ "Issue using AWS Comprehend iOS", "I'm pretty sure I set up my IAM role appropriately (I literally attached the ComprehendFullAccess policy to the role) and the Cognito Pool was also setup appropriately (I know this because I'm also using Rekognition and it works with the IAM Role and Cognito ID Pool I created) and yet every time I try to send a request to AWS Comprehend I get the error \n\nError Domain=com.amazonaws.AWSServiceErrorDomain Code=6 \"(null)\" UserInfo={__type=AccessDeniedException, Message=User: arn:aws:sts::<my sts>:assumed-role/Cognito_<my id pool name>Unauth_Role/CognitoIdentityCredentials is not authorized to perform: comprehend:DetectEntities}\n\nAny idea of what I can do in this situation? I tried creating a new Cognito Pool and creating a custom IAM Role that literally only allows comprehend:DetectEntities and it still doesn't work." ]
[ "ios", "swift", "amazon-web-services", "aws-sdk-ios" ]
[ "Making a input appear when specific option is selected in a dynamic jQuery form", "Im a jQuery noob and Im stuck in this problem. \n\nThis code makes appear a form every time you click the button, and you can remove it clicking \"Remove\".\n\nThe problem is: I need an input to appear (one per form) when the option \"Other\" is selected. And make it disappear if you select \"Option 1\", \"Option 2\" or \"Option 3\".\n\nYou can see the code here: https://jsfiddle.net/9dgr9e3s/1/\n\nHTML\n \n \n \n\n<div class=\"input_fields_wrap\">\n <button class=\"add_field_button\">Add More Fields</button>\n</div>\n\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js\"></script>\n<script>`\n\n\nscript jQuery\n\n$(document).ready(function() {\nvar max_fields = 10; //maximum forms allowed\nvar wrapper = $(\".input_fields_wrap\"); //Fields wrapper\nvar add_button = $(\".add_field_button\"); //Add button ID\n\nvar x = 1; //initlal text box count\n$(add_button).click(function(e){ //on add form button click\n e.preventDefault();\n if(x < max_fields){ //max forms box allowed\n x++; //text box increment\n $(wrapper).append('<div></p>Name<input name=\"nombre\" type=\"text\" onkeyup=\"update()\" maxlength=\"16\" />\\\n Select <select name=\"username\" onchange=\"update()\">\\\n <option value=\"1\">Option1</option>\\\n <option value=\"2\">Option2</option>\\\n <option value=\"3\">Option3</option>\\\n <option value=\"4\">Other</option>\\\n </select><input type=\"hidden\">\\\n <a href=\"#\" class=\"remove_field\">Remove</a></div>'); //add form\n }\n});\n\n$(wrapper).on(\"click\",\".remove_field\", function(e){ //user click on remove text\n e.preventDefault(); $(this).parent('div').remove(); x--;\n $(document).ready(function() {update();});\n})\n\n});\n\n\nAny idea, suggestion? :(" ]
[ "jquery", "html", "forms", "select" ]
[ "What does the AT symbol mean in KOTLIN", "What does the @ symbol mean in this code clip?\n\nLearning\n\n @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)\n fun onResume() {\n log.i(LOG_TAG, \"OnResume\")\n }" ]
[ "kotlin", "symbols" ]
[ "PHP multidimensional array elements being skipped", "I have set up a multidimensional array in PHP like this:\n\n$contents = array(\n \"Header1\" => array(\n \"Section 1\" => array (\n \"Description1\",\n \"Notes1\",\n ),\n \"Gap\" => \"Gap\",\n \"Section 2\" => array (\n \"Description2\",\n \"Notes2\",\n ),\n \"Gap\" => \"Gap\",\n \"Section 3\" => array (\n \"Description3\",\n \"Notes3\",\n ),\n ),\n);\n\n\nthen I loop through this array as follows:\n\nforeach ($contents as $header => $section) {\n foreach ($section as $title => $details) {\n echo $title.\"<br>\";\n }\n}\n\n\nThe output will be:\n\nSection1\nGap\nSection2\nSection3\n\n\nWhy isn't the second \"Gap\" showing?\n\nThanx" ]
[ "php", "arrays" ]
[ "jQuery Offset wrong on refresh of page", "I'm using jQuery offset function to place an absolutely positioned DIV over an anchor element. \n\n$(\"#marker1\").offset({ top: $(\"#<%= hypHowItWorks.ClientID %>\").offset().top, left: $(\"#<%= hypHowItWorks.ClientID %>\").offset().left });\n$(\"#marker1\").width( $(\"#<%= hypHowItWorks.ClientID %>\").outerWidth() );\n\n\nWhen the page loads up this works fine, however, if I reload the page by hitting F5, it displays the DIV slightly offset from where it shoud be. If I then go page back-forward in the browser its in the right place again!!\n\nThis is an issue with latest Chrome and Firefox, but not with IE9.\n\nAny ideas?\n\nChris." ]
[ "jquery", "positioning" ]
[ "JQueryMobile content jump after page transition (Using data-position=\"fixed\")", "I've been trying for days to get smooth transitions in a RhoMobile project i'm working on, and i've managed to fix most of the glitches in page transitions: flickers, header jumping a couple pixels on transitions, etc... \n\nBut one problem still remains: It seems that when going from one page to another, just after the transitions is done (the destination page alredy appears), it will scroll down about 15-20 px, as if during the transition, it paints the destination page content not taking into account the px needed to display the header, and then later, adds that space.\n\nI've seen this question asked before, but with no answer. Notice its not a duplicate of all the questions regarding flickering on transitions, since if alredy managed to get that working.\n\nMy viewport is as follows:\n\n<meta name=\"viewport\" content=\"user-scalable=no, height=device-height, width=device-width\">\n\n\nI've tried using javascript to set overflow: hidden while transitioning, but this has no effect on android.\n\nAny suggestion appreciated,\nThanks!" ]
[ "javascript", "html", "css", "jquery-mobile", "rhomobile" ]
[ "How to set default value of UITypeEditor", "I have this property of a custom object to be displayed in a PropertyGrid:\n\n [DisplayName(\"Dirección IP Local\")]\n [Editor(typeof(Configuracion.Editors.IPAddressEditor), typeof(UITypeEditor))]\n [Description(\"Dirección IP del computador en el cual está conectado el dispositivo.\")]\n public IPAddress IPLocal { get; set; }\n\n\nIn constructor of the same class I have:\n\nthis.IPLocal = Common.Helper.ProgramInfo.GetLocalIPAddresses().FirstOrDefault();\n\n\nThe IPAddressEditor is this:\n\npublic class IPAddressEditor : UITypeEditor\n{\n private IWindowsFormsEditorService _editorService;\n private IpAddressInput _ipAddressInput;\n private bool _escKeyPressed;\n\n public IPAddressEditor()\n {\n _ipAddressInput = new IpAddressInput();\n _ipAddressInput.Width = 150;\n _ipAddressInput.BackgroundStyle.BorderWidth = -1;\n _ipAddressInput.ButtonClear.Visible = true;\n _ipAddressInput.ValueChanged += _ipAddressInput_ValueChanged;\n _ipAddressInput.PreviewKeyDown += _ipAddressInput_PreviewKeyDown;\n }\n\n void _ipAddressInput_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)\n {\n if (e.KeyCode == Keys.Escape)\n _escKeyPressed = true;\n }\n\n void _ipAddressInput_ValueChanged(object sender, EventArgs e)\n {\n if (_editorService != null)\n _editorService.CloseDropDown();\n }\n\n public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)\n {\n return UITypeEditorEditStyle.DropDown;\n }\n\n public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)\n {\n if (provider != null)\n {\n _editorService =\n provider.GetService(\n typeof(IWindowsFormsEditorService))\n as IWindowsFormsEditorService;\n }\n\n if (_editorService != null)\n {\n _escKeyPressed = false;\n\n _editorService.DropDownControl(_ipAddressInput);\n\n if (!_escKeyPressed)\n {\n IPAddress ip = IPAddress.None;\n if (IPAddress.TryParse(_ipAddressInput.Value, out ip))\n return ip;\n }\n }\n\n return value;\n }\n}\n\n\nThe problem is that the control inside the editor (in this case _ipAddressInput) is not initialized with the value I assigned in object constructor.\n\nThis is obvious because in type editor constructor I am creating a new instance of IpAddressInput, so the question is: what is the best way to initialize it?\n\nI was thinking about creating a public setter for that variable and calling in constructor of the custom object using a TypeDescriptor, but I think this is tricky,\n\nIs there a better solution?\n\nRegards\nJaime" ]
[ "uitypeeditor" ]
[ "Using group by in C#", "Could anyone explain what this sample of code is doing? I can't quite grasp how the words string is being grouped. Is it taking the first letter of each word and grouping them somehow?\n\n// Create a data source. \n string[] words = { \"apples\", \"blueberries\", \"oranges\", \"bananas\", \"apricots\" };\n\n // Create the query. \n var wordGroups1 =\n from w in words\n group w by w[0] into fruitGroup\n where fruitGroup.Count() >= 2\n select new { FirstLetter = fruitGroup.Key, Words = fruitGroup.Count() };" ]
[ "c#", "linq" ]
[ "How to set color to cell if it is not empty in qtableview?", "I have a table with 26 row, 4 column and in 4th column is the only editable and to set color to the cell if it is not empty and when clicked and edit any cell it should be changed background color , in short when cell on 4th column is non empty cell it should be red color and for other non empty cell no any background color so looking for basic code structure in QTableView in PyQt5, basically how to structure code if anyone could help to do this thing in QTableview in PyQt5, I have read most of the queries about Background Color but it's very hard to understand." ]
[ "python", "pyqt", "pyqt5", "qtableview" ]
[ "'NoneType' object has no attribute 'format' python string", "I wrote a program in python to find compound interest (more like copied). This program was written in python 2 and I am having a problem on the last line .format(years).\nI need to know what I can do with this code, and how to write it properly in Python 3. Also with the {} part in the last line. Should I change it to %s? The error says:\n\n"AttributeError: 'NoneType' object has no attribute 'format'".\n\nMy code looks like this :\n# Estimated yearly interest\n\nprint ("How many years will you be saving ? ")\nyears = int(input("Enter the number of years : "))\n\nprint("How much money is currently in your account ? ")\nprincipal = float(input("Enter current amount in account : "))\n\nprint("How much money do you plan on investing monthly ? ")\nmonthly_invest = float(input("Monthly invest : "))\n\nprint("What do you estimate the interest of this yearly investment would be ? ")\ninterest = (float(input("Enter the interest in decimal numbers (10% = 0.1) : ")))\n\nprint(' ')\n\nmonthly_invest = monthly_invest * 12\nfinal_amount = 0\n\nfor i in range(0, years ):\n if final_amount == 0:\n final_amount = principal\n final_amount = (final_amount + monthly_invest) * (1 + interest)\n\nprint("This is how much money you will have after {} years: ").format(years) + str(final_amount)" ]
[ "python", "string" ]
[ "Can html5 poster size be varied for use as small thumbnail?", "I want to use the html5 video poster attribute to set up a thumbnail for a video on a Joomla page. I'm using this markup:\n\n<video width=\"100%\" height=\"100%\" poster=\"/templates/beez_20/images/ws_wst2.png\" controls> \n<source src=\"/templates/beez_20/video/ws_wst2.webm\" type='video/webm;codecs=\"vp8, vorbis\"'/>\n </video>\n\n\nThis works OK but the poster image displayed at the same size as the video which defeats the purpose of having a thumbnail. The SO page, \"How to set the thumbnail image on HTML5 video?\", is on the topic, but doesn't address the thumbnail size issue. I don't know whether this is achievable using the poster attribute or not. I'm happy to use js or jquery if necessary. Any help would be much appreciated." ]
[ "jquery", "html", "video" ]
[ "check if text box is empty then run code", "I have the following jquery and want to check if the text box is empty before the code is run:\n\n<script type=\"text/javascript\">\n $(document).ready(function () {\n if ($(\"#FNameTB\").val().length < 0) {\n $(\"input#FNameTB\").labelify({ labelledClass: \"greylabel\" });\n } \n</script>\n\n\nbut its not working." ]
[ "jquery", "asp.net", "textbox" ]
[ "Read zip or jar file without unzipping it first", "I'm not looking for any answers that involve opening the zip file in a zip input or output stream. My question is is it possible in java to just simply open a jar file like any other file (using buffered reader/writer), read it's contents, and write them somewhere else? For example:\n\nimport java.io.*;\n\npublic class zipReader {\n\npublic static void main(String[] args){\n\n BufferedReader br = new BufferedReader(new FileReader((System.getProperty(\"user.home\").replaceAll(\"\\\\\\\\\", \"/\") + \"/Desktop/foo.zip\")));\n BufferedWriter bw = new BufferedWriter(new FileWriter((System.getProperty(\"user.home\").replaceAll(\"\\\\\\\\\", \"/\") + \"/Desktop/baf.zip\")));\n char[] ch = new char[180000];\n\n while(br.read(ch) > 0){\n\n bw.write(ch);\n bw.flush();\n\n }\n\n br.close();\n bw.close();\n\n}\n\n}\n\n\nThis works on some small zip/jar files, but most of the time will just corrupt them making it impossible to unzip or execute them. I have found that setting the size of the char[] to 1 will not corrupt the file, just everything in it, meaning I can open the file in an archive program but all it's entries will be corrupted and unusable. Does anyone know how to write the above code so it won't corrupt the file? Also here is a line from a jar file I tested this on that became corrupted:\n\n\n nèñà?G¾Þ§V¨ö—‚?‰9³’?ÀM·p›a0„èwåÕüaEܵp‡aæOùR‰(JºJ´êgžè*?”6ftöãÝÈ—ê@qïc3âi,áž…¹¿Êð)V¢cã>Ê”G˜(†®9öCçM?€ÔÙÆC†ÑÝ×ok?ý—¥úûFs.‡\n\n\nvs the original:\n\n\n nèñàG¾Þ§V¨ö—‚‰9³’ÀM·p›a0„èwåÕüaEܵp‡aæOùR‰(JºJ´êgžè*?”6ftöãÝÈ—ê@qïc3âi,áž…¹¿Êð)V¢cã>Ê”G˜(†®9öCçM€ÔÙÆC†ÑÝ×oký—¥úûFs.‡\n\n\nAs you can see either the reader or writer adds ?'s into the files and I can't figure out why. Again I don't want any answers telling me to open it entry by entry, I already know how to do that, if anyone knows the answer to my question please share it." ]
[ "java", "jar", "zip", "bufferedreader", "bufferedwriter" ]
[ "how to create after update trigger in sql server 2008", "Dear friends I have one table \"terms_marks\" in which we create an trigger \"trgcreatetotal\" but when we update an specific column \"SA1\" in table terms_marks it will give the following error . I already done lot of googling . but i have not found solution. \n\n\"Msg 512, Level 16, State 1, Procedure trgcreatetotal, Line 11\nSubquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.\nThe statement has been terminated.\"\n\nso please any one can suggest us how it will we resolve please\n\nThanks.........\n\ndatabase table\n\nCREATE TABLE [dbo].[terms_marks](\n [marksmaster_id_] [int] IDENTITY(1,1) NOT NULL,\n [term_id] [int] NULL,\n [st_id] [int] NULL,\n [sub_id] [int] NULL,\n [roll_no] [numeric](18, 0) NULL,\n [admission_no] [numeric](18, 0) NULL,\n [FA1] [int] NULL,\n [FA2] [int] NULL,\n [SA1] [int] NULL,\n [Total_FirstTerm] [int] NULL,\n [FA3] [int] NULL,\n [FA4] [int] NULL,\n [SA2] [int] NULL,\n [Total_SecondTerm] [int] NULL,\n [Total_FA] [int] NULL,\n [Total_SA] [int] NULL,\n [GrandTotal] [int] NULL,\n [maxmarks] [int] NULL\n\n\n) ON [PRIMARY]\n\ntrigger code here \n\n SET ANSI_NULLS ON\n GO\n\n SET QUOTED_IDENTIFIER ON\n GO\n\n create trigger [dbo].[trgcreatetotal] on [dbo].[terms_marks]\n AFTER UPDATE\n AS\n declare @std_id int;\n IF UPDATE(SA1)\n begin\n SELECT @std_id = st_id \n FROM inserted\n UPDATE T\n SET T.Total_FirstTerm= (select (FA1+FA2))\n from terms_marks T\n INNER JOIN INSERTED I ON T.st_id=I.st_id\n WHERE T.Total_FirstTerm IS NULL\nupdate terms_marks set Total_FirstTerm=(select(FA1+FA2))where st_id=@std_id\n\nEND\nGO" ]
[ "sql-server-2008" ]
[ "Webstorm turn off new spaces in anonymous function declaration", "e.g. I have this:\n\nexports.getsertHexId = function (table, hex) {\n\n\nWebstorm 8's auto-indent is creating the space between the keyword function and the open paren (.\n\nIts settings spaces options cover:\n\n\nFunction declaration parentheses\nFunction call parentheses\n'if' parentheses\n. . .\n\n\nConfused since this should be covered under function declaration parentheses I thought. Can this be properly configured? Is it a bug?" ]
[ "javascript", "webstorm" ]
[ "How to get quality of jpeg 100? Camera2API", "i spend a lot of time with question how to set jpeg quality if you use Camera2API, and finally find such solution\n\nI achieved increasing the JPEG quality by adding it as a key to the CaptureRequest.Builder\n\nThe JPEG quality is set in the captureStillPicture() method in the Camer2BasicFragment like so:\n\n// This is the CaptureRequest.Builder that we use to take a picture.\n final CaptureRequest.Builder captureBuilder =\n mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);\n captureBuilder.addTarget(mImageReader.getSurface());\n\n //Set the JPEG quality here like so\n captureBuilder.set(CaptureRequest.JPEG_QUALITY, (byte)100);\n\n\nThanks to @BlinkingCahill\n\nbut issue is that case if i set quality 100 evetually in saved image i get 96...\n\nMaybe someone know how i can get 100? Or it depends of device or smth else?" ]
[ "java", "android", "image", "camera", "android-camera" ]
[ "How to perform multiple database alterations at once using NHibernate?", "I am looking into using Fluent NHibernate in a desktop application which uses 3 different database files. (Well, 3 different types.)\n\n\nDB1 is the main database file containing tables A, B, C and D. \nDB2 is a database file containing detailed data (X samples per second, program session will receive a new file as they can grow very large) in table E.\nDB3 is a database file used to export and import data between users (contains 1 row from A, 1 from B and all of E that belongs to the given row of A and B)\n\n\nCreating this is not really a problem as the SchemaExport.Create function does this perfectly.\n\nThe problem I face is that I don't exactly know what the best way to alter my tables is. More precisely, to do multiple version updates at once. My application is currently version 1, shipping with database format version 1, next week I bump everything to version 2 - I can update the database with SchemaUpdate.Execute - and next month I bump everything to version 3 and I can do the same thing again. But I want my users to be able to update from version 1 to version 3 at once.\n\nIf I would do things manually I would create a table called version in each database file which contains a version. I would then check that field against the current version and perform ALTER table queries. For example:\n\nif (db_version < LATEST_VERSION) {\n switch (db_version + 1) {\n case 2: Execute(\"ALTER TABLE A...\"); Execute(\"UPDATE A...\"); break;\n case 3: Execute(\"ALTER TABLE B...\"); break;\n }\n}\n\n\nUsing this approach (when using the SQLite database provider directly) I would only have to foresee 1 version of my data model, 1 update service which handles everything but I would need to create my database and my data model files manually, and I would have to update at least two .db files and 2 update services (one for each db type). Which can be seen as duplicate work. (I found the database migration of Banshee an example of what I mean by this.)\n\nBy using NHibernate I eliminate the process of maintaining a database file and a data model, but the only way I can see on doing updates from 1 to 3 is to keep a legacy version of each data model and do something like:\n\nnamespace Version1 {\n public class A {}\n DoUpdate();\n}\n\nnamespace Version2 {\n public class A {}\n DoUpdate();\n}\n\n\nAm I totally looking at this the wrong way or is my case simply to complex and would I be better off using the manual approach? \nWhat would be the best solution to update and migrate from version 1 to 3 using Fluent NHibernate? Or would anyone recommend using the manual approach, and if so why?" ]
[ "c#", "database", "nhibernate" ]
[ "MySQL Cluster (Master/Slave) and Hibernate", "The application when developed is using a single database and the spring configuration is as follows.\n\n<bean id=\"dataSource\" class=\"org.apache.commons.dbcp.BasicDataSource\" destroy-method=\"close\">\n <property name=\"driverClassName\" value=\"com.mysql.jdbc.Driver\" />\n <property name=\"url\" value=\"jdbc:mysql://localhost:3306/test\" />\n <property name=\"username\" value=\"root\" />\n <property name=\"password\" value=\"\" />\n</bean>\n\n\n<bean id=\"hibernateProperties\" class=\"org.springframework.beans.factory.config.PropertiesFactoryBean\">\n <property name=\"properties\">\n <props>\n <prop key=\"hibernate.hbm2ddl.auto\">update</prop>\n <prop key=\"hibernate.dialect\">org.hibernate.dialect.MySQLDialect</prop>\n ...\n </props>\n </property>\n</bean>\n\n<bean id=\"sessionFactory\" class=\"org.springframework.orm.hibernate3.LocalSessionFactoryBean\">\n <property name=\"dataSource\">\n <ref local=\"dataSource\" />\n </property>\n <property name=\"hibernateProperties\">\n <ref bean=\"hibernateProperties\" />\n </property>\n <property name=\"mappingResources\">\n <list>\n <value>...</value>\n </list>\n </property>\n</bean>\n\n<bean id=\"txManager\" class=\"org.springframework.orm.hibernate3.HibernateTransactionManager\">\n <property name=\"dataSource\" ref=\"dataSource\" />\n <property name=\"sessionFactory\" ref=\"sessionFactory\" />\n</bean>\n\n\nHowever for production there is a chance that either MySQL clustering or Master/Slave replication will be used. Any idea about the code/configuration changes for this ?\n\nAlso a quick question to all - How much transactions/sec a single mysql server instance running on a dedicated server can handle ?" ]
[ "mysql", "hibernate", "spring" ]
[ "Convert bytes to integer", "So I have the following functions:\n\nvoid SomeClass::Read(__in uint32_t& Res)\n{\n ReadBinary<uint32_t>(Res);\n}\n\ntemplate < typename T > \nvoid SomeClass::ReadBinary(T& Res)\n{\n size_t sBytesToRead = sizeof(T);\n\n Res = 0;\n std::vector<char> vcBuffer(sBytesToRead);\n m_Fstream.read(&vcBuffer[0], sBytesToRead);\n\n // little endian\n if (m_Endian == LITTLE_ENDIAN)\n for (int n = sBytesToRead-1; n >= 0; n--)\n Res = (Res << 8) + vcBuffer[n];\n\n // big endian\n else\n for (unsigned n = 0; n < sBytesToRead; n++)\n Res = (Res << 8) + vcBuffer[n];\n}\n\nvoid SomeClass::DetectEndian()\n{\n int num = 1;\n if (*(char *)&num == 1)\n m_Endian = LITTLE_ENDIAN;\n else\n m_Endian = BIG_ENDIAN;\n}\n\n\nThose functions are designed to detect system endianness and read binary integers from file.\n\nfor some reason I don't get the expected values. How do I know? I've written a simple python script:\n\nmode = 'rb'\nwith open(filename, mode) as f:\n print struct.unpack('i', f.read(4))[0]\n print struct.unpack('i', f.read(4))[0]\n\n\nIt seems like when the integer is small to be contain in a single byte the value of both programs are the same. However, once the integer consist of multiple bytes I get different values.\n\nthis leads me to think that I have a problem with those lines:\n\n// little endian\nif (m_Endian == LITTLE_ENDIAN)\n for (int n = sBytesToRead-1; n >= 0; n--)\n Res = (Res << 8) + vcBuffer[n]; \n\n\nAny ideas?" ]
[ "c++", "endianness", "typeconverter" ]
[ "is it possible to sort primefaces Datagrid?", "is it possible sort primefaces datagrid data? as i'm aware it's possible in data table.if it is not possible by default,is there any other way to do it? Thanks" ]
[ "sorting", "datagrid", "primefaces" ]
[ "Detecting if Apache is using mod_rewrite", "How can a client detect if a server is using mod_rewrite? Now I know that some mod_rewrite rules are not very obvious. But some are, such as \"SEO Friendly Urls\". What types of behavior is impossible unless a server is running mod_rewrite?" ]
[ "apache", "mod-rewrite", "seo" ]
[ "windows batch script to svn delete set of folders", "Suppose there are 15 folders committed in svn (each name starting with folder_).\nHow can I run svn delete on all the folders which were created on or before a specific date?\n\nThanks in advance.\n\nRegards,\nRohan" ]
[ "windows", "svn", "batch-file", "cmd", "command-prompt" ]
[ "flowjs: call of method `join`. Method cannot be called on mixed", "Say I have a constant animals, which I import with \n\nimport animals from './animals\n\n\nSay the animals constant is:\n\n{\n hoofed:[\n 'horses',\n 'sheep',\n 'goats'\n],\n feline: [\n 'lions',\n 'tigers'\n],\n canine: [\n 'dogs',\n 'wolves'\n ]\n}\n\n\nSay that I want to construct a Url query to some animals api, and write the following code:\n\nconst fq = Object.values(animals).reduce((memo, animalList) => memo + `animal:${animalList.join(' animal:')} `, '')\n\n\nNow this code generates a string of animals, separated by the word animal and whitespace, which is then URL encoded and correctly matches the target API surface.\n\nFlowJS however, rejects this code with:\n\n13: const fq = Object.values(animals).reduce((memo, animalList) => memo + `animal:${animalList.join(' animal:')} `, '')\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `join`. Method cannot be called on\n 13: const fq = Object.values(animals).reduce((memo, animalList) => memo + `animal:${animalList.join(' animal:')} `, '')\n ^^^^^^^^ mixed\n\n\nMy question is: why? The array is quite clearly not mixed, it is a constant, and Object.values should be returning something of type [string]?\n\nWhat is flow detecting, and how can I avoid it?" ]
[ "javascript", "types", "casting", "ecmascript-6", "flowtype" ]
[ "double level aggregation pandas python", "I am having some issues using groupby. I need to aggregate by one field, but the other field has to be the maximum of all the values for each group. Then I need the sum of this latest aggregation.\n\nLet's say I have this table:\n\nfield 1 field 2 value\n 1 1 0\n 1 2 1\n 1 3 1\n 2 1 1\n 2 1 1\n 2 4 0\n\n\nI want to know the field 1 count distinct for each field 2 but also the number of value = 1 for each field 1 (but only counting once each field 2).\n\nfield 2 count distinct field 1 value = 1\n 1 2 1(because field 1 is the same when value = 1)\n 2 1 1\n 3 1 1\n 4 1 0\n\n\nThe way I got it to work is by aggregating twice:\n\ndf = df.groupby([field1, field2]).aggregate({'value':'max'})\ndf = df.groupby(field2).aggregate({field1: 'count', 'value': 'sum'})\n\n\nBut it takes long time. I am sure there is a lambda function I can use, but I am new to this and I cannot figure it out. Could anyone please help me?" ]
[ "python", "pandas", "group-by" ]
[ "Failed to find a presenting view controller - UIDatePicker in overlay", "I'm presenting an overlay view using the following code (by adding it as a subview to the window):\n@objc func show() {\n if let window = UIApplication.shared.keyWindow {\n setupBlackView(window: window)\n setupSelf(window: window)\n window.addSubview(blackView)\n window.addSubview(self)\n UIView.animate(withDuration: 0.2, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .curveEaseOut, animations: {\n self.blackView.alpha = 1\n if let height = self.percentageHeight {\n self.frame = CGRect(x: 0, y: (1-height) * window.frame.height, width: screenWidth, height: screenHeight * height)\n }\n }, completion: nil)\n }\n}\n\nThe overlay view contains a UIDatePicker. This code used to work fine. However, now I am seeing the following error:\n[Assert] Failed to find a presenting view controller for view (<_UIDatePickerIOSCompactView: 0x7fe8003288e0; frame = (0 0; 114 188.333); gestureRecognizers = <NSArray: 0x600003bca3d0>; layer = <CALayer: 0x600003025a80>>) in window (<UIWindow: 0x7fe7fc436010; frame = (0 0; 390 844); autoresize = W+H; gestureRecognizers = <NSArray: 0x6000038918f0>; layer = <UIWindowLayer: 0x60000367d5c0>>). The interaction's view (or an ancestor) must have an associated view controller for presentation to work.\n\nand the UIDatePicker looks broken:" ]
[ "ios", "swift", "uiviewcontroller", "datepicker" ]
[ "In which cases does std::optional operator == cause undefined behavior?", "Cppreference has the following description of mixed (optional and some other non-optional type) comparison operators for std::optional:\n\nCompares opt with a value. The values are compared (using the\ncorresponding operator of T) only if opt contains a value. Otherwise,\nopt is considered less than value. If the corresponding two-way\ncomparison expression between *opt and value is not well-formed, or if\nits result is not convertible to bool, the behavior is undefined.\n\nWhat confuses me here is:\n\nWhat would be examples of these not well-formed comparisons?\n\nWhy don't compilers/STL just reject the invalid comparisons instead of giving us UB?" ]
[ "c++", "c++17", "stdoptional" ]
[ "Most efficient algorithm to compute a common numerator of a sum of fractions", "I'm pretty sure that this is the right site for this question, but feel free to move it to some other stackexchange site if it fits there better.\n\nSuppose you have a sum of fractions a1/d1 + a2/d2 + … + an/dn. You want to compute a common numerator and denominator, i.e., rewrite it as p/q. We have the formula\n\np = a1*d2*…*dn + d1*a2*d3*…*dn + … + d1*d2*…d(n-1)*an\nq = d1*d2*…*dn.\n\n\nWhat is the most efficient way to compute these things, in particular, p? You can see that if you compute it naïvely, i.e., using the formula I gave above, you compute a lot of redundant things. For example, you will compute d1*d2 n-1 times. \n\nMy first thought was to iteratively compute d1*d2, d1*d2*d3, … and dn*d(n-1), dn*d(n-1)*d(n-2), … but even this is inefficient, because you will end up computing multiplications in the \"middle\" twice (e.g., if n is large enough, you will compute d3*d4 twice).\n\nI'm sure this problem could be expressed somehow using maybe some graph theory or combinatorics, but I haven't studied enough of that stuff to have a good feel for it.\n\nAnd one note: I don't care about cancelation, just the most efficient way to multiply things. \n\nUPDATE:\n\nI should have known that people on stackoverflow would be assuming that these were numbers, but I've been so used to my use case that I forgot to mention this.\n\nWe cannot just \"divide\" out an from each term. The use case here is a symbolic system. Actually, I am trying to fix a function called .as_numer_denom() in the SymPy computer algebra system which presently computes this the naïve way. See the corresponding SymPy issue. \n\nDividing out things has some problems, which I would like to avoid. First, there is no guarantee that things will cancel. This is because mathematically, (a*b)**n != a**n*b**n in general (if a and b are positive it holds, but e.g., if a == b ==-1 and n == 1/2, you get (a*b)**n == 1**(1/2) == 1 but (-1)**(1/2)*(-1)**(1/2) == I*I == -1). So I don't think it's a good idea to assume that dividing by an will cancel it in the expression (this may be actually be unfounded, I'd need to check what the code does).\n\nSecond, I'd like to also apply a this algorithm to computing the sum of rational functions. In this case, the terms would automatically be multiplied together into a single polynomial, and \"dividing\" out each an would involve applying the polynomial division algorithm. You can see in this case, you really do want to compute the most efficient multiplication in the first place.\n\nUPDATE 2:\n\nI think my fears for cancelation of symbolic terms may be unfounded. SymPy does not cancel things like x**n*x**(m - n) automatically, but I think that any exponents that would combine through multiplication would also combine through division, so powers should be canceling. \n\nThere is an issue with constants automatically distributing across additions, like:\n\nIn [13]: 2*(x + y)*z*(S(1)/2)\nOut[13]: \nz⋅(2⋅x + 2⋅y)\n─────────────\n 2 \n\n\nBut this is first a bug and second could never be a problem (I think) because 1/2 would be split into 1 and 2 by the algorithm that gets the numerator and denominator of each term. \n\nNonetheless, I still want to know how to do this without \"dividing out\" di from each term, so that I can have an efficient algorithm for summing rational functions." ]
[ "algorithm", "math" ]
[ "Scheme:R5RS:: Make it ten-thousandth place value", "(define m (expt 2 32))\n(define a 22695477)\n(define c 1.0)\n\n(define (integers-starting-from n)\n (stream-cons n (integers-starting-from (+ n 1))))\n\n(define (prng seed)\n (define xn (remainder (+ c (* a seed)) m))\n (define prn (/ (remainder (+ c (* a seed)) m) m))\n (stream-cons prn\n (prng xn)))\n\n\n\nWhen I run this code my current output is\n\n(stream->list (prng 3) 5)\n> (0.015852607786655426 0.4954120593611151 0.998752823099494 0.7253396362066269 0.03071586787700653)\n\n\nBut Output has to be \n\n(stream->list (prng 3) 5)\n> (0.01585 0.4954 0.9988 0.7253 0.0307)\n\n\nHow do I make output to ten-thousandth place value?" ]
[ "scheme", "racket", "r5rs" ]
[ "shell script not running the other script inside it", "#!/bin/bash\nvalue=$(</var/www/sym_monitor/man.txt)\n\n\nif [ \"$value\" == \"true\" ]; then\n\n ps -ef|grep sym |grep -v grep |awk '{ print $2 }'|sudo xargs kill -9;\ncd /var/www/symmetric-ds-3.1.6/bin;\nsleep 30;\n\n(sudo ./sym --port 8082 --server);\n\nfi\n\n\nI'm trying to run the above script every 10 mins using cron. While running it under root manually the script is doing fine but when I try to run the script inside cron it is executing the (ps -ef|grep sym |grep -v grep |awk '{ print $2 }'|sudo xargs kill -9;) and it is not executing the script (sudo ./sym --port 8082 --server) and it is not giving any error. Can anybody suggest me any idea?" ]
[ "linux", "shell", "ubuntu", "crontab" ]
[ "Unable to add time picker time to textfield in swift", "I have created time picker in alert and in ok action i want to add selected time to regarding textfield, and is it possible to hide AM, PM from time picker, if possible how? i need to show only hours and minutes without AM, PM in time picker. please help me in the code.\n\nhere is my code: \n\n func timePicker(){\n\n let vc = UIViewController()\n vc.preferredContentSize = CGSize(width: 200,height: 200)\n let timePicker = UIDatePicker(frame: CGRect(x: 0, y: 0, width: 200, height: 200))\n let dateFormatter = DateFormatter()\n //dateFormatter.dateFormat = \"HH:mm\"\n timePicker.datePickerMode = .time\n\n vc.view.addSubview(timePicker)\n let addTimePickerAlert = UIAlertController(title: \"\", message: \"\", preferredStyle: UIAlertController.Style.alert)\n\n addTimePickerAlert.setValue(vc, forKey: \"contentViewController\")\n let ok = UIAlertAction(title: \"OK\", style: .default, handler: { (action) -> Void in\n\n self.hoursMinutesTextField.text = dateFormatter.string(from: timePicker.date)\n print(\"time textfield \\(self.hoursMinutesTextField.text)\")\n })\n let cancelAction = UIAlertAction(title: \"Cancel\", style: .default, handler: {\n (action : UIAlertAction!) -> Void in\n })\n addTimePickerAlert.addAction(ok)\n addTimePickerAlert.addAction(cancelAction)\n\n self.present(addTimePickerAlert, animated: true)\n}\n\nfunc textFieldShouldBeginEditing(_ textField: UITextField) -> Bool \n{\n\n self.timePicker()\n return true\n}\n\n\nplease help me in the code" ]
[ "ios", "swift", "uitextfield", "timepicker" ]
[ "Space Invaders With 2 Errors Unity", "I have an issue with increasing the score in my space invaders clone. I have 2 errors.\n\n\n Assets/Scripts/ScoreManager.cs(26,12): error CS0103: The name\n `retryLevel' does not exist in the current context\n \n Assets/Scripts/ScoreManager.cs(55,43): error CS1061: Type int' does\n not contain a definition forTostring' and no extension method\n Tostring' of typeint' could be found. Are you missing an assembly\n reference?\n\n\nWhere and what exactly in my script should I change?\n\nusing System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\nusing UnityEngine.UI;\n\npublic class ScoreManager : MonoBehaviour\n{\n\nint i = 0;\npublic GameObject HighScoreDisplay;\npublic Text scoreDisplay;\npublic int score = 0;\npublic Text[] highScoreTables;\n\n\nprivate void Start()\n{\n if (HighScoreDisplay == null || scoreDisplay == null) {\n\n Debug.LogWarning(\"Values are missing on the ScoreManager!\");\n\n return;\n\n }\n\n retryLevel();\n\n}\n\nprivate void update()\n{\n scoreDisplay.text = score.ToString();\n\n}\n\npublic void ModifyScore(int scoreToAdd)\n{\n score += scoreToAdd;\n\n}\n\npublic void fromScratch(){\n score = 0;\n HighScoreDisplay.SetActive(false);\n}\n\npublic void PlayerDied()\n{\n\n\n HighScores.AddScore(score);\n\n foreach (Text table in highScoreTables)\n {\n table.text = HighScores.scoreTable[i].Tostring();\n\n i++;\n }\n\n HighScoreDisplay.SetActive(true);\n score = 0;\n\n}\n\n}\n\npublic static class HighScores\n\n\n{\n\n public static List<int> scoreTable = new List<int>{0,0,0};\n\n public static void AddScore(int score)\n{\n if (score > scoreTable[2])\n {\n scoreTable[2] = score;\n }\n else if (score > scoreTable[1])\n{\n scoreTable[1] = score;\n}\nelse if (score > scoreTable[0])\n{\nscoreTable[0] = score;\n}\n}\n}" ]
[ "c#", "unity3d" ]
[ "Hide specific image in class", "I need to hide and run a delete script when a user clicks on an image.\n\nDisplay script:\n\n<?php\necho '<img src=\"../uploads/foto/clanky/' . $file . '\" id=\"' . $id . '\" class=\"img_edit\">';\n\n\nJS\n\n<script type=\"text/javascript\">\n $( \".img_edit img\" ).click(function() {\n var className = $('.img_edit').attr('id');\n $(this.id).hide( \"slow\", function() {\n\n });\n $.post(\"delete.php?id=\"+className);\n });\n</script>\n\n\nBut it's still doesn't work." ]
[ "php", "jquery" ]
[ "How to capture process output asynchronously in powershell?", "I want to capture stdout and stderr from a process that I start in a Powershell script and display it asynchronously to the console. I've found some documentation on doing this through MSDN and other blogs.\n\nAfter creating and running the example below, I can't seem to get any output to be displayed asynchronously. All of the output is only displayed when the process terminates.\n\n$ps = new-object System.Diagnostics.Process\n$ps.StartInfo.Filename = \"cmd.exe\"\n$ps.StartInfo.UseShellExecute = $false\n$ps.StartInfo.RedirectStandardOutput = $true\n$ps.StartInfo.Arguments = \"/c echo `\"hi`\" `& timeout 5\"\n\n$action = { Write-Host $EventArgs.Data }\nRegister-ObjectEvent -InputObject $ps -EventName OutputDataReceived -Action $action | Out-Null\n\n$ps.start() | Out-Null\n$ps.BeginOutputReadLine()\n$ps.WaitForExit()\n\n\nIn this example, I was expecting to see the output of \"hi\" on the commandline before the end of program execution because the OutputDataReceived event should have been triggered.\n\nI've tried this using other executables - java.exe, git.exe, etc. All of them have the same effect, so I'm left to think that there is something simple that I'm not understanding or have missed. What else needs to be done to read stdout asynchronously?" ]
[ "events", "powershell", "asynchronous" ]
[ "Custom ArrayList to Spinner", "I want every name from my ArrayList into a arrayadapter or spinner.\n\nI have a ArrayList<Type> types\n\nType class:\n\npublic class Type{\n\n int id;\n String name;\n\n public Type(int id, String name) {\n this.id = id;\n this.name = name;\n }\n}\n\n\nAnd i also have a Spinner now i want in the spinner all the names from the arraylist.\n\nbut if i choose a name from the spinner i also want to know what the id from the name is.\n\nAnyone who knows if this is possible?" ]
[ "java", "android", "arraylist", "spinner" ]
[ "Ansible - how to check if all elements on list are the same?", "We have list, like:\n['A', 'A']\nHow to check if list contains only elements A? (Yes, it is exactly string). \n\nFor example, for\n['A'], ['A','A','A','A'] True should be returned, however for\n[], ['A','A', 'B'] False should be returned. \n\nIs there exists any elegant way to express it?" ]
[ "ansible", "jinja2" ]
[ "accessing columns after row being read csv file", "Ok I admit I made this way too complicated. I have uploaded a simple image. \nIn a nutshell I can access the first line of each incident. (The numbers in the picture). I am able to manipulate and print them etc. \n\nWhat I would like to do is to be able to manipulate select columns in the rows beneath the first line. So when I access row 1 (numbers) I would also be able to access \"e,f,g\" on row 2 and \"z,z,z\" in row 3 and so forth. \n\nAt the moment my code jumps straight from line 1 (numbers) to line 6 (numbers) then line 11 (numbers) etc." ]
[ "python", "csv", "row", "line" ]
[ "Make an ajax request based on the output from another ajax request", "What I am doing now is, I am making an Jquery ajax call whenever a user clicks a button and If I get a particular output from this call, say 12345, then I need to make another ajax call. I can easily do that by making the second ajax call inside the success callback, but I believe this is not a nice way to get things done.\n So I tried different methods to implement this. But the thing is, my two ajax calls doesn't depend on each other. What I mean is, I don't need to pass data from ajax 1 to ajax2. I need to make the second ajax call only if I receive an output, 12345 from my first call. So what I did is\n\nvar first_call= ajax_call_1;\najax_call_1.done(function(data)\n{\n if(data==='1234')\n {\n // call a function which will perform the second ajax call\n }\n else\n {\n // do nothing\n }\n});\n\n\nSo my question is, Is there any other way to implement this? I mean a better way to do this? I am new to jquery deferred object and promise. I am going through the documentation now. I appreciate all the help I get." ]
[ "jquery", "ajax", "promise", "jquery-deferred" ]
[ "How to call a function from another module", "In my angularJS application, I have two modules : module A and module B.\n\nangular.module('A').controller('ACtrl',function($scope){\n $scope.alertA = function(){alert('a');}\n //...\n});\n\nangular.module('B').controller('BCtrl',function($scope){\n //...\n});\n\n\nHow to call the function alertA in the module B ?" ]
[ "javascript", "angularjs", "angularjs-scope" ]
[ "Cassandra instability that causes Timeouts on queries", "Cassandra 3.11.1, 5-node cluster\n\n\nAll works well till yesterday\nBut yesterday (without visible cause) we start to get random Read/Write Timeout Exception. Any query can be executed for 1ms and after it, repeat and Timeout, repeat and again 1ms - so application cannot work.\n\n\nI'm not an admin (developer) but i start to looking for something in nodetool and have a look at tpstats and it's Dropped part, and what i see.\n\nMessage type Dropped\nREAD 396\nRANGE_SLICE 485\n_TRACE 496047\nHINT 0\nMUTATION 1139\nCOUNTER_MUTATION 0\nBATCH_STORE 28\nBATCH_REMOVE 0\nREQUEST_RESPONSE 0\nPAGED_RANGE 0\nREAD_REPAIR 0\n\n\nFor me - it's sign that something is very and very wrong but i cannot understand how to diagnose it more detailed, what is cause and how to fix.\n\nAfter some experiments we see that timeout caused if token owned by certain node,\nfor example select id from mytable where it = '<token from invalid node>' - it will be fail with timeout every 5 runs.\n\nIs where any suggestions???" ]
[ "cassandra" ]
[ "Image storage as byte code locally from XML parsing & display if it is stored Otherwise go for parsing.", "I am having an app in which at the time of launcing the app XML parsing is giving Main category from URL like hp, dell, etc...I am displaying it in the Tableview.\n\nThen on click of particular cell i can get the detail of main category means its subcategory like http://www.dealsbell.com/findcoupon.php?store=hp\n\nHere also i am getting data properly after parsing.\n\nBut my concern over here is, in ( http://www.dealsbell.com/findcoupon.php?store=hp ) this link i am getting images.\n\nEach particular subcategory will have a same image. So i want to do something like that the image if first time loaded from the URL then it will display image from parsing otherwise i would like to store that image as its byte code in folder / file / in any way in my device on first parsing.\n\nIf once the image is stored to the particular way in my device next time when i will go to see the subcategory it will first check this image is stored locally to my device or not.\n\nIf yes then it should go to the particular location to fetch this local image & display it to each cell otherwise will parse & display image.\n\nI hope you are getting, what i want to ask.\n\nPlease guide me, how can this be possible & what is the way to get result.\n\nIf any example or link you can suggest, then it will be more efficient to me.\n\nThanks in advance." ]
[ "iphone" ]
[ "SQL Error Handling Help: While loop with tran with try catch", "Sorry for the horrid title...it's not very easy to explain what I'm asking in one line.\n\nI want to run two dependent DML queries in a loop...if either of the queries fail/throw an error...I want to rollback the transaction, exit the loop, and terminate the entire proc while throwing an error (so jobs will detect the failure). I think what I have is correct...but I have a few questions because I want to better understand how it works. I've read the Microsoft documentation...but I'm still unclear on some things.\n\nI know by using SET XACT_ABORT ON; that it will handle the rollback for the tran. Does that mean I do not need to check for IF (@@TRANCOUNT > 0) in the CATCH block?\n\nThe other question...the reason I have the TRY...CATCH block is because of the WHILE loop...I'm not sure if the failed transaction will also terminate the proc, so I'm forcing it with THROW?\n\nHere's what I have: (Ignore the fact that it's an infinite loop, I'm not including the break logic to keep the example simple)\n\nSET XACT_ABORT ON;\nWHILE(1=1)\nBEGIN\n BEGIN TRY\n BEGIN TRAN;\n --DML Query 1\n --DML Query 2\n COMMIT TRAN;\n END TRY\n BEGIN CATCH\n IF (@@TRANCOUNT > 0)\n ROLLBACK TRAN;\n\n THROW;\n END CATCH\nEND\n\n\n\n\nUPDATE\n\nOkay I'm trying to figure out how to test it myself, I was having a hard time figuring out how to test it, but I think I've got it now. So now I feel bad for posting the question :D\n\nHere's the test I've got so far...I'll update it as I make changes to it. It appears that the IF (@@TRANCOUNT > 0) in the CATCH block is not necessary, because when I remove the ROLLBACK and check for a transaction after a failure...there's no open transaction. However, if I leave it in...the IF statement resolves to true and it still runs the rollback without error.\n\nSET NOCOUNT ON;\n\nIF OBJECT_ID('dbo.ChadTestTable1') IS NOT NULL DROP TABLE dbo.ChadTestTable1; --SELECT * FROM dbo.ChadTestTable1\nCREATE TABLE dbo.ChadTestTable1 (TestField VARCHAR(10) NOT NULL)\n\nIF OBJECT_ID('dbo.ChadTestTable2') IS NOT NULL DROP TABLE dbo.ChadTestTable2; --SELECT * FROM dbo.ChadTestTable2\nCREATE TABLE dbo.ChadTestTable2 (TestField VARCHAR(10) NOT NULL)\n\nINSERT INTO dbo.ChadTestTable1 (TestField) VALUES ('Test1')\nINSERT INTO dbo.ChadTestTable2 (TestField) VALUES ('Test1')\n\nSET XACT_ABORT ON;\nWHILE(1=1)\nBEGIN\n BEGIN TRY\n BEGIN TRAN;\n RAISERROR('Update first table',0,1) WITH NOWAIT;\n UPDATE dbo.ChadTestTable1 SET TestField = 'Test3'\n\n RAISERROR('Update second table',0,1) WITH NOWAIT;\n UPDATE dbo.ChadTestTable2 SET TestField = NULL\n\n RAISERROR('Updates done',0,1) WITH NOWAIT;\n COMMIT TRAN;\n END TRY\n BEGIN CATCH\n --It appears this isn't necessary...but if it's here, it still resolves to true and runs?\n IF (@@TRANCOUNT > 0)\n BEGIN\n RAISERROR('Rolling back transaction',0,1) WITH NOWAIT;\n ROLLBACK TRAN;\n END\n\n RAISERROR('Throwing Error',0,1) WITH NOWAIT;\n THROW;\n END CATCH\n\n RAISERROR('End of loop',0,1) WITH NOWAIT;\n BREAK;\nEND\n\nSELECT * FROM dbo.ChadTestTable1 ctt\nSELECT * FROM dbo.ChadTestTable2 ctt" ]
[ "sql-server", "tsql", "transactions", "try-catch" ]
[ "Is there a way to read a text from a text.file and set it to maven property in pom.xml maven?", "Is there a way to read a text from a text.file and set it to maven property in pom.xml maven? I am trying with the below code. But, I will need to read the text from tmp.txt and assign it to the maven property \"token\".\n\n<plugin>\n <groupId>org.codehaus.mojo</groupId>\n <artifactId>exec-maven-plugin</artifactId>\n <version>1.5.0</version>\n <executions>\n <execution>\n <id>generate-random-string</id>\n <phase>install</phase>\n <goals>\n <goal>exec</goal>\n </goals>\n <configuration>\n <executable>bash</executable>\n <arguments>\n <argument>temp.sh</argument>\n </arguments>\n <workingDirectory>temp.txt</workingDirectory>\n </configuration>\n </execution>\n </executions>\n</plugin>\n\n\ntemp.sh\n\nPWD=${openssl rand hex 12}\necho $PWD >> temp.txt" ]
[ "java", "maven", "maven-antrun-plugin", "maven-exec-plugin" ]
[ "Helm and Kubernetes: Is there a barrier equivalent for jobs?", "Given 3 jobs (A,B,C) in 3 Helm charts, is it possible to run A and B jobs in parallel, then start job C as soon as both of them are finished? Think of a barrier, in which a bunch of stuff needs to be finished before moving on.\n\nEven if I put A and B charts as sub-charts for C chart, then all 3 are started in parallel.\n\nI already have an workaround for this: add an external check for A and B job finishing, then start C. Still, I would prefer a Helm-based solution, if it exists." ]
[ "kubernetes", "kubernetes-helm" ]
[ "Visual Studio Code not performing error checking in Javascript", "I've tried following these instructions:\n\nhttps://code.visualstudio.com/Docs/runtimes/nodejs\n\nI am not getting the green/red swiggly lines at all. Is there something I'm missing?\n\nYou can also see the same thing in this video:\n\nhttps://youtu.be/sE8_bTEBlFg?t=1m37s\n\nAs far as I know, they're running the default editor. I've tried installing typings and typescript using npm. I've Followed that tutorial to get Javascript intellisense for node.js, but I fail to get either error/warning checking or any type information for node.js modules.\n\nIs there a location the type files should be installed to in order to make them global to every JS project you create in VS Code?" ]
[ "javascript", "node.js", "visual-studio-code" ]
[ "How to copy-paste the whole discover page to my Kibana dashboard?", "I'm using Kibana 5. I want to copy-paste the whole discover page content (including the plot and fields filters) to my dashboard:\n\n\n\nIn order to do that I save a search and then insert it into the dashboard. Unfortunately, I get only the list of requests without fields filter and plot" ]
[ "kibana" ]
[ "Getting Methods from another Class in Java", "I'm new to Java, so please bear with me if this is the stupidest thing you have ever heard. \n\nSo, basically I'm creating a form in Java. When it is submitted, it is validated, and if there in an error, I want the specific form item to turn red. I've managed to do so by calling the method setAsError()\n\npublic void setAsError(){\n this.setBackground(new Color(230,180,180));\n}\n\n\nBut the problem is, my form items (Includes Text fields, Combo Boxes and other swing classes) already extends the Java components.\n\npublic class KComboBox extends JComboBox {\n\npublic KComboBox(String[] s){\n super(s);\n //There's other stuff in here too\n}\n\n\nI want to add the setAsError() method to my form items. I realize that I could individually add the method to all the necessary classes, but this seems a bit odd for OO programming.\n\nIn any case, the end result should be, when I do\n\nmyFormItem.setAsError()\n\n\nthe field should turn red.\n\nAny help would be appreciated, and thanks in advance." ]
[ "java", "class", "methods", "add" ]
[ "wget a local HTTPS site? Can I set the IP wget should use to connect to the site?", "wget is trying to connect at 127.0.0.1 but it doesn't work. Is it possible to set the IP address wget should connect to without changing my /etc/hosts\n\nChanging the /etc/hosts creates all sorts of other problems.\n\nI'm running Debian 8 and I get:\n\nERROR: The certificate of ‘example.com’ is not trusted.\n\nI suppose a way to accept unsigned certificates would also do.\n\nThanks very much!" ]
[ "linux", "ubuntu", "https", "debian", "wget" ]
[ "How to remove Parent checkbox in pygtk", "I have created one Treestore in pygtk. Everything is fine only problem is, I don't want patent checkbox. you can see in below picture.\n\nComputer1 [ ]-----This checkbox I don't want\n C drive [ ]\n D drive [ ]\n E drive [ ]\n\n\nI have written code as,\n\nself.view = gtk.TreeView( model )\nself.renderer = gtk.CellRendererText()\nself.renderer.set_property( 'editable', False )\n\nself.renderer1 = gtk.CellRendererToggle()\nself.renderer1.set_property('activatable', True)\nself.renderer1.connect( 'toggled', self.col1_toggled_cb, model )\n\nself.column0 = gtk.TreeViewColumn(\"Computer Name\", self.renderer, text=0)\n\nself.column1 = gtk.TreeViewColumn(\"Select Drive\", self.renderer1 )\nself.column1.add_attribute( self.renderer1, \"active\", 1)\nself.view.append_column( self.column0 )\nself.view.append_column( self.column1 )\n\nself.tree_store = gtk.TreeStore( gobject.TYPE_STRING,\n gobject.TYPE_BOOLEAN )\nfor item in tasks.keys():\n parent = self.tree_store.append( None, (item, None) )\n if len(tasks[item])>1:\n for x in range(0,len(tasks[item])): \n self.tree_store.append( parent, (tasks[item][x],1) )\n else:\n self.tree_store.append( parent, (tasks[item][0],None) )" ]
[ "python", "python-2.7", "treeview", "gtk", "pygtk" ]
[ "Insert Checkboxes in to PHP Post Array", "Sorry for daft question. I have a form with multiple dynamically generated checkboxes, I want to insert these in to a post array to move them on to the next page then manipulate them.\n\nThe form:\n\n<form action=\"campcreate.php\" class=\"form\" method=\"post\">\n<label for \"campName\">Campaign Name:</label>\n<input type=\"text\" id=\"campName\" class=\"form-control\" name=\"campName\" placeholder=\"Campaign Name\" required minlength=\"6\" autofocus>\n<label for \"notes\">Description:</label>\n<textarea class=\"form-control\" name=\"notes\" rows=\"5\" id=\"notes\" placeholder=\"Add any useful notes or descriptions here\"></textarea>\n<h3>Select committee memmbers:</h3>\n<p>Committee members can be changed as required, all members selected as committee members will be able to view documents, meetings etc. connected to the campaign.</p>\n<p>Assigning a committee member does <strong>not</strong> grant them any different admin privillages on the site.</p>\n<?php getnames(); ?>\n\n<div>\n<button type=\"submit\" class=\"btn btn-success float-right\" id=\"create\">Next</button>\n<button type=\"button\" class=\"btn btn-primary float-right\" id=\"restart\">Back</button>\n</div> <!--Form Div--->\n</form>\n\n\nThe included function:\n\nfunction getnames(){\n global $conn;\n$sqlga = \"SELECT user_id, user_first, user_last FROM users WHERE (usr_acrive= 1) AND (perm!=0) ORDER BY user_last ASC\";\n$stmt = mysqli_stmt_init($conn); \nmysqli_stmt_prepare($stmt, $sqlga);\nmysqli_stmt_execute($stmt);\n$result = mysqli_stmt_get_result($stmt);\nwhile ($row = mysqli_fetch_assoc($result)) {\n if ($row['user_id']!=$_SESSION['user_id']){\n $checked=\"\";\n }else{\n $checked=\"checked disabled\";\n }\n echo '<input type=\"checkbox\"'.$checked.' value=\"'. $row['user_id'] .'\" name=\"userid\"> '.$row['user_first'] . ' '. $row['user_last'] . '<br>';\n }\n}\n\n\nI want to carry these forward these check boxes (which display correctly) to the next page but I can't work out how to include these in the post, one box will be automatically selected (the user creating the post) but up to say 100 other boxes may be ticked.\n\nI've tried echoing out, but I can only see the text boxes.\n\nAny pointers welcome." ]
[ "php", "html", "mysql" ]
[ "split string only on first instance of specified character", "In my code I split a string based on _ and grab the second item in the array.\n\nvar element = $(this).attr('class');\nvar field = element.split('_')[1];\n\n\nTakes good_luck and provides me with luck. Works great!\n\nBut, now I have a class that looks like good_luck_buddy. How do I get my javascript to ignore the second _ and give me luck_buddy?\n\nI found this var field = element.split(new char [] {'_'}, 2); in a c# stackoverflow answer but it doesn't work. I tried it over at jsFiddle..." ]
[ "javascript", "jquery", "regex" ]
[ "How do I sort a two-dimensional (rectangular) array in C#?", "I have a two-dimensional array (of Strings) which make up my data table (of rows and columns). I want to sort this array by any column. I tried to find an algorithm for doing this in C#, but have not been successful.\n\nAny help is appreciated." ]
[ "c#", "arrays", "sorting" ]
[ "How to make Angular 2 remember scroll position?", "I'm on page 1, I scroll halfway through the page and then click a link that brings me to page 2 through the Angular router. When I hit the \"back\" button, I'd like page 1 to be scrolled halfway down, just like it was before I left that page.\n\nWhat is the easiest way to do that?" ]
[ "angular", "scroll", "angular2-router" ]
[ "libpng not linked on Mac OSX 10.9.2", "I installed matrix2png on my Mac and had used it without problem before last week when I installed another image manipulating tool \"circos\". Circos requires me to install a different version of libpng, and I did. After that, I am no longer able to run matrix2png, which gives me the following error. I think the old ligpnb is not linked any more. Does anyone know how to fix this error? - appreciate your help.\n\ndyld: Library not loaded: /usr/local/lib/libpng15.15.dylib\n Referenced from: /usr/local/bin/matrix2png\n Reason: image not found" ]
[ "macos", "libpng" ]
[ "DOM2 events in mobile browsers?", "I am currently developping a HTML/Javascript mobile application, and my question is :\nare DOM2 addEventListener(...) functions compatible with mobile browsers/which ones? \n\nPS couldn't find the answer on http://www.quirksmode.org/m/table.html" ]
[ "javascript", "android", "html", "dom", "browser" ]
[ "check only once on click event with jquery", "On every click i tried to check if the class exists, and if the class found then load the enscroll plugin.\nbut the problem is, after find the class st2-wr || st2, its again load the enscroll plugin with click event because the class exists, \n\ni want only once the plugin load after finding the class. \n\n$('.embtn').delegate(this, 'click', function(){\n var $sec = $(this).closest('.sec'), \n $parentSection = $sec.closest('.m_ms');\n\n if($parentSection.hasClass('st2-wr') || $parentSection.hasClass('st2')){\n $('.ms_box').enscroll({\n showOnHover: true,\n verticalTrackClass: 'track3',\n verticalHandleClass: 'handle3'\n });\n }\n});" ]
[ "javascript", "jquery", "onclick" ]
[ "Round image as background for input type=\"submit\"", "In the page found in below link(bg-button.html), I have put round image as a background using styles. But I find a gray background outside the image area. How can I make the background transparent, Please let me know?\nRound image as background" ]
[ "forms" ]
[ "Turn off jQuery Mobile when accessed from non-mobile device", "Here is my situation - I'm working on a web-site using only JQM controls and doesn't matter, if the site is accessed from desktop or mobile device the site is using JQM controls.\nI'm using ASP.NET so inside the code a typical controls look like this:\n\n<asp:Button runat=\"server\" data-theme=\"b\" data-icon=\"check\" data-mini=\"true\" SkinID=\"btnSelectMiniB\"/> \n<asp:Button runat=\"server\" data-theme=\"b\" data-icon=\"arrow-r\" data-iconpos=\"right\" data-mini=\"true\" SkinID=\"btnViewMiniB\"/> \n<asp:DropDownList runat=\"server\" data-theme=\"b\" SkinID=\"ddlThemeB\"></asp:DropDownList>\n\n\nI need a technique that will allow me to incorporate new styling for non-mobile devices, without creating new website. Can I turn off JQM scripts and CSS somehow, if my web-site is accessed via mobile browser? Are these data tags going to be a problem, if I turn off the JQM (somehow). Are there any other underwater stones that could appear? How can I then handle the situation, when the site is accessed via mobile devices and I need to override the desktop styling?\n\nAny starting tips with code snippets will be highly appreciated." ]
[ "css", "jquery-mobile", "mobile-devices" ]
[ "MYSQL time and date troubles", "I am running a query to show upcoming events and selecting the events closest to the current date\nand i am also sorting it on the basis of timing.\n\nSo suppose today's date is 18th july 2013, it is pulling out the top 3 events which are closest to july 18th .\n\nSO if the event is on 22nd july 2013, it will select the three events and because of the AND in the query it is also checking for the timing of the event .\n\nNow if the current time is 23:00 and the time of the event is 19:00 but event is on 22nd july it wont show that event because according to the query it should be greater than the curtime ..\n\nSO how should i solve this problem..\nTHanks in advance \n\n$sql=\"SELECT * FROM events WHERE d_o_e>=CURDATE() AND t_o_e>=CURTIME() ORDER BY d_o_e ASC,t_o_e ASC LIMIT 3;\";" ]
[ "mysql", "date", "time" ]
[ "Can I extract Positive, Nat to int32, Z to int?", "Hi I am writing an extraction from Coq to Ocaml, I would like to convert type:\n\npositive --> int32\nN -> int32\n\n\nbut I want to keep type Z is int\n\nHere is the code I am doing to extract these conditions:\n\nRequire Import ZArith NArith.\nRequire Import ExtrOcamlBasic.\n\n(* Mapping of [positive], [N], [Z] into [int32]. *)\nExtract Inductive positive => int32\n[ \"(fun p-> let two = Int32.add Int32.one Int32.one in\n Int32.add Int32.one (Int32.mul two p))\"\n \"(fun p->\n let two = Int32.add Int32.one Int32.one in Int32.mul two p)\" \"Int32.one\" ]\n \"(fun f2p1 f2p f1 p -> let two = Int32.add Int32.one Int32.one in\n if p <= Int32.one then f1 () else if Int32.rem p two = Int32.zero then\n f2p (Int32.div p two) else f2p1 (Int32.div p two))\".\n\nExtract Inductive N => int32 [ \"Int32.zero\" \"\" ]\n\"(fun f0 fp n -> if n=Int32.zero then f0 () else fp n)\".\n\nExtract Inductive Z => int [ \"0\" \"\" \"(~-)\" ]\n\"(fun f0 fp fn z -> if z=0 then f0 () else if z>0 then fp z else fn (-z))\".\n\n\nI cannot do it to keep Z -> int because the definition of Z in Coq's library (BinInt.v)\n\nInductive Z : Set :=\n | Z0 : Z\n | Zpos : positive -> Z\n | Zneg : positive -> Z.\n\n\nI got an error: (function coq_Zdouble_plus_one)\n\nFile \"BinInt.ml\", line 38, characters 4-5:\n\nError: This expression has type int but an expression was expected of type\n int32\n\nBinInt.ml\n\nopen BinPos\nopen Datatypes\n\n(** val coq_Z_rect :\n 'a1 -> (int32 -> 'a1) -> (int32 -> 'a1) -> int -> 'a1 **)\n\nlet coq_Z_rect f f0 f1 z =\n (fun f0 fp fn z -> if z=0 then f0 () else if z>0 then fp z else fn (-z))\n (fun _ ->\n f)\n (fun x ->\n f0 x)\n (fun x ->\n f1 x)\n z\n\n(** val coq_Z_rec : 'a1 -> (int32 -> 'a1) -> (int32 -> 'a1) -> int -> 'a1 **)\n\nlet coq_Z_rec f f0 f1 z =\n (fun f0 fp fn z -> if z=0 then f0 () else if z>0 then fp z else fn (-z))\n (fun _ ->\n f)\n (fun x ->\n f0 x)\n (fun x ->\n f1 x)\n z\n\n(** val coq_Zdouble_plus_one : int -> int **)\n\nlet coq_Zdouble_plus_one x =\n (fun f0 fp fn z -> if z=0 then f0 () else if z>0 then fp z else fn (-z))\n (fun _ ->\n Int32.one)\n (fun p ->\n ((fun p-> let two = Int32.add Int32.one Int32.one in\n Int32.add Int32.one (Int32.mul two p))\n p))\n (fun p -> (~-)\n (coq_Pdouble_minus_one p))\n x\n\n\nIf I extract Z -> int32, it is Ok, but it is not what I want." ]
[ "ocaml", "coq", "coq-extraction" ]
[ "Requests change language from ASP", "I am working on some scraps, and making tests, but i don't know how to change the web language if it's from an ASP file/web.\n\nThis is the web\n\nFrom Google Chrome Tools I saw when you click on a language, it calls an .asp file: \n\nCommon/Source/WG2/wg_ServerRequestFramework.asp\n\n\nBut I don't know how to give it params to to get the HTML on the language I want. Every time I try, I got an error or nothing.\n\nMy code is:\n\nheaders = {\n 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0',\n 'Accept': '*/*',\n 'Accept-Language': 'es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3',\n 'Accept-Encoding': 'gzip, deflate, br',\n }\n\nproduct_link = url + '/prodotti/a/' + productname.replace('/', '@')+\"/\"\n\ns = requests.Session()\nr = s.get(product_link, headers=headers)\ntree = html.fromstring(r.content)\n language_link='https://www.microdetectors.com/Common/Source/WG2/wg_ServerRequestFramework.asp'\n\nparams={'typeRequest': 'salvaSession','NomeSession': 'CodLingua', 'ValoreSession': 'SPA', 'CodVerifica': '8TWoHMM0', 'UtenteAtt':''}\nr=s.post(language_link, headers=headers, data=params, cookies = {'CodVerificaAccesso': '8TWoHMM0', 'CodLingua':'ita'})\nprint(r.text)\n\n\nI think i am doing everything wrong? Hope you can help me :(" ]
[ "python", "python-requests", "asp-classic" ]
[ "How does Moq mock a data for pattern matching?", "The background \n\npublic interface IEvent {}\n\npublic class Event1 : IEvent {}\n\npublic class Event2 : IEvent {} \n\n\nNow I have a business logic does this: \n\nswitch (evt) {\n case Event1 e1: {\n // do something so I can use e1 directly \n }\n default: {\n // handle other types of concrete events \n }\n}\n\n\nIn the unit test, I simulate a test observable to pump a set concrete event type, then I can do \n\ntestScheduler.AdvanceBy(n) \n\n\nI can test every section of my business logic. \n\nHowever, now I have to create the concrete type of each event and put them in the observable. \n\nI do have to mock some data entities, as some relies on an additional type, which cannot be mocked, that's why I have an interface of this data object. One example is, I wrap the BrokeredMessage so I can call the CompleteAsync from interface instead the actual unmockable BrokeredMessage. \n\nHow do I use MOQ to mock a data object so pattern matching will work? \n\nThanks" ]
[ "c#", "moq" ]
[ "Making function variables from imported module available in iPython interactive namespace", "I want to know how to make variables from functions in imported modules available in the IPython interactive namespace.\n\nI have some example code which I want to run from another script so I set it up as run_test.py:\n\ndef run_test():\n a = 5\n\nif __name__ == \"__main__\":\n run_test()\n\n\nI import the module as follows and call the function:\n\nimport run_test\nrun_test.run_test()\n\n\nHow do I make variable 'a' available in the interactive namespace? The only way I can do it is to make 'a' a global and run run_test.py directly rather than importing it and calling the function.\n\nAny pointers appreciated." ]
[ "python", "ipython" ]
[ "Jquery fails when i use button tag in HTML to call Javascript function which in turn uses Jquery", "I have button on my HTML page. Initially i was using \n\n<input name=\"op\" id=\"changepass_submit\" value=\"Change Password\" disabled=\"disabled\" class=\"form-submit\" type=\"button\" onClick=\"change_passwd();\" />. \n\n\nUsing this i am able to call the javascript function change_passwd() which has it's definition as,\n\nfunction change_passwd()\n{\n var o_pass = document.getElementById('o_passwd').value;\n var n_pass = document.getElementById('n_passwd').value;\n var c_pass = document.getElementById('c_passwd').value;\n if(n_pass == \"\")\n alert(\"New Password can not be empty!\");\n else \n {\n if(n_pass == o_pass)\n {\n alert('New password and old password are same! Please choose different new password.');\n }\n else\n {\n o_pass = rtrim(ltrim(o_pass));\n n_pass = rtrim(ltrim(n_pass));\n $.ajax({\n type: \"POST\",\n data: {o_pass:o_pass,n_pass:n_pass},\n url: \"changepass\",\n success: function(response) {\n var result = eval(response);\n alert(result[1]);\n window.location = \"/my_profile\";\n }\n });\n }\n }\n}\n\n\nIt works fine. \n\nBut when i change <input> tag to:\n\n<button name=\"op\" id=\"changepass_submit\" disabled=\"disabled\" class=\"form-submit\" onClick=\"change_passwd();\" style=\"width:150px;\"><strong>Change Password</strong></button>\n\n\nit gives jQuery error..\n\nwhy so? If any body has any suggestions or answers pls let me know. Thanks in advance." ]
[ "javascript", "jquery-ui" ]
[ "How do Iterators act when working with databases?", "Making queries like SELECT * FROM people could create serious memory problems, i.e., as many like to call it, \"memory exceeded\".\n\nMany programmers invoke using iterators to reduce memory consumption. Iterators are a sort of \"play-n-pause video recording\", meaning that they procuce a value, they stop, they produce a value and so on, avoiding to generate all the values all at once. An example in Python could be the following:\n\ndef myIterator():\n for i in range(10):\n yield i * 2\n\n\nNow, when it comes to use iterators to fetch data from databases, I get pretty confused. I was always told to limit the number of queries toward a database because it could become a bottleneck and, using iterators, it seems to me to increment the number of queries. Is it so? How does an iterator work with database queries? Is this the well-known problem of the short bed sheet, again? In addition, what happens if, during the fetch phase with an iterators, some data is added in the database?\n\nP.S. My question isn't related to a particular programming language, but it is in general." ]
[ "sql", "database", "iterator" ]
[ "why is this setting cookie in wordpress is not working?", "This is my code to set cookie in functions but hook init is not working. How can i fix this issue?\n\nfunction set_carts_cookies($carts_Items){\n global $carts;\n $carts=serialize($carts_Items);\n function setting_new_cookie() {\n global $carts;\n setcookie('cart_item',$carts,time() + (60),'/');\n }\n add_action( 'init', 'setting_new_cookie');\n}\nset_carts_cookies(array(1,2));\n\n\necho $carts=serialize($carts_Items); this line is working fine but unable to init hook." ]
[ "php", "wordpress", "cookies" ]
[ "How to force developer tools to open in IE", "I need to force open the developer tab in IE. I'm working with an application in IE that has \"disabled shortcuts\". I would like to open the developer tab to modify the client side layout for better work flow. Is there a way to force open the developer tab to add my custom JavaScript to improve work flow?\n\nEDIT The application is in a window without any tool bars or access to anything but the url. IE is required. No other browser will support the application without crashing" ]
[ "javascript", "internet-explorer", "developer-tools" ]
[ "Parallelise a for that uses views (Scala)", "I'm very new to Scala! However, I have the following working solution to Euler Problem 4 that I would like to use par on, just to see if I can do it:\n\nimport scala.math\n\nobject Problem4 {\n def isPalindrome(x: Int): Boolean = {\n val string = x.toString\n string.reverseIterator.sameElements(string.iterator)\n }\n\n def getPairs(minimum: Int, maximum: Int) = {\n for (i <- minimum to maximum view;\n j <- minimum to maximum view)\n yield (i, j)\n }\n\n def getAnswer(numberOfDigits: Int): Int = {\n val maximum = math.pow(10, numberOfDigits).toInt\n val minimum = math.pow(10, numberOfDigits - 1).toInt\n val products = for {\n pair <- getPairs(minimum, maximum)\n product = pair match { case (i, j) => i * j } \n if isPalindrome(product)\n } yield product\n products.par.max\n }\n\n def main(args: Array[String]) {\n val answer = getAnswer(4)\n println(\"Problem 4 answer: %s\".format(answer))\n }\n} // object Problem4\n\n\nProject Euler 4 asks for 3-digit numbers, and I've noticed that finding the answer for 4-digit numbers takes 63 seconds on my PC and only uses one processor on my dual-core system. This is despite applying par to the end of the for expression.\n\nHow do I parallelise this using par? Ideally I'd like finding the answer for 4 digits to take 30-40 seconds. Thanks!\n\nEDIT: I'm pretty sure getPairs returns a View:\n\n scala> def getPairs(minimum: Int, maximum: Int) = {\n | for (i <- minimum to maximum view;\n | j <- minimum to maximum view)\n | yield (i, j)\n | }\n getPairs: (minimum: Int, maximum: Int)scala.collection.SeqView[(Int, Int),Seq[_]]\n\n\nMoreover, adding par to the getPairs call returns a warning, still only uses one of my processors, and results in a java.lang.OutOfMemoryError: Java heap space exception:\n\n[info] Loading project definition from M:\\programming\\testdriveneuler\\src\\problem4\\project\n[info] Set current project to euler (in build file:/M:/programming/testdriveneuler/src/problem4/)\n[info] Compiling 1 Scala source to M:\\programming\\testdriveneuler\\src\\problem4\\target\\scala-2.9.2\\classes...\n[warn] M:\\programming\\testdriveneuler\\src\\problem4\\src\\main\\scala\\Problem4.scala:39: `withFilter' method does not yet exist on scala.collection.parallel.ParSeq[((Int, Int), Int)], using `filter' method instead\n[warn] pair <- getPairs(minimum, maximum).par\n[warn] ^\n[warn] one warning found\n\n\nEDIT: I'm explicitly interested in calculating the answer to Euler problem 4 for the product of 2 4-digit numbers. For reference the answer is 99000099." ]
[ "scala" ]
[ "How to make an Alt loop in batch file?", "@echo off &setlocal\ntitle Escape\nmode con: cols=75 lines=20\nSetLocal EnableExtensions EnableDelayedExpansion\nfor /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (\n set "DEL=%%a"\n)\n\nfor /f "tokens=2 delims=:" %%i in ('chcp') do set /a oemcp=%%~ni\n\n>nul chcp 437\n\n:: Create, convert, and save the box-drawing characters.\n>"%temp%\\boxdrw.~b64" echo(//4CJSQlYSViJVYlVSVjJVElVyVdJVwlWyUQJRQlNCUsJRwlACU8JV4lXyVaJVQlaSVmJWAlUCVsJWclaCVkJWUlWSVYJVIlUyVrJWolGCUMJQ==\n>nul certutil.exe -f -decode "%temp%\\boxdrw.~b64" "%temp%\\boxdrw.~u16"\nfor /f %%i in ('type "%temp%\\boxdrw.~u16"') do set "box=%%i"\ndel "%temp%\\boxdrw.~b64" "%temp%\\boxdrw.~u16"\n\nsetlocal EnableDelayedExpansion\nfor /l %%i in (0 1 39) do echo !box:~%%i,1! %%box:~%%i,1%%&echo(\nendlocal\n\ngoto bof\n\nrem call :ColorText 0a "blue"\nrem add 'echo.' after\n\ngoto :eof\n\n:ColorText\necho off\n<nul set /p ".=%DEL%" > "%~2"\nfindstr /v /a:%1 /R "^$" "%~2" nul\ndel "%~2" > nul 2>&1\ngoto :eof\n\n:bof\ncolor 09\ncls\nREM %box:~22,1%%box:~26,1%%box:~8,1%\ncall :ColorText 09 %box:~22\nfor /l %%x in (1, 1, 100) do (\n echo (\n 1%%box:~26\n )\n)\ncall :ColorText 09 1%%box:~8,1%\n>nul chcp %oemcp%\npause\n\nSo this is my whole code, at the moment, however for the\ncall :ColorText 09 %box:~22\nfor /l %%x in (1, 1, 100) do (\n echo (\n 1%%box:~26\n )\n)\ncall :ColorText 09 1%%box:~8,1%\n\nI was wondering how to make it so instead of continuously putting '1%%box:~26' if i could have it do a loop and have it repeat but on the same line. Can anyone help with that?\nThis is the way it was working before, but i would have to put so many of the '1%%box:~26'\necho %box:~22,1%%box:~26,1%%box:~8,1%" ]
[ "batch-file" ]
[ "html2canvas problem: Background Image(external) missing।", "I can not download as \"jpg/png/pdf\" with a background image, just downloading the text. Using JavaScript or jQuery.\n\n<script>\n $(document).ready(function() {\n var element = $(\"#html-content-holder\"); // global variable\n var getCanvas; // global variable\n\n html2canvas(element, {\n onrendered: function(canvas) {\n $(\"#previewImage\").append(canvas);\n getCanvas = canvas;\n }\n });\n\n $(\"#btn-Convert-Html2Image\").on('click', function() {\n var imgageData = getCanvas.toDataURL(\"image/png\");\n\n var newData = imgageData.replace(/^data:image\\/png/, \"data:application/octet-stream\");\n $(\"#btn-Convert-Html2Image\").attr(\"download\", \"your_pic_name.png\").attr(\"href\",\n newData);\n });\n });\n</script>" ]
[ "javascript", "jquery", "html", "background-image", "html2canvas" ]
[ "Is ./path necessary?", "<link rel=\"icon\" href=\"./favicon.ico\" type=\"image/x-icon\" />\n\n\nThe above is what I see in index.php of phpMyAdmin.\n\nIsn't it the same as:\n\n<link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\" />\n\n\nOr say, can you give an example where these two generates different results?" ]
[ "html", "path" ]
[ "what is the exact meaning of \"message\" in this line on iphone", "NSDictionary *story = [stories objectAtIndex: indexPath.row];\ncell.text=[NSString stringwithFormat:[story objectForKey@\"message];\n\n\ni dont knw what exaclty \"message \" contains (what is the meaning of objectForKey@\"message\")\n\nEDIT CODE\n\nNSString *key =[appDelegate.books objectAtIndex:indexPath.row];\n //dict y=@\"Name\";\n\n NSArray *nameSection = [dict objectForKey:key];\n\n\n NSDictionary *story = [nameSection objectAtIndex: indexPath.row];\n cell.text=[NSString stringwithFormat:[story objectForKey:key]];\n\n NSLog(@\"Value Of message: %@\", [dict objectForKey:key]);\n\n\nwhy my code crashes" ]
[ "iphone" ]
[ "PySpark - read recursive Hive table", "I have a Hive table that has multiple sub-directories in HDFS, something like:\n\n/hdfs_dir/my_table_dir/my_table_sub_dir1\n/hdfs_dir/my_table_dir/my_table_sub_dir2\n...\n\n\nNormally I set the following parameters before I run a Hive script:\n\nset hive.input.dir.recursive=true;\nset hive.mapred.supports.subdirectories=true;\nset hive.supports.subdirectories=true;\nset mapred.input.dir.recursive=true;\n\nselect * from my_db.my_table;\n\n\nI'm trying to do the same using PySpark,\n\nconf = (SparkConf().setAppName(\"My App\")\n ...\n .set(\"hive.input.dir.recursive\", \"true\")\n .set(\"hive.mapred.supports.subdirectories\", \"true\")\n .set(\"hive.supports.subdirectories\", \"true\")\n .set(\"mapred.input.dir.recursive\", \"true\"))\n\nsc = SparkContext(conf = conf)\n\nsqlContext = HiveContext(sc)\n\nmy_table = sqlContext.sql(\"select * from my_db.my_table\")\n\n\nand end up with an error like:\n\njava.io.IOException: Not a file: hdfs://hdfs_dir/my_table_dir/my_table_sub_dir1\n\n\nWhat's the correct way to read a Hive table with sub-directories in Spark?" ]
[ "pyspark", "pyspark-sql" ]
[ "Word add Ins with JavaScript, paragraph.getHtml() equations converted as image", "I'm creating a word addIns, where I want to get ms word contents as html with images.\nparagraph.getHtml() returned html has <img> tags for Images/equations but i'm not able to get that image.\n\n\n// Run a batch operation against the Word object model.\nWord.run(function(context) {\n // Create a proxy object for the paragraphs collection.\n var paragraphs = context.document.body.paragraphs;\n\n // Queue a command to load the style property for all of the paragraphs.\n context.load(paragraphs, \"style\");\n\n // Synchronize the document state by executing the queued commands,\n // and return a promise to indicate task completion.\n return context.sync().then(function() {\n // Queue a a set of commands to get the HTML of the first paragraph.\n var html = paragraphs.items[0].getHtml();\n\n // Synchronize the document state by executing the queued commands,\n // and return a promise to indicate task completion.\n return context.sync().then(function() {\n console.log(\"Paragraph HTML: \" + html.value);\n write(html.value)\n });\n\n });\n}).catch(function(error) {\n console.log(\"Error: \" + JSON.stringify(error));\n if (error instanceof OfficeExtension.Error) {\n console.log(\"Debug info: \" + JSON.stringify(error.debugInfo));\n }\n});\n\n\n\nreturned img tag like this\n<img width=180 height=36 src=\"~WRS%7b11EAF911-2A25-4F41-A8C9-CEA82B5713E9%7d_files/image001.png\" >\n\nHow can i get these images as base64 which is converted equations to images?\n\nThank you" ]
[ "ms-word", "office-js", "word-addins" ]
[ "How to add info from txt file to hash table", "How to implement the addInfo function. We have to find and sort the lines based on their serial number using chaining hash function. But before I need to do addInfo.\nFor example: the first line \"1009 1 \"Royal Queen\" 2015 160\"\nthe serial number is 1009 and if there is other ships that have the serial number ended with 9 we have to display them together.\nHere is the code that I have so far:\n\n#include <iostream>\n#include <fstream>\nusing namespace std;\nstruct ShipRecord\n{\n int serialNum;\n int shipType;\n string name;\n int year;\n int cap;\n ShipRecord *next;\n ShipRecord(int x)\n {\n serialNum = x;\n next = nullptr;\n }\n};\nconst int SIZE = 10;\nclass HashMgr\n{\n ShipRecord *head = nullptr;\n ShipRecord *tail = nullptr;\npublic:\n HashMgr()\n {\n ShipRecord * hashTable[SIZE] = {nullptr};\n\n string line;\n ifstream myfile;\n myfile.open(\"shipRecords.txt\");\n if(myfile.is_open())\n {\n while (!myfile.eof())\n {\n getline (myfile, line);\n addInfo(line);\n }\n myfile.close();\n }\n }\naddInfo(string line)\n {}\ndisplayOne(int serialNum)\n {}\ndisplayAll()\n {}\nint main()\n{\n HashMgr hm;\n hm.displayAll();\n hm.displayOne(1009);\n hm.displayOne(1010);\n hm.displayOne(1019);\n hm.displayOne(1029);\n hm.displayOne(1039);\n hm.displayOne(1014);\n hm.displayOne(1008); /// Prompt a message to that the record does not exist\n hm.deleteOne(1009);\n hm.deleteOne(1039);\n hm.displayAll();\n return 0;\n}\n/*\nHere is the txt.file\n 1009 1 \"Royal Queen\" 2015 160\n 1010 2 \"Carnival\" 2016 1600\n 1019 1 \"Ocean King\" 2013 110\n 1029 2 \"Royal Prince\" 2012 2000\n 1039 2 \"Royal Princess\" 2010 2100\n 1014 2 \"Royal Caribbean\" 2016 1600\n*/" ]
[ "c++" ]
[ "very simple: 1/20 returns 0.0", "In Processing I have this code:\n\nint numberOfSteps = 20;\nfloat numberOfStepsCalculated = (1/20);\nprintln(numberOfStepsCalculated);\n\n\nBut my print keeps returning 0.0\n\nI can not figure out why!\n\nThanks for my dumb question" ]
[ "java", "processing" ]
[ "Is this TOC scenario possible using c# and iTextSharp?", "I've just downloaded iTextSharp and before I put a lot of effort into this I'd like to know if this scenario is possible with it. We have a client that is insisting that their SSRS report PDFs contain a table of contents, preferably with page numbers. The various components of these reports have highly variable lengths so we can't hard code actual page numbers. As you all probably know, there is no direct way to create a Table of Contents in SSRS. (We've even had a special session with the Microsoft rep about this.)\n\nWhat I would like to do is as follows: \n\n\nMark the target locations in the SSRS report by setting their\nDocumentMapLabel property. \nGenerate the pdf in the usual fashion, either from the report server \nor a ReportViewer control. (This will be in c#.)\nOpen the pdf in my hypothetical code.\nInsert a blank page at or near the front.\nScan the pdf for DocumentMapLabels (and, ideally, detect which page\nthey're on.)\nPopulate the blank page with links to the various sections.\n\n\nIs this possible?" ]
[ "c#", "pdf-generation", "itextsharp", "ssrs-2012" ]
[ "changing link in iframe using java script", "I am trying to change iframe link using java script but script is not working.\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \n\"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n <title></title>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n\n</head>\n<body>\n <iframe name=\"pageChange\" src=\"about:blank\" width=\"1300\" height=\"1300\" scrolling=\"auto\" frameborder=\"1\" onload=pageChange></iframe>\n <script type=\"text/javascript\">\n var pages=new Array();\n pages[0]=\"http://valuewingcoe.com\";\n pages[1]=\"http://www.link2.com\";\n pages[2]=\"http://www.link3.com\";\n pages[3]=\"http://www.link4.com\";\n var time=7000; // this is set in milliseconds\n function pageChange() {\n var rand=Math.floor(Math.random()*pages.length);\n document.getElementById(\"frame\").src=pages[rand];\n setTimeout(\"pageChange()\",time);\n }\n onload=pageChange;\n </script>\n</body>\n</html>" ]
[ "javascript", "php", "html" ]
[ "WooCommerce custom plugin: Check for customer completed orders issue", "I'm trying to write a simple plugin that would show new or returning customer information and the number of completed orders from the user. To do this, I created a folder called returning-customers.php and file with the same name. In this file, I wrote the next code:\n/*\n * Plugin Name: Kasha returning customers\n * Description: Displays information returning customer or new, and also displays the number of completed orders\n * Version: 1.0.0\n * Author: Me\n * License: GPLv2 or later\n */\n\n\nadd_filter( 'woocommerce_admin_order_data_after_order_details', 'render_customer_is_new_field' );\n\nfunction render_customer_is_new_field($order)\n{\n\n $args = array(\n 'status' => 'completed',\n 'return' => 'ids',\n );\n \n if ( $order->get_user_id() !== 0 ) {\n $args['customer_id'] = $order->get_customer_id();\n } else {\n $args['customer'] = $order->get_billing_email();\n }\n \n $customer_has_existing_orders = wc_get_orders( $args );\n\n $orders_count = count($customer_has_existing_orders);\n\n $markData = ( (int)count($customer_has_existing_orders) >= 2 )\n ? array('status-processing', 'Returning customer')\n : array('status-on-hold', 'New Customer');\n\n\n echo '\n <p class="kasha-customer-counter" style="float: left">\n <mark class="order-status '. $markData[0] .'">\n <span>'. $markData[1] .' <strong style="color:#ff0000;font-weight: 900;"> '. $orders_count .'</strong></span>\n </mark>\n </p>\n ';\n}\n\nBut this code does not work correctly. I always see that the customer has returned and all his orders are considered. However, the mark that the user is returning customer should be placed only after two orders with the status completed and only orders with the status completed should be considered. Now it looks like the wc_get_orders function is not working. When I write: var_dump(wc_get_orders()) I see NULL." ]
[ "php", "wordpress", "woocommerce", "plugins", "hook-woocommerce" ]
[ "C++11 list initialization doesn't work", "Here are my files\nscreen.h\n\n#ifndef SCREEN_H\n#define SCREEN_H\n\n\nclass Screen {\npublic:\n using pos = std::string::size_type;\n Screen() = default;\n Screen(pos ht, pos wd, char c) : height(ht), width(wd), contents(ht*wd, c) {}\n char get() const { return contents[cursor]; }\n char get(pos r, pos c) const;\n Screen &move(pos r, pos c);\n\nprivate:\n pos cursor = 0;\n pos height = 0, width = 0;\n std::string contents;\n};\n\ninline char Screen::get(pos r, pos c) const {\n pos row = r*width;\n return contents[row + c];\n}\n\ninline Screen &Screen::move(pos r, pos c) {\n pos row = r*width;\n cursor = row + c;\n return *this;\n}\n\n\nclass Window_mgr {\nprivate:\npublic:\n std::vector<Screen> screens = { Screen(24, 80, ' ') };\n\n};\n\n#endif\n\n\nmain.cpp\n\n#include <iostream>\n#include <string>\n#include <vector>\n\n#include \"screen.h\"\n\nusing std::cin;\nusing std::cout;\nusing std::endl;\nusing std::string;\nusing std::vector;\n\nint main() {\n Window_mgr w;\n w.screens.push_back(Screen(24, 80, ' '));\n\n std::vector<Screen> screens = { Screen(24, 80, ' ') };\n}\n\n\nThe problem is in list initialization line inside Window_mgr class. Compiler says:\n\n\"std::vector<Screen,std::allocator<_Ty>>::vector(std::initializer_list<Screen>,const std::allocator<_Ty> &)\": \nневозможно преобразовать аргумент 1 из \"Screen\" в \"const std::allocator<_Ty> &\" \nd:\\users\\family\\documents\\visual studio 2013\\projects\\consoleapplication\\screen\\screen.h\n\n\nBut the fact is such list initialization runs properly in two of my tryes outside the class (see main.cpp). I thought it was because of private modifier, but public didn't help very.\nSo could you suggest me, please, where the real problem is? Thanks!\n\nUPD I use MS VS Expess 2013 and CTP 2013 VC++ compiler." ]
[ "c++", "c++11", "vector", "visual-studio-2013", "list-initialization" ]
[ "Flutter bottom of sliverappbar let 1 pixel of background", "I have a small problem where a 1 pixel bar is sometimes displayed in my header as you can see on the image below.\nMy code is below. The first function is just to calculate the scroll for the user to have a beautiful animation.\nthe 1 pixel is surrounded in blue.\ni'll be very proud if someone can resolve this problem ^^'...\n\nimport 'package:flutter/material.dart';\nimport 'package:flutter_share/flutter_share.dart';\n\nclass _CustomHeaderState extends State<CustomHeader> {\n ScrollController _scrollController;\n double heightHeader = 0;\n _scrollListener() {\n if (_scrollController.hasClients) {\n double calcul2 = 2 / ((300 - kToolbarHeight) / _scrollController.offset);\n if (calcul2 < 0 && heightHeader != 0) {\n setState(() {\n heightHeader = 0;\n });\n } else if (calcul2 > 2 && heightHeader != 2) {\n setState(() {\n heightHeader = 2;\n });\n } else if (calcul2 >= 0 && calcul2 <= 2) {\n if (heightHeader != calcul2) {\n setState(() {\n heightHeader = calcul2;\n });\n }\n }\n }\n }\n\n @override\n void initState() {\n _scrollController = ScrollController();\n _scrollController.addListener(_scrollListener);\n\n super.initState();\n }\n\n @override\n Widget build(BuildContext context) {\n return Scaffold(\n // extendBody: true,\n body: CustomScrollView(\n controller: _scrollController,\n slivers: [\n SliverAppBar(\n primary: true,\n pinned: true,\n automaticallyImplyLeading: false,\n backgroundColor: Colors.white,\n title: Text(""),\n // elevation: 0,\n expandedHeight: 300,\n flexibleSpace: FlexibleSpaceBar(\n background: widget.image,\n ),\n actions: [//header changed when scroll],\n bottom: PreferredSize(\n preferredSize: Size(MediaQuery.of(context).size.width, 0),\n child: Container(\n margin: EdgeInsets.zero,\n padding: EdgeInsets.zero,\n height: heightHeader >= 1.75 ? 25 - ((heightHeader - 1.75) * 100) : 25,\n decoration: BoxDecoration(\n color: Colors.white,\n borderRadius: BorderRadius.only(\n topLeft: Radius.circular(25),\n topRight: Radius.circular(25),\n ),\n ),\n ),\n ),\n ),\n SliverToBoxAdapter(\n child: widget.child,\n ),\n ],\n ),\n );\n }\n}" ]
[ "flutter", "flutter-sliverappbar" ]
[ "how to get Android-Studio modules name I Intellij Plugin development", "I want to develop plugin for Android studio for this I am using Intellij idea plugin APIs. For this I need to get project module names in project. Can anyone suggest how i can get list of modules in android studio project using intellij plugin APIs." ]
[ "java", "android-studio", "intellij-idea", "intellij-plugin" ]
[ "jquery: pass an object to event handler using jquery trigger method", "Following code for passing an object to event handler is not working: \n\n$('a.another').live('click', function(e, data) {\n alert(data); // **alerts '[{isMachineClick:true}]'**\n alert(data.isMachineClick); // **alerts 'undefined'**\n});\n\n$('a.another').trigger('click', \"[{isMachineClick:true}]\");\n\n\nPlease have a look at this.\n\nPS: solution provided at link pass an object through jquery trigger is not working, so posting a new thread." ]
[ "jquery" ]