texts
list
tags
list
[ "Display logfile before committing transaction. Only commit if user confirms", "When I update records in the data I want to show the user the update log BEFORE the transaction is committed and give the option to continue or roll back.\n\nThe code that commits the updates to the database follows this format:-\n\n<?php\ninclude 'submitLogger.php';\n\n// Begin logging\nini_set( \"error_log\", $logFile );\nini_set( \"log_errors\", \"On\" );\nini_set( \"display_errors\", \"Off\" );\nerror_log( \"Log file '\" . $logFile . \"' created\" );\n\n// Open the database\n.\n.\n\nerror_log( \"Connect OK\" );\n.\n.\n\nerror_log( \"Transaction started (autocommit OFF)\\n\" ); \n.\n.\n\nerror_log( \"Processing \" . count( $deletes ) . \" item(s) marked for deletion...\" ); \n.\n.\n\n\n// commit changes\nerror_log( \"Committing changes...\" ); \nif ( mysqli_commit( $link ) === false ) {\n mysqli_rollback( $link );\n error_log( \"Commit failed. Transaction rolled back.\" ); \n $response['error'] = \"Could not commit changes. Transaction rolled back.\";\n} else {\n error_log( \"Commit successful!\" ); \n $response['success'] = \"Success!\";\n}\n\n// close DB connection\n.\n.\n\n// Return result\n.\n.\n\n\nThis is the code that loads the update code above and then displays the logfile, but AFTER the transaction has been committed:-\n\n<script type=\"text/javascript\">\n\n$(document).ready( function() {\n\n\n // send AJAX request to perform the updates and begin logging\n $.post(\n '../lib/updateMenu.php', \n sendData,\n function( response ) {\n // was it successful?\n if ( typeof response.success === 'undefined' ) {\n // no - show alert\n if ( response.error ) {\n alert( response.error );\n }\n console.error( \"Amend not successful\" );\n console.error( response );\n return;\n }\n\n // delete the AmendmenuAmendselected program window to force a reload on next click\n $( \"#programWindowAmendmenuAmendselected\" ).remove();\n },\n \"json\"\n ).error(function(jqXHR, textStatus, errorThrown) {\n alert( 'Unexpected error: ' + textStatus + ' ' + errorThrown );\n console.error( 'Unexpected error during amend: ' + textStatus + ' ' + errorThrown );\n console.error(jqXHR);\n }).complete(function() {\n // once a reply is received, stop the logging\n ajaxLogtail.stopTail(); \n });\n\n // begin querying log file\n var ajaxLogtail = new AjaxLogtail( '../lib/ajaxLogtail.php?logfile=' + logFile, \"programWindowAmendmenuSubmit\" ); \n ajaxLogtail.startTail();\n});\n\n</script>\n\n\nI cannot figure out how to split this so that I can display the logfile and then, if there weren't any update errors, commit the transaction.\n\nDoes anyone have a neat idea to help, please?" ]
[ "php", "jquery", "logging", "transactions", "commit" ]
[ "Get coordinates in specific country only by post code. JAVASCRIPT", "I am trying to get location coordinates only by post code in specific country. I am using maps javascript api. Sometimes I receive expected results, but sometimes it does not find the location, coordinates that I was looking for. My code:\n const geocoder = new google.maps.Geocoder();\n geocoder.geocode({\n componentRestrictions: {\n country: "CY",\n postalCode: zipcode,\n }\n },\n function(results, status){\n var latitude= '';\n var longitude = '';\n console.log(results, status);\n if (status == google.maps.GeocoderStatus.OK) {\n latitude = results[0].geometry.location.lat();\n longitude = results[0].geometry.location.lng();\n console.log([latitude, longitude]);\n }\n });\n\nAny ideas?" ]
[ "javascript", "google-maps", "maps" ]
[ "Rails 3: rollback for after_create", "I have an enrollment form. \n\nWhen the user enrolls, the app is supposed to save the data in the enrollments table and in the users table. (I need this separation because the user's profile can change but the data he entered for that particular enrollment has to be archived. So even if later the user changes his last name, in the enrollment form I'll have his initial information.)\n\nSo I was thinking about saving data in the enrollments table then have a after_create call, like this...\n\nclass Enrollment < ActiveRecord::Base\n\n after_create :save_corresponding_user\n\n def save_corresponding_user\n user = User.new\n user.full_name = self.user_full_name\n user.email = self.user_email\n user.mobile_phone = self.user_mobile_phone\n user.save\n end\nend\n\n\nThe issue is, what if saving the user fails for any reason. How can I rollback and destroy the just saved data from the enrollments table?" ]
[ "ruby-on-rails", "ruby" ]
[ "sql query result with count istruction", "I can't understand because this SQL query doesn't work:\n\nSELECT COUNT Department, \n IF(Department = 'toys', COUNT(*), 0) AS nt, \n IF(Department = 'health', COUNT(*), 0) AS nh\nFROM TABLE;\n\n\nTABLE\n\nDepartment Value\ntoys A\ntoys B\ntoys C\nhealth K\nhealth F\ntoys G\ntoys R\ntoys W\ntoys Q\n\n\nI'd like to count number of occurrences about both toys record and health ones into 2 columns.\n\ndepartment nt nh\ntoys 7 0\nhealth 0 2\n\n\nWHY ?!\n\nthanks" ]
[ "mysql" ]
[ "how to implement progress bar in php while loop", "I save the image quality to the individual image to the database, then i want to show the image with progress bar value together. I wrote the script but i takes the first image progress bar value.\n\nFirst half I take the progress bar value from database..\n\nSecond half I fetch image together with progress bar value\n\n\r\n\r\n<?php\r\n$targetid = $_REQUEST['id'];\r\n$conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_DATABASE);\r\nif ($conn->connect_error) {\r\n die(\"Connection failed: \" . $conn->connect_error);\r\n}\r\n$conn->autocommit(FALSE); \r\n$query = \" SELECT * FROM others \" ;\r\n$result1 = $conn->query($query);\r\n\r\nif($result1->num_rows >0) {\r\n while($rowquerycat = $result1->fetch_assoc()) {\r\n $imgqulty = $rowquerycat['imagefeature'];\r\n //echo $imgqulty;\r\n?> \r\n<!---progress-->\r\n<script>\r\n $( function() {\r\n $( \"#progressbar\" ).progressbar({\r\n value: '<?php echo $imgqulty; ?>'\r\n });\r\n });\r\n</script>\r\n<!---end--->\r\n<?php\r\n }\r\n}\r\n$query = \" SELECT * FROM \" . TB_OTHERS ;\r\n$result1 = $conn->query($query);\r\n\r\nif($result1->num_rows >0) {\r\n while($rowquerycat = $result1->fetch_assoc()) {\r\n?> \r\n <div id=\"progressbar\" style=\"height: 0.5em;width: 50%;margin-left: 30%;\" >sample</div>\r\n<?php\r\n }\r\n}\r\n?>" ]
[ "javascript", "jquery" ]
[ "Consistent DNS between Kubernetes and docker-compose", "As far as I'm concerned, this is more of a development question than a server question, but it lies very much on the boundary of the two, so feel free to migrate to serverfault.com if that's the consensus).\n\nI have a service, let's call it web, and it is declared in a docker-compose.yml file as follows:\n\n web:\n image: webimage\n command: run start\n build:\n context: ./web\n dockerfile: Dockerfile\n\n\nIn front of this, I have a reverse-proxy server running Apache Traffic Server. There is a simple mapping rule in the url remapping config file\n\nmap / http://web/\n\n\nSo all incoming requests are mapped onto the web service described above. This works just peachily in docker-compose, however when I move the service to kubernetes with the following service description:\n\napiVersion: v1\nkind: Service\nmetadata:\n labels:\n io.kompose.service: web\n name: web\nspec:\n clusterIP: None\n ports:\n - name: headless\n port: 55555\n targetPort: 0\n selector:\n io.kompose.service: web\nstatus:\n loadBalancer: {}\n\n\n...traffic server complains because it cannot resolve the DNS name web.\n\nI can resolve this by slightly changing the DNS behaviour of traffic server with the following config change:\n\nCONFIG proxy.config.dns.search_default_domains INT 1\n\n\n(see https://docs.trafficserver.apache.org/en/7.1.x/admin-guide/files/records.config.en.html#dns)\n\nThis config change is described as follows:\n\n\n Traffic Server can attempt to resolve unqualified hostnames by expanding to the local domain. For example if a client makes a request to an unqualified host (e.g. host_x) and the Traffic Server local domain is y.com, then Traffic Server will expand the hostname to host_x.y.com.\n\n\nNow everything works just great in kubernetes.\n\nHowever, when running in docker-compose, traffic-server complains about not being able to resolve web.\n\nSo, I can get things working on both platforms, but this requires config changes to do so. I could fire a start-up script for traffic-server to establish if we're running in kube or docker and write the config line above depending on where we are running, but ideally, I'd like the DNS to be consistent across platforms. My understanding of DNS (and in particular, DNS default domains/ local domains) is patchy.\n\nAny pointers? Ideally, a local domain for docker-compose seems like the way to go here." ]
[ "docker", "dns", "kubernetes", "docker-compose", "apache-traffic-server" ]
[ "Override Android Back Button", "A little info as to why I am attempting to do this: I am using ActivityGroups to open an activity from a tabHost activity and have that new activity stay under the tabs. That part i've got. But when in that new activity, if I use the back button it takes me right out of the tabs activity so I have to click a few times to get back to where I was. \n\nIs there a way to set the back button to go to a specific activity rather than killing the current activity window?" ]
[ "android", "android-activity", "back" ]
[ "PHP: split string based on array", "Below is that data I'm trying to parse:\n\n50‐59 1High300.00 Avg300.00\n90‐99 11High222.00 Avg188.73\n120‐1293High204.00 Avg169.33\n\n\nThe first section is a weight range, next is a count, followed by Highprice, ending with Avgprice.\n\nAs an example, I need to parse the data above into an array which would look like\n\n[0]50-59\n[1]1\n[2]High300.00\n[3]Avg300.00\n\n[0]90-99\n[1]11\n[2]High222.00\n[3]Avg188.73\n\n[0]120‐129\n[1]3\n[2]High204.00\n[3]Avg169.33\n\n\nI thought about creating an array of what the possible weight ranges can be but I can't figure out how to use the values of the array to split the string.\n\n$arr = array(\"10-19\",\"20-29\",\"30-39\",\"40-49\",\"50-59\",\"60-69\",\"70-79\",\"80-89\",\"90-99\",\"100-109\",\"110-119\",\"120-129\",\"130-139\",\"140-149\",\"150-159\",\"160-169\",\"170-179\",\"180-189\",\"190-199\",\"200-209\",\"210-219\",\"220-229\",\"230-239\",\"240-249\",\"250-259\",\"260-269\",\"270-279\",\"280-289\",\"290-299\",\"300-309\");\n\n\nAny ideas would be greatly appreciated." ]
[ "php", "regex" ]
[ "how to filter all items in filter box with all check in superset", "I know we can select all items separately in the filter box. But is there a way to have an item like all whereby clicking it we can choose all the items in the filter box?" ]
[ "apache-superset" ]
[ "Use Firebase Emulator without an internet connection", "It seems that when you use the firebase emulator but have no internet connection you can't load the firebase scripts like http://localhost:5000/__/firebase/8.4.2/firebase-app.js the local server that is created by firebase emulator must be actually fetching the firebase-app.js from google firebase servers and serving that back through localhost.\nIs it possible to use Firebase Emulator without an internet connection?" ]
[ "firebase", "firebase-tools" ]
[ "2 asp.net mvc sites conflicting with each other", "i have deployed an asp.net mvc site a few days ago and everything is going fine. I just deployed a second website (totally unrelated)\n\ni just went to the first website and i am now getting an error below. Can anyone help me determine what is going on. I dont understand why they would know anything about each other.\n\nThe controller name 'Home' is ambiguous between the following types:\nSite.netmvc.Controllers.HomeController\nSalemGolf.Controllers.HomeController\nDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.\nException Details: System.InvalidOperationException: The controller name 'Home' is ambiguous between the following types:\nSite.netmvc.Controllers.HomeController\nSalemGolf.Controllers.HomeController\nSource Error:\nAn unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.\nStack Trace:\n[InvalidOperationException: The controller name 'Home' is ambiguous between the following types:\nSite.netmvc.Controllers.HomeController\nSalemGolf.Controllers.HomeController]\n System.Web.Mvc.DefaultControllerFactory.GetControllerTypeWithinNamespaces(String controllerName, HashSet`1 namespaces) +417\n System.Web.Mvc.DefaultControllerFactory.GetControllerType(String controllerName) +286\n System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +57\n System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase h" ]
[ "asp.net-mvc" ]
[ "Get pid of current subshell", "I am trying to get the pid of a currently executing subshell - but $$ is only returning the parent pid:\n\n#!/usr/bin/sh\n\nx() {\n echo \"I am a subshell x echo 1 and my pid is $$\"\n}\n\ny() {\n echo \"I am a subshell y echo 1 and my pid is $$\"\n}\n\n\necho \"I am the parent shell and my pid is $$\"\nx &\necho \"Just launched x and the pid is $! \"\n\ny &\necho \"Just launched y and the pid is $! \"\n\nwait\n\n\nOutput\n\nI am the parent shell and my pid is 3107\nJust launched x and the pid is 3108\nI am a subshell x echo 1 and my pid is 3107\nJust launched y and the pid is 3109\nI am a subshell y echo 1 and my pid is 3107\n\n\nAs you can see above, when I run $$ from the function that I've backgrounded, it does not display the PID as when I do $! from the parent shell." ]
[ "bash", "sh" ]
[ "On link click load html page in container", "Jquery novice here with a quick question. I have two empty containers in the html:\n <aside></aside>\n <section></section>\n\nThen I load content into it:\n\n$('aside').load('timeline.html #dates');\n$('section').load('timeline.html #intro');\n\n\n#dates contains links that, when clicked on, should replace and load its url content into <section> without reloading the whole page. I tried making a click handler but it's not working (on click still leaves current page and goes to url): \n\n$('a').click(function(e) {\n e.preventDefault();\n e.stopPropagation();\n var url = $(this).attr(\"href\");\n $('section').empty().load(url); \n});\n\n\nI even tried this variation to no avail:\n\n$('aside a').on('click', function() {\n var url = $(this).attr(\"href\");\n $('section').empty().load(url);\n return false;\n});\n\n\nI could use iframes, but I don't want to since I'm learning about .load(). Any suggestions?" ]
[ "javascript", "jquery", "ajax", "load" ]
[ "Do you use particular conventions for naming complementary variables?", "I often find myself trying to come up with good names for complementary pairs of variables; where two variables denote opposing concepts, two participants in some sort of duologue, and so on.\n\nThis might be better explained by a counter-example - I maintain an app that prints two graphics as part of a print advertisement. They're stored in the database as TopLogo and LowerLogo, which I have to stop and double-check every time I use them because I'm expecting top to complement bottom, and lower should complement upper. \n\nThere's some obvious examples that I think work well:\n\nclient / server\nsource / target for copying/moving data or files from one variable to another\nminimum / maximum \n\nbut there's some concepts that just don't lend themselves to such neat naming schemes. For example, when paging through records, does 'last' mean 'final' or 'previous' ? I recently saw some code that used firstPage, previousPage, nextPage and finalPage to avoid the ambiuous lastPage completely, which I thought was very beat, hence this question.\n\nDo you have any particularly neat variable name pairs you'd care to share with us? (Bonus points if they're the same length, which makes the code so much neater in monospaced fonts.)" ]
[ "language-agnostic", "naming-conventions", "variable-names" ]
[ "Calling a non static method in Server Side by a Client Side Function", "I can get an object from the server side by using static receive callbackresult methods from server side.\n\nBut I want to run a non-static method in my page which populates an ajax accordion by calling a client side function.\n\nThe object I am calling from server side is a complex object which I can't use in client side if I get it by callbackresults. \n\nIs there any other solution that I can run a non static method in an aspx file by a client side control ?\n\nCodes I am using so far ...\n\n function ReceiveServerData(arg, context) {\n //Message.innerText = \"Date from server: \" + arg;\n}\n\n#region ICallbackEventHandler Members\n\npublic void RaiseCallbackEvent(String eventArgument)\n{\n // Processes a callback event on the server using the event\n // argument from the client.\n Insert(); // this is running, but doesnt work !\n //printAlternativesFromAirport(eventArgument);\n}\n\npublic string GetCallbackResult()\n{\n // Returns the results of a callback event to the client.\nreturn null;\n}\n\n#endregion\n\n\nprotected void Page_Load(object sender, EventArgs e)\n{\n ClientScriptManager cm = Page.ClientScript;\n String cbReference = cm.GetCallbackEventReference(this, \"arg\",\n \"ReceiveServerData\", \"\");\n String callbackScript = \"function CallServer(arg, context) {\" +\n cbReference + \"; }\";\n cm.RegisterClientScriptBlock(this.GetType(),\n \"CallServer\", callbackScript, true);\n }" ]
[ "asp.net", "javascript", "ajax", "asmx" ]
[ "grpc-gateway endpoints priority order", "I have a service defined this way :\n\nservice Service {\n rpc SearchCategory(SearchCategoryRequest) returns (SearchCategoryResponse) {\n option (google.api.http) = {\n get: \"/v1/categories/search\"\n };\n }\n rpc GetCategory(GetCategoryRequest) returns (GetCategoryResponse) {\n option (google.api.http) = {\n get: \"/v1/categories/{id.val}\"\n };\n }\n}\n\n\nThe problem is that even if I call search?q=MyQuery, it is caught by the GetCategory method and it tries to get the category with id search.\n\nI suppose it is because the paths are very close. Is there a way of defining a priority in the routes like one would do in a classic web application ?\n\nThanks" ]
[ "routes", "grpc", "grpc-gateway" ]
[ "How to configure an App to run at every bootup of mobile?", "In Titanium Appcelerator how can I configure my App to start running as soon as the mobile boots ? any Ideas ? Thank You" ]
[ "android", "titanium", "appcelerator" ]
[ "How to get pixel data from screencap.cpp directly", "I'm a newbie in Android.\nI using Nexus7 reference device and I've downloaded the full source code from source.android.com.\nI have an engineering system image and I can make a system application.\n\n/system/bin/screencap utility is good for me to capture screen. \nI want to get a pixel data using screencap.cpp directly in my application. \n\nWhen I used to screencap utility, the process is like below.\n\n\ncapture screen and save an image.\nOpen image file\ndecodefile to bitmap\nget pixel data(int array) from bitmap\n\n\nI want to remove the step 1, 2 and 3. \nJust call api to get pixel data of a screen directly, \nHow can I do that?" ]
[ "android" ]
[ "Aspect not getting executed", "My AspectConfig\n\n@Configuration\n@EnableAspectJAutoProxy\npublic class LoggingAspectConfig {\n\n @Bean\n public SampleRestService restService() {\n return new SampleRestService();\n }\n\n @Bean\n public ServiceMonitor serviceMonitor() {\n return new ServiceMonitor();\n }\n}\n\n\nMy Aspect\n\n@Aspect\n@Component\npublic class ServiceMonitor {\n\n @Pointcut(\"@annotation(com.web.rest.logging.Monitor)\")\n public void requestMapping() {}\n\n @Before(\"requestMapping()\")\n public void logServiceStart(JoinPoint joinPoint) {\n System.out.println(\"Start: \" + joinPoint);\n System.out.println(joinPoint.getSignature());\n System.out.println(joinPoint.getSignature().getName());\n }\n\n}\n\n\nMy Sample Service\n\n@Service\npublic class SampleRestService {\n\n @Monitor\n public static void getParams(){\n String url = \"<sample url>\";\n\n HttpHeaders headers = new HttpHeaders();\n headers.setContentType(MediaType.APPLICATION_JSON);\n\n\n HttpEntity entity = new HttpEntity(headers);\n\n RestTemplate restTemplate = new RestTemplate();\n\n ResponseEntity<String> response2 = restTemplate.exchange( url, HttpMethod.GET, entity , String.class );\n\n System.err.println(response2.getBody());\n\n }\n\n\nMy Annotation\n\n@Retention(RetentionPolicy.RUNTIME)\n@Target(ElementType.METHOD)\npublic @interface Monitor {\n\n}\n\n\nI am calling with this getParams from a Controller which is annotated with @Component\n\nPlease let me know if i am missing something,\n\nDo i need to add some more config? or is the pointcut expression wrong.\n\nI have the following jars included\n\naspectjweaver-1.8.9.jar\naspectjrt-1.8.9.jar\nspring-aop-4.2.0.RELEASE.jar" ]
[ "java", "spring", "spring-aop" ]
[ "SQL Server Express Idle Timeout Period?", "I am using SQL Server Express 2012 for an ASP.NET application, and I noticed that if no one had used the site for more than 20 minutes or so then the first time a page hit the DB it would take more than 10 seconds to load, with subsequent hits to the DB being fast. I looked at the event log and discovered that SQL Server was being woken up by the page hit. I created a command line application that does a simple query to the DB and set it to run in the task manager every 20 minutes. Then I still noticed the \"wakeup\" entry like this every 20 minutes:\n\n\n Server resumed execution after being idle 193 seconds: user activity\n awakened the server. This is an informational message only. No user\n action is required.\n\n\nMost of the time it was exactly 193 seconds, with a few saying 183 and even one time it said 173 seconds. I don't know why they all seem to end in 3, but this makes me believe there is a timeout after about 1000 seconds of inactivity. My questions:\n\n\nIs this timeout only for SQL Server Express?\nIs the length of the timeout documented anywhere? If yes, does it differ between 2008 and 2012?" ]
[ "sql-server", "timeout", "sql-server-express" ]
[ "how to get name of USB module in android", "I want to get the name USB module as i want to block loading of USB module in android\nfor the I am using lsmod to get list of loadable module and it is showing the following output\n\n# lsmod\nlsmod\nbcm4329 204281 0 - Live 0xbf09e000\nvpnclient 62940 1 - Live 0xbf000000\n\n\nbut how Can i Know which is USB Module from the above 2\n\nPlease help!!!" ]
[ "android", "linux-kernel", "linux-device-driver" ]
[ "ORA-01735: invalid ALTER TABLE option - Toad", "When i execute below SQL in Toad its throws \"ORA-01735: invalid ALTER TABLE option\".\n\nALTER TABLE CALCULATE\n ADD (CAL_METHOD VARCHAR2(50), REMARKS VARCHAR2(500));\n\n\nBut when execute in SQL Developer its running successful, Is there any issue with SQL / Toad. Please advice me." ]
[ "sql", "oracle", "toad" ]
[ "I have mentioned the Plugins in YAML file but still getting issues in Xcode", "I am getting plugin not found error in Xcode." ]
[ "flutter", "flutter-dependencies" ]
[ "npm run start working whereas ng serve not working", "I try to run angular 2 app with ng serve in Linux machine. It is not working. But I tried npm run start command. It is working fine. \nI got the following message when I tried ng serve command. \n\nAs a forewarning, we are moving the CLI npm package to \"@angular/cli\" \nwith the next release,\nwhich will only support Node 6.9 and greater. This package will be \nofficially deprecated\nshortly after.\n\nTo disable this warning use \"ng set --global \nwarnings.packageDeprecation=false\".\n\nYou have to be inside an angular-cli project in order to use the \ngenerate command.\n\n\nI'm trying this command inside the project folder also.\n\nMy package.json file as follows\n\n {\n \"name\": \"xxxxxx\",\n \"version\": \"1.0.0\",\n \"scripts\": {\n \"ng\": \"ng\",\n \"start\": \"ng serve\",\n \"build\": \"ng build\",\n \"test\": \"ng test\",\n \"lint\": \"ng lint\",\n \"e2e\": \"ng e2e\"\n },\n \"private\": true,\n \"dependencies\": {\n \"@angular/animations\": \"^4.1.3\",\n \"@angular/common\": \"4.1.3\",\n \"@angular/compiler\": \"4.1.3\",\n \"@angular/core\": \"4.1.3\",\n \"@angular/forms\": \"4.1.3\",\n \"@angular/http\": \"4.1.3\",\n \"@angular/platform-browser\": \"4.1.3\",\n \"@angular/platform-browser-dynamic\": \"4.1.3\",\n \"@angular/router\": \"4.1.3\",\n \"@angular/upgrade\": \"4.1.3\",\n \"angular2-jwt\": \"0.2.3\",\n \"chart.js\": \"2.5.0\",\n \"core-js\": \"2.4.1\",\n \"moment\": \"2.18.1\",\n \"ng2-charts\": \"1.5.0\",\n \"ngx-bootstrap\": \"1.6.6\",\n \"primeng\": \"^4.0.0-rc.3\",\n \"rxjs\": \"5.4.0\",\n \"ts-helpers\": \"1.1.2\",\n \"zone.js\": \"0.8.11\"\n },\n \"devDependencies\": {\n \"@angular/cli\": \"1.0.4\",\n \"@angular/compiler-cli\": \"4.1.3\",\n \"@types/jasmine\": \"2.5.47\",\n \"@types/node\": \"7.0.22\",\n \"codelyzer\": \"3.0.1\",\n \"jasmine-core\": \"2.6.2\",\n \"jasmine-spec-reporter\": \"4.1.0\",\n \"karma\": \"1.7.0\",\n \"karma-chrome-launcher\": \"2.1.1\",\n \"karma-cli\": \"1.0.1\",\n \"karma-jasmine\": \"1.1.0\",\n \"karma-jasmine-html-reporter\": \"0.2.2\",\n \"karma-coverage-istanbul-reporter\": \"1.2.1\",\n \"protractor\": \"5.1.2\",\n \"ts-node\": \"3.0.4\",\n \"tslint\": \"5.3.2\",\n \"typescript\": \"2.3.3\"\n }\n\n}\n\n\nI have tried ng generate module [name]. It also not working gives the same above message. What can be the reason for this?" ]
[ "node.js", "angular", "npm", "angular2-modules" ]
[ "autocomplete constructor in phpstorm", "Is there a way for PhpStorm to autocomplete a constructor as soon as I start a new class? (I've seen a video where this can be done in Netbeans, for example)" ]
[ "class", "autocomplete", "phpstorm" ]
[ "Resources closed but sonarlint still showing resource not closed", "I have defined Output stream like below \nOutputStream os=new FileOutputStream(file);\n\nTried to close the resource like below\n\nif(os != null) {\n try {\n os.close();\n } catch (IOException e) {\n e.printStackTrace();\n }} \n\n\nStill sonarlint showing \"Use try-with-resources or close this \"FileOutputStream\" in a \"finally\" clause.\"" ]
[ "java", "io", "sonarlint" ]
[ "Youtube API: HttpError 403 when requesting URL . Json returned \"The request cannot be completed because you have exceeded your quota\"", "Enviroment:\n OS: windows 64bit\npython version: Python 3.7.4\npyenv version: Pyenv global 3.7.2\nI have already installed API(Youtube Data V3) from GCP and got API key, the module for python(google-api-python-client) as well\nI have tried to use Youtube API(youtube Data V3) with python, but Many time I caught the error below\ngoogleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/youtube/v3/search?part=snippet&q=%E3%83%9C%E3%83%BC%E3%83%89%E3%82%B2%E3%83%BC%E3%83%A0&order=viewCount&type=video&key=AIza*******************&alt=json returned "The request cannot be completed because you have exceeded your <a href="/youtube/v3/getting-started#quota">quota</a>.">\n\nthis is python code\n\nimport os\nfrom apiclient.discovery import build\nYOUTUBE_API_KEY = os.environ['YOUTUBE_API_KEY']\n\nyoutube = build('youtube', 'v3', developerKey=YOUTUBE_API_KEY)\nprint(youtube)\n\n\nsearch_response = youtube.search().list(\n part='snippet',\n q='RIZEN',\n type='video'\n\n).execute()\n\n\nI have just read the the document(https://developers.google.com/youtube/v3/docs/errors)but I couldn`t understand what is the rootcause of the error because of lack of my experience.\nI would be happy if you share your knowledge." ]
[ "python", "youtube", "youtube-api" ]
[ "What is the meaning of the syntax:", "I am reading a tutorial and I have found a sample code with a line looking like this:\n\n<input #foo />\n\n\nI think that it's an input with id=\"foo\". But isn't the correct syntax this one:\n\n<input id=\"foo\" />" ]
[ "html", "angular", "typescript" ]
[ "why the input tag prints user input in the 'value' atttribute", "I have the following code from somewhere and I don't know the reason why there is a need to have the 'value' attribute in the input tag. I deleted it and the code worked perfectly. Is is for security reasons ? or am I missing something ?\n\n<input type=\"text\" name=\"username\" placeholder=\"Enter Username\" maxlength = \"30\" value= \"<?php if (isset($_POST['username'])) echo $_POST['username']; ?>\" required> \n\n\nThanks for your time" ]
[ "php", "html" ]
[ "ArrayList, double contains", "private static boolean moreThanOnce(ArrayList<Integer> list, int number) {\n if (list.contains(number)) {\n return true;\n }\n return false;\n}\n\n\nHow do I use list.contains to check if the number was found in the list more than once? I could make a method with for loop, but I want to know if it's possible to do using .contains. Thanks for help!" ]
[ "java", "arraylist" ]
[ "web apps: modules speaking with each others", "I'm building a web app. My code is inside this usual:\n\n;(function($) {\n//a lot of code\n})(jQuery);\n\n\nMy problem now is that I'd like to split this code in more files, each with its \"local\" scope like above. What's the best way then to do this, taking in account that maybe code blocks in the different files should communicate with each other?" ]
[ "javascript", "design-patterns", "web-applications", "scope" ]
[ "Custom UICollectionView in Swift 3 not working", "So I am new to swift and am trying to create a custom UiCollectionView that you can horizontally scroll through, and when tapping on a button, you can add an image from your camera roll to the array of images in the collection view. This is what I have so far and I have run into some problems. I have tried watching videos online but I still get errors so i don't know what I am doing wrong. I have some images of apple products that I loaded into my assets folder and I will be using those images in an array for the collectionView. Each image will be in one colletionViewCell. \n\nclass ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {\n\n @IBOutlet weak var collectionView: UICollectionView!\n\n let imageArray = [UIImage(named: \"appleWatch\" ), UIImage(named: \"iPhone\"), UIImage(named: \"iPad\" ), UIImage(named: \"iPod\" ), UIImage(named: \"macBook\")]\n\n\n func numberOfSections(in collectionView: UICollectionView) -> Int {\n\n return 1\n\n }\n\n\n func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n\n return self.imageArray.count\n\n\n }\n\n\n func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n\n let cell = collectionView.dequeueReusableCell(withReuseIdentifier: \"Cell\", for: indexPath) as! UICollectionViewCell\n\n\n cell.ourImage?.image = self.imageArray[indexPath.row]\n\n return cell\n\n }\n}\n\n\nIt gives me an error here cell.ourImage?.image = self.imageArray[indexPath.row] and says that \"value type UICollectionViewCell has no member 'ourImage'\" Even though I named the outlet ourImage on another UICollectionViewCell swift file. I have checked the Main.storyboard and I think I have named all of my classes correctly and have assigned them to the collectionViewCell and the identifier. I delete this line and it compiles fine, but whenever the app is run nothing shows up on the screen so there may be something wrong with my images too. Does anybody have any ideas? How would you go about creating a custom UiCollection View? Do I have the right idea?" ]
[ "ios", "swift", "xcode", "uicollectionview" ]
[ "Python XOR preference: bitwise operator vs. boolean operators", "Is there a preferred method for doing a logical XOR in python?\n\nFor example, if I have two variables a and b, and I want to check that at least one exists but not both, I have two methods:\n\nMethod 1 (bitwise operator):\n\nif bool(a) ^ bool(b):\n do x\n\n\nMethod 2 (boolean operators):\n\nif (not a and b) or (a and not b):\n do x\n\n\nIs there an inherent performance benefit to using either one? Method 2 seems more \"pythonic\" but Method 1 looks much cleaner to me. This related thread seems to indicate that it might depend on what variable types a and b are in the first place!\n\nAny strong arguments either way?" ]
[ "python", "xor" ]
[ "searching a specific word from a list of words in batch file", "I have a %list% variable which has words (see the code) and I want to search a word which ends with letter 'Y' (ignoring the case-sensitive) and which starts with the last letter of user's input. User input would be any valid word. Once I find that specific word then I want to store it into a variable (%myWord%). My intention is to use the %myWord% variable later in the code. If I already used that word from the %list% then I want a new word shown to user. My list of words starts with any letter and end in 'Y' letter and are in alphabetic order. The %list% is pretty long.\nFollowing is my code. I feels like I am lost and I couldn't find the solution to this issue. \n\n@echo off\n\n:START\nset /p INPUTWORD=>Enter a word:\nSET lastletter=%INPUTWORD:~-1%\n\nset \"list=daddy day gladly happily key pay randomly ray say urgency utility yesterday\"\nFor %%L in (%list%) do (\n SET endingY=%%L:~-1%\n For %%X in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do (\n if findstr /i \"%lastletter%\" %%X EQU first letter of the words in %list%\n if %%L:~-1% EQU \"y\"\n if %myWord% is already shown to user then search for a new word.\n and then set myWord==%%L (new word; unused one)\n\necho My Word is: %myWord%\npause\ngoto START\n\n\nFor example:\n\nSession 1:\nEnter a word: dog\n\nMy word is: gladly\n\nSession 2:\nEnter a word: yak\n\nMy word is: key\n\nUsing any type of function is totally fine. As long as it search for the right word. \nThis seems possible but I'm tired of thinking. I think I might need to be fresh." ]
[ "batch-file", "cmd", "scripting" ]
[ "Interceptor for all PortletResponses in a JSF project", "I'd like to implement an interceptor that wraps around all PortletResponses in a JSF project.\n\nBut to be honest, I don't even know where to begin. I guess the faces-config.xml or the web.xml would be a good start.\n\nWe're using Java6 and JSF 1.2." ]
[ "java", "jsf", "portlet", "interceptor", "jsf-1.2" ]
[ "CLLocationManager issue", "I'm learning about user localization in swift. I'm trying to print localization on console (later I will use it for info on label, so I want to check if it works), but I have no idea why it prints nothing. Even if delete conversions to string, and leave just for printing anything, it still doesn't work. Please help.\n\nYes, I added NSLocationAlwaysUsageDescription and \nNSLocationWhenInUseUsageDescription. \n\nimport UIKit\nimport CoreLocation\nimport MapKit\n\nclass ViewController: UIViewController, CLLocationManagerDelegate {\n\n var locationManager = CLLocationManager()\n var myPosition = CLLocationCoordinate2D()\n\n override func viewDidLoad() {\n super.viewDidLoad()\n locationManager.delegate = self\n locationManager.requestWhenInUseAuthorization()\n locationManager.startUpdatingLocation()\n\n }\n\n override func didReceiveMemoryWarning() {\n super.didReceiveMemoryWarning()\n }\n\n func locationManager(manager: CLLocationManager, didUpdateToLocation newLocation: CLLocation, fromLocation oldLocation: CLLocation) {\n\n print(\"Got location: \\(newLocation.coordinate.latitude), \\(newLocation.coordinate.longitude)\")\n\n myPosition = newLocation.coordinate\n\n locationManager.stopUpdatingLocation()\n }\n\n}" ]
[ "ios", "swift", "core-location", "cllocationmanager" ]
[ "Track system activity", "Is there a neat/easy way in objective-c/cocoa to track if a user is at their computer, ie I assume by detecting key presses and mouse movement?\n\n(ie I want to fill out my timesheet automatically by detecting when I am at work and not at work)" ]
[ "objective-c", "cocoa", "monitor" ]
[ "Open global search as overlay", "I am writing a launcher and want to be able to open up a search as an overlay rather than full-screen in the Google App.\n\nSo far I only found a way to open the search in the Google App full-screen as follows (taken from AOSP Launcher3 source code):\n\n public static boolean openSearch(Context context) {\n\n SearchManager searchManager = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);\n ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity();\n if (globalSearchActivity == null) {\n Timber.w(\"No global search activity found.\");\n return false;\n }\n Intent intent = new Intent(android.app.SearchManager.INTENT_ACTION_GLOBAL_SEARCH);\n intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n intent.setComponent(globalSearchActivity);\n Bundle appSearchData = new Bundle();\n appSearchData.putString(\"source\", \"launcher-search\");\n\n intent.putExtra(android.app.SearchManager.APP_DATA, appSearchData);\n\n intent.putExtra(android.app.SearchManager.QUERY, \"\");\n intent.putExtra(android.app.SearchManager.EXTRA_SELECT_QUERY, true);\n try {\n context.startActivity(intent);\n return true;\n } catch (ActivityNotFoundException ex) {\n Timber.w(\"Global search activity not found: %s\", globalSearchActivity);\n return false;\n }\n\n }\n\n\nI know it is possible because other launchers like Nova and Action Launcher managed to do it..." ]
[ "android", "android-launcher", "android-searchmanager" ]
[ "Can a WF/WCF 4.0 service be accessed from 3.5 SP1 clients/websites?", "If I was to develop a workflow hosted in WCF using .NET 4.0, is there anything that will prevent me from accessing it using a 3.5 SP1 based client or website?" ]
[ ".net", "wcf", "workflow-foundation" ]
[ "Looking for lightweight PHP stack for development on Windows", "I'm looking to setup a lightweight, developer only web stack on Windows (and possible OSX). Ideally, I'd be working with Zend framework, MySQL. But I'm open to other APIs to facilitate creating RESTFul (or pseudo-Restful) web services.\n I've seen some tools, like QuickPHP, but it might have been too lightweight as I couldn't get everything working that I wanted.\n I'm not opposed to installing Apache and all that, but was just curious if there's some other tools I'm not seeing to get up to speed quickly.\n\nKeep in mind that this is for local development only.\n\nThank you." ]
[ "php", "windows", "rest" ]
[ "Binarize a python list based on previous value", "I want to binarize python list based on previous value, output should be 1 if previous value is lower, and 0 if higher. Example:\n\n[18985.0, 20491.0, 18554.0, 14241.0, 13390.0, 14965.0,]\n\n\nshould become:\n\n[0, 1, 0, 0, 0, 1]\n\n\nIs there any elegant way to do this?\nThanks in advance!" ]
[ "python", "algorithm", "list" ]
[ "get php results with ajax json code", "Hello this is my code to display data each 2s without refresh page but I don't know why it's not working.\n\n<body>\n <script type=\"text/javascript\">\n $(document).ready(function() {\n done();\n });\n\n function done() {\n setTimeout(function() {\n updates();\n done();\n }, 2000);\n }\n\n function updates() {\n $.getJSON(\"saipa.php\", function(data) {\n $(\"ul\").empty();\n $.each(data.result, function(){\n $(\"ul\").append(\"<li>Name: \"+this['Name']+\"</li>\n <li>detail: \"+this['Description']+\"</li>\n <li>Today price: \"+this['Today']+\"</li>\n <li>Last day price: \"+this['Lastday']+\"</li>\n <br />\");\n });\n });\n }\n </script>\n <ul></ul>\n</body>\n\n\nJSON:\n\n[{\"Name\":\"arash\",\"Description\":\"vian\",\"Today\":\"20,500,000\",\"Lastday\":\"22,410,000\"},{\"Name\":\"shaber\",\"Description\":\"root\",\"Today\":\"38,200,000\",\"Lastday\":\"40,210,000\"}]" ]
[ "php", "jquery", "ajax", "json" ]
[ "Pattern for cascade/nested asynchronous calls", "When working with gwt on client side there is common situation to call asynchronous method with processing in callback method.\n\nasyncService.method(new AbstractAsyncCallback<Number>() {\n @Override\n public void onSuccess(Number num) {\n // do something with number\n }\n});\n\n\nBut often encountered situation where need to get result from one asynchronous method, pass to another, etc. That's why we get dirty cascade code, that hard to read.\n\nasyncService.method(new AbstractAsyncCallback<Number>() {\n @Override\n public void onSuccess(Number num) {\n asyncService.method1(num, new AbstractAsyncCallback<String>() {\n @Override\n public void onSuccess(String str) {\n asyncService.method2(str, new AbstractAsyncCallback<Void>() {\n @Override\n public void onSuccess(Void void) {\n // do something\n }\n });\n }\n });\n }\n });\n\n\nI know, we can combine this three calls on server side to make separate service method, but what if we need a lot such combinations of different methods? Another concern is to add separate method, that perform functionality that we can get by simple combination of existing ones.\n\nIs there a common pattern to get rid of such code and not change server-side service?" ]
[ "java", "design-patterns", "gwt", "asynchronous" ]
[ "Parse XML With Additional String", "I need to support parsing xml that is inside an email body but with extra text in the beginning and the end.\n\nI've tried the HTML agility pack but this does not remove the non-xml texts.\n\nSo how do I cleanse the string w/c contains an entire xml text mixed with other texts around it?\n\nvar bodyXmlPart= @\"Hi please see below client <?xml version=\"\"1.0\"\" encoding=\"\"UTF-8\"\"?>\" +\n\"<ac_application>\" +\n\" <primary_applicant_data>\" +\n\" <first_name>Ross</first_name>\" +\n\" <middle_name></middle_name>\" +\n\" <last_name>Geller</last_name>\" +\n\" <ssn>123456789</ssn>\" +\n\" </primary_applicant_data>\" +\n\"</ac_application> thank you, \\n john \";\n\n//How do I clean up the body xml part before loading into xml\n//This will fail:\nvar xDoc = XDocument.Parse(bodyXmlPart);" ]
[ "c#", ".net", "xml" ]
[ "Locating Xrite ColorChecker samples in image", "I am trying to perform color adjustments in a photo taking mobile app using a Xrite ColorChecker and for that I am trying to come up with a way to locate the color samples on the checker in the view.\n\nI assume\n\n\nUser has placed the ColorChecker in the camera view\nThe position can be arbitrary and can also be in any orientation or even skewed\nApp should ideally find the color checker in the camera view automatically, or less ideally with the help of the user (tapping anywhere within the ColorChecker)\nThe lighting conditions may not be ideal, so the less dependent the algorithm is on the actual colors, the better\n\n\nThis is how the ColorChecker looks. I am interested specifically in the samples in right half of the device.\n\n\n\nThe app is targeting iOS 11 and is built in Xamarin.iOS and C#. \n\nWhat I have tried already\n\nMy first idea was to utilize built in augmented reality capabilities in iOS to identify the rectangle in scene, but I found out that this will not work as the device is not regular shaped and the available methods have hard time locating it. I also learned it is possible to train a machine learning model to answer the question of whether ColorChecker is in the current screen, but still will not answer the question of where the individual color samples are and how is the device oriented.\n\nI have also found CCFind algorithm using MATLAB, which does find ColorChecker given a photo, but is not fast enough even on powerful PC to be usable as a real-time solution and also MATLAB cannot be ported to iOS, so I tried rewriting the code to OpenCV + C++, which was tedious and I couldn't finish it successfully in almost a month of work.\n\nI am open to any suggestions or tips on how to approach this problem, as I am not very knowledgeable in computer vision area and don't really know where to start." ]
[ "ios", "xamarin", "computer-vision" ]
[ "Flask and Transfer-Encoding: chunked", "We're trying get a Flask web service working, and we're having some issues with streaming posts - i.e. when the header includes Transfer-Encoding: chunked. \n\nIt seems like the default flask does not support HTTP 1.1. Is there a work around for this?\n\nWe are running this command:\n\n$ curl -v -X PUT --header \"Transfer-Encoding: chunked\" -d @pylucene-3.6.1-2-src.tar.gz \"http://localhost:5000/async-test\"\n\n\nAgainst this code:\n\[email protected](\"/async-test\", methods=['PUT'])\ndef result():\n print '------->'+str(request.headers)+'<------------'\n print '------->'+str(request.data)+'<------------'\n print '------->'+str(request.form)+'<------------'\n return 'OK'\n\n\nHere's the curl output:\n\n$ curl -v -X PUT --header \"Transfer-Encoding: chunked\" -d @pylucene-3.6.1-2-src.tar.gz \"http://localhost:5000/async-test\"\n* About to connect() to localhost port 5000 (#0)\n* Trying ::1... Connection refused\n* Trying 127.0.0.1... connected\n* Connected to localhost (127.0.0.1) port 5000 (#0)\n> PUT /async-test HTTP/1.1\n> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5\n> Host: localhost:5000\n> Accept: */*\n> Transfer-Encoding: chunked\n> Content-Type: application/x-www-form-urlencoded\n> Expect: 100-continue\n>\n* HTTP 1.0, assume close after body\n< HTTP/1.0 200 OK\n< Content-Type: text/html; charset=utf-8\n< Content-Length: 2\n< Server: Werkzeug/0.8.3 Python/2.7.1\n< Date: Wed, 02 Jan 2013 21:43:24 GMT\n<\n\n\nAnd here's the Flask server output:\n\n* Running on 0.0.0.0:5000/ \n------->Transfer-Encoding: chunked\n Content-Length:\n User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5\n Host: localhost:5000\n Expect: 100-continue\n Accept: */*\n Content-Type: application/x-www-form-urlencoded\n\n <------------\n -------><------------\n ------->ImmutableMultiDict([])<------------" ]
[ "python", "http", "flask" ]
[ "Listening for Firebase Analytics automatic events", "Firebase has the functionality to track several events automatically. This means your application code is never actually executed and the SDK takes care of pushing the events to your Firebase project.\n\nI need a way to listen to the automatically tracked events, so that I can send them to a different analytics service.\n\nI check the firebase documentation (1) (2) and I didn't find anything related to this.\n\nAny ideas?\n\nThanks" ]
[ "android", "firebase", "firebase-analytics" ]
[ "How do I form a Github API POST request to add a new comment to a gist?", "I'm doing a Post request to github at this url:\n\nhttps://api.github.com/gists/2710948/comments\n\nTheoretically, this should create a comment with the text being formed from what's in the request body. However, when I try to make that post, I get a 404 error. That leads me to believe that the gist is not being found, however, if you do a Get request at the same address it comes up just fine.\n\nIs there an authentication thing I need to be doing? I've tried adding a username and password to my headers collection but I've got no idea if I'm using the right format. I've tried making this work via Ruby, HTTP Client, and curl, and I get the same error either way. \n\nThe curl command I'm using is this:\n\ncurl -X POST -d \"This is my sample comment\" https://api.github.com/gists/2710948/comments\n\nI think that if I can get the curl command working, I'll be able to figure out the HTTP Client and then the Ruby. This will be my first attempt at consuming an API, so there's nothing too basic for me to double-check; all suggestions will be helpful." ]
[ "ruby", "github" ]
[ "How to multiply all columns in SAS by another column?", "Suppose data set looks like:\n\nA B C\n1 2 0.2 \n2 7 0.3\n3 10 0.7\n\n\nand I want to multiply columns A and B by C and update the values? What is the most efficient way to do this?" ]
[ "sql", "sas" ]
[ "Error reverse engineering Sql Server database to model using EF Core 1.0.1 in Visual Studio 2015 Update 3", "I am creating a .Net Core 1.0.1 Web API in Visual Studio 2015 Update 3, using EF Core.\nI am trying to reverse engineer to a model from a database hosted locally on Sql Server 2016 Express, on my Windows 10 Home 64 bit PC.\nI am following this tutorial: https://docs.efproject.net/en/latest/platforms/aspnetcore/existing-db.html#reverse-engineer-your-model\n\nThe tutorial says I need to run this command in the Package Manager Console to reverse engineer my model: \n\nScaffold-DbContext \"Server=(localdb)\\mssqllocaldb;Database=Blogging;Trusted_Connection=True;\" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models \n\nSo, I modified the connection string to connect to my database as follows:\n\nScaffold-DbContext \"Data Source=DESKTOP-AEAOCON\\SQLEXPRESS;Initial Catalog=propworx;Integrated Security=True;\" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models\n\nand ran it. But I get the following error:\n\n\n Scaffold-DbContext : The term 'Scaffold-DbContext' is not recognized\n as the name of a cmdlet, function, script file, or operable program.\n Check the spelling of the name, or if a path was included, verify that\n the path is correct and try again.\n At line:1 char:1\n + Scaffold-DbContext \"Data Source=DESKTOP-AEAOCON\\SQLEXPRESS;Initial Ca ...\n + ~~~~~~~~~~~~~~~~~~\n     + CategoryInfo          : ObjectNotFound: (Scaffold-DbContext:String) [], CommandNotFoundException\n     + FullyQualifiedErrorId : CommandNotFoundException\n\n\nThe tutorial does mention the following:\n\n\n If you receive an error stating the term ‘Scaffold-DbContext’ is not\n recognized as the name of a cmdlet, then close and reopen Visual\n Studio.\n\n\nBut I've done this and it hasn't helped. Any ideas anyone?\n\nThis is my project.json file:\n\n{\n \"dependencies\": {\n \"Microsoft.NETCore.App\": {\n \"version\": \"1.0.1\",\n \"type\": \"platform\"\n },\n \"Microsoft.AspNetCore.Mvc\": \"1.0.1\",\n \"Microsoft.AspNetCore.Routing\": \"1.0.1\",\n \"Microsoft.AspNetCore.Server.IISIntegration\": \"1.0.0\",\n \"Microsoft.AspNetCore.Server.Kestrel\": \"1.0.1\",\n \"Microsoft.Extensions.Configuration.EnvironmentVariables\": \"1.0.0\",\n \"Microsoft.Extensions.Configuration.FileExtensions\": \"1.0.0\",\n \"Microsoft.Extensions.Configuration.Json\": \"1.0.0\",\n \"Microsoft.Extensions.Logging\": \"1.0.0\",\n \"Microsoft.Extensions.Logging.Console\": \"1.0.0\",\n \"Microsoft.Extensions.Logging.Debug\": \"1.0.0\",\n \"Microsoft.Extensions.Options.ConfigurationExtensions\": \"1.0.0\",\n \"Microsoft.EntityFrameworkCore.SqlServer\": \"1.0.1\"\n },\n\n \"tools\": {\n \"Microsoft.AspNetCore.Server.IISIntegration.Tools\": \"1.0.0-preview2-final\"\n },\n\n \"frameworks\": {\n \"netcoreapp1.0\": {\n \"imports\": [\n \"dotnet5.6\",\n \"portable-net45+win8\"\n ]\n }\n },\n\n \"buildOptions\": {\n \"emitEntryPoint\": true,\n \"preserveCompilationContext\": true\n },\n\n \"runtimeOptions\": {\n \"configProperties\": {\n \"System.GC.Server\": true\n }\n },\n\n \"publishOptions\": {\n \"include\": [\n \"wwwroot\",\n \"**/*.cshtml\",\n \"appsettings.json\",\n \"web.config\"\n ]\n },\n\n \"scripts\": {\n \"postpublish\": [ \"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%\" ]\n }\n}" ]
[ ".net", "entity-framework", "asp.net-core", "scaffolding" ]
[ "Moving GameObjects via script smoothly across the screen like an animation in Unity", "I am trying to move GameObjects to different places on the screen, I want them to move like an animation, smoothly moving over while the programming is running. I am using Unity with Leapmotion \n\nI have tried the code below but this just moves the object into the new position immediately, it doesn't move it slowly so that the user can see it move from current location to new. - like an animation. \n\n myobject.transform.Translate(0f,0.5f,1f);\n\n\nYour help will be appriciated. Thankyou in advance" ]
[ "c#", "unity3d", "gameobject" ]
[ "One-Column Layout with liquid images on either side", "What I want to be able to do is to have a 700px column with an image to the left of it with a 20% width and an image to its right with a width that takes up the rest of the page on the right side. SO essentially from left to right there will be a 20% wide image, then a 700px wide column with the content of the site, and then an image on the right that takes up the rest of the width of the page. I have been struggling with how to do this, and I feel like I'm making it too complicated." ]
[ "css", "layout", "liquid-layout" ]
[ "How to enable .zip file download in a directory inside wordpress website", "I have created a wordpress website. I have created a directory named my-resources in the root directory & uploaded few zip files to it via FTP. Now I am trying to download the zip files by directly entering the zip file URL in a browser but it is always showing the wordpress default 404 page. I tried to enable using .htaccess without any success.\n\nExample URL: http://www.example.com/my-resources/sample.zip\n\nAdditional Notes:\n\n\nIts a Linux Server\nI have configured permalinks like http://www.example.com/sample-post/\nI have installed Easy Media Download, Yoast SEO plugins which I think might conflict with the file download\n\n\nHow do I enable to download zip files from a particular directory?" ]
[ "wordpress", ".htaccess", "download", "zip" ]
[ "UITabBar iOS 11 extra place", "There are extra place in uitabbar in iOS 11.\nThat's how tabbar looks on iOS 10:\n\n\nAnd that's how tabbar looks on iOS 11:\n\n\nAnybody know what can be wrong and how to fix it?\n\nI would be grateful for any help!" ]
[ "ios", "iphone", "tabbar", "ios11", "xcode9" ]
[ "Retrieving properties from item in array by string in javascript", "So I know I can retrieve properties from an object by string with bracket notation:\nconst obj = {a:[\n {b: 'hi'},\n]};\n\nconsole.log(obj['a']); // Array [Object { b: "hi" }]\n\nBut if I try to access the item in the array with that notation, it doesn't allow it:\nconsole.log(obj['a[0].b']); // undefined\nconsole.log(obj['a[0]']); // undefined\n\nIs there a way to do this in javascript?\nWhy am I doing this?\nSo my function is getting strings with array and object information like this:\n\n"folder[2].people[1].name.firstName"\n"folder[2].people[1].name.lastName"\n"folder[2].name"\n\nand I need to get that information from the object itself. I'd prefer to not have to parse the string." ]
[ "javascript" ]
[ "Command Line - bool argument doesn't work", "I am trying to use bool argument in my console application. I'm using the CommandLineParser Package, but parser return error.\n\nthis is my option\n\n [Option(\"randomize\", Required = false, DefaultValue = false, HelpText = \"Enter \\\"true\\\" for the random selection\")]\n public bool Randomize { get; set; }\n\n\nargument: --randomize=true\n\nI am using Parser.Default.ParseArguments\n\nAny idea why this doesn't work?" ]
[ "c#", "command-line-arguments", "command-line-parser" ]
[ "Can I extract TFS Service hook trigger message in Jenkins", "I am trying to trigger jenkins via TFS service hook, I want to use jenkin to extract out check in information to create a log using powershell script. I have it set up to trigger the jenkins on check in. but I can not figure out a way to parse message info sent from TFS service hook. Looking at https://github.com/jenkinsci/tfs-plugin/blob/master/README.md I can see there are few environment variables created on trigger but I want to extract some of the check in information as in username who checked in and tfs id it was checked in against etc. TFS_USERNAME only record the username of the account that is configured to access tfs in Jekins" ]
[ "jenkins", "service", "tfs", "hook", "webhooks" ]
[ "Can anyone tell me why the following regex won't match to \"2015\"?", "string str = @\"(?<Year>\\d{4})?\";\nRegex regex = new Regex(str);\nvar match = regex.Match(\"abc/2015/01/11/efg_20150111.tsv\");\n\n\nI cannot find \"2015\" in match.Groups.\nThanks!" ]
[ "c#", "regex" ]
[ "Awk only match first match of line in multiline text", "I'm trying to match a specific number (06:00) and (9:00) if it's the first match on a line in a multi-line file. The problem it seems with my limited knowledge of awk is that I either get only the first match, or matches with the second number also. I would also like to tally up the resulting matches count and the end too, but since it's not matching correctly I haven't gotten that far.\n\nSchedule in <06:00>:12 out <06:00>:0\nSchedule in <08:00>:10 out <06:00>:0\nSchedule in <06:00>:9 out <05:00>:0\nSchedule in <07:00>:13 out <08:00>:0\nSchedule in <06:00>:12 out <09:00>:0\nSchedule in <09:00>:12 out <06:00>:0\nSchedule in <07:00>:11 out <06:00>:0\n\n\nI tried:\n\nawk '/06/||/09/' schedule.txt\n\nawk '$1 ~ /\\<06/||/\\<09/ {print $1}' schedule.txt\n\n\ncorrect output:\n\nSchedule in <06:00>:12 out <06:00>:0\nSchedule in <06:00>:9 out <05:00>:0\nSchedule in <06:00>:12 out <09:00>:0\nSchedule in <09:00>:12 out <06:00>:0\n4 Total Matches" ]
[ "regex", "macos", "bash", "shell", "awk" ]
[ "How to make suitable border and shadow for a widget created by CustomClipper", "I have a Container widget inside of a ClipPath which uses a CustomClipper. Everything works fine, I have the desired widget shape.\n\nHowever, I could not find a way to make a shadow for this custom shaped Widget.\nAlso, I want to have an outline(border) that follows the edges of this custom widget automatically.\n\nAgain no luck. I tried BoxDecoration:border, BoxDecoration:boxShadow, ShapeDecoration:shape, ShapeDecoration:shadows, Material:Elevation, etc.." ]
[ "dart", "flutter", "clip-path" ]
[ "Angular, rxjs: can we add something like a template variable to a rxjs subject so that data streams are routed based on where they should go?", "I am a newbie to the angular, rxjs area. I was working with a Subject observable to accept data from one component (angular) and send to another component. I was wondering if there was a way we could create a message analogous to an email and send a data stream to many recipients but only the intended ones.\n\nTyping this, I think it might have been a naive question to ask, but I am going with the \"no question is stupid\" analogy." ]
[ "angular", "rxjs" ]
[ "Can't use $_GET values properly when using php based css templates", "If anyone can think of a better title, please let me know. \n\nRight now I'm using a technique from this tutorial to get the width and height of the user's viewing window. It works, but only on the index.php page. I'm using a php based css file. \nIn the php based css file, everything would normally work fine, except that the first line at the top *$width_div_center = $GET['width']0.8; thinks the width is in string form. (Or something like that.) As a result, the $width_div_center variable is set to zero which causes a lot of issues. What am I doing wrong, or how can I get the php based css file to do a multiplication on *$GET['width']0.8 properly? Thank you for your assistance. \n\n<html>\n<head>\n<title>Taylor Love</title>\n<!--\n<link rel=\"stylesheet\" media=\"only screen and (color)\" href=\"main.css\" />\n<link rel=\"stylesheet\" href=\"main.css\"/>\n-->\n<link rel=\"stylesheet\" type=\"text/css\" href=\"css/style.php\" />\n<?php\n $content = \"null\";\n include_once('content.php');\n?>\n</head>\n<body class=\"body\">\n <!-- top header -->\n <div class=\"div-center decorated-white\">\n <div class=\"header-background\">\n <div style=\"margin:10px;\">\n <font color=\"#AAA\" >\n hello, universe!\n <?php\n echo $_GET['width'] *.8;\n echo \"<h1>Screen Resolution:</h1>\";\n echo \"Width : \".$_GET['width'].\"<br>\";\n echo \"Height : \".$_GET['height'].\"<br>\";\n ?>\n </font>\n </div>\n </div>\n </div><!-- div-center-->\n <div class=\"div-center\" style=\"margin-top:10px;\">\n <?php\n include('sidenav.php');\n ?>\n <div id=\"div-content\" class = \"decorated-white\">\n <?php echo $content; ?>\n </div><!-- div-content-->\n </div><!-- div-center-->\n <div class=\"clear\"></div>\n <!-- top header\n <div class=\"div-center decorated-white\" style=\"margin-top:10px\">\n <?php\n for ($i = 0; $i < 5; $i++){\n echo \"</br>\";\n }\n ?>\n </div>-->\n</body>\n</html>\n\n\n////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////\nI appear to be having issues separating two different pages of code." ]
[ "php", "javascript", "css", "variables", "math" ]
[ "How can I use (Node) Livereload on a development server in my network", "Background: My PHP projects (CakePHP, Wordpress) run on an Ubuntu server in my network, I access them through a development TLD (.dev for example) setup through a local DNS server and I edit the files through a Samba share.\n\nI would like to utilize Livereload for my development, preferably have it running on the server itself. I have basic Node/Gulp knowledge, but haven't been able to get this running.\n\nLivereload (or a middleware server) should proxy the 'real' URLs, making sure all websites run as they would normally and Livereload should be available over the network (so not just localhost, because that runs on the development server)\n\nDesired result:\n\nLivereload runs on my dev server (IP: 10.0.0.1), my project is called helloworld.dev, I browse to 10.0.0.1:3000 on my machine and see helloworld.dev proxied through Livereload. I now edit a CSS file over the Samba share and the CSS is reloaded without a refresh.\n\nI've tried using a few NPM packages, gulp-livereload, livereload, node-livereload, with their provided examples that come with the packages, but haven't been able to get the desired result. They all expect you to run in locally, don't support access to the Livereload URL over the network, cannot proxy the 'real' URLs or require static content.\n\nCan anyone provide an example or 'proof of concept' code of my wish, so I can see where to start?" ]
[ "node.js", "gulp", "livereload" ]
[ "Flash AS3 function trace same value", "Could somebody possibly explain why the trace below returns the length of the array rather than the value of the \"i\" in the array item?\n\nMany thanks, Nick\n\nAS3\n\nfunction createMarkers(mapLocations){\n var markerArray:Array = new Array();\n for(i=0; i<mapLocations.length; i++){\n markerArray.push(new marker());\n markerArray[i].x=mapLocations[i][1];\n markerArray[i].y=mapLocations[i][2];\n\n markerArray[i].markerText.text = mapLocations[i][0].toString();\n markerArray[i].addEventListener(MouseEvent.CLICK, function(e:MouseEvent){clickTarget(e,i);});\n bgImage.addChild(markerArray[i]);\n }\n}\n\nfunction clickTarget(e:MouseEvent,a){\n trace(a);\n}" ]
[ "actionscript-3", "flash" ]
[ "How to simply extract leading N parts of a path?", "I've got a bunch of directory names and file names, some are absolute path, some are relative path. I just wish to get the 2 leading parts of each path. Input:\n\nD:\\a\\b\\c\\d.txt\\\nc:\\a\n\\my\\desk\\n.txt\nyou\\their\\mine\n\n\nI expect to get:\n\nD:\\a\nc:\\a\n\\my\\desk\nyou\\their\n\n\nIs there a convenient way in PowerShell to achieve this?" ]
[ "powershell", "path", "split" ]
[ "Java ArrayList add() method in the instance variable section", "In a Java class where you normally declare/define instance variables, I would like to have an ArrayList as one of the instance variables and initialize it with some elements to start out with. One way of doing this is declare the ArrayList and initialize it in a constructor. However, I am wondering why it is illegal to initialize the value outside the constructor. For example, \n\npublic class Test {\n // some instance variables...\n\n private ArrayList<String> list = new ArrayList<String>();\n list.add(\"asdf\");\n\n // methods here...\n}\n\n\nSo I get that this is illegal. But why exactly is this illegal?" ]
[ "java", "arraylist", "instance-variables" ]
[ "await function doesn't seem to be waiting", "I'm trying to build a simple login then redirect but the await function doesn't seem to work. When I add in a window.alert between each awaits then it does work. Please help\n\nClient:\n\n\r\n\r\n async function submitLogin(){\r\n\r\n var email,pass;\r\n\r\n email=$(\"#inputUser\").val();\r\n pass=$(\"#inputPassword\").val(); \r\n \r\n try {\r\n const result = await fetch(\"/login\", {method:\"POST\", headers:{\"content-type\":\"application/json\"}, body: JSON.stringify({'email':email, 'pass':pass,}) });\r\n const login = await result.json();\r\n\r\n if(login.success === true) {\r\n window.location.href=\"/admin\";\r\n }\r\n else {\r\n window.alert(\"incorrect login info\");\r\n }\r\n } catch (e){\r\n console.log(e);\r\n }\r\n }\r\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js\"></script>\r\n<button class=\"btn btn-lg btn-primary btn-block\" type=\"submit\" id=\"submit\" onclick=\"submitLogin()\">Sign In</button>\r\n\r\n\r\n\n\nServer:\n\n\r\n\r\napp.post('/login', async (req,res) => {\r\n\r\n sess = req.session;\r\n sess.email = req.body.email;\r\n\r\n let result = {};\r\n\r\n try{\r\n const pass = await checkUserPass(sess.email);\r\n if ( JSON.stringify(pass[0].password) == JSON.stringify(req.body.pass) ){\r\n result.success = true; \r\n }\r\n else{\r\n result.success=false; \r\n }\r\n }\r\n catch(e){\r\n result.success=false; \r\n }\r\n finally{\r\n res.setHeader(\"content-type\", \"application/json\");\r\n console.log(JSON.stringify(result));\r\n res.send(JSON.stringify(result));\r\n }\r\n \r\n});\r\n\r\n\r\n\n\nI can see this line displaying console.log(JSON.stringify(result)); on the server console." ]
[ "javascript", "server", "async-await", "client" ]
[ "Url rewriting not working with wordpress unless using [R]", "I have a Wordpress installation on my website on the folder blog-ita/. Now, I'd like to add a rewrite rule to allow accessing it from website-name/blog/.\n\nI used this rewrite rule:\n\nRewriteRule ^website-name/blog/(.*)$ blog-ita/$1\n\n\nNow, this works if I add the [R] tag, but otherwise I get the 404 not found page from wordpress instead of the page I wanted to see.\n\nHow can that be? How can I make this work without the [R] flag?" ]
[ "wordpress", ".htaccess", "mod-rewrite", "url-rewriting" ]
[ "Using wait() vs waitpid() in c", "So I'm trying to traverse a directory(and subdirectories) and create new processes to sort files and traverse subdirectories. However, I'm having a little trouble understanding how useful my code will be. To my understanding, wait() will sleep the parent process until the child process terminates. Currently my recursive function is \n\nvoid iterate_dir(char* name){\n\n DIR *dd = opendir(name);\n struct dirent *curr;\n\n while((curr = readdir(dd))!=NULL){\n\n if((strcmp(curr->d_name,\".\")==0 || strcmp(curr->d_name,\"..\")==0) && curr->d_type==DT_DIR){\n\n continue;\n\n }\n\n int status = -1;\n int pid = fork();\n\n if(pid==0){\n\n //child process\n if(curr->d_type==DT_DIR){\n\n printf(\"DIRECTORY:\\t%s\\n\", curr->d_name);\n char new_path[strlen(curr->d_name)+strlen(name)+2];\n sprintf(new_path,\"%s/%s\",name,curr->d_name);\n //recurse, iterate sub directory\n iterate_dir(new_path);\n _exit(getpid());\n\n\n }else{\n\n printf(\"FILE:\\t%s\\n\", curr->d_name);\n //sort the file\n _exit(getpid());\n\n }\n\n\n }\n\n wait(&status);\n\n }\n\n closedir(dd);\n\n}\n\n\ngiven and initial directory, it works, but im concerned with the wait() function. I would like the code to continue traversing the directory while the child processes are executing, and currently wait prevents this from happening. But I still need to prevent zombie children. Would using waitpid() instead allow me to have this functionality(ie. allow the loop to continue through the rest of the directory while the child process executes), can I just use 1 wait in main which will prevent all processes created from becoming zombies, or is there a different approach I should take? This is for a school project and I'm required to use fork (not exec) to create a new process for traversing sub directories and a new process for sorting each file." ]
[ "c", "fork", "wait", "child-process", "waitpid" ]
[ "Multiple forms, keep original input even though form is never used again", "in my project I have 3 forms.\n\nOn the first form is a textbox which gathers a username, which is then checked against a database and, if confirmed, logs the user into the project.\n\nOn the third form, there is a label that displays the username that was entered in the first forms' textbox. When the user is done with a project, they click a button that gives them the choice if they wish to start over...if yes is clicked, they start over from the second form (I don't want them to have to \"login\" again.\n\nThe first general run through the program works fine (first -> second -> third form)...\nMy problem is, since the first form was closed, never to be seen again, the data that was entered in the first forms' textbox is now gone and the third forms' label just displays \"label1\"\n\nIs there a way to make it so they user logs in once (the first form) and then continues on about the project (going through the second and third forms over and over again) without having to login again? And having that label KEEP the original \"username\"?\n\nThanks to everyone in advance!" ]
[ "vb.net" ]
[ "how to use sklearn when target variable is a proportion", "There are standard ways of predicting proportions such as logistic regression (without thresholding) and beta regression. There have already been discussions about this:\n\nhttp://scikit-learn-general.narkive.com/4dSCktaM/using-logistic-regression-on-a-continuous-target-variable\n\nhttp://scikit-learn-general.narkive.com/lLVQGzyl/beta-regression\n\nI cannot tell if there exists a work-around within the sklearn framework." ]
[ "python", "scikit-learn" ]
[ "What's the best way of storing and extracting files inside the .jar archive?", "I am looking for a way to store files inside the jar (and extract them), but it must work when running/debugging from Eclipse as well.\n\nexplanation:\nStoring files as in images that I want to use for an icon of a Frame. I hope it's clear now." ]
[ "java", "jar", "archive" ]
[ "F# SQLProvider - Assign NULL values to fields", "I'm loading data from an API, where certain fields have NULL values - which is expected. After I load the data (objects) into the list, I'm iterating over the list and storing each object into the database using SQLProvider.\n\nfor x in myList do\n let item = db.Dbo.Item.Create()\n item.Name <- x.Name\n item.Description <- x.Description // Description might be NULL\n\ndb.SubmitUpdates()\n\n\nHowever, this fails with the error saying that not all query parameter values are supplied.\n\nAs a workaround I now do this below, but it gets really annoying on the tables with a lot of columns.\n\nif x.Description |> isNull |> not then\n item.Description <- x.Description\n\n\nIs there a way to avoid this null-check?" ]
[ "database", "f#", "type-providers" ]
[ "Errno 13 Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-18954.pth'", "I've downloaded python 3.6.1 and I'm trying to use terminal to setup beautifulsoup4 but it keeps trying to install on python 2.7. Any help? \n\nJakes-iMac:beautifulsoup4-4.5.3 Jake$ cd /Users/Jake/Downloads/beautifulsoup4-4.5.3\nJakes-iMac:beautifulsoup4-4.5.3 Jake$ python setup.py install\nrunning install\n\nChecking .pth file support in /Library/Python/2.7/site-packages/\n\nerror: can't create or remove files in install directory\n\n\nThe following error occurred while trying to add or remove files in the\ninstallation directory:\n\n\n[Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-18954.pth'\n\n\n\nThe installation directory you specified (via --install-dir, --prefix, or\nthe distutils default setting) was:\n\n/Library/Python/2.7/site-packages/\n\n\nPerhaps your account does not have write access to this directory? If the\ninstallation directory is a system-owned directory, you may need to sign in\nas the administrator or \"root\" account. If you do not have administrative\naccess to this machine, you may wish to choose a different installation\ndirectory, preferably one that is listed in your PYTHONPATH environment\nvariable.\n\nFor information on other options, you may wish to consult the\ndocumentation at:\n\nhttps://pythonhosted.org/setuptools/easy_install.html\n\nPlease make the appropriate changes for your system and try again" ]
[ "python", "python-2.7", "beautifulsoup" ]
[ "category to binary response variable", "I am trying to convert my category to binary response variable.\n\ny.sample(5)\n\n\nOutput:\n\n7325944 Not Liable\n6817854 Liable\n7401930 Liable\n1324151 Not Liable\n3747135 Liable\nName: hearing_disposition, dtype: object\n\n\ndef convert_to_binary(x):\n if x=='Liable':\n return 0\n if x=='Not Liable':\n return 1\n\ny['hearing_disposition'] = y['hearing_disposition'].apply(convert_to_binary)\n\n\nAfter running this I got:\n\nKeyError Traceback (most recent call last)\n<ipython-input-52-c867b2f7a6b8> in <module>()\n 5 return 1\n 6 \n----> 7 y['hearing_disposition'] = y['hearing_disposition'].apply(convert_to_binary)\n\n\nI was wondering if you could give me some hints to resolve this." ]
[ "python", "python-3.x", "pandas" ]
[ "Android ADT version update throws error status", "I am writing this after struggling a lot with updating my ADT. I have tried using different eclipse, android sdk everything, but still it says me that Android SDK requires android developer toolkit version 17.0.0 or above, current version is 11.0.0.v201105251008-128486. \n\nI referred question mentioned here Android SDK requires android developer toolkit version 17.0.0 or above\n\nBut when I checked for updates again it displays a warning message stating that \n\nWarning: You are installing software that contains unsigned content. The authenticity or validity of this software cannot be established. Do you want to continue with the installation? \n\nalong with the OK and Cancel buttons.\n\nI got fed up of this, can any one tell me how to resolve this?\n\nThank you" ]
[ "android", "eclipse", "android-ndk" ]
[ "rails 4 delayed job - Running Delayed Job according to the requested url or domain", "I have a requirement in one of the application which deals with the delayed Jobs. I am running two applications using single database.\n\nHere i am facing a problem to call the domain specific delayed Jobs.\n\nFor example lets say we are running two applications with domain names abc.com and xyz.com using single database and initiated a delayed job from abc.com and set the time for call a job, as the request from xyz.com is calling milliseconds before the abc.com the job from xyz.com is initiating and job is running with wrong perameters.Here i want a solution by which we can call the delayed job according to the call from the domain or requested url. \n\nCan any one help me in this regard as i was stucked with the possibilities to handle this situations.\n\nThanks in advance" ]
[ "ruby-on-rails", "ruby-on-rails-4", "delayed-job" ]
[ "routing in asp.net mvc gives me lenght", "I'm trying to create this route: \n\nhttp://localhost:28790/Admin/Reporting/Reporting?reportName=MyReportName\n\n\nIn order to access to this Controller:\n\npublic ActionResult Reporting(string reportName){...}\n\n\nFor this, i've added this routing in the area:\n\ncontext.MapRoute(\n \"Admin_Reporting\",\n \"Admin/Reporting/Reporting/{reportName}\",\n new\n {\n reportName = UrlParameter.Optional\n }\n );\n\n\nAnd I've tested this ActionLink\n\[email protected](My Link, \"Reporting\", \"Reporting\", new { area = \"Admin\", reportName = \"reportingName\" })\n\n\nBut indeed the result is not what I expect to have:\n\nhttp://localhost:28790/Admin/Reporting/Reporting?Length=9\n\n\nWhat can I do in order to have the right URL (first URL of the post) instread of this wrong URL (latest URL of the post) ?\n\nThanks in advance for your help" ]
[ "asp.net", "asp.net-mvc", "asp.net-mvc-4", "asp.net-mvc-routing" ]
[ "How does the \"this\" syntax work?", "Is this line\n\n$(this).attr(\"id\").replace(\"_button\",\"\");\n\n\nequivalent to this one?\n\nthis.attr(\"id\").replace(\"_button\",\"\");" ]
[ "jquery" ]
[ "Registering Custom WMI C# class/event", "I have a project with a class that extend a WMI event and used to publish data through WMI. the class look like this (just few rows of the entire class):\n\n[InstrumentationClass(InstrumentationType.Instance)]\npublic class PointInstrumentation\n{\n private bool enabled = true;\n\n // static data\n public string UserName { get; set; }\n public string EffectiveUserName { get; set; }\n public string Environment { get; set; }\n public string Universe { get; set; }\n public int AppProcessId { get; set; }\n public string ProcessName { get; set; }\n public string AppHostName { get; set; }\n public string Keyword { get; set; }\n public string Version { get; set; }\n public string OrbAddress { get; set; }\n public string ApiVersion { get; set; }\n\n\n..\n\n public void Publish()\n {\n\n System.Management.Instrumentation.Instrumentation.Publish(this);\n\n\n..\n\nas you can see, its extends using attribute declation \"[InstrumentationClass(InstrumentationType.Instance)]\"\n\nmy issue is that when i register the dll, i don't see PointInstrumentation class in the WMI explorer, hence, i can't query what is being published.\n\nCan anyone please explain me what am i doing wrong and what the appropriate way to register WMI (c#) classes.\n\nThanks" ]
[ "c#", "wmi", "wmi-query" ]
[ "Take mean of feature set using openSMILE audio feature extractor", "My problem is taking mean of all features from different frames in one sample .wav file. I am trying cFunctionals in \"chroma_fft.conf\" file which belongs to latest OpenEar framework. For best explanation, i am writing these essential codes which i wrote in \"chroma_fft.conf\" and it is shown below;\n\n[componentInstances:cComponentManager]\ninstance[functL1].type = cFunctionals\n\n[functL1:cFunctional]\nreader.dmLevel = chroma\nwriter.dmLevel = func \nframeMode = full\nframeSize=0\nframeStep=0\nfunctionalsEnabled = Means\nMeans.amean = 1\n\n[csvSink:cCsvSink]\nreader.dmLevel = func\n..NOT-IMPORTANT......\n..NOT-IMPORTANT......\n\n\nHowever, when i run from command prompt in windows, i got error;\n\"(ERROR) [1] in configManager : base instance of field 'functL1.reader.dmInstance' not found in configmanager!\"\n\nVery similar code is running succesfully from \"emo_large.conf\" but this code got error. If any body knows how to use OpenSmile audio feature extractor, can give advice or answer why it has error and how to use \"cFunctionals\" properly to take mean, variance, moments etc. of large feature sets. \n\nThanks!" ]
[ "audio", "cmd", "frameworks", "feature-extraction", "feature-selection" ]
[ "Loading data from config file angular2", "I have created a GUI for retrieving data from a remote server. Now I want to try and save the settings of this GUI into a config file, so that the file settings could be changed.\n\nI have no idea how to create a config file in Angular2. I tried to looking into links on how to create and use a config file but I just found it for Java and C#. Does it exists in Angular2?" ]
[ "typescript", "angular", "configuration-files" ]
[ "json references are not preserved when deserializing data", "I am trying to load json data into my database. The data is highly structured, and has the potential for numerous elements to be repeated throughout the structure. For repeated elements, I would like to use id's and references so I don't need to duplicate code.\n\nI am currently using json.NET for the deserialization, and I can not get references to deserialize properly. I keep winding up with null values for the elements I try to populate with references.\n\nI have tried structuring the references a myriad of ways, both using id's and using URI syntax. I have gotten the same result no matter how I structure the references.\n\nHere's the c# code I am using for deserialization:\n\nString dir = Directory.GetCurrentDirectory() + \"\\\\wwwroot\\\\json\\\\\";\nString incidentJson = System.IO.File.ReadAllText(dir + \"incident_test.json\");\nIncidentArray incidents = JsonConvert.DeserializeObject<IncidentArray>(\n incidentJson\n ,new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.All }\n);\n\n\nHere's the class I am trying to deserialize the data to:\n\npublic class IncidentArray\n{\n public Incident[] Incidents { get; set; }\n}\n\npublic class Incident\n{\n public Jurisdiction Jurisdiction { get; set; }\n}\n\npublic class Jurisdiction\n{\n public String Code { get; set; }\n public String Name { get; set; }\n public String Description { get; set; }\n}\n\n\nHere's an incident_test.json that parses just fine:\n\n{\n \"incidents\": [\n {\n \"jurisdiction\": {\n \"code\": \"CD\",\n \"name\": \"City Division\",\n \"description\": \"City Division, Portland OR USA\"\n }\n }\n ]\n}\n\n\nAnd here's an incident_test.json with references. The jurisdiction comes out null in the deserialized object:\n\n{\n \"incidents\": [\n {\n \"jurisdiction\": { \"$ref\": \"1\" }\n }\n ],\n \"definitions\": {\n \"jurisdiction\": {\n \"$id\": \"1\",\n \"code\": \"CD\",\n \"name\": \"City Division\",\n \"description\": \"City Division, Portland OR USA\"\n }\n }\n}\n\n\nI would expect the object resulting from the deserialization to populate with the data in the referenced json data. As previously stated, I'm getting null instead.\n\nRESOLVED: desmondgc definitely pointed me in the right direction with his answer below, but there's a little more to it than object order. I did some more testing considering object order and placement. This deserializes and captures the reference:\n\n{\n \"incidents\": [\n {\n \"jurisdiction\": {\n \"$id\": \"1\",\n \"code\": \"CD\",\n \"name\": \"City Division\",\n \"description\": \"City Division, Portland OR USA\"\n }\n },\n {\n \"jurisdiction\": { \"$ref\": \"1\" }\n }\n ]\n}\n\n\nand if I construct the deserializer like this:\n\nIncidentArray incidents = JsonConvert.DeserializeObject<IncidentArray(\n incidentJson\n ,new JsonSerializerSettings {\n PreserveReferencesHandling = PreserveReferencesHandling.All\n ,MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead\n }\n);\n\n\nThis works too:\n\n{\n \"incidents\": [\n {\n \"jurisdiction\": {\n \"code\": \"CD\",\n \"name\": \"City Division\",\n \"$id\": \"1\",\n \"description\": \"City Division, Portland OR USA\"\n }\n },\n {\n \"jurisdiction\": { \"$ref\": \"1\" }\n }\n ]\n}\n\n\ndue to the MetadataPropertyHandling property.\n\nObviously, order matters here, and in my original test data the order was wrong. Another important factor, however, seems to be the fact that in my initial test json, the object with the reference id was not actually being deserialized because it did not match the structure of the object I was deserializing to. As a result, there was no object to copy into the reference object when the deserializer was trying to process it.\n\nSo order matters, but object structure matters as well. The id property has to mark an object that the deserializer will process, and the reference object has to be in a place in the object graph where the deserializer recognizes it as the same type as the original object." ]
[ "c#", "json.net", "deserialization" ]
[ "most economic way to display formatted rich text in wpf?", "I'm looking for basically fastest way to display non-editable FlowDocument with continuous, variously decorated text.\nI know RichTextBox and usually use FlowDowcumentScrollViewer that can display FlowDocument content.\nI know TextBlock can (kind of) be fed Inlines in code, but doens't support Paragraphs etc.\n\nBut did anybody measure which of the former two are faster with different occasions (scrolling / non scrolling, long / shorter document etc.) ?\n\nOr is there some other, more effective solution ?\n\nSome people claim that FlowDowcumentScrollViewer is actually slower because it supports more (advanced) formatting scenarios. Not sure if thats true.\nOn the other hand RichTextBox has all the editing functionality etc. that drags its speed down.\n\nAs Im currently writing a RichText heavy application, I would be glad for any tips on this" ]
[ "c#", ".net", "wpf", "flowdocument", "richtext" ]
[ "How to write a property in the link?", "I am new to Vue.js and do a task in which I need to write a property to a link, but I don’t know how to do it? How do I write \"counter\" from \"data\" to a link so that it works.\n\nexport default {\n name: 'app',\n data () {\n return {\n counter: 1,\n }\n },\n created(){\n axios.get('http://jsonplaceholder.typicode.com/posts? \n _start=${counter}+0&_limit=10').then(response => {\n this.posts = response.data\n })\n }\n}" ]
[ "javascript", "vue.js", "axios" ]
[ "Retrieving and processing a server side value from XML at runtime", "I am trying to implement a solution to updating what a user control displays without republishing the user control itself. The UC gets xml from an external file as its content rather than storing the content in the control, so the xml is what is republished instead of the UC.\n\nThe issue is that I also have a need for the content to contain inline variables such as <% =myvariable %>. Is there a way to retrieve the xml and then run that also at runtime instead of treating it as text?\n\nThe following is just a rudimentary example with only the basics related to this issue specifically, not the full extent of the code on the page, but hopefully it is enough to illuminate what I am asking. Instead of just \"Response.Write(xmlcontent);\" is there some way I can get the value of the retrieve xml to run as if it were \"native\" to the page at runtime and process that inline variable?\n\nUser Control:\n\n<script runat=\"server\">\nstring xmlcontent = \"\";\nprotected override void OnLoad(EventArgs e)\n{\n try\n {\n XmlDocument doc = new XmlDocument();\n doc.Load(Server.MapPath(\"/usercontrols/xml/test.xml\"));\n xmlcontent = doc.SelectSingleNode(\"content\").InnerText;\n }\n\n catch\n {\n\n }\n}\n\n</script>\n\n<%if (!string.IsNullOrEmpty(xmlcontent))\n\n {\n Response.Write(xmlcontent);\n } %>\n\n\nXML:\n\n<content>\n<![CDATA[<div>This is the content. The next word is a C# variable <% =variabletest %>.</div>]]>\n</content>" ]
[ "c#", "xml" ]
[ "C# Linq Expression on Property of BindingList", "I construct a dynamic search linq expression.\n\nI'm able to count the number of records in a List but if I change the List to a BindingList I can't use the property Count in my Lambda expression. I get the following error:\n\n\n An unhandled exception of type 'System.NotSupportedException' occurred\n in EntityFramework.SqlServer.dll\n \n Additional information: The specified\n type member 'Count' is not supported in LINQ to Entities. Only\n initializers, entity members, and entity navigation properties are\n supported.\n\n\nHere is a little sample:\n\npublic class Toto \n{\nBindingList<Tata> tatas; // or List<Tata> tatas;\n}\n\n\nI make the query as following:\n\nvar c = System.Linq.Expressions.Expression.Parameter(typeof(Toto), c);\nvar member = System.Linq.Expressions.Expression.PropertyOrField(c, \"tatas\");\nvar memberCount = System.Linq.Expressions.Expression.PropertyOrField(member, \"Count\");\nvar constantValue = System.Linq.Expressions.Expression.Constant(2);\nvar countExpression = System.Linq.Expressions.Expression.Equal(memberCount, constantValue);\nvar lambdaExpression = System.Linq.Expressions.Expression.Lambda<Func<Bike, bool>>(countExpression, c);\nusing (var context = new Context())\n{\n var listResult = context.Totos.Where(lambdaExpression).ToList();\n Console.WriteLine(listResult.Count);\n}\n\n\nIf tatas is of type List this code works great but I can't figure out how I can use the Count property on BindingList to make my lambda expression work." ]
[ "c#", "linq", "lambda", "field", "bindinglist" ]
[ "How do you fool a window into believing it has focus?", "I have been trying to send mouse clicks to a WebBrowser control inside of my form using PostMessage(), and I have run into a rather significant issue. What I am trying to achieve is to simulate mouse clicks on this WebBrowser while my form is minimized. Usually PostMessage() would work just fine doing this, but it seems that it only works while my form has focus. This leads me to believe that there is some check going on to see if the particular website I am loading into my WebBrowser control is in focus before it handles mouse events.\n\nThis is how I send the clicks with my program:\n\nprivate void SendClick(Point location)\n { \n resetHandle = true;\n StringBuilder className = new StringBuilder(100);\n while (className.ToString() != \"Internet Explorer_Server\") \n {\n handle = GetWindow(handle, 5); // 5 == child\n GetClassName(handle, className, className.Capacity);\n //MessageBox.Show(className.ToString());\n }\n IntPtr lParam = (IntPtr)((location.Y << 16) | location.X); \n IntPtr wParam = IntPtr.Zero; \n const uint downCode = 0x201; \n const uint upCode = 0x202;\n const uint moveCode = 0x200;\n PostMessage(handle, moveCode, wParam, lParam); //move mouse\n PostMessage(handle, downCode, wParam, lParam); // mousedown\n PostMessage(handle, upCode, wParam, lParam); // mouseup\n }\n\n\nThis is what the resetHandle does:\n\nprivate void timer3_Tick(object sender, EventArgs e)\n {\n if (resetHandle == true)\n {\n handle = webBrowser1.Handle;\n resetHandle = false;\n }\n }\n\n\nI'm not sure if there is a better way of sending mouse events to a background window and I am open to any ideas. What I am really asking though is if it is at all possible to make a window believe it is in focus when it is actually still minimized?\n\nAny help at all would be much appreciated!" ]
[ "c#", "focus", "mouseevent", "postmessage" ]
[ "Dependency Injection - Is it better to pass a complete class, or the name of a class?", "For dependency injection, I understand that I have to pass an instance of one class to the main instance instead of the main class creating it's own instance, like so (php):\n\nclass Class_One {\n protected $_other;\n public function setOtherClass( An_Interface $other_class ) {\n $this->_other_class = $other_class;\n }\n public function doWhateverYouHaveToDoWithTheOtherClass() {\n $this->_other_class->doYourThing();\n }\n}\n\ninterface An_Interface {\n public function doYourThing();\n}\n\nclass Class_Two implements An_Interface {\n public function doYourThing() { }\n}\n\nclass Class_Three implements An_Interface {\n public function doYourThing() { }\n}\n\n\n// Implementation:\n$class_one = new Class_One();\n$class_two = new Class_Two();\n$class_three = new Class_Three();\n$class_one->setOtherClass( $class_two );\n$class_one->doWhateverYouHaveToDoWithTheOtherClass();\n$class_one->setOtherClass( $class_three );\n$class_one->doWhateverYouHaveToDoWithTheOtherClass();\n\n\nThis is all fine. I know that since both Class_Two and Class_Three both implement An_Interface, they can be used interchangeably in Class_One. Class_One wouldn't know the difference between them.\n\nMy question is, is it ever a good idea to, instead of passing an instance to setOtherClass, pass a string such as \"Class_Two\", and have Class_One's setOtherClass method actually create the instance itself like so:\n\nclass Class_One {\n ...\n public function setOtherClass( $other_class_name ) {\n $this->_other_class = new $other_class_name();\n }\n ...\n}\n\n\nDoes this sort of defeat the purpose of Dependency Injection, or is this completely valid? I thought this type of set up may help me with configuration, where a user can specify which class he wants to use in a string earlier on and this can later be passed to the Class_One..\n\nActually, writing this out has made me think that it's probably not a good solution, but I'll still post this in case someone can give me some good feedback on why I should/shouldn't do this.\n\nThanks =)\n\nRyan" ]
[ "php", "interface", "dependency-injection", "decoupling" ]
[ "php preg_match, matching when 2 words might come in random sequence", "Is it possible to match two words that might come in random sequences?\nExamples:\n\n$title = \"2 pcs watch for couple\";\n$title = \"couple watch 2 pcs\";\n\n\nCurrently I'm using two regexes:\n\nif (preg_match(\"/2( )?pcs/i\", $title) and preg_match(\"/couple/i\", $title))\n\n\nJust want to know if it can be done with only 1?" ]
[ "php", "regex", "preg-match" ]
[ "Read stored file line by line in postgresql carrierwave", "I am using carrierwave-postgresql to store user uploaded files.\n\nI have an uploader called FileUploader (in /app/uploaders/file_uploader.rb) with storage :postgresql_lo.\n\nThe uploaded files are linked to a column :file_oid in a model called UploadedFile (in app/models/uploaded_file.rb) with mount_uploader :file_oid, FileUploader:\n\nclass UploadedFile < ActiveRecord::Base\n attr_accessible :file_oid, :processed, :type\n mount_uploader :file_oid, FileUploader\nend\n\n\nI upload a file as\n\nf = UploadedFile.new\nf.file_oid = params[:flat_file]\nf.save!\n\n\nNow when I try to read a file, the read method works fine, but I can't get an 'each' or 'open'.\n\n> uf = UploadedFile.find(:first)\n> uf.file_oid.read # works, gives the contents of the file\n> uf.file_oid.file.read # this works too\n> uf.file_oid.file.each\nNoMethodError: undefined method `each' for #<CarrierWave::Storage::PostgresqlLo::File:0x000000039157a0>\n> uf.file_oid.file.open\nNoMethodError: private method `open' called for #<CarrierWave::Storage::PostgresqlLo::File:0x000000039157a0>\n> uf.file_oid.open\nNoMethodError: private method `open' called for /uploadedfile_file_oid/231132:FileUploader" ]
[ "ruby-on-rails", "ruby", "postgresql", "carrierwave" ]
[ "Website URL only displays domain name and not the subpages", "When I access my website at www.example.com, I receive the correct page. When I click on a link that accesses www.example.com/somepage.php, the server loads the new page correctly, but the URL bar still says www.example.com. In addition, the web pages do not show the <title> specified in the HTML.\n\nCould this have something to do with my using a URL Frame instead of a URL redirect through Namecheap?" ]
[ "php" ]
[ "Know selected row with responsive datatables", "I have a problem with responsive datatables. When I resize the window and button was hidden this code, used to know which row is selected, doesn't work:\n\n$('#usersTable tbody').on( 'click', 'button', function () {\n usernameSelected = (userTable.row( $(this).parents('tr') ).data().username);\n } );\n\n\nMaybe the problem is on parents('tr'), but how can I get information when table was resized? I use the returned value to recognize the button of which row is clicked. My table use ajax call like this:\n\nif ( ! $.fn.DataTable.isDataTable( '#licensesTable' ) ) {\n licenseTable = $('#licensesTable').DataTable({\n responsive: true,\n //disable order and search on column\n columnDefs: [\n {\n targets: [4,5],\n orderable: false,\n searchable: false,\n }\n ],\n //fix problem with responsive table\n \"autoWidth\": false,\n \"ajax\": \"table\",\n \"columns\": [\n { \"data\": \"user\" },\n { \"data\": \"startDate\",\n \"render\": function (data) {\n return (moment(data).format(\"DD/MM/YYYY\")); \n }\n },\n { \"data\": \"endDate\",\n \"render\": function (data) {\n return (moment(data).format(\"DD/MM/YYYY\")); \n }\n },\n { \"data\": \"counter\" },\n { data:null, render: function ( data, type, row ) {\n return '<button type=\"button\" class=\"btn btn-primary\" id=\"updadteLicense\" data-toggle=\"modal\"'\n +'data-target=\"#updateLicenseModal\">Update</button>'\n\n }\n },\n { data:null, render: function ( data, type, row ) {\n return '<button type=\"button\" class=\"btn btn-danger\" id=\"deleteLicense\" data-toggle=\"modal\"'\n +'data-target=\"#deleteLicenseModal\">Delete</button>' \n }\n }\n ],\n });\n}\nelse {\n licenseTable.ajax.url(\"table\").load();\n}\n\n\nThis is the HTML code relative datatable:\n\n<table id=\"licensesTable\"\nclass=\"table table-bordered table-striped\">\n <thead>\n <tr>\n <th>User</th>\n <th>Start date</th>\n <th>Expire date</th>\n <th>Max execution</th>\n <th>Delete</th>\n <th>Update</th>\n </tr>\n </thead>\n</table>" ]
[ "javascript", "datatables" ]
[ "Get line number from Get-PSCallStack?", "I want to add the line number to a message format method. Basically, this method is called to prepend useful information before it gets printed via Write-[Whatever level]. How do I do that?" ]
[ "powershell" ]
[ "How to change the default fromEmail in mailjet?", "I am using Mailjet service for sending email in my node application. \nHow can I change the default Sender name and email. \nI have tried to pass the fromName and fromEmail in Mailjet send api function,\nbut it doesn't work. It is showing the default fromEmail and FromName." ]
[ "mailjet" ]
[ "Objective-C. Create file at path which doesn't exist?", "For example if I want to write file.txt into /folder1/folder2/folder3/ and noone of folders exists.\n\nIs it the only way to create them manually?" ]
[ "objective-c", "directory", "exists", "file-exists", "createfile" ]
[ "Calculating a exact spline with 3 given Points in 2D. C++", "I have a std::vector with 3 points (2D) with values x >= 0 and x <= 512.\nWith these 3 points I have to calculate a draw that passes all of these 3 points.\nHere\nyou see the 3 Points and the corresponding circle. I need a function to interpolate the points based on a variable which defines the accuracy (eg the number of points inbetween).\nIf its not clear: I work in C++." ]
[ "c++", "vector", "2d", "spline" ]
[ "Odd HTML validation error", "I'm getting an odd HTML validation error from this piece of JavaScript any help appreciated, I think it may be causing a bug in the slider function that I'm working with...\n\n<script type=\"text/javascript\" charset=\"utf-8\">\n sfHover = function() {\n var sfEls = document.getElementById(\"nav2\").getElementsByTagName(\"LI\");\n for (var i=0; i<sfEls.length; i++) {\n sfEls[i].onmouseover=function() {\n this.className+=\" sfhover\";\n }\n sfEls[i].onmouseout=function() {\n this.className=this.className.replace(new RegExp(\" sfhover\\\\b\"), \"\");\n }\n }\n }\n if (window.attachEvent) window.attachEvent(\"onload\", sfHover);\n </script>\n\n\nThe errors are\n\n\n Error: character \";\" not allowed in\n attribute specification list\n\n\nand\n\n\n Error: element \"sfEls.length\"\n undefined\n\n\nfrom the line\n\n\n for (var i=0; i\n\n\nand \n\n\n Error: end tag for \"sfEls.length\"\n omitted, but OMITTAG NO was specified\n\n\nfrom the closing script tag" ]
[ "javascript" ]
[ "How to use SafeWaitHandle.DangerousGetHandle?", "I have unmanaged code that calls an asynchronous managed method that returns a handle, and then the unmanaged code uses that handle to wait.\nAccording to the documentation, SafeWaitHandle provides 2 other methods (DangerousAddRef and DangerousRelease ).\nShould I use these methods in order to prevent the Handle from not being released? As the name of the method DangerousGetHandle suggest, it seems to me that I should be very careful with something, what is so dangerous here?\n\nEdit: Is there a better way to implement this scenario (not dangerously)?" ]
[ ".net", "multithreading", "interop", "unmanaged", "handle" ]
[ "How to know which key point match which in an image", "I'm using an ORB to Featured Matching two images. One is a frame from a TV show, the other one is the logo. If the logo is within the frame, it means the TV program is on. If it's not within the frame, it means the TV is running a commercial block.\n\nIn order to do this, I've set a rectangle in the frame which contains the TV logo. Then, I'm checking which key points are contained in the rectangle section. This is the fraction of code which does that.\n\ndef pointatRectangulo(x,y,width,height,ptx,pty):\n resultado = x < ptx < x+width and y < pty < y+height\n return resultado\n\n rectX = 1100\n rectY = 600\n rectWidth = 1180 - rectX\n rectHeight = 670 - rectY\n cv2.rectangle(frame,(rectX,rectY),(1180,670),(0,255,0),3)\n\n bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)\n matches = bf.match(des1, des2)\n\n cent = False\n cont = 0\n\n for m in matches:\n frame_idx = m.queryIdx\n logo_idx = m.trainIdx\n (x1,y1) = pc1[frame_idx].pt\n (x2,y2) = pc2[logo_idx].pt\n lista_pc1.append((x1, y1))\n lista_pc2.append((x2, y2))\n\n for point in lista_pc1:\n cent = pointatRectangulo(rectX,rectY,rectWidth,rectHeight,point[0],point[1])\n if (cent == True):\n cont = cont + 1\n#if cont > 5, then the TV is running a TV show and not a commercial block.\n\n\nOf course, after thinking I had the problem solved, I noticed that I was just asking the algorithm if a key point from the original frame was in the rectangle section of that same frame, instead of asking if a key point from the logo matched with a key point from the frame within the aforementioned rectangle.\n\nI've consulted some OpenCV documentation and I don't get any solutions to perform this problem. Any ideas?" ]
[ "python", "opencv" ]