texts
sequence
tags
sequence
[ "Unable to get data of a line chart and bar chart in a Cognos report using Cognos Mash-up service?", "Trying to get data of a report employee satisfaction in the sample cognos reports folder using\nhttp://lxxxxx:9300/bi/v1/disp/rds/reportData/report/iED4FABBAF84C47EBA65B8A44FDCEF444?fmt=DataSetJSON\nattached image of the output of the restcall, I am not getting data for Survey topic scores which is line chart and also EMPLOYEE RANKING which is bar chart.\nenter image description here\nwhy am i not able to get line chart and bar chart data? How to achieve this?" ]
[ "cognos", "cognos-bi" ]
[ "JSON Array to Listview", "I'm creating an application which receives tuples from a MySQL database and converts this into a JSON array. This is currently working. Below is the JSON array;\n\nJSONArray jArray = new JSONArray(result);\n for(int i=0;i<jArray.length();i++){\n JSONObject json_data = jArray.getJSONObject(i);\n Log.i(\"log_tag\",\"payslip_id: \"+json_data.getInt(\"payslip_id\")+\n \", user_id: \"+json_data.getString(\"user_id\")+\n \", date: \"+json_data.getString(\"date\")+\n \", units: \"+json_data.getInt(\"units\")+\n \", rate: \"+json_data.getInt(\"rate\")+\n \", grosspay: \"+json_data.getInt(\"grosspay\")+\n \", deductions: \"+json_data.getInt(\"deductions\")+\n \", netpay: \"+json_data.getInt(\"netpay\"));\n\n returnString += \"\\n\\t\" + jArray.getJSONObject(i);\n\n\nThis is currently shown in a textview producing the below output (there will be more records this is just for example)\n\n[{\"payslip_id\":\"1\",\"user_id\":\"2\",\"date\":\"04-04-2011\",\"units\":\"18\",\"rate\":\"7\",\"grosspay\":\"400\",\"deductions\":\"100\",\"netpay\":\"300\"}]\n\n\nMy question is how can I output this in a listview to display up to 12 records? Any help with this is greatly appreciated. Thanks for your time guys. I'm doing my best to understand but I'm fairly new to this concept." ]
[ "android", "android-layout" ]
[ "Load view from different states in one view and same url angularjs ui-router", "I need to load two different views in two different ui-view(s) with different states but same url. I made an example which works but if I change app.header.view.index to index it stops working, I want to use different states because I have multiple modules which loads in one project and each one of them doesn't know anything about the others so each one of them has own routing and own states but they can load different view in same url. for example all of them has header module which loads header and menus and etc.. for all pages. let me know if I didn't explain clearly.\n\nhttps://jsfiddle.net/navid_gh/jwjbd1j4/\n\nhtml\n\n<body ng-app=\"myApp\">\n <div ui-view=\"header\"></div>\n <div ui-view=\"body\"></div>\n <div ui-view=\"content\"></div>\n</body>\n\n\njs\n\n(function(angular) {\n angular.module('myApp', [\"ui.router\"]);\n\n angular.module('myApp').config(appConfig);\n\n appConfig.$inject = ['$stateProvider', '$urlRouterProvider'];\n\n function appConfig($stateProvider, $urlRouterProvider) {\n $urlRouterProvider.otherwise(\"/\");\n\n $stateProvider\n .state('app', {\n abstract: true,\n url: '',\n views: {\n 'body@': {\n template: \"1\"\n }\n }\n })\n .state('app.header', {\n url: '',\n abstract: true,\n views: {\n \"header@\": {\n template: \"<div ui-view='menu'></div><div ui-view='sidebar'></div>\"\n }\n }\n })\n .state('app.header.view', {\n url: '',\n abstract: true,\n views: {\n \"menu\": {\n template: \"2\"\n },\n \"sidebar\": {\n template: \"3\"\n }\n }\n })\n .state('app.header.view.index', {\n url: '/',\n views: {\n 'content@': {\n template: \"4\"\n }\n }\n });\n }\n})(angular);" ]
[ "javascript", "angularjs", "angular-ui-router" ]
[ "Translations problem when loading languages from json file", "I have simple localization in my app. When I set languages manually in state it's works, but when I want to load translations from some json file I have a problem with second language and get standard error \"Missing translationId: userId for language: cr\", but code stays the same...\nIn constructor, when I use translations1, this.props.addTranslation(this.state.translations1);\nit works, but when I use this.props.addTranslation(this.state.translations);\ni get error\n\nCan someone help me?\n\n constructor(props){\n super(props);\n this.state = {\n translations1: {\n pocetna: ['Početna', 'Почетна'],\n listaKorisnika: ['Lista Korisnika', 'Листа Корисника'],\n dodajKorisnika: ['Dodaj Korisnika', 'Додај Корисника'],\n userId: ['User ID', 'Усер ИД']\n },\n translations: []\n }\n this.props.initialize({\n languages: [\n {name: \"Latinica\", code: \"lt\"},\n {name: \"Cirilica\", code: \"cr\"}\n ],\n options: {\n renderToStaticMarkup,\n defaultLanguage: 'lt'\n }\n })\n\n this.props.addTranslation(this.state.translations);\n this.onChangeLanguage = this.onChangeLanguage.bind(this);\n}\nonChangeLanguage(_slag) {\n console.log('onChangeLanguage: ', _slag.value)\n this.props.setActiveLanguage(_slag.value);\n}\n\ncomponentDidMount() {\n this.props.getTranslations();\n}\n\ncomponentWillReceiveProps(nextProps) {\n console.log('nextProps: ', nextProps.translations)\n this.setState({\n translations: nextProps.translations\n })\n}\n\nrender() {\n\n const languageInSelect = [\n { label: 'Latinica', value: 'lt' },\n { label: 'Cirilica', value: 'cr' }\n ];\n\n return(\n <div className=\"sidebar\" style={{'backgroundImage': 'url(assets/img/sidebar-3.jpg)'}}\n data-color=\"purple\" data-background-color=\"white\" \n data-image=\"../assets/img/sidebar-1.jpg\">\n\n <div className=\"sidebar-wrapper\">\n <ul className=\"nav\" >\n <li className=\"nav-item \">\n <NavLink to=\"/pocetna\" exact={true} className=\"nav-link\" activeStyle={{ 'backgroundColor': '#9c27b0', 'color':'white', 'fontWeight':'bold'}}>\n <MaterialIcon icon=\"dashboard\" />\n {/* <i className=\"material-icons\">dashboard</i> */}\n <Translate id=\"pocetna\">Početna</Translate>\n {/* <p>Početna</p> */}\n </NavLink>\n </li>\n <li className=\"nav-item \">\n <NavLink to=\"/listaKorisnika\" exact={true} className=\"nav-link\" activeStyle={{ 'backgroundColor': '#9c27b0', 'color':'white','fontWeight':'bold'}}>\n <i className=\"material-icons\">person</i>\n <Translate id=\"listaKorisnika\">Lista Korisnika</Translate>\n {/* <p>Lista korisnika</p> */}\n </NavLink>\n </li>\n\n <li className=\"nav-item \">\n <NavLink to=\"/dodajKorisnika\" className=\"nav-link\" activeStyle={{ 'backgroundColor': '#9c27b0', 'color':'white','fontWeight':'bold' }}>\n <i className=\"material-icons\">person_add</i>\n <Translate id=\"dodajKorisnika\">Lista Korisnika</Translate>\n {/* <p>Dodaj korisnika</p> */}\n </NavLink>\n </li>\n\n <li className=\"nav-item \">\n <Select \n onChange={this.onChangeLanguage}\n options={languageInSelect}\n defaultValue={{label: 'Latinica', value: 'lt'}}\n />\n </li>\n </ul>\n </div>\n\n\n\n </div>\n )\n\n\n}" ]
[ "reactjs", "react-redux" ]
[ "Pixel data incorrect with alpha", "I am loading in an image with alpha and am confused at the data I am see to represent each pixel. I am splitting the pixel to get each b,g,r,a band respectively and am confused with my output when loaded into a data set as seen below:\n\nPixel ---------------------B-band---------G-band----------R-band---------------A-band\n\n\n\nWhy are my white pixels in the r band (4th column) 254 and not 255?\nWhy are the alpha values ranging from 0 to 255 and not 0 to 1?\n\nAnother interesting note is that where the alpha is set to 0 (transparent) I am confused as to why the pixels being given a color and alternately why opaque pixels are displayed as white and not transparent?\n\n\nCode:\n\nimg = cv2.imread('/Volumes/EXTERNAL/ClassifierImageSets/Origional_2.png',-1)\nb,g,r,a = cv2.split(img)\n test = pd.DataFrame({'bBnad':b.flat[:],'gBnad':g.flat[:],'rBnad':r.flat[:],'Alpha':a.flat[:]})\n with pd.option_context('display.max_rows', None, 'display.max_columns', 4):\n print(test)" ]
[ "python", "pandas", "opencv", "scikit-learn", "alpha" ]
[ "blind/visually impaired - Redirect to Accessible website", "Is there a way to add something on selected page on a web site that said to people using accessible software, like NVDA, to go to the page X for full accessibility.\n\nI have some page with a lot of thing hard to make accessible and keeping the user design.\n\nThink like a mobile page where you can redirect to mobile.mysite.com\n\nI want mysite.com/mySelectedFolder/index.xyz?accessibilty=on\nThis page will remove all user graphic, javascript and other things that cause difficulty to NVDA. Probably change the way that some of the data are showed.\n\nIs this a bad things to do?" ]
[ "accessibility" ]
[ "Symfony2: How to get action name in form class", "My form is on the base of self-referenced entity (category have parent category)\n\nFor the parent field, I want to have different query_builder function depending of action name. When action is update, parent field (drop-down list) contains all categories, excepting edited category. This is work good. But, when action is Create new, parent form field contains only null value (in my case Main category).\nThis is category form class\nCategoryType class:\n\nnamespace Dimas\\CatalogBundle\\Form;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolverInterface;\nuse Doctrine\\ORM\\EntityRepository;\n\nclass CategoryType extends AbstractType {\n\n /**\n * @param FormBuilderInterface $builder\n * @param array $options\n */\n public function buildForm(FormBuilderInterface $builder, array $options) {\n $builder\n ->add('name')\n ->add('parent', 'entity', array(\n 'label' => 'Parent Category ',\n 'empty_value' => '- Main level -',\n 'class' => 'DimasCatalogBundle:Category', 'property' => 'getTreeName',\n 'required' => false,\n 'query_builder' => function(EntityRepository $er) use ($options) {\n $er->createQueryBuilder('u');\n //need only if action is 'update'\n $er->where('u.id <> :selfId');\n $er->setParameter(':selfId', $options['data']->getId());\n // end if\n return $er;\n },\n ));\n }\n\n /**\n * @param OptionsResolverInterface $resolver\n */\n public function setDefaultOptions(OptionsResolverInterface $resolver) {\n $resolver->setDefaults(array(\n 'data_class' => 'Dimas\\CatalogBundle\\Entity\\Category'\n ));\n }\n\n /**\n * @return string\n */\n public function getName() {\n return 'dimas_catalogbundle_category';\n }\n\n}\n\n\nIs it a good idea to add if in query_builder? How to get action name?\n$options array contains action name, but it is so deep inside." ]
[ "php", "forms", "symfony" ]
[ "event handling on shapes in dojo gfx", "I am creating a surface and drawing some shapes onto it. Now doing a \n\ndojo.connect(iSurface.getEventSource(), \"mousedown\", HandleMouseDown);\n\n\nand during handler trying to make the target shape moveable.\n\nHandleMouseDown(event)\n{\n foo = new dojox.gfx.Moveable(event.target);\n}\n\n\nHowever I keep getting \"this.shape.connect is not a function\", I think this is due to the fact that event.target is a svg rect not a gfx shape object. Can anyone help me in finding how do I get gfx shape object in the event instead of underlying svg object?\n\nThanks." ]
[ "events", "dojo", "shape", "gfx" ]
[ "Exception handling and member variables", "I have a simple Q. \n\nIf we have a class that has dynamically allocated member(or member that used dynamic allocation) and we often use that member what is the best way to handle some operation failing on that member.\nOfc there is try catch but Im not talking about that.\n\n1)\nIm talking about the fact that now the member is in the state it shouldnt be(and here Im not talking about leaking resources, Im talking about the fact that for example we wanted to push_back 100 elements to std::vector but we only added 47). \n\nAnd now for example when we call the other method sendToDB we will be sending 47 instead of 100 items to DB. \nMy guesstimates for solving is to have bool return values on all public methods(trying to go for all or nothing(aka push_back all 100 or push 0) and return false if we do manage to push 100, false if we push 0. \n\n2)\nBut this still leaves the problem of the dynamically allocated members(for example shared_ptr). \nDoes that mean that every method that uses it must do something like this:\n\nbool MyClass::sendDataToDB()\n{\n if (! m_DBConnection ) //m_DBConnection is std::shared_ptr\n return false;\n //...\n\n\n}" ]
[ "c++", "exception-handling", "c++11" ]
[ "iOS Safari - what event triggers the progress bar to go away?", "Trying to make a site feel faster to the user on load. What browser event triggers the blue progress bar to 'finish' and go away?\n\nonload?" ]
[ "javascript", "performance", "mobile", "web" ]
[ "Jquery autocomplete with coldfusion", "I'm trying to do a simple jquery autocomplete using ColdFusion, based on Jens great example.\n\nHTML:\n\n<form name=\"merchantSearch\" id=\"merchantSearch\" method=\"post\" action=\"/index.cfm/shop.store/\"> \n <input type=\"text\" name=\"state\" id=\"state\"/>\n <input type=\"submit\" name=\"submit\" id=\"submit\" value=\"\" class=\"searchButton\"/> \n <input type=\"hidden\" name=\"merchantID\" id=\"merchantID\"/>\n </form>\n\n\nThe entire json struct shows in the select box. When you click on one, it populates it with the entire struct. The autocomplete seems really confused about what to do with the json.\n\nColdFusion:\n\n <cfloop query=\"request.qMerchants\">\n <cfset request.merchantStruct = StructNew()>\n <cfset request.merchantStruct[\"merchantID\"] = #request.qMerchants.merchantID#>\n\n <cfset request.altText = altText...\"\n <cfset request.merchantStruct[\"label\"] = #request.qMerchants.merchant#&#request.altText#>\n\n <cfset ArrayAppend(request.merchantArray, request.merchantStruct)>\n</cfloop>\n\n\n<cfoutput> \n #serializeJSON(request.merchantArray)#\n</cfoutput>\n\n\nJquery:\n\n$(document).ready(function(){\n\n $(\"#state\").autocomplete( \n \"xhr/merchantAutoComplete.cfm\", \n {\n minLength:2, \n minchars:2,\n autoFill:false,\n select:function(event,ui) {\n $(\"#merchantID\").val(ui.item.merchantID);\n $(\"#merchant\").val(ui.item.merchant);\n }\n }\n ); \n\n});\n\n\nThe CF file returns the json formatted data, but it stays as json. The results end up like:\n\n[\n {\"label\":\"AAA 112 pts\\/$\",\"merchantID\":6},\n {\"label\":\"BBB 64 pts\\/$\",\"merchantID\":62},\n {\"label\":\"CCC 48 pts\\/$\",\"merchantID\":277},\n {\"label\":\"DDD 144 pts\\/$\",\"merchantID\":278},\n {\"label\":\"EEE 80 pts\\/$\",\"merchantID\":279}\n]\n\n\nAnd selecting one puts the whole json struct in the select box. I assume I have the right group of jquery, jquery UI, and css files to get anything back, but I'll post them just to make this really bloated:\n\n<script src=\"/assets/js/jquery/jquery.autocomplete.js\"></script>\n<script src=\"/assets/js/jquery/jquery1.4.2.js\"></script>\n<link rel=\"stylesheet\" href=\"/assets/css/jquery.autocomplete.css\" type=\"text/css\" media=\"screen, projection\" />\n<script src=\"/assets/js/jquery/jquery-ui-1.8.2.js\"></script>\n\n\nI'm sure its a 'label/value' issue, but nothing seems to help. Any suggestions would be awesome..Thanks!! Jon\n\nStill haven't figured this out. I think the remote call is returning a properly formatted json struct. Looks like: \n[{\"value\":\"FedEx Office 48 pts per $\",\"id\":578},{\"value\":\"Fergie Shoes.com 88 pts per $\",\"id\":784}]\n\nthe autocomplete js looks like:\n\n $(document).ready(function(){\n $(\"#merchantLabel\").autocomplete( \n \"xhr/merchantAutoComplete.cfm\", \n { \n select:function(event,ui) {\n $(\"#merchantID\").val(ui.item.id); \n return false;\n }\n }\n ); \n });\n\n\nThe html looks like:\n\n <form name=\"merchantSearch\" id=\"merchantSearch\" method=\"post\" action=\"/index.cfm/shop.store/\"> \n <input type=\"text\" name=\"merchantLabel\" id=\"merchantLabel\"/>\n <input type=\"submit\" name=\"submit\" id=\"submit\" value=\"\" class=\"searchButton\"/> \n <input type=\"hidden\" name=\"merchantID\" id=\"merchantID\"/> \n </form>" ]
[ "jquery", "json", "coldfusion", "autocomplete" ]
[ "Specifying \"groups\" dynamically in stacked bar chart c3js", "//take this code as an example\n\nHere i have specified yvalue[0],yvalue[1] in groups..\nBut i need a general design ,where I dont know the number of groups that i have to create(i.e the number of segments) this varies according to the json data.\n\nConsider this example here I have total,total1 therefore i have only 2 values.But if a third variable say total2 is specified in json, I should have a segment for it in my bar chart and so on.This has to be done without altering the groups everytime a field is added.Is there any way to achieve this??\n\nThanks\n\nvar datajson = [ {\ncountry : \"china\",\ntotal : 20,\ntotal1 : 10\n}, {\ncountry : \"India\",\ntotal : 40,\ntotal1 : 20\n}, {\ncountry : \"aus\",\ntotal : 10,\ntotal1 : 30\n}, {\ncountry : \"nxz\",\ntotal : 50,\ntotal1 : 40\n}\n\n ];\n\n var xvalue;\n var yvalue = [];\n var i = 0;\n\n var obj = datajson[0]\n for ( var key in obj) {\n if (xvalue === undefined)\n xvalue = key;\n else {\n yvalue[i] = key;\n i++;\n }\n\n }\n\n\n\n var chart = c3.generate({\n bindto : '#chart',\n data : {\n json : datajson,\n\n type : 'bar',\n keys : {\n x : xvalue, // it's possible to specify 'x' when category axis\n value : [yvalue[0],yvalue[1]],\n },\n groups : [ [yvalue[0],yvalue[1]] ]\n },\n bar : {\n width : {\n ratio : 0.3\n // this makes bar width 50% of length between ticks\n }\n },\n axis : {\n x : {\n type : 'category'\n\n },\n\n\n }\n });" ]
[ "c3" ]
[ "Removing CDATA tag from XmlNode", "I have an XmlNode which represents the following xml for example:\n\nXmlNode xml.innerText =\n<book>\n<name><![CDATA[Harry Potter]]</name>\n<author><![CDATA[J.K. Rolling]]</author>\n</book>\n\n\nI want to change this node so that it'll contain the following:\n\nXmlNode xml.innerText =\n<book>\n<name>Harry Potter</name>\n<author>J.K. Rolling</author>\n</book>\n\n\nAny ideas?Thanks!" ]
[ "c#", "xmldocument", "cdata", "xmlnode" ]
[ "not able to return QString from c++ function to PERL function by using SWIG", "I have c++ code (Includes Qt also), i want to call those functions by using Perl.\nWhich we can do by using SWIG, so I have implemented interfaces and did all the stuff need to use them in Perl script.\n\nI have a function in c++ which returns a QString value, \n\nQString get_string()\n{\n return QString(\"mystring\");\n}\n\n\nI have written one more class which will be used in perl script where i have a function which calls this get_string() function and returns const char*.\n\nconst char* get_const_string()\n{\n QString str = get_string();\n\n **//here I print str and str .toLocal8Bit().constData()\n //both are printing the text which i shoud get here**\n\n return str.toLocal8Bit().constData();\n\n //here I have tried diff combinations also, as \n // return str.toStdString().c_str();\n}\n\n\nThe problem is, in get_const_string() function, I could get the string I wanted, but when I call this function in my perl script, I am getting undefine value i.e null string\n\n. \n\nAny idea, what is the problem here ??\n\nI am using perl5, Qt4.8.4\n\nThanks in advance." ]
[ "c++", "qt", "swig", "perl" ]
[ "Convert java thread-based tcp socket server to javascript async tcp socket server", "I am looking to convert a java thread-based tcp socket server to javascript-based (preferably nodejs) async tcp socket server. It's my app and now learning to nodejs. Thought it would be a good exercise to learn more about nodejs this way.\n\nI've looked at nodejs and would be using the net module. I've also read that nodejs is event based and does not do thread-based stuff.\n\nAny ideas?" ]
[ "javascript", "node.js", "sockets", "asynchronous" ]
[ "Can't embed glut files in c# setup project", "I have built a project for learning OpenGL in Visual Studio 2010. When I run the program from my pc everything works ok. I also built a setup proj for this application. When I run the .msi in a computer that has not visual studio and try to run my embedded opengl examples, it says that cannot find glu files.\n\nMy glut files are extracted from a zip file in \"C:/examples/GL\" and I have updated my linker props for all my examples.\n\nCan anyone help me with that?" ]
[ "c#", "visual-studio-2010", "opengl" ]
[ "is it possible to keep the checked values of radio button should be same when we move from current page to previous page in php?", "is it possible to keep the checked values of radio buttons should be same as we selected before when we move from current page to previous page in php?\nplease explain with sample code....\n\nmy dynamically generated radio button values are posted automatically when am going to next page in pagination before i submit the button.\ni have 20 questions and answers per page.i need to evaluate them.i got answers in a array.\ni cant get users selected radio button values while moving next or previous buttons with pagination,please help any one.\nthanks in advance" ]
[ "php" ]
[ "Set Bitrate for the stream audio in android", "I have a simple android app, thar stream online radio, everything is OK, but the client want the app has 2 options, 128 kbp/s and 38 kbp/s. how I can set bitrate to the MediaPlayer Class in asdroid?\n\nthis is my pla action:\n\npublic void actionPlay(View view) {\n mediaPlayer = new MediaPlayer();\n try {\n mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);\n mediaPlayer.setDataSource(url);\n mediaPlayer.prepare(); // might take long! (for buffering, etc)\n mediaPlayer.start();\n } catch (IllegalArgumentException e) {\n e.printStackTrace();\n } catch (SecurityException e) {\n e.printStackTrace();\n } catch (IllegalStateException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n}" ]
[ "android", "media-player" ]
[ "sed, replace first line", "I got hacked by running a really outdated Drupal installation (shame on me)\n\nIt seems they injected the following in every .php file;\n\n<?php global $sessdt_o; if(!$sessdt_o) { \n $sessdt_o = 1; $sessdt_k = \"lb11\"; \n if(!@$_COOKIE[$sessdt_k]) { \n $sessdt_f = \"102\"; \n if(!@headers_sent()) { @setcookie($sessdt_k,$sessdt_f); } \n else { echo \"<script>document.cookie='\".$sessdt_k.\"=\".$sessdt_f.\"';</script>\"; } \n } \n else { \n if($_COOKIE[$sessdt_k]==\"102\") { \n $sessdt_f = (rand(1000,9000)+1); \n if(!@headers_sent()) {\n @setcookie($sessdt_k,$sessdt_f); } \n else { echo \"<script>document.cookie='\".$sessdt_k.\"=\".$sessdt_f.\"';</script>\"; } \n sessdt_j = @$_SERVER[\"HTTP_HOST\"].@$_SERVER[\"REQUEST_URI\"]; \n $sessdt_v = urlencode(strrev($sessdt_j)); \n $sessdt_u = \"http://turnitupnow.net/?rnd=\".$sessdt_f.substr($sessdt_v,-200); \n echo \"<script src='$sessdt_u'></script>\"; \n echo \"<meta http-equiv='refresh' content='0;url=http://$sessdt_j'><!--\"; \n } \n } \n $sessdt_p = \"showimg\"; \n if(isset($_POST[$sessdt_p])){\n eval(base64_decode(str_replace(chr(32),chr(43),$_POST[$sessdt_p])));\n exit;\n } \n }\n\n\nCan I remove and replace this with sed? e.g.:\n\nfind . -name *.php | xargs ... \n\n\nI hope to have the site working just for the time being to use wget and made a static copy." ]
[ "sed" ]
[ "Give user the option to view desktop version of responsive layout", "What is the easiest way to give users the option to view the desktop version of a website on a mobile device when using a responsive layout?" ]
[ "css" ]
[ "how to create a many to many relationships with core data? Swift, xcode", "I have 2 entities.\n\nentity 1 - People\nentity 2 - books\n\nPeople entity has a property which is an array of string names of their favorite books.\n\nI need to create a relationship that somehow maps the favorite book of a person to the corresponding book entity object(s).\n\nI am not sure how to do this. \n\nSo far I have started by creating a relationship in core data model for people by setting destination to \"books\" and then for the books entity creating a relationship by setting destination to \"people\".\n\nI don't see or understand how this will automatically pick out each of the person's favorite books...at the end of the day they are both seperate objects. How will the people class know that for a specific people instance that this, this and this book are that person's favorite?" ]
[ "swift", "core-data", "entity", "relationship" ]
[ "gnuplot, plotting time on x-axis", "I have data in the following format in a text file. I want to print the time (hours, mins and secs) on the x-axis. Each timestamp is on a separate line \n\n00:00:05,1\n00:00:15,0\n01:05:23,1\n07:45:00,0\n23:21:22,1\n\n\nTrying the following commands with gnuplot but time isn't printed on x-axis. I would like the time displayed in hours.\n\nset datafile separator \",\"\nset xdata time\nset xrange[\"00:00:00\":\"24:00:00\"]\nset timefmt '%H:%M:%S\nplot 'data.txt' using 1:2 with boxes\n\n\nAny help greatly appreciated." ]
[ "gnuplot" ]
[ "Using Generics to create an interfaced object", "I've written a function that accepts a class type (T) and an interface type (I) and returns an interface (I) to the object (T). Here's the code.\n\ninterface\n\nfunction CreateObjectInterface<T: Class, constructor; I: IInterface>(\n out AObject: TObject): I;\n\n\n...\n\nimplementation\n\nfunction TORM.CreateObjectInterface<T, I>(out AObject: TObject): I;\nbegin\n AObject := T.Create;\n\n if not Supports(AObject, GetTypeData(TypeInfo(I))^.Guid, Result) then\n begin\n AObject.Free;\n AObject := nil;\n\n raise EORMUnsupportedInterface.CreateFmt(\n 'Object class \"%s\" does not support interface \"%s\"',\n [AObject.ClassName, GUIDToString(GetTypeData(TypeInfo(I))^.GUID)]\n );\n end;\nend;\n\n\nThe function works as expected with no memory leaks or other undesirables.\n\nAre there other ways to achieve the same result?" ]
[ "delphi", "generics", "interface", "delphi-xe7" ]
[ "How to highlight a part of text in textarea", "Is there a way to highlight a part of text in text-area?\n\nSay, the text is Hi @twitter @twitpic and now I would like to highlight @twitter and @twitpic only and not Hi. Is that possible?\n\nThis has to happen on the fly. \n\nPS: I don't want to use iFrame\n\nThanks in advance" ]
[ "javascript", "html", "css", "textarea" ]
[ "Access when GROUP BY in table1 and take the FIRST, how do I update a reference in table2?", "I have a table named brand1, where brands are repeated multiple times (but shouldn't be):\n\n+----+-----------+\n| id | name |\n+----+-----------+\n| 1 | FORD |\n| 2 | FIAT |\n| 3 | FIAT |\n| 4 | FIAT IND. |\n+----+-----------+\n\n\nSo I'm grouping by name on brand1 obtaining brand2 table. So far so good:\n\nSELECT \n FIRST(b.id) AS id, \n TRIM(b.name) AS name\nFROM brand AS b\nGROUP BY TRIM(b.name)\nORDER BY FIRST(b.id)\n\n+----+-----------+\n| id | name |\n+----+-----------+\n| 1 | FORD |\n| 2 | FIAT | <- the first id found in the grouping\n| 4 | FIAT IND. |\n+----+-----------+\n\n\nThe problem is: my second table model has a reference to the brand1 table (column brand_id) so i need to \"translate\" that reference and get the right brand_id found in table brand2:\n\n+----+---------+----------+\n| id | name | brand_id |\n+----+---------+----------+\n| 1 | Model A | 1 |\n| 2 | Model A | 2 | <-- should be 2 as FIAT is repeated in brand1\n| 3 | Model B | 3 | <-- should be 2 as FIAT is repeated in brand1\n| 4 | Model C | 4 |\n+----+---------+----------+\n\n\nWhat I've tried is not working (Model B gets brand_id 3):\n\nSELECT\n FIRST(m.id) AS id,\n FIRST(TRIM(m.name)) AS name,\n FIRST(m.brand_id) AS brand_id\nFROM model AS m\nGROUP BY TRIM(m.name), m.brand_id\nORDER BY FIRST(m.id)\n\n\nMaybe this is very very easy to accomplish but I've to admin I'm not very good playing with MS Access.\n\nResult should look like:\n\n+----+---------+----------+\n| id | name | brand_id |\n+----+---------+----------+\n| 1 | Model A | 1 |\n| 2 | Model A | 2 |\n| 3 | Model B | 2 |\n| 4 | Model C | 4 |\n+----+---------+----------+" ]
[ "sql", "ms-access" ]
[ "How to select a portion of an image and save just that portion to a file", "I am taking a screenshot of the current screen then saving the image. I want to open that image up and be able to select a box of a certain element or whatever it is i want the pic to be of and to be able to in turn save that smaller selected image to \n a file. Please help.\n\nRemoteControlConfiguration config = new RemoteControlConfiguration();\n config.setPort(4447);\n\n SeleniumServer server = new SeleniumServer(config);\n try{\n // TODO Auto-generated method stub\n\n server.start();\n\n DefaultSelenium selenium = new DefaultSelenium(\"localhost\", 4447, \"*firefox\", \"http://www.google.com/\");\n selenium.start();\n selenium.open(\"http://www.google.com/\");\n selenium.waitForPageToLoad(\"10000\");\n selenium.windowMaximize();\n\n BufferedImage image1 = Screenshot(\"screen1.jpg\");\n\n //selenium.type(\"q\", \"Hello world\");\n Thread.sleep(2000);\n\n BufferedImage image2 = Screenshot(\"screen2.jpg\");\n\n public static BufferedImage Screenshot(String fileName) throws Exception\n {\n Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();\n Rectangle screenRectangle = new Rectangle(screenSize);\n Robot robot = new Robot();\n BufferedImage image = robot.createScreenCapture(screenRectangle);\n File file = new File(fileName);\n ImageIO.write(image, \"jpg\", file);\n return image;\n }" ]
[ "java" ]
[ "Number of possible palindrome anagrams for a given word", "I have to find No. of palindrome anagrams are possible for a given word.\nSuppose the word is aaabbbb.My approach is\n\n\n \n Prepare a hash map that contains no. of time each letter is appearing\n \n For my example it will be\n\na--->3\nb--->4\n\n \n \n If length of string is even then no. of occurrence of each letter should be even to form palindrome of given word else no of\n palindrome anagrams is 0\n If length of string is odd then at max one occurrence of letter can be odd and other should be even.\n \n \n\n\nThis two above steps was for finding that weather a given word can can form palindrome or not.\n\nNow for finding no of palindrome anagrams, what approach should I follow?" ]
[ "algorithm", "math", "combinatorics", "palindrome", "anagram" ]
[ "using gsub in ruby strings correctly", "I have this expression:\n\nchannelName = rhash[\"Channel\"].gsub(\"'\", \" \")\n\n\nit works fine. However, I can only substitute 1 character with it. I want to add a few more characters to substitue. So I tried the following:\n\nchannelName = rhash[\"Channel\"].gsub(/[':;] /, \" \")\n\n\nThis did not work, that is there was no substitution done on strings and no error message. I also tried this:\n\nchannelName = rhash[\"Channel\"].gsub!(\"'\", \" \")\n\n\nThis lead to a string that was blank. So absolutely not what I desired.\n\nI would like to have a gsub method to substitute the following characters with a space in my string: \n\n ' ; :\n\n\nMy questions:\n\n\nHow can I structure my gsub method so that all instances of the above characters are replaced with a space?\nWhat is happening with gsub! above as its returning a blank." ]
[ "ruby", "string", "gsub" ]
[ "Java FXML Loading a view for later use", "I want to load a FXML view into my program and save the view for later use.\n\nI currently have a Pane that switches out FXML files.\n\n@FXML private Pane contentPane;\n@FXML \npublic void toHome() {\n contentPane.getChildren().setAll(FXMLLoader.load(getClass().getResource(\"../fxml/Home.fxml\")));\n}\n@FXML \npublic void toBrowse() {\n contentPane.getChildren().setAll(FXMLLoader.load(getClass().getResource(\"../fxml/Browse.fxml\")));\n}\n\n\nThe thing is that I have text fields on each of the new FXML pages and when I switch pages, I don't want it to create a new FXML reference and lose the data in that text field. How can I keep the original page that I set?\n\nThanks,\n\nBart" ]
[ "java", "javafx", "fxml" ]
[ "Performing two firebase queries with argument from first query at once (inner join) using operators?", "To select document im using this function:\n\nreservations: observable<any>;\n\n/// ...\n this.reservations = this.afs.collection('reservations', ref => ref.where('uid', '==', 'someUID'))\n .snapshotChanges()\n .pipe(\n map(reservationData => {\n return reservationData.map(reservation => {\n const data = reservation.payload.doc.data();\n const id = reservation.payload.doc.id;\n\n console.log(data);\n\n return { id, ...data };\n });\n })\n );\n\n\n\nin result i got:\n\n[\n \"serviceid\": \"TM2Y6vBk70rgKZ3zTUAw\",\n \"uid\": \"MwdM8bak78eE1omf6u04KtqlE2X2\",\n \"venueid\": \"9G0miVLclY7QBZcHAMuq\"\n },\n {\n \"serviceid\": \"dReNKvOyV1rOussdSdNe\",\n \"uid\": \"MwdM8bak78eE1omf6u04KtqlE2X2\",\n \"venueid\": \"2l3NhWeTC2HfB6nJmo5X\"\n }\n]\n\n\nHow to add another query to this obervable? It should be working like inner join in sql, i need to add document from services collection (from received serviceid). This function should return:\n\n[\n {\n \"rOussk78eE1oMwdM8ba\": [\n {\n \"name\": \"some name\",\n \"price\": 142\n }\n ],\n \"uid\": \"MwdM8bak78eE1omf6u04KtqlE2X2\",\n \"venueid\": \"9G0miVLclY7QBZcHAMuq\"\n },\n {\n \"dReNKvOyV1rOussdSdNe\": [\n {\n \"name\": \"some name\",\n \"price\": 142\n }\n ],\n \"uid\": \"MwdM8bak78eE1omf6u04KtqlE2X2\",\n \"venueid\": \"2l3NhWeTC2HfB6nJmo5X\"\n }\n]\n\n\nHow can i do this?\n\n\nThanks in advance,\nD." ]
[ "angular", "typescript", "google-cloud-firestore", "rxjs", "angularfire" ]
[ "How to Remove a node when node on top is removed spritkit", "I have 2 nodes as shown in figure. The node above (SKLabelNode) is child to the node below (SKSpriteNode). When I touch the SKLabelNode both node should be removed from the scene, but now just the label node is getting removed, Can you please suggest how to remove the node below when I touch the node above?" ]
[ "ios", "objective-c", "sprite-kit" ]
[ "Class \"simpleModule\" not found in omnetpp", "I am writing my own simple modules in omnet++.\n\nInside the omnet IDE, I have created three simple modules.\n\nAfter that I have created a \"network\" using those modules.\n\nIt is building successfully, but whenever I try to simulate it it shows\n\n\n Error in module (cModule) NetworkTopologyOnly (id=1) during network\n setup: Class \"mySimplemodule2\" not found -- perhaps its code was not\n linked in, or the class wasn't registered with Register_Class(), or in\n the case of modules and channels, with\n Define_Module()/Define_Channel().\n\n\nWhat should I do to successfully simulate using my own simple modules?" ]
[ "networking", "omnet++" ]
[ "Why is UserManage.CreateAsync throwing an EntityValidationError when duplicate username is used rather than returning result with failure?", "I have the following register method, and I swear I (manually) tested this a while back and noted that if a username already existed, the result simply had a false value for result.Succeeded and would append the error message to the ModelState (using the build in AddErrors(result) helper method). I'm pretty sure this method (Register(...)) comes out of the box with ASP.NET mvc 5, but I think I changed the user to include a username (whereas out of the box, the email is simply used as the username).\n\npublic async Task<ActionResult> Register(RegisterViewModel model)\n{\n if (ModelState.IsValid)\n {\n var user = new ApplicationUser { UserName = model.Username, Email = model.Email };\n\n var result = await UserManager.CreateAsync(user, model.Password);\n if (result.Succeeded)\n {\n await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);\n\n return RedirectToAction(\"Index\", \"Home\");\n }\n AddErrors(result);\n }\n\n // If we got this far, something failed, redisplay form\n return View(model);\n}\n\n\nInstead, I am currently getting the error as an EntityValidationError being thrown and uncaught.\n\nI know I could simply catch this error and move on with my day, but I want to make sure that something else is causing this issue if it is not the correct behavior.\n\nUpdate: \n\nAfter creating a new MVC project, I can confirm that the typical behavior (when a duplicate username is registered) is that CreateAsync should return a result with a false value for result.Succeeded and an error message of \"Username is taken\" should be appended to the ModelState. Clearly something is amiss in my code or config, but I haven't the foggiest idea of where to start exploring. If it helps, I have been seeing EntityValidationErrors in other places of my code lately in situations that shouldn't warrant it either. See: Unable to SaveChanges on a db update. Weird lazy loading behavior possibly?" ]
[ "c#", "asp.net", "asp.net-mvc", "entity-framework", "asp.net-identity" ]
[ "MySQL strange behaviour: \"b'schemaname'\" schema is created", "this is my frist time posting something like this but im pulling my hair our, for days on end i have been trying to debug and find what is wrong with mysql, i run a gameserver and use mysql to store all the players information, like items, clothes etc, i recently came into this issue, i can no longer run sql scripts, when i try an error is thrown and a new schema is created with the name of the current schema im trying to run the script in, but it creates it like this b'schemaname' (schemaname being what the name of my schema is that im trying to run the script on), now i have reinstalled mysql and to no luck the issue still persists, i have included a video to show exactly what i mean and what is happening. ----> https://youtu.be/l6o4r5jtpcU <------ I appreciate every and anyone that helps, its not too big of an issue as i can still run the scripts a different way but still, i have no idea what has caused this or a fix for it, thank you" ]
[ "mysql", "mysql-workbench" ]
[ "How to fix \"ImportError: No module named dj_database_url\" with Django", "I have a similar problem as \"Error: No module named tinymce\". \n\nI have an error importing both \"ckeditor\" and \"tinymce\" libraries. When I run the server I get\n\nImportError: No module named ckeditor_uploader\n\n\nBut there is no problem when I import with python manage.py shell.\n\nHere is the detail of the error:\n\nTraceback (most recent call last): \n File \"manage.py\", line 10, in <module> \n execute_from_command_line(sys.argv) \n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 338, in execute_from_command_line \n utility.execute() \n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 312, in execute \n django.setup() \n File \"/usr/local/lib/python2.7/dist-packages/django/__init__.py\", line 18, in setup \n apps.populate(settings.INSTALLED_APPS) \n File \"/usr/local/lib/python2.7/dist-packages/django/apps/registry.py\", line 85, in populate \n app_config = AppConfig.create(entry) \n File \"/usr/local/lib/python2.7/dist-packages/django/apps/config.py\", line 119, in create \n import_module(entry) \n File \"/usr/lib/python2.7/importlib/__init__.py\", line 37, in import_module \n __import__(name) \nImportError: No module named ckeditor_uploader \n\n\nIn the virtualenv of my project I have the following libraries installed:\n\n$ pip list\nargparse (1.2.1)\ndj-database-url (0.3.0)\ndj-static (0.0.6)\nDjango (1.8)\ndjango-ckeditor (5.0.2)\ndjango-toolbelt (0.0.1)\ngunicorn (19.3.0)\npip (1.5.4)\npsycopg2 (2.6.1)\nsetuptools (2.2)\nstatic3 (0.5.1)\nwsgiref (0.1.2)\n\n$ cat requirements.txt \nDjango==1.8\nargparse==1.2.1\ndj-database-url==0.3.0\ndj-static==0.0.6\ndjango-ckeditor==5.0.2\ndjango-toolbelt==0.0.1\ngunicorn==19.3.0\npsycopg2==2.6.1\nstatic3==0.5.1\nwsgiref==0.1.2\n\n\nmodels.py:\n\nfrom django.db import models\nfrom ckeditor.fields import RichTextField\n\nclass Posts(models.Model):\n name = models.CharField(max_length=200)\n content = RichTextField()\n\n def __unicode__(self):\n return self.name\n\n\nsetting.py:\n\nINSTALLED_APPS = (\n 'django.contrib.admin',\n ...\n 'django.contrib.staticfiles',\n 'ckeditor_uploader',\n)\n\nCKEDITOR_CONFIGS = {\n 'awesome_ckeditor': {\n 'toolbar': 'Basic',\n },\n}\n\n\nAny idea?" ]
[ "python", "django", "ckeditor", "tinymce" ]
[ "App Engine Load Testing", "I want to load test my web app on app engine, simulating multiple users logging in and hammering the app with requests. \n\nI am new to Jmeter and don't know it too well but based on some research, I should be able to simulate logins with multiple accounts, credentials residing in a CSV files. I used the recording controller feature in Jmeter to simulate a test of one user logging in my app engine webapp. my app using Google Authorization. Now my problem is once I've created the CSV file config in Jmeter and the variables, USERNAME and PASSWD and the csv files, where do I plugin those fields? Looking at the requests generated by the recording proxy, I can't seem to find the point at which an actual post to a login form is made. The closest thing to a login attempt request that I see is a HTTP Request called '/_ah/conflogin', though it is a get request and not a post and the only variable present there is something called 'state'. \n\nAm I approaching this all wrong. Will Jmeter allow me to load test an authorized app in app engine? I found very scare resources on this online..Though I have found Google IO talks mentioning Jmeter as a stress testing tool for a web app in engine but with no details as to how to. I am not stuck on Jmeter either, just curious as to what is the 'right' way to go about load testing an app engine web application that requires login. I guess I can also do this programmatically instead." ]
[ "google-app-engine", "jmeter", "load-testing" ]
[ "Angular linky without sanitize (filter)", "New to angular. I'm using the linky filter to add href links to some already-sanitized text, with line breaks in it.\n\nhttp://docs-angularjs-org-dev.appspot.com/api/ngSanitize.filter:linky\nangularjs newline filter with no other html\n\n<section class=\"description\"\n ng-bind-html-unsafe=\"piano.description | noHTML | newlines | linky \">\n</section>\n\n\nHowever, linky automatically sanitizes the html, removing my carefully added newlines. There doesn't seem to be an accepted way of doing this, what would work well? Make a filter to unescape my linebreaks? Customize linky to add a no filter option?" ]
[ "angularjs" ]
[ "Angular: How to create tree iterate from my JSON", "I have checked this post AngularJS - Json to Tree structure but their code is bit difficult to understand.\n\nBasically I want to generate tree from my json.....does any easy way exist?\n\nHere is my json:\n\nangular.module(\"myApp\", []).\ncontroller(\"MasterDetails\", ['$scope', function($scope) {\n $scope.details = [{\"ID\":1,\"Name\":\"Suzy\",\"ParentID\":0},\n{\"ID\":2,\"Name\":\"Somi\",\"ParentID\":1},\n{\"ID\":3,\"Name\":\"Romi\",\"ParentID\":2},\n{\"ID\":4,\"Name\":\"Jumi\",\"ParentID\":3},\n{\"ID\":5,\"Name\":\"Gargi\",\"ParentID\":0},\n{\"ID\":6,\"Name\":\"Sujoy\",\"ParentID\":5},\n{\"ID\":7,\"Name\":\"Kamal\",\"ParentID\":6},\n{\"ID\":8,\"Name\":\"Joy\",\"ParentID\":0},\n{\"ID\":9,\"Name\":\"Sumana\",\"ParentID\":8},\n{\"ID\":10,\"Name\":\"Alex\",\"ParentID\":0}];\n}]);\n\n\nLooking for guidance. Thanks." ]
[ "angularjs", "json", "tree" ]
[ "Where is a Scala profile for SonarQube?", "Is there basic ruleset/quality profile for SonarQube for the Scala language?\n\nI couldn't find any and it's hard to imagine that everyone starts with an empty ruleset." ]
[ "scala", "sonarqube" ]
[ "EmberJS - Calling a controller method within a routes setupController", "I have a controller with a few methods attached to it. I have a relevant route. I added the methods inside the controller so that they can be re-used in a few other places. These methods retrieve some data from the server. Inside the setupController of the route, I'm calling these methods and everything works as expected.\n\nBut once I concatenate the files, Ember throws an error saying the method I'm trying to call is undefined. I use grunt-contrib-concat plugin but also tried changing it to use uglify. Still the same issue. I don't think there is anything wrong with the concatenation as it always worked previously. However, I never used the setupController before other than to set properties. Added the sample code below. Any help is appreciated.\n\n/* Ember 1.10.0 Debug version */\n\n/* Route */\nApp.DashboardRoute = Ember.Route.extend({\n model: function() { return []; },\n setupController: function(controller, model) {\n this._super(controller, model);\n\n /* Setting values on the controller works */\n controller.set('currentDate', new Date());\n\n /* Calling a method works normally but throws error when minified */\n /* Error: dashboard undefined is not a function */\n controller.addNumbers();\n } \n});\n\n/* Controller */\nApp.DashboardController = Ember.ArrayController.extend({\n currentDate: null,\n addNumbers: function() {\n return 1 + 2;\n }\n});" ]
[ "javascript", "ember.js" ]
[ "Convert json format to dataframe frame", "Having a jsong format like this:\n\n{'reputation_history_type': 'post_upvoted', 'reputation_change': 10, 'post_id': 12, 'creation_date': 1217553646, 'user_id': 1}, {'reputation_history_type': 'post_downvoted', 'reputation_change': 10, 'post_id': 2, 'creation_date': 1217540009, 'user_id': 3}\n\n\nHow is it possible to convert it to a dataframe? example of expected output:\n\nreputation_history_type reputation_change post_id creation_date user_id" ]
[ "python", "pandas" ]
[ "Loading Routes via JSON in Angular2", "I am trying to load the routes from a JSON file, as i do not want to hard code them and load the routes lazily. \nSomething like this:\n\n\r\n\r\nimport { RouterModule } from '@angular/router';\r\nconst routes = [\r\n { path: '', loadChildren: 'app/home/home.module' },\r\n { path: ':item/shoes', loadChildren: 'app/shoes/shoes.module' },\r\n { path: ':item/watch', loadChildren: 'app/watch/watch.module' }\r\n];\r\nexport default RouterModule.forRoot(routes);\r\n\r\n\r\n\nI want to load the following routes from a JSON file.\n\n\r\n\r\n{ path: '', loadChildren: 'app/home/home.module' },\r\n { path: ':item/shoes', loadChildren: 'app/shoes/shoes.module' },\r\n { path: ':item/watch', loadChildren: 'app/watch/watch.module' }\r\n\r\n\r\n\n\nI am reading the JSON file using a service which is injected in a component. How do i inject the service in the router to get the values? Or is there any other better way using which i can load the routes from JSON?" ]
[ "angular", "angular2-routing", "angular2-router" ]
[ "cordova navigator.app.close() is keeping app in background", "I'm trying to close my android app by calling cordova navigator.app.close(), app closes but still running in background and I can see it in app manager. \nI tried to solve this problem like it described there: PhoneGap keep running on Android after onPause\nby inserting \n\n<preference name=\"keepRunning\" value=\"false\" /> \n\n\nin config.xml, but it doesn't work for me. \n\nAre there some other ideas to solve this problem?" ]
[ "javascript", "android", "cordova" ]
[ "Unable to remove on-premise database from Azure Sync Group", "The on-prem database within the Sql Data Sync software is at status 'reachable'. I submit an agent key obtained from the portal, in which test is successful, then click Unregister for one of the databases. I click Yes I'm sure, and presented with this error:\n\n\n\nHow do I unregister databases?" ]
[ "synchronization", "azure-sql-database" ]
[ "Express: Render partially in each handler?", "I have a modest little site that uses Express and Pug. Every page has a navbar that contains the user's name drawn from a user parameter and the main content of the page is below which uses a data parameter. The main content is rendered from a template that extends the root template. Both need their own parameter to render properly.\n\nIs there a way to partially render a view in each handler?\n\nvar app = require('express')()\napp.set('view engine', 'pug')\n\napp.get('/', (req, res, next) => {\n var userdata = '...'\n req.render('/index', {user: userdata}\n next() // the request is for /page\n})\n\napp.get('/page', (req, res, next) => {\n var moredata = '...'\n req.render('./page/index', {data: mroedata})\n})" ]
[ "express", "render", "partial-views" ]
[ "Cannot find module \"@auth0/angular-jwt/\"", "I'm currently developing a Web Application using ADFS authentication.\n\nI have the following runtime error:\n\n\n \"Cannot find module @auth0/angular-jwt\".\n\n\nI'm using Angular 5.2.10. I've tried to reinstalled my dependencies, however I still have errors:\n\nI've errors in index.d.ts: \n\n\n Cannot find name 'Provider'and 'ModuleWithProviders'\n\n\nAnd in jwt.interceptor.d.ts: \n\n\n Cannot find modules \"@angular/common/http\" and \"rxjs/internal/Observable\"\n\n\nAnd in jwtoptions.token.d.ts: \n\n\n Cannot find module \"@angular/core\"\n\n\nI haven't modified any of those files.\n\nIs this an angular version problem? Am I using wrong versions of those libraries?\n\nThanks for your help!" ]
[ "angular", "typescript", "node-modules", "auth0" ]
[ "using SpeechRecognizerUI in my WP 8 app causing it crash unexpectedly?", "I am new to windows phone app development. I am trying to build a simple speech recognition app using SpeechRecognizerUI class. But the problem is whenever i try to debug the app in my Lumia 520 device(working on 8.1 platform), it load the listener as usual and then debugger stopped automatically at the same time it load within a second, don't allow me sufficient time to speak even a single word. I am googling since 2 days but got nothing helpful. I have provided a single button on \"MainPage.xml\" of my app for which i have given the following code. \n\nnamespace Kundali\n{\npublic partial class MainPage : PhoneApplicationPage\n{\n // Constructor\n public MainPage()\n {\n InitializeComponent(); \n }\n private async void button_Click(object sender, RoutedEventArgs e)\n {\n ![SpeechRecognizerUI][1] sprec = new SpeechRecognizerUI();\n SpeechRecognitionUIResult result = await sprec.RecognizeWithUIAsync();\n MessageBox.Show(string.Format(\"You said {0} \", result.RecognitionResult.Text)); \n }\n}\n\n\nWhen i tried to handle the exception in catch handler it shows the exception \"The text associated with this error code could not be found\" not even listening the single text. Some one please help me. \n\nActually i am working with Visual studio 2012 (Express for windows Phone 8) but my device is on 8.1. Is this the problem?? If yes then please provide the solution. How do i integrate the functionality of 8.1 in vs2012?" ]
[ "c#", "windows-phone-8", "exception-handling", "eventhandler" ]
[ "Get the outer neighbour pixels of contour C#", "I have the pixel coordinates of the contour of an object. I need to get the outer neigbours of these pixels. First i calculated the middle x value and middle y value of these contour points. For every contour point I determined if the x value is higher/lower than the middle x value, I did the same for the y values. For example if the x-value of a contour point is lower than the x middle and the y value of a contour point is lower than the y middle I create a new point that is south-west to the original point. When I do this I will get 4 holes, see picture in the link below. Can someone please help me solve this problem\n\nhttp://i.stack.imgur.com/EY3uD.jpg" ]
[ "c#", "opencv", "image-processing", "computer-vision", "pixel" ]
[ "How can I encode this query string?", "I'm trying to implement a payment processor. In order to validate that the response is legitimate, I have to take the query string and append a validation key, then perform an MD5 hash and match my hashed values to theirs.\n\nThe payment processor is generating their hash based on a querystring like the following:\n\n\n trnId=10000041\n &messageText=Duplicate+Transaction+%2D+This+transaction+has+already+been+approved\n &trnAmount=11.20\n &trnDate=6%2F8%2F2011+12%3A32%3A20+PM\n &trnEmailAddress=john%2Edoe%40gmail%2Ecom\n &avsMessage=Address+Verification+not+performed+for+this+transaction%2E\n &ref1=aab02ccd%2D7d17%2D4d09%2Da30c%2Dad6324fe33f1 \n\n\nNow if I were to call QueryString[\"messageText\"] I would get \"Duplicate Transaction - This transaction has already been approved\". I can't use that, as I need the + and %2D\n\nSo to generate my string I do something like this:\n\nNameValueCollection queryString = new NameValueCollection(QueryString);\nqueryString.Remove(\"hashValue\");\n\nList<string> parameters = new List<string>();\nforeach(string qs in queryString.Keys)\n parameters.Add(qs + \"=\" + HttpUtility.UrlEncode(QueryString[qs]));\n\nstring value = string.Join(\"&\", parameters.ToArray());\n\n\nMy resulting string:\n\n\n trnId=10000041\n &messageText=Duplicate+Transaction+-+This+transaction+has+already+been+approved\n &trnAmount=11.20\n &trnDate=6%2f8%2f2011+1%3a05%3a09+PM\n &trnEmailAddress=john.doe%40gmail.com\n &avsMessage=Address+Verification+not+performed+for+this+transaction.\n &ref1=aab02ccd-7d17-4d09-a30c-ad6324fe33f1 \n\n\nThat is a little closer, but with 2 issues, the dashes and periods are not encoded, and the encoding generated lowercase instead of upper case. %2f instead of %2F.\n\nIs there any way to fix this without doing a string.replace? A different method I could call that would provide the results I want?" ]
[ "c#", "url-encoding" ]
[ "Center 3 images in a div Bootrstrap", "how can I make this 3 images to be in center of the page with Bootstrap? \nmy code:\n\n<div id=\"small-img\" class=\"col-xs-12 col-sm-12 col-md-12 col-lg-12 pagination-centered footer-bottom-img\">\n <ul>\n <li>\n <img class=\"img-responsive inline-block center-block\" alt=\"\" src=\"ssl_secure.png\">\n </li>\n <li>\n <img class=\"img-responsive inline-block center-block\" alt=\"\" src=\"secure-cc-paypal.png\">\n </li>\n <li>\n <img class=\"img-responsive inline-block center-block\" alt=\"\" src=\"gt-secured-seal.gif\">\n </li>\n </ul>\n</div>" ]
[ "html", "css", "twitter-bootstrap", "twitter-bootstrap-3" ]
[ "How to pass the C pointers in swift", "I am using C pointer in objective C\n\nThis is my C function:\n\nlong ListReaders(\n__out char** szReadersList,\n__out unsigned long* pulListLen){\n}\n\nlong Result; \nchar* pszReadersList; \nunsigned long pulListLen; \nResult=ListReaders(&pszReadersList, & pulListLen);\n\n\nIt is very easy to use the pointers in Objective C, but when i tried in swift there other concepts for pointers like UnsafeMutablePointer, UnsafePointer etc.\n\nHow can i use the same C function in swift\n\nI tried to use it is showing like this\n\nvar Result :CLong? \nvar pszReadersList :CChar? \nvar pulListLen: CUnsignedLong? \nResult=ListReaders(szReadersList:UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>!UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>!>, pulListLen: UnsafeMutablePointer<UInt>!UnsafeMutablePointer<UInt>!>)\n\n\nCan you Guys please suggest me the usage of C pointers in swift" ]
[ "ios", "c", "swift", "pointers" ]
[ "CSS Selector Case Insenstive", "I am having issues using Stylish to skin a site but the image values given are not all the same case. I will get some images with Cattle.GIF, Cattle.gif or cattle.GIF. Right now, I have it working for one set of the images but the others will not work.\n\nimg[src*=\"cattle\"] {\n height: 00 !important;\n width: 1 !important;\n /* these numbers match the new image's dimensions */\n\n padding-left: 41px !important;\n padding-top: 35px !important;\n background: url(https://s3-us-west-1.amazonaws.com/resonantriseimages/resources/CattleIcon.png) no-repeat !important;\n}\n\n\nAbove will only work if the word is all lower case. I am trying to make it so it doesn't care if it is capital or lowercase." ]
[ "html", "css" ]
[ "What sorting algorithm does qsort use?", "I can't find any information regarding what sorting algorithm C qsort function uses.\n\nIs it quicksort? It is not mentioned in man." ]
[ "c", "sorting" ]
[ "jQuery menu using tags", "I'm making a very basic menu but I can't seem to get it to work. I'm using jQuery for it. Here's what I have so far.\n\n<script>\n$(document).ready(function(){\n $(\"a#lnk\").click(function(){\n top.location.href=\"http://\"+this.lnk\n });\n});\n</script>\n\n\nI've used a custom \"lnk\" attribute to store the site link. Can anyone help?" ]
[ "jquery", "menu", "web", "lnk" ]
[ "Laravel - Notification Mail ShouldQueue does't work", "I would like to send email notifications using the queue.\n\nI have created the queue table and tracked all the documentation related to this topic but the notifications are sent without going through the queue.\n\nIn my controller :\n\nNotification::send(User::role('team')->get(), new NewExchangeToCollaboratorNotification($user, $exchange, $firstMessage));\n\n\nAnd my notification code is :\n\n<?php\n\nnamespace App\\Notifications;\n\nuse Illuminate\\Bus\\Queueable;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Illuminate\\Notifications\\Messages\\MailMessage;\nuse Illuminate\\Notifications\\Notification;\nuse Setting;\n\nclass NewExchangeToCollaboratorNotification extends Notification implements ShouldQueue\n{\n use Queueable;\n\n protected $user; protected $exchange; protected $exchangeMessage; protected $replyToAddress;\n\n public function __construct($user, $exchange, $exchangeMessage)\n {\n $this->user = $user;\n $this->exchange = $exchange;\n $this->exchangeMessage = $exchangeMessage;\n $this->replyToAddress = Setting::get('MAIL_REPLY_TO_ADDRESS', env('MAIL_FROM_ADDRESS'));\n }\n\n public function via($notifiable)\n {\n return ['mail'];\n }\n\n public function toMail($notifiable)\n {\n return (new MailMessage)->view(\n 'emails.exchanges.new',\n [\n 'user' => $this->user,\n 'exchangeMessage' => $this->exchangeMessage,\n 'exchange' => $this->exchange\n ]\n ) ->subject('New exchange: ' . $this->exchange->title)\n ->from(env('MAIL_FROM_ADDRESS'))\n ->replyTo($this->replyToAddress);\n }\n}\n\n\nAre the notifications queueable ? Is there something I'm doing wrong ? \nThank you for your answers :)\n\nEDIT : \nAdd delay does not work too.\n\n$when = now()->addMinutes(10);\nNotification::send(User::role('team')->get(), (new NewExchangeToCollaboratorNotification($user, $exchange, $firstMessage))->delay($when));\n\n\nEDIT 2 : \nNo failed job" ]
[ "php", "laravel", "queue", "laravel-7" ]
[ "\"value >> is not a member of\" compilation error", "I have the following code:\n\nimport java.io.{File, PrintWriter} \n\nimport com.github.nscala_time.time.Imports._ \nimport net.ruippeixotog.scalascraper.browser.JsoupBrowser \nimport net.ruippeixotog.scalascraper.browser.JsoupBrowser.JsoupElement \nimport net.ruippeixotog.scalascraper.model.{ElementNode, Node} \n\nobject ConvertHTMLToCSV extends App { \n val browser = JsoupBrowser() \n val doc = browser.parseFile(\"my-doc.html\") \n doc >> \"h3\"\n .\n .\n . \n}\n\n\nI am getting the following compilation error:\n\nError:(11, 7) value >> is not a member of ConvertHTMLToCSV.browser.DocumentType\n doc >> \"h3\" \n\n\nI am trying to implement an example given for the Scala Scraper library.\n\nWhat am I doing wrong?" ]
[ "scala", "implicit" ]
[ "How to see the operations performed in a Tensorflow pb file?", "More specifically, I want to see the operations performed in the graph inside 'classify_image_graph_def.pb' which is inside Tensorflow's imagenet Inception model." ]
[ "python-2.7", "tensorflow" ]
[ "WCF service contract design. Is a use case controller appropriate?", "First off, apologies if this question has been asked before but I couldn't find anything that answers this directly.\n\nHere's my problem. I've inherited a product which has been designed to be so flexible that populating pretty much every combobox and textblock on the (silverlight) form requires a service request. Some of the screens take upward of 15 separate requests just to populate!\n\nNow I've worked with WCF web services on a number of occasions and having service contracts split into small discrete operations has never been too much of a hit,..sadly this is not the case for this project. So it left me wondering...\n\nThere are no plans to expose the service outside of our own walls. There are no plans to write another client for this particular service. So couldn't I just write a 'use case controller' at the service end? So, in a 'create complaint' screen, instead of having a list of requests like...\n\n\nGetComplaintTypes\nGetCustomerTypes\nGetAreaDetails\nAnd so on...\n\n\nto populate the form I would just have a single operation contract called 'GetCreateComplaintData'. It seems crazy to have so many operations exposed in such granularity when there's only one client which then has to aggregate and synchronise all these requests into something meaningful. Why not expose something meaningful in the first place?\n\nMore to the point, if you don't intend on exposing the service API to third parties isn't this a better strategy than exposing CRUD ops for tables in the DB?\n\nAll help and opinions are appreciated.\nThanks in advance." ]
[ "wcf", "controller", "soa", "use-case" ]
[ "How to make php5 on a machine running php4, without breaking anything", "I know with python and a couple other languages there is a way to safely make install a newer generational version of a language onto a machine, but after digging through PHP5's configure & makefile the only thing I've seen is the prefix dir option and the ini scan path.\n\nIdeally I'd like php5 to have its own lib/bin subdirectories in /usr/local and then I can just put php5 after php4 in the path or make a symbolic link from the php5 binaries to php5-cli, php5-cgi, etc. \n\nAlso, am I missing anything dramatically bad here, the server in question is a legacy application server that's still somewhat busy and is due to be deprecated by June of 2009 but in the meantime the plan is to start updating parts with php5 code.\n\nMachine states:\nCENTOS 5\nPHP 4 was built from a source RPM outside of yum's control\n\nMost of php4 is in ambiguous directories:\n/usr/{include,lib}/php" ]
[ "php", "sysadmin" ]
[ "Flutter - Search elements in array with firstwhere", "The problem is simple: What is the correct way to search element in array ? \n\nMy code is \n\ndata = [{id: 1, descripcion: Asier}, {id: 2, descripcion: Pepe}]\nestateSelected= data.firstWhere((dropdown)=>dropdown.id==1);\n\n\nThe error that return is\n\n\n Bad state: no element" ]
[ "dart", "flutter" ]
[ "Python design - initializing, setting, and getting class attributes", "I have a class in which a method first needs to verify that an attribute is present and otherwise call a function to compute it. Then, ensuring that the attribute is not None, it performs some operations with it. I can see two slightly different design choices:\n\nclass myclass():\n def __init__(self):\n self.attr = None\n\n def compute_attribute(self):\n self.attr = 1\n\n def print_attribute(self):\n if self.attr is None:\n self.compute_attribute()\n print self.attr\n\n\nAnd\n\nclass myclass2():\n def __init__(self):\n pass\n\n def compute_attribute(self):\n self.attr = 1\n return self.attr\n\n def print_attribute(self):\n try:\n attr = self.attr\n except AttributeError:\n attr = self.compute_attribute()\n if attr is not None:\n print attr\n\n\nIn the first design, I need to make sure that all the class attributes are set to None in advance, which can become verbose but also clarify the structure of the object. \n\nThe second choice seems to be the more widely used one. However, for my purposes (scientific computing related to information theory) using try except blocks everywhere can be a bit of an overkill given that this class doesn't really interact with other classes, it just takes data and computes a bunch of things." ]
[ "python", "class", "oop", "scientific-computing", "class-attributes" ]
[ "In pandas, is inplace = True considered harmful, or not?", "This has been discussed before, but with conflicting answers:\n\nin-place is good!\nin-place is bad!\n\nWhat I'm wondering is:\n\nWhy is inplace = False the default behavior?\nWhen is it good to change it? (well, I'm allowed to change it, so I guess there's a reason).\nIs this a safety issue? that is, can an operation fail/misbehave due to inplace = True?\nCan I know in advance if a certain inplace = True operation will "really" be carried out in-place?\n\n\nMy take so far:\n\nMany Pandas operations have an inplace parameter, always defaulting to False, meaning the original DataFrame is untouched, and the operation returns a new DF.\nWhen setting inplace = True, the operation might work on the original DF, but it might still work on a copy behind the scenes, and just reassign the reference when done.\n\npros of inplace = True:\n\nCan be both faster and less memory hogging (the first link shows reset_index() runs twice as fast and uses half the peak memory!).\n\npros of inplace = False :\n\nAllows chained/functional syntax: df.dropna().rename().sum()... which is nice, and offers a chance for lazy evaluation or a more efficient re-ordering (though I don't think Pandas is doing this).\nWhen using inplace = True on an object which is potentially a slice/view of an underlying DF, Pandas has to do a SettingWithCopy check, which is expensive. inplace = False avoids this.\nConsistent & predictable behavior behind the scenes.\n\nSo, putting the copy-vs-view issue aside, it seems more performant to always use inplace = True, unless specifically writing a chained statement. But that's not the default Pandas opt for, so what am I missing?" ]
[ "python", "pandas" ]
[ "ExpandoObject.KeyCollection.Contains method does not check if data is Uninitialised", "I'm attempting to test whether an ExpandoObject contains a given key. The object is created, the key added, and then removed. Using the IDictionary.ContainsKey method returns false, but using IDictionary.Keys.Contains returns true.\nThis seems to be because the ExpandoObject.Remove method does not actually remove the key from the private _data field, but instead sets the value to ExpandoObject.Uninitialized. Then, the ExpandoObject.KeyCollection.Contains method does not check whether or data stored the ExpandoObject._data is Uninitialized, as ContainsKey does. Is there a reason for the difference between these checks?\nIDictionary< string, object > expando = new ExpandoObject();\n\nvar key = "key";\n\nexpando[ key ] = new object();\nexpando.Remove( key );\n\nvar containsKey = expando.ContainsKey( key ); // = false\nvar keysContains = expando.Keys.Contains( key ); // = true" ]
[ "c#", "expandoobject" ]
[ "How can i display post offsets in WP?", "I'm actually using this short snippet of code to display some content on my website.\n\n<?php\n global $post;\n $myposts = get_posts('numberposts=3');\n foreach($myposts as $post) :?>\n content\n<? php endforeach; ?>\n\n\nAnd I wanted to know if there was a way to incorporate the offset function of wp into it." ]
[ "php", "wordpress", "wordpress-theming" ]
[ "not working in composite", "I'm using primefaces 5 and I have the following form:\n\n<h:form id=\"registarVagaForm\" prependId=\"false\">\n <p:panel id=\"dadosGeraisVagaPanel\" header=\"#{label['seccao.registarVaga.dadosGerais']}\" toggleable=\"true\" closable=\"false\" toggleSpeed=\"500\" widgetVar=\"panel\">\n <recrutamento:vaga titulo=\"#{registarVaga.vaga.titulo}\" descricao=\"#{registarVaga.vaga.descricao}\" observacoes=\"#{registarVaga.vaga.observacoes}\" competencias=\"#{registarVaga.competencias}\" disabled=\"false\" />\n <f:facet name=\"footer\">\n <div align=\"right\">\n <p:commandButton action=\"#{registarVaga.registar}\" value=\"#{label['campo.registarVaga.botao.registar']}\" ajax=\"false\" />\n </div>\n </f:facet>\n </p:panel>\n</h:form>\n\n\nInside the composite vaga I have the following dataTable tabelaCompetencias:\n\n<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:c=\"http://java.sun.com/jsp/jstl/core\" xmlns:h=\"http://java.sun.com/jsf/html\" xmlns:f=\"http://java.sun.com/jsf/core\" xmlns:ui=\"http://java.sun.com/jsf/facelets\" xmlns:p=\"http://primefaces.org/ui\" xmlns:sec=\"http://www.springframework.org/security/facelets/tags\" xmlns:composite=\"http://java.sun.com/jsf/composite\">\n <composite:interface>\n ...\n </composite:interface>\n <composite:implementation>\n ...\n <p:panelGrid columns=\"2\" styleClass=\"invisibleGrid\" >\n <h:outputLabel value=\"#{label['seccao.registarVaga.competencias.associadas']}\" for=\"tabelaCompetencias\" />\n <p:message for=\"tabelaCompetencias\" />\n </p:panelGrid>\n <p:dataTable id=\"tabelaCompetencias\" var=\"competencia\" value=\"#{cc.attrs.competencias}\" selection=\"#{registarVaga.competenciasSelecionadas}\" rowKey=\"#{competencia.id}\" rows=\"15\" paginator=\"true\" paginatorTemplate=\"{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}\" paginatorPosition=\"bottom\" style=\"width:600px;\">\n <p:column headerText=\"#{label['seccao.registarVaga.competencias.descricao']}\">\n <h:outputText value=\"#{competencia.descricao}\" />\n </p:column>\n <p:column selectionMode=\"multiple\" style=\"width:3%;text-align:center\"/>\n </p:dataTable>\n </composite:implementation>\n</html>\n\n\nWhen I submit the form and my validation fails, I try to pass an error message to \"tabelaCompetencias\" like so:\n\nfinal FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, \"Error!\", \"Error!\");\nFacesContext.getCurrentInstance().addMessage(\"tabelaCompetencias\", facesMsg); \n\n\nOn my other non-composite views it works like a charm, however if declared as a composite my message won't display. Also if I use, for example, an inputText with required=\"true\", primefaces displays the message correctly.\n\nWhat am I doing wrong? Any help would be appreciated" ]
[ "java", "jsf-2", "primefaces" ]
[ "C# string.Format throws exception", "I am trying to format a string using string.Format but it throws an exception.\n\n var format = \"public {0} {1} { get; {2}set; }\";\n var arg0 = \"long\";\n var arg1 = \"Ticks\";\n\n var formatedString = string.Format(format, arg0, arg1, null);\n\n\nThe last line throws a System.FormatException with the following details:\n\n System.FormatException was unhandled\n HResult=-2146233033\n Message=Input string was not in a correct format.\n Source=mscorlib\n StackTrace:\n at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)\n at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)\n at System.String.Format(String format, Object arg0, Object arg1, Object arg2)\n at ConsoleApplication1.Program.Main(String[] args) in E:\\lab\\cheque\\helloworldprism\\ConsoleApplication1\\ConsoleApplication1\\Program.cs:line 11\n at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)\n at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\n at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\n at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\n at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\n at System.Threading.ThreadHelper.ThreadStart()\n InnerException:" ]
[ "c#", "string", "string-formatting" ]
[ "CSP Browser Policy + Zopim widget (+ underscore)", "For the past few days, I've been trying to add properly Meteor's CSP package, browser-policy. So far, I followed these ressources:\n\n\nhttps://dweldon.silvrback.com/browser-policy\nhttps://themeteorchef.com/snippets/using-the-browser-policy-package/\n\n\nThings were a bit rough at the beginning but we are close to something, the last piece of the puzzle being live-chat Zopim's widget not being a fan of our new policy. I tried to whitelist and put zopim's widget code into a Meteor.startup call somewhere but it still fails on load due to some unsafe-eval as you can see below.\n\n\nAs I don't want to loosen up more my policies, is there any workaround for this or should I just forget about Zopim and give a shot at some other tool (which I'd be glad to hear about if you have any suggestion).\n\nBonus: Also, I first had my policy with BrowserPolicy.content.disallowEval(); but MDG's underscore package started to fall appart and I had to allow it. Allowing eval is clearly not ideal and I'd be glad to hear any alternative." ]
[ "meteor", "content-security-policy" ]
[ "How can I accelerate an already moving object?", "I am working on learning a new coding language, which in Javascript in this. We are starting simple: Creating a rectangle making it move horizontally over the screen. However I need to find a way to make it speed up the longer it goes on. \n\nSo far the only thing I could figure out and find out is that I could use the existing value and multiply it by a very small factor that is slightly higher than one ('IF' statement). However, is there a different and easier way to do this?\n\n//variabelen X en Y\n\nvar posX;\nvar posY;\n\n\n//Canvas\nfunction setup() {\n createCanvas(400, 400);\n posX = 0;\n posY = 50;\n\n}\n\n//rode vierkant\n\nfunction draw() {\n background(255);\n fill(255, 0, 0);\n rect(posX, posY, 50, 50);\n posX = posX + 1;\n\n if (posX >= 1) { \n\n posX = posX * 1.05;\n }\n\n}\n\n\nAs mentioned above, I expect the red rectangle to start with a certain speed (in this case +1) and then gradually accelerate." ]
[ "javascript" ]
[ "Is it possible to undo last execution of a while loop?", "Here is an example:\n\nint i = 0;\nwhile (i < 11) {\n System.out.println(i);\n list.add(i);\n i++;\n}\n\n\nOutput should be:\n\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n\n\nThe arraylist should have the same values for each index but what if I don't want the 10?\n\nIs it possible \"undo\" the last execution of the while loop considering the while loop cannot be modified? \n\nI know it's simpler to just remove the last index of the arraylist but what if the execution wasn't as simple to undo (as is the case for my related problem)?\n\nIf not possible, would it be better to just modify the loop condition?\n(for my problem different from this one, I'm stuck on how to modify the condition as it works perfectly except for the very last execution which modifies a whole bunch of different things that is not easy to undo as with the simple arraylist example here)." ]
[ "java", "while-loop" ]
[ "jQuery selector by a, class, href", "I have a HTML block\n\n<a class=\"active\" href=\"#mobileOrder\">\n\n\nI am using jQuery 2.1.1 . When I click the above block, I want call JavaScript \n\nfunction move(){...}\n\n\nHow to do this?" ]
[ "javascript", "jquery", "jquery-selectors" ]
[ "Laravel - how to sum() field from relation", "I'm trying to optimize this code because it's causing Timeout problems.\nIt's getting all items from database and performing SUM() in PHP.\npublic function getInstalledCost()\n{\n $items = $this->stockItems()\n ->where('status', 'INSTALADO')\n ->with(['shipment' => function($q){ $q->select('id', 'item_cost'); }])\n ->select('id','shipment_id')\n ->get();\n\n $cost = 0;\n foreach($items as $i){\n $cost += $i->shipment->item_cost;\n }\n\n return $cost;\n}\n\nSo is there any way to get this data already SUM() from the database?" ]
[ "php", "laravel" ]
[ "How to generate random strings that match a given regexp?", "Duplicate:\n\nRandom string that matches a regexp\n\nNo, it isn't. I'm looking for an easy and universal method, one that I could actually implement. That's far more difficult than randomly generating passwords.\n\nI want to create an application that takes a regular expression, and shows 10 randomly generated strings that match that expression. It's supposed to help people better understand their regexps, and to decide i.e. if they're secure enough for validation purposes. Does anyone know of an easy way to do that?\nOne obvious solution would be to write (or steal) a regexp parser, but that seems really over my head.\nI repeat, I'm looking for an easy and universal way to do that.\nEdit: Brute force approach is out of the question. Assuming the random strings would just be [a-z0-9]{10} and 1 million iterations per second, it would take 65 years to iterate trough the space of all 10-char strings." ]
[ "regex", "parsing", "random", "reverse" ]
[ "How to log in to apacheds with non-admin user", "I am trying to log in with a user to ApacheDS through Java.\n\nThis are my user's details as exported in an ldif:\n\ndn: uid=carlspring,ou=users,ou=system\nobjectClass: top\nobjectClass: inetOrgPerson\nobjectClass: person\nobjectClass: organizationalPerson\ncn: Martin Todorov\nsn: Todorov\nuid: carlspring\nuserPassword:: e1NTSEF9bC9LRk45RllHdW5aVGdLcUtScmNTYk80RXRLMmJvbTEvM2NOYnc9PQ==\n\n\nThis is the code I have:\n\n // Set up environment for creating initial context\n Hashtable env = new Hashtable(11);\n env.put(Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.ldap.LdapCtxFactory\");\n env.put(Context.PROVIDER_URL, \"ldap://localhost:10389/ou=users,ou=system\");\n env.put(Context.SECURITY_AUTHENTICATION, \"simple\");\n env.put(Context.SECURITY_PRINCIPAL, \"uid=carlspring,ou=users,ou=system\");\n env.put(Context.SECURITY_CREDENTIALS, \"password\");\n\n try\n {\n // Create initial context\n DirContext ctx = new InitialDirContext(env);\n\n System.out.println(ctx.lookup(\"ou=users\"));\n System.out.println(\"Logged in.\");\n\n // do something useful with ctx\n\n // Close the context when we're done\n ctx.close();\n }\n catch (NamingException e)\n {\n e.printStackTrace();\n }\n\n\nI am getting the following exception:\n\njavax.naming.NameNotFoundException: [LDAP: error code 32 - NO_SUCH_OBJECT: failed for MessageType : SEARCH_REQUEST\nMessage ID : 2\n SearchRequest\n baseDn : 'ou=users,ou=users,ou=system'\n filter : '(objectClass=*)'\n scope : base object\n typesOnly : false\n Size Limit : no limit\n Time Limit : no limit\n Deref Aliases : deref Always\n attributes : \norg.apache.directory.api.ldap.model.message.SearchRequestImpl@c7594470 ManageDsaITImpl Control\n Type OID : '2.16.840.1.113730.3.4.2'\n Criticality : 'false'\n'\n: ERR_648 Invalid search base ou=users,ou=users,ou=system]; remaining name 'ou=users'\n\n\nFrom what I understand, it doesn't seem to be connecting properly. I've tried logging in through Apache Directory Studio (with uid=carlspring,ou=users,ou=system) and that works fine. I can also log in with the admin user like this:\n\n env.put(Context.PROVIDER_URL, \"ldap://localhost:10389/ou=system\");\n env.put(Context.SECURITY_PRINCIPAL, \"uid=admin,ou=system\");\n env.put(Context.SECURITY_CREDENTIALS, \"secret\");\n\n\nCould somebody please tell me what I'm doing wrong and why it's not logging in? I can't seem to be able to figure it out. Many thanks in advance!" ]
[ "java", "ldap", "apacheds" ]
[ "Conditional JOIN on two data frames in R", "Suppose there are two data frames likes the following (given from this post):\n\ndf1 = data.frame(CustomerId = c(1:6), Product = c(rep(\"Toaster\", 3), rep(\"Radio\", 3)))\ndf2 = data.frame(CustomerId = c(2, 4, 6), State = c(rep(\"Alabama\", 2), rep(\"Ohio\", 1)))\n\ndf1\n# CustomerId Product\n# 1 Toaster\n# 2 Toaster\n# 3 Toaster\n# 4 Radio\n# 5 Radio\n# 6 Radio\n\ndf2\n# CustomerId State\n# 2 Alabama\n# 4 Alabama\n# 6 Ohio\n\n\nThe question is how can I do the following sql query in R:\n\nSELECT * FROM df1 JOIN df2 on df1.CustomerId <= df2.CustomerId\n\n\nWhat I have known is that I can do the inner join using merge(df1, df2, by = \"CustomerId\"). But it is not satisfied the condition of the join." ]
[ "sql", "r", "merge", "inner-join" ]
[ "C++ Adding objects that have constructors to an array", "When I declare a an array, all the variables/objects get declared. But what happens with the objects, if their class has constructors? The class I'm using has 2 constructors - one with no arguments and one with a few arguments. Will the first constructor activate after the declaration? Or no constructors will activate?\n\nIf the first case happens, I'll have to make a function that replaces the constructors.\n\nSo, what happens with the objects in a newly declared array?" ]
[ "c++", "arrays", "object" ]
[ "The Big Facebook Share Buttons", "I'm wondering how I can implement the big facebook share buttons that I see around. Is there a tutorial somewhere, or perhaps a wordpress plugin? Thats what I'm using.\n\nHere is an example of what I'm talking about:\n\nNormal\n\n\n\nHover state" ]
[ "css", "twitter-bootstrap", "facebook-like" ]
[ "Using pre built static libraries android", "I am using freeimage.so for my android project,How can I refer this library from the C code?Or is it needed to access the functions in this library?\nFurther info:I have put the function in armeabi folder in the project\nKindly provide me with your valuable suggestions\nThank you in advance for your valuable efforts" ]
[ "android", "c++", "c", "android-ndk", "shared-libraries" ]
[ "Location changes immediately from certain location to my current location in Skobbler map", "I am new in Skobbler map. In my Skobbler map, I am getting my current location in onCurrentPositionUpdate method. \n\nSKCoordinateRegion region = new SKCoordinateRegion();\n region.setCenter(currentPosition.getCoordinate());\n region.setZoomLevel(13);\n mapView.changeMapVisibleRegion(region, true);\n\n\nSo, it shows my current location.\n\n\n\nWhen i move some distance from my current location by dragging the map like this:\n\n\n\nBut, after few 4 or 5 seconds later, it returns back to my current location immediately. What can be done to stop that movement because i want to return to my current location after pressing the button only. In my button, i use:\n\n @OnClick(R.id.fab_gps)\n public void goToMyGpsLocation(View view) {\n if (mapView != null && currentPosition != null) {\n mapView.getMapSettings().setCurrentPositionShown(true);\n } else{\n if(Helper.isGPSEnabled(this)){\n requestCurrentPositionProvider();\n }else{\n Helper.alertbox(\"GPS not enabled\", \"Please enable gps before you are directed to your current location\", this);\n }\n }\n }\n\n\nIn my requestCurrentPositionProvider method:\n\npublic void requestCurrentPositionProvider(){\n\n\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n Permissions.requestPermission(this, LOCATION_PERMISSION_REQUEST_CODE,\n Manifest.permission.ACCESS_FINE_LOCATION, true);\n } else{\n if(mapView != null) {\n mapView.getMapSettings().setCurrentPositionShown(true);\n\n }\n if(Helper.isGPSEnabled(this)){\n showSnackBar(findViewById(android.R.id.content));\n\n currentPositionProvider = new SKCurrentPositionProvider(this);\n currentPositionProvider.setCurrentPositionListener(this);\n currentPositionProvider.requestLocationUpdates(MapUtils.hasGpsModule(this), MapUtils.hasNetworkModule(this), false);\n\n }\n\n else {\n Helper.alertbox(\"GPS not enabled\", \"Please enable gps before you are directed to your current location\", this);\n }\n\n\nSomething like Camera movement changes so rapid. How do i stop that? What can done on onClick method, so that i return my current location after pressing button only?" ]
[ "android", "skmaps", "skobbler-maps" ]
[ "AVAudioPlayer throws breakpoint in debug mode", "Every time I load the app it stops as if I had set a breakpoint on this line:\n\nself.audioPlayer = \n [[[AVAudioPlayer alloc] initWithData:[dataPersister loadData:self.fileName] \n error:&outError] autorelease];\n\n\nThere's no breakpoint above or any place near this line. It only happens when I run the app in debug mode and nothing crashes after the breakpoint. The app works as nothing happened when I click \"Continue program execution\".\n\nThis is the loadData method, which is called with initWithData:\n\n-(NSData*)loadData:(NSString*)fileName\n{\n NSString *dataPath = [self.path stringByAppendingPathComponent:fileName];\n dataPath = [dataPath stringByStandardizingPath];\n NSData *data = [[[NSData alloc] initWithContentsOfFile:dataPath]autorelease ];\n return data;\n}\n\n\nThe loadData function seems to be working fine. The requested mp3 file is loaded and played without any problems after the breakpoint.\n\nDo you have any idea what I'm doing wrong?\n\nEDIT:\nI ran a backtrace when it stops at the breakpoint. This was the output:\n\n\n(lldb) bt\n* thread #1: tid = 0x1c03, 0x30df1724 libc++abi.dylib`__cxa_throw, stop reason = breakpoint 1.2\n frame #0: 0x30df1724 libc++abi.dylib`__cxa_throw\n frame #1: 0x36403a24 AudioToolbox`ID3ParserHandle::ID3ParserHandle(void*, long (*)(void*, unsigned long, unsigned long, unsigned long, void**, unsigned long*)) + 452\n frame #2: 0x36403b0e AudioToolbox`ID3ParserOpen + 142\n frame #3: 0x3635bd16 AudioToolbox`MPEGAudioFile::ParseID3Tags() + 58\n frame #4: 0x3635b9aa AudioToolbox`MPEGAudioFile::ParseAudioFile() + 26\n frame #5: 0x3631723e AudioToolbox`AudioFileObject::DoOpenWithCallbacks(void*, long (*)(void*, long long, unsigned long, void*, unsigned long*), long (*)(void*, long long, unsigned long, void const*, unsigned long*), long long (*)(void*), long (*)(void*, long long)) + 166\n frame #6: 0x36316480 AudioToolbox`AudioFileOpenWithCallbacks + 612\n frame #7: 0x31f4c1ec AVFoundation`-[AVAudioPlayer initWithData:error:] + 120\n\n\n\"SOLUTION\": It turns out, if I disable exception breakpoint for all exceptions and only use breakpoint for Objective-C exceptions the problem disappears. But it doesn't solve the problem that the allocation of AVAudioPlayer throws a C++ exception." ]
[ "ios", "objective-c", "iphone", "cocoa-touch", "avaudioplayer" ]
[ "What wrong with my C code? Is it a compiler bug in CodeBlock 16.01?", "I am using Code::Block 16.01, the current version, that come with compiler. The problem is when I change xMax to 1.2, the result does not change. It produce the same result as xMax=1.1. Did I do something wrong with my C code? Or is this a compiler problem? Here is my MWE:\n\n#include<stdio.h>\nint main()\n{\n double xMin=1.0;\n double xMax=1.1;\n double x=xMin;\n double h=0.1;\n while(x <= xMax)\n {\n printf(\"x=%f\\n\",x);\n x=x+h;\n }\n return 0;\n}" ]
[ "c", "while-loop", "codeblocks" ]
[ "Extended Stats elasticsearch Standard Deviation population or sample?", "Is the elasticsearch extended stats standard deviation calculated as the sample standard deviation or the population standard deviation?" ]
[ "java", "elasticsearch", "statistics" ]
[ "How to add array of objects to apollo client mutation request?", "I am building a nativescript mobile application which consume graphql API, and I am using apollo client via apollo boost.\n\nThe problem appear when I am trying to send array of objects inside the mutation like below: \n\nlet {\n to,\n total,\n drugList\n} = order\n\napolloClient.mutate({\n mutation: gql `mutation {\n makeOrder(\n to: \"${to}\",\n total: ${total},\n drugList: ${drugList}\n ){\n id\n }\n }`\n}).then((res) => {\n console.log(res)\n}).catch((error) => {\n console.log(error)\n})\n\n\nI have tried to log the drugList inside a template literals like: \n\nconsole.log(`${drugList}`)\n\n\nBut I got [object object],[object object] then I have tried to use ${[...drugList]} instead and I got the desired structure of array of objects but the mutate function of apollo client doesn't accept it (doesn't execute the mutation or log an error).\n\nAm I miss something to make it run or are there any recommendation to run it?" ]
[ "javascript", "graphql", "apollo-client" ]
[ "Getting the index of a failed Task after calling TTask.WaitForAny", "Consider the following example:\n\n t1 := TTask.Run(\n procedure\n begin\n sleep(Random(1000) + 100);\n raise Exception.Create('Error Message 1');\n end\n );\n\n t2 := TTask.Run(\n procedure\n begin\n sleep(Random(1000) + 100);\n raise Exception.Create('Error Message 2');\n end\n );\n\n res := -1;\n try\n res:= TTask.WaitForAny([t1, t2]);\n except\n end;\n\n write('Index: ' + intToStr(res)); // Prints \"-1\"\n readln;\n\n\nWhen one of the tasks fails WaitForAny throws an exception and the res variable is not assigned the index of the completed task. Instead it contains \"-1\" (assigned earlier).\n\nIn C# (TPL) Task.WaitAny also throws an exception, but it returns the index of the failed task.\n\nIs there a way to get the RES variable assigned or get the index of the failed task?" ]
[ "multithreading", "delphi" ]
[ "TwentyTwenty no height after being hidden and then shown by a click", "I have Foundation TwentyTwenty on my page but on first load, this content is hidden. After a button is clicked, it will be visible but occasionally, TwentyTwenty container doesn't have any height. \n\nFireFox seems fine but chrome and IE doesn't have a height. On my computer right now, and I'm using IE 11 on Widows 7, IE works. Chrome doesn't. On other Windows 7 computers, IE and chrome doesn't work even with the latest versions. \n\nHere's the link to the site. Click on read all to view the TwentTwenty slider.\n\n<script type=\"text/javascript\">\n$(document).ready(function() {\n $(\"#container1\").twentytwenty();\n // hide here after twentytwenty load in this div.\n $(\"#yalecontent\").hide(\"fast\");\n\n $(\".openthis\").click(function() {\n $(\"#yalecontent\").show(\"slow\");\n });\n});\n</script>" ]
[ "javascript", "jquery", "html", "css", "google-chrome" ]
[ "Find by where NOT current row", "I am developing a small cms and I am using spring data jpa to do my database stuff.\n\nWhen I add a new page, I want to make sure the slug doesn't already exist, for that purpose I added a method to my repository:\n\npublic interface PageRepository extends JpaRepository<Page, Integer> {\n\n Page findBySlug(String slug);\n\n}\n\n\nThat works fine when adding.\n\nHowever when editing a page, I want to check that the slug doesn't already exist but NOT for the current page, how can I do that? I guess I could somehow pass the current row id or something like that, but how would I do that?" ]
[ "java", "spring-boot", "spring-data-jpa" ]
[ "How to remove a duplicate title tag and meta description tag with canonical link", "I have run SEO tool for my website, it showed that I have a duplicate title tag and meta description tag, both are in \"domain.com/\" and \"/index.html\" , they are the same file. How do I use Canonical Link to remove the duplicate tags ? Please help. Thanks." ]
[ "seo", "canonical-link" ]
[ "Any way to get the sender phone number from a received sms on Iphone?", "I realize the ios sandbox prevents you from viewing the contents of an SMS msg, but is there some kind of workaround? What about if the msgs are sent to a skype or google voice number, could an iphone application access the numbers then? Thanks." ]
[ "iphone", "ios" ]
[ "I need a data grid which should perform server side paging, sorting and filtering and editing?", "I am working in angularjs, I need a grid which should perform server side paging, sorting and filtering and editing, currently I am using angular ui-grid, but lately I have realized that I am not using any features that Ui-grid is providing, as I have applied sorting paging and filtering externally, Can someone suggest me what should be my approach." ]
[ "angular-ui-grid" ]
[ "SSIS Version100 database compatibility level is not supported Error", "I'm using BIDS that came with SQL Server 2008 R2 (Visual Studio 2008) to design an SSIS package to transfer objects from a SQL Server 2008 R2 Server to another SQL Server using the Transfer SQL Server Objects Task. \n\nThe source database has compatibility level 2008 (100). The destination is SQL Server 2012 with a 2008 compatible database. When I execute the component though I get the error message: \n\n\n SSIS package \"Package.dtsx\" starting. Information: 0x4002F418 at\n Transfer SQL Server Objects Task, Transfer SQL Server Objects Task:\n There are no Logins to transfer. Information: 0x4002F41D at Transfer\n SQL Server Objects Task, Transfer SQL Server Objects Task: There are\n no Users to transfer. Error: 0xC002F325 at Transfer SQL Server Objects\n Task, Transfer SQL Server Objects Task: Execution failed with the\n following error: \"Version100 database compatibility level is not\n supported.\".\n\n\nI've checked the assembly version of the Transfer SQL Server Objects Task and it is Version 10. Why am I getting this error message?" ]
[ "sql-server-2008", "ssis" ]
[ "How to average two masks?", "I have two boolean masks that I got from the object detection for two video frames i and i+1. Now I want to \"avarage\" them to remove noise. Masks are closed convex curves. So basically I want to find the middle line between them. How can I do this?\n\nHere is an example:\n\n\nLet's say that we have two maks red and blue for two successive frames, after filtering we need to get something like the green line that is between two contours." ]
[ "opencv", "image-processing", "scipy", "computer-vision", "filtering" ]
[ "What is the preferred way to validate data in an AngularJS app?", "I've heard of a couple of different approaches to providing the validation specs to an Angular UI. \n\nOne is to build it in on the UI side with a configuration file specifying such things as field length, which fields are required, and valid selections as examples of items to be validated.\n\nAnother approach is to have the UI query a service on the backend to provide these validations by pulling them out of a database. There is a logical grouping of validations, so the service would specify the group ID and the validations would be returned.\n\nI can see advantages to both, but the database side may start to feel like a UI framework instead of just a set of validations. You still need to specify the endpoints for CRUD operations, but putting that in the backend would make the whole thing pretty heavy.\n\nThanks" ]
[ "angularjs", "validation" ]
[ "thrust::system::system_error in transform_reduce", "I am running a monte carlo simulation using Thrust on an Nvidia card with 2.1 compute capability. If I try to transform_reduce the whole device_vector at once, I get the following error. Its not a matter of using up the memory on device because the vectors are that big (~1-10mb). I know my code is right because it works if I compile with openmp and run on the host only. What can be causing this problem? \n\nUnhandled exception at 0x776e15de in mccva.exe: Microsoft C++ exception: thrust::system::system_error at memory location 0x0014cb28.\n\nBut if I do the transform_reduce in chunks it works fine until I scale the number of timesteps in the simulation which it then gives the same error.\n\n//run the Monte Carlo simulation\nzpath * norm_ptr = thrust::raw_pointer_cast(&z[0]);\ncout << \"initialized raw pointer\" << endl;\nthrust::device_vector<ctrparty> devctrp = ctrp;\nassert(devctrp.size()==ctrp.size());\ncout << \"Initialized device vector\" << endl;\ncout << \"copied host vec to device vec\" << endl;\n\nfloat cva = 0;\nfor(unsigned int i=0; i<5; i++)\n{\n if(i<4)\n cva += (1-R) * thrust::transform_reduce(devctrp.begin()+i*2000, devctrp.begin() + (i+1)*2000 - 1, calc(norm_ptr, dt, r, sims, N), 0.0f, sum());\n else\n cva += (1-R) * thrust::transform_reduce(devctrp.begin()+i*2000, devctrp.begin() + (i+1)*2000, calc(norm_ptr, dt, r, sims, N), 0.0f, sum());\n} \n\n\nI get the error when I try this:\n\nfloat cva = 0.0f;\ntry\n{\n cva = thrust::transform_reduce(devctrp.begin(), devctrp.end(), calc(norm_ptr, dt, r, sims, N), 0.0f, sum()); //get the simulated CVA\n}\ncatch(thrust::system_error e)\n{\n printf(e.what());\n}\n\n\nI'm using VS2010 and when it breaks at the errors it points to the following in the dbgheap.c file.\n\n__finally {\n /* unlock the heap\n */\n _munlock(_HEAP_LOCK);\n}" ]
[ "c++", "cuda", "thrust" ]
[ "Display servlet as img src using session attribute", "I have a servlet which is used to display image.This servlet actually called by the \n\n<img src=\"/displaySessionImage?widgetName=something\"/>\n\n\nMy get & post redirect to this method,\n\nprotected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\n HttpSession session = request.getSession();\n String widgetName = request.getParameter(\"widgetName\"); \n\n try {\n //this is my file manager which was store ealier\n StorageFile file = (StorageFile)session.getAttribute(widgetName); \n response.setContentType(file.getContentType()); \n\n //the file manager can retrieve input stream\n InputStream in = file.getInputStream();\n OutputStream outImage = response.getOutputStream();\n\n byte[] buf = new byte[1024];\n int count = 0;\n while ((count = in.read(buf)) >= 0) {\n outImage.write(buf, 0, count);\n }\n\n\n } catch (Exception e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n\n\nBut this code does not work, the image could not be display. I think this will not work because i have store the file manager that contain the input stream in a session. This same method work for another image file that was retrieved from database and not stored in the session. i have actually print out the input stream. it contain the same input stream as the database file.\n\nIs it something wrong with the code? \nor i actually cannot store the file manager that contain the input stream in a session?\nor is it that i used input stream in a wrong way?" ]
[ "java", "jsp", "servlets" ]
[ "Setting queue name in pig v0.15", "I am getting below exception while trying to execute pig script via shell.\n\nJobId Alias Feature Message Outputs\njob_1520637789949_340250 A,B,D,top_rec GROUP_BY Message: java.io.IOException: org.apache.hadoop.yarn.exceptions.YarnException: Failed to submit application_1520637789949_340250 to YARN : Application rejected by queue placement policy\n\n\nI understand that it is due to not setting the correct queue name for MR execution. In order to find that how to set a queuename for mapreduce job, I tried searching thorough help, pig --help, it listed below options\n\nApache Pig version 0.15.0-mapr-1611 (rexported)\ncompiled Dec 06 2016, 05:50:07\n\nUSAGE: Pig [options] [-] : Run interactively in grunt shell.\n Pig [options] -e[xecute] cmd [cmd ...] : Run cmd(s).\n Pig [options] [-f[ile]] file : Run cmds found in file.\n options include:\n -4, -log4jconf - Log4j configuration file, overrides log conf\n -b, -brief - Brief logging (no timestamps)\n -c, -check - Syntax check\n -d, -debug - Debug level, INFO is default\n -e, -execute - Commands to execute (within quotes)\n -f, -file - Path to the script to execute\n -g, -embedded - ScriptEngine classname or keyword for the ScriptEngine\n -h, -help - Display this message. You can specify topic to get help for that topic.\n properties is the only topic currently supported: -h properties.\n -i, -version - Display version information\n -l, -logfile - Path to client side log file; default is current working directory.\n -m, -param_file - Path to the parameter file\n -p, -param - Key value pair of the form param=val\n -r, -dryrun - Produces script with substituted parameters. Script is not executed.\n -t, -optimizer_off - Turn optimizations off. The following values are supported:\n ConstantCalculator - Calculate constants at compile time\n SplitFilter - Split filter conditions\n PushUpFilter - Filter as early as possible\n MergeFilter - Merge filter conditions\n PushDownForeachFlatten - Join or explode as late as possible\n LimitOptimizer - Limit as early as possible\n ColumnMapKeyPrune - Remove unused data\n AddForEach - Add ForEach to remove unneeded columns\n MergeForEach - Merge adjacent ForEach\n GroupByConstParallelSetter - Force parallel 1 for \"group all\" statement\n PartitionFilterOptimizer - Pushdown partition filter conditions to loader implementing LoadMetaData\n PredicatePushdownOptimizer - Pushdown filter predicates to loader implementing LoadPredicatePushDown\n All - Disable all optimizations\n All optimizations listed here are enabled by default. Optimization values are case insensitive.\n -v, -verbose - Print all error messages to screen\n -w, -warning - Turn warning logging on; also turns warning aggregation off\n -x, -exectype - Set execution mode: local|mapreduce|tez, default is mapreduce.\n -F, -stop_on_failure - Aborts execution on the first failed job; default is off\n -M, -no_multiquery - Turn multiquery optimization off; default is on\n -N, -no_fetch - Turn fetch optimization off; default is on\n -P, -propertyFile - Path to property file\n -printCmdDebug - Overrides anything else and prints the actual command used to run Pig, including\n any environment variables that are set by the pig command.\n18/03/30 13:03:05 INFO pig.Main: Pig script completed in 163 milliseconds (163 ms)\n\n\nI tried pig -p mapreduce.job.queuename=my_queue; and was able to login into grunt without any error.\n\nHowever, on the first command itself, it threw below\n\nERROR 2997: Encountered IOException. org.apache.pig.tools.parameters.ParseException: Encountered \" <OTHER> \".job.queuename=my_queue \"\" at line 1, column 10.\nWas expecting:\n \"=\" ...\n\n\nI am not sure, if I am doing it right?" ]
[ "hadoop", "mapreduce", "bigdata", "apache-pig", "mapr" ]
[ "Dynamically add reactive plots to web page using shiny", "I am trying to do something very similar to what is explained here\ndynamically add plots to web page using shiny.\n\nHowever I need the equivalent call to the plot function inside renderPlot (server.r:line 28) to be reactive, to be called only when input changes. In my setup I have a list with the function names that I need to call.\n\nI have provided a sample code of want I mean and the attempt of using the reactive callback.\n\nfor (i in 1:length(plot_list)) {\n local({\n my_i <- i\n plotname <- paste(\"plot_fn_name\", my_i, sep=\"\")\n output[[plotname]] <- renderPlot({\n args <- list(input$arg1, input$arg2, input$arg3)\n fn <- reactive({plot_list[[my_i]](args)})\n #p <- do.call(fn, args)\n p <- fn()\n print(p)\n })\n })\n}\n\n\nAny thougts on how to achieve this?\nThanks." ]
[ "r", "shiny" ]
[ "Error: Could not find or load main class hello in Windows 7", "i am a new java student \ni am running a hello world program in command prompt but i am getting a error \n\n class hello{\n\npublic static void main(String agrs[]){\n system.out.println(\"Hello world\");\n}\n\n}\n\n\nthis is my hello world program\n\nG:\\java>javac hello.java\n\n\n\n G:\\java>dir\n Volume in drive G has no label.\n Volume Serial Number is 32DF-BA6B\n\n Directory of G:\\java\n\n14-Sep-13 04:36 PM <DIR> .\n14-Sep-13 04:36 PM <DIR> ..\n14-Sep-13 04:36 PM 415 hello.class\n14-Sep-13 04:35 PM 100 hello.java\n 2 File(s) 515 bytes\n 2 Dir(s) 55,645,966,336 bytes free\nG:\\java>java hello\nError: Could not find or load main class hello\n\n\nmy java path is right \n\nG:\\java>path\nPATH=G:\\Windows\\system32;G:\\Windows;G:\\Windows\\System32\\Wbem;G:\\Windows\\System32\n\\WindowsPowerShell\\v1.0\\;G:\\Program Files\\Java\\jdk1.7.0_25\\bin\n\n\nbut when is use this command then program run .\n\nG:\\java>java -classpath . hello\nHello world\n\n\ni want to ask that why is my program not run normally is any problem in my path setting variable ? i want to run my program normally as \n\nG:\\java>java hello" ]
[ "java" ]
[ "Using ajax response as the function's argument", "I'm trying to use the ajax response as an argument for the function drawing the chart with google charts.\n\nThis is the JS code:\n\ndata.addRows([['One', 5], ['Two', 2]]);\n\n\nAs you can see, the argument contains a couple of square brackets with the \"chart's unit\" name and its value. Everything works. However when I pass ajax responseText as the argument, it doesn't work at all.\n\ndata.addRows(xmlhttp.responseText);\n\n\nThe PHP code returns json_encode($value), where the $value variable is this string:\n[[one, 5], [two, 2]]\n\nSo as the result I get:\n\n\"[['one', 5], ['two', 2]]\"\n\n\nBTW. I also tried removing double quotes from the string in the JS code - still no results.\n\nWhat's wrong? The firebug gives me some strange errors: Argument given to addRows must be either a number or an array...\n\nHow should I fix this?" ]
[ "php", "javascript", "ajax", "google-visualization" ]
[ "ReferenceError: todoItem is not defined Backbone + CoffeeScript", "I'm trying to use backbone with coffeescript instead javascript:\n\nTodoItem = Backbone.Model.extend(\n toggleStatus: ->\n if @.get 'status' is \"incomplete\"\n @.set 'status': 'complete' \n else\n @.set 'status': 'incomplete'\n @.save() \n )\n\ntodoItem = new TodoItem(\n description: 'I play the guitar'\n status: 'incomplete'\n id: 1\n)\n\nTodoView = Backbone.View.extend(\n tagName: 'div'\n id: \"box\"\n className: 'red-box'\n\n events: \n \"click h3\": \"alertStatus\"\n 'change input': 'toggleStatus'\n\n template: \n _.template \"<h3> <input type=checkbox #{ print \"checked\" if status is \"complete\"} /> <%= description %></h3>\"\n\n initialize: ->\n @.model.on 'change', @.render, @\n @.model.on 'destroy', @.remove, @\n\n toggleStatus: ->\n @.model.toggleStatus()\n\n alertStatus: ->\n alert('Hey you clicked the h3!')\n\n remove: ->\n @.$el.remove()\n\n render: ->\n @.$el.html @.template(@.model.toJSON())\n)\n\ntodoView = new TodoView({model: todoItem})\ntodoView.render()\nconsole.log todoView.el\n\n\nIf I try in console:\n\ntodoItem.set({description: 'asdfadfasdfa'});\n\n\nI get:\n\nReferenceError: todoItem is not defined\n\n\nAlso, I can't see inside of my body the div:\n\n<div id=\"box\" class=\"red-box\">\n <h3>\n <input type=\"checkbox\" undefined>\n \"I play the guitar\"\n </h3>\n </div>\n\n\nBut I can see this div in my console fine.\n\nWhere is it the error?\n\nThank you!" ]
[ "javascript", "jquery", "backbone.js", "coffeescript", "underscore.js" ]
[ "VSCode Remote Container - extensions not installing on dev container using docker-compose", "I am having trouble getting extensions installed in the dev container using \"Remote - Containers\". I do not know if it's a bug, incorrect configuration on my end, or intended behaviour. Down below is my current configuration, both files are located in the root folder of the project.\n\ndocker-compose.yml\n\nversion: \"3.7\"\n\nservices:\n api:\n image: node:12\n restart: always\n ports:\n - ${API_PORT}:3000\n volumes:\n - .:/usr/app\n - /usr/app/node_modules\n working_dir: /usr/app\n command: bash -c \"yarn && yarn dev\"\n\n\n.devcontainer.json\n\n{\n \"dockerComposeFile\": \"docker-compose.yml\",\n \"service\": \"api\",\n \"workspaceFolder\": \"/usr/app\",\n \"extensions\": [\n \"eamodio.gitlens\",\n \"formulahendry.auto-rename-tag\",\n \"coenraads.bracket-pair-colorizer-2\",\n \"kumar-harsh.graphql-for-vscode\",\n \"esbenp.prettier-vscode\",\n \"ms-vscode.vscode-typescript-tslint-plugin\",\n \"visualstudioexptteam.vscodeintellicode\"\n ]\n}\n\n\nThe list of extensions listed in the .devontainer.json are the ones I want to have installed in the dev container. Any help is appreciated!" ]
[ "docker", "visual-studio-code", "vscode-remote" ]
[ "How to attach EventTrigger in code behind in Silverlight 4", "My question is the following:\n\nI have a grid and I attached the SelectedIndexChanged event the following way in the xaml file:\n\n\"<cc:DetailViewGrid AutoGenerateColumns=\"False\" HorizontalAlignment=\"Stretch\" Margin=\"0,0,0,0\" Name=\"dgAcitivityList\" VerticalAlignment=\"Stretch\" ItemsSource=\"{Binding EntityList}\" SelectionMode=\"Single\" IsReadOnly=\"False\">\n <interactivity:Interaction.Triggers>\n <interactivity:EventTrigger EventName=\"SelectionChanged\">\n <interactivity:InvokeCommandAction Command=\"{Binding SelectedItemChangeCommand}\" CommandParameter=\"{Binding SelectedItem, ElementName=dgAcitivityList}\"/>\n </interactivity:EventTrigger>\n </interactivity:Interaction.Triggers>\"\n\n\nBut I want to attach this event in code behind. I ctreated an own grid that is inherited from windows grid, and I put this code to own control.\n\n public override void OnApplyTemplate()\n {\n //base.OnApplyTemplate();\n\n System.Windows.Interactivity.EventTrigger selectedItemChangedTrigger = new System.Windows.Interactivity.EventTrigger(\"SelectionChanged\");\n\n System.Windows.Interactivity.InvokeCommandAction action = new System.Windows.Interactivity.InvokeCommandAction();\n\n action.CommandName = \"{Binding SelectedItemChangeCommand}\";\n\n action.CommandParameter = string.Format(\"{{Binding SelectedItem, ElementName={0}}}\", this.Name);\n\n selectedItemChangedTrigger.Actions.Add(action);\n\n System.Windows.Interactivity.Interaction.GetTriggers(this).Add(selectedItemChangedTrigger);\n\n base.OnApplyTemplate();\n }\n\n\nIs this solution proper? It's not working but I'm not sure that I should put this code in the OnApplyTemplate() method." ]
[ "silverlight-4.0" ]