texts
sequence
tags
sequence
[ "How to bind a value to a variable using ng-init in a ng-repeat?", "I am working on a project based on angular. I am facing a problem while initialising a variable in ng-repeat.I want to initialise a variable in ng-init and use it in ng-model.I am getting following error in console. any help will be appreciated\n\nionic.bundle.js:25510 Error: [$parse:syntax] Syntax Error: Token '{' invalid key at column 6 of the expression [key={{component.name}}] starting at [{component.name}}].\nhttp://errors.angularjs.org/1.4.3/$parse/syntax?p0=%7B&p1=invalid%20key&p2=6&p3=key%3D%7B%7Bcomponent.name%7D%7D&p4=%7Bcomponent.name%7D%7D\nat http://localhost:8100/lib/ionic/js/ionic.bundle.js:13248:12\nat Object.AST.throwError (http://localhost:8100/lib/ionic/js/ionic.bundle.js:26061:11)\nat Object.AST.object (http://localhost:8100/lib/ionic/js/ionic.bundle.js:26048:16)\nat Object.AST.primary (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25956:22)\nat Object.AST.unary (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25944:19)\nat Object.AST.multiplicative (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25931:21)\nat Object.AST.additive (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25922:21)\nat Object.AST.relational (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25913:21)\nat Object.AST.equality (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25904:21)\nat Object.AST.logicalAND (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25896:21)\nat Object.AST.logicalOR (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25888:21)\nat Object.AST.ternary (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25874:21) <div ng-repeat=\"component in reportTemplate\" ng-init=\"key={{component.name}}\" class=\"inputFieldSection inputFieldTitle\" ng-if=\"component.type == 'text'\" data-ng-animate=\"1\">\n\n\nfollowing is my code snippet\n\n<div ng-repeat=\"component in reportTemplate\" ng-init=\"key={{component.name}}\" class=\"inputFieldSection inputFieldTitle\" ng-if=\"component.type == 'text'\">\n <label class=\"item item-input\">\n <input type=\"text\" name={{component.name}} ng-model=reportTemplateKeyData[key] ng-focus=\"clearValidation();\" max-length=\"50\" required placeholder=\"{{component.label}}\">\n </label>\n <p ng-show=\"createReportForm[component.name].$error.required\">Please Enter {{component.name}}</p>\n </div>" ]
[ "angularjs" ]
[ "Trouble using HashMaps with ArrayList", "I am having trouble with implementing HashMaps with ArrayListsin my java class. The thing is it keeps adding objects to the ArrayList is the HashMap even though I am not updating my HashMap.\n\nThis is the code that I can not understand how works:\n\nHashMap<String, ArrayList<String>> map = new HashMap<>();\n\nArrayList<String> array = new ArrayList<String>();\narray.add(\"One\");\narray.add(\"Two\");\n\nmap.put(\"Key\", array);\n\narray.add(\"Three\"); //2. Why does this get added to the HashMap?\n\nSystem.out.println(map1.get(\"Key\"));\n//1. This print out [One, Two, Three].. When it should be [One, Two]!" ]
[ "java", "arraylist", "hashmap" ]
[ "renaming code behind class in VS2010, does not change inherits attribute in .aspx form", "when using auto-rename functionality of vs2010 for renaming a code behind class, this does not change automatically the inherits attribute in the in the .aspx form? at least not in vs2010).\n\nExample: if you rename \"Error\" class to \"ErrorLs\" this would lead to errors not caught at compile time, due to that Inherits attribute in page tag was not automatically changed.\n\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"Error.aspx.cs\" Inherits=\"ABC.Error\" %>\n\n\nThe Error.aspx.cs after renaming Error class:\n\nnamespace ABC\n{\n public partial class ErrorLs : Page\n {\n ...\n }\n}\n\n\nSince this a common task performed by using VS IDE, does anybody knows the reason why is not by default set to change the Inherits attribute either, I am expecting too much :)?\n\nhere I found a link with the same question but no answer from Microsoft Team:\n\nhttps://connect.microsoft.com/VisualStudio/feedback/details/664505/renaming-partial-classes-via-refactor-rename-should-change-inherits-directive" ]
[ "c#", "asp.net", "visual-studio-2010" ]
[ "How to implement list view inside fragment android studio Kotlin", "How to implement list view inside fragment android studio Kotlin\nI am new to programming and I want to make my app a simple listview of names of places by region.\n\nThis is the fragment name VisayasMindanao\n\npackage com.gumangan.uecficenterslist\nimport android.os.Bundle\nimport android.support.v4.app.Fragment\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport android.widget.ArrayAdapter\nimport android.widget.ListView\n\n\nclass VisayasMindanao : Fragment(){\n\noverride fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {\n\nval centerlist = resources.getStringArray(R.array.region2)\n\n//Creating Array of Region \nvar lv = findViewById(R.id.content_main_lview) as ListView \nval adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, centerlist)\nlv.adapter = adapter\n\n return LayoutInflater.from(container?.context).inflate(R.layout.visayas_mindanao, container, false)\n}\n\n\n}\n\nThis is in my layout name visayas_mindanao\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.constraint.ConstraintLayout \nxmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"match_parent\">\n\n\n<ListView\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:id=\"@+id/visayas_mindanao_lview\"/>\n\n</android.support.constraint.ConstraintLayout>\n\n\nAnd I'm trying to get values from here\n\n<resources>\n<string name=\"region1\">\n <item>ARANAAR TI BAGGAK TI DAYA\n acarra, Ilocos Norte\n </item>\n</string>\n</resources>" ]
[ "android", "listview", "kotlin", "fragment", "implements" ]
[ "Java 8 lambdas group list into map - different key if more than one list item per key", "I have a list of relationships. Each relationship object has three variables: personA, personB and relationshipType.\n\nThe relationshipType object has two variables: relationship (Son) and relationshipPlural (Sons)\n\nI have a requirement where I need to list a person's relationships. If a person has one wife, it would be:\n\nWife <wifeName>\n\n\nIf the person has more than one son, it would be:\n\n Sons <firstSonName>\n <secondSonName>\n\n\nIs there a simple lambda expression where I can turn a list of relationships into a map<String,List<relationship>> where if the key has a list with more than one item, then the key value is the relationshipType.relationshipPlural value?\n\nThe only option I can think of is using two expresions, \n\n1) Collectors.toMap() to create a map of relationshipType, and then \n\n2) process the map to create another map where the map's key will be relationshipType.relationshipPlural if map's value is a list with more than one value.\n\nThanks in advance" ]
[ "java", "java-8", "java-stream" ]
[ "How to set Tabulator groupValues outside of initial setup", "When creating a tabulator table one can set the groupBy options using something like:\ngroupBy: ["CapType"],\ngroupValues: [["Large", "Medium", "Small", "Micro"]],\nHowever there doesn't seem to be a similar method to change the groupValues after the table has already been created, like you can using table.setGroupBy("")\nIs there a function I have missed in the docs?\nI want to do this to pretty up the group names instead of using the raw values extracted from the table." ]
[ "tabulator" ]
[ "Get owner of one file, and apply it to another", "I have this line in a script I'm creating\n\nls -l ../$_module.php | awk '{print $3}'\n\n\nWhich simply prints out the owner of a file. Is it possible to assign the $3 to a variable (let's call it _owner) so I can then run\nchmod $_owner $_con\"Controller.php\" on a file the script is creating, so $_con\"Controller.php\" has the same owner as $_module.php?" ]
[ "linux", "bash" ]
[ "how to set a color to a value in matlab?", "Assume I have a matrix with integers.\nI want to map a value to color.\nFor example, the value 0 will present as black, the value 0.5 will present as green etc.\nI tried colormap but it doesn't work as I want.\nIn colormap, when i change a value in the matrix it effects other values as well.\n\nSo how can i map a color to a value?\na cell contains 0 presented as black.\na cell contains 0.5 presented as green.\na cell contains number equal or bigger than 1 presented as yellow.\n\nThanks!" ]
[ "matlab", "map", "colors", "matrix" ]
[ "How to handle type errors when working with blobs in SQLite?", "Is there a good way to handle type errors when working with blobs in SQLite? For example, the following code registers two functions create_vector and display_vector. Basically, create_vector stores a std::vector as a blob and display_vector converts this blob into text, so that we can see it:\n\n/* In order to use\n\nsqlite> .load \"./blob.so\" \nsqlite> select display_vector(create_vector());\n[ 1.200000, 3.400000, 5.600000, 7.800000, 9.100000 ]\n\n*/\n\n#include <string>\n#include <sqlite3ext.h>\nSQLITE_EXTENSION_INIT1\n\nextern \"C\" {\n int sqlite3_blob_init(\n sqlite3 * db,\n char ** err,\n sqlite3_api_routines const * const api\n );\n}\n\n// Cleanup handler that deletes an array \ntemplate <typename T>\nvoid array_cleanup(void * v) {\n delete [] static_cast <T *> (v);\n}\n\n// Creates and returns a std::vector as a blob\nstatic void create_vector(\n sqlite3_context *context,\n int argc,\n sqlite3_value **argv\n){\n // Create a dummy vector\n auto * v = new double[5] {1.2,3.4,5.6,7.8,9.10};\n\n // Either cleanup works\n sqlite3_result_blob(context,v,sizeof(double[5]),array_cleanup <double>);\n}\n\n// Converts a std::vector into text\nstatic void display_vector(\n sqlite3_context *context,\n int argc,\n sqlite3_value **argv\n){\n // Grab the vector. Note, if this is not a vector, then sqlite will\n // almost certainly segfault.\n auto const * const v =static_cast <double const * const> (\n sqlite3_value_blob(argv[0]));\n\n // Assuming we have a vector, convert it into a string\n auto s = std::string(\"[ \");\n for(unsigned i=0;i<5;i++) {\n // If we're not on the first element, add a comma\n if(i>0) s += \", \";\n\n // Add the number\n s += std::to_string(v[i]);\n }\n s += \" ]\";\n\n // Return the text\n sqlite3_result_text(\n context,sqlite3_mprintf(\"%s\",s.c_str()),s.size(),sqlite3_free);\n}\n\n// Register our blob functions\nint sqlite3_blob_init(\n sqlite3 *db,\n char **err,\n sqlite3_api_routines const * const api\n){\n SQLITE_EXTENSION_INIT2(api)\n\n // Register the create_vector function\n if( int ret = sqlite3_create_function(\n db, \"create_vector\", 0, SQLITE_ANY, 0, create_vector, 0, 0)\n ) {\n *err=sqlite3_mprintf(\"Error registering create_vector: %s\",\n sqlite3_errmsg(db));\n return ret;\n }\n\n // Register the display_vector function\n if( int ret = sqlite3_create_function(\n db, \"display_vector\", 1, SQLITE_ANY, 0, display_vector, 0, 0)\n ) {\n *err=sqlite3_mprintf(\"Error registering display_vector: %s\",\n sqlite3_errmsg(db));\n return ret;\n }\n\n // If we've made it this far, we should be ok\n return SQLITE_OK;\n}\n\n\nWe can compile this with:\n\n$ make\ng++ -g -std=c++14 blob.cpp -shared -o blob.so -fPIC\n\n\nNow, if we use these functions as advertised, everything works fine:\n\nsqlite> .load \"./blob.so\"\nsqlite> select display_vector(create_vector());\n[ 1.200000, 3.400000, 5.600000, 7.800000, 9.100000 ]\n\n\nHowever, if we try to use display_vector on a non-vector, we segfault:\n\nsqlite> .load \"./blob.so\"\nsqlite> select display_vector(NULL);\nSegmentation fault\n\n\nReally, the issue is that the static_cast in display_vector vector is not correct. In any case, is there a good way check the type of the blob or even guarantee that we have a blob? Is there a good way to prevent a segfault when a new extension requires an input of a certain type?" ]
[ "c++", "sqlite", "casting" ]
[ "Finding a count of rows in an arbitrary date range using Oracle", "The question I need to answer is this \"What is the maximum number of page requests we have ever received in a 60 minute period?\"\n\nI have a table that looks similar to this:\n\ndate_page_requested date;\npage varchar(80);\n\n\nI'm looking for the MAX count of rows in any 60 minute timeslice.\n\nI thought analytic functions might get me there but so far I'm drawing a blank.\n\nI would love a pointer in the right direction." ]
[ "oracle", "analytic-functions" ]
[ "Schema for storing historical transaction data in Neo4J?", "I have around 200 entities that have invested in a company over the last 30 years. I have been tracking how much money they contributed over time. My database will be in Neo4J.\n\nSo far on my graph I have (1) 200 nodes representing the 200 entities that have invested and (2) 1 node representing the single company they invested in.\n\nI see two options for me to represent the capital infusions:\n\n\nI explicitly create 1,500 nodes representing each of the initial capital infusion, capital increase, etc. The nodes captures information on changes in dollar amounts, etc. Then my graph is roughly this (e:Entity)-[:PROVIDES]->(f:Financing {amount: {value}, year: {2010}})-[:PROVIDES]->(t:Target). In some way, I find this much cleaner and easier for analysis down the road but this will be a larger graph and the PROVIDES relationships are not particularly insightful.\nI represent those 1,500 financing rounds much more directly as relationships between the 200 entities and the target company\n(e:Entity)-[:FINANCING {amount: {value}, year: {2010}}]->(t:Target). In that case, I'm a bit unsure about how to handle the analysis afterwards or whether it makes sense to have say 50 FINANCING relationships between Entity X and the target company.\n\n\nThe type of analysis I'd like to do would include (1) generating the target entity ownership say in year 2004, (2) generating the evolution over time of shareholding in the target company by entity X, etc.\n\nWhat would you recommend as a solution for the schema? I know Neo4J is schema-optional but I suspect this choice between nodes and relationships matters.\n\nMany thanks!\n\nCheers" ]
[ "neo4j", "schema" ]
[ "Passing a javascript function to ReactJS.NET Server side", "I have a pretty basic, but probably complicated question.\n\nI am using ReactJS.net to render react components server side. I have a typeahead component which I use multiple times throughout my site. One of the properties it expects is a javascript filter function. \n\nI don't want to have to create a seperate component for each instance of the typeahead, but would like to pass in a javascript function as a property so that I can reuse the component throughout the site. \n\nFor example, to render a component on the server I would do the following. The second parameter is the properties argment\n\n\n @Html.React(\"Components.WorkSiteTypeahead\", new { filterFn = model.SomeFunction })\n\n\nNow as ReactJS.net expects native c# objects (string, array, list, etc), I don't see any straight forward way to pass in a Javascript function. Any ideas on how would I go about telling my MVC5 view to render my function not as a string? My first instinct is that there might be some sort of Javascript Raw type I am not aware of, but haven't been able to find it." ]
[ "c#", "reactjs.net" ]
[ "use select tags with table sorter plug in and have it default to a given value", "I have a table that has drop down boxes to allow the user to select different options. I need to show what the default selection is when the table is loaded. Here is my code so far:\n\n //get info for defect dropdown\n var myselectoptions = '';\n for(y=0;y<data.defect2.length; y++)\n {\n defect2 = data.defect2[y];\n defect3 = defect2.substring(0,30);\n myselectoptions += '<option value=\"'+data.defect_id[y]+'\">'+defect3+'</option>'; \n }\n\n if(data.isbn2 === null){\n $(\"#inventoryUpdate\").append('<tr><td>No Records Found</td></tr>');\n }else{\n for(var x=0;x<data.isbn2.length;x++)\n {\n\n $(\"#inventoryUpdate\").append('<tr><td id=\"tableSKU\">'+data.sku[x]+'</td><td id=\"tableISBN\">'+data.isbn2[x]+\n '</td><td><input type=\"text\" id=\"tableQuantity\" value=\"'+data.quantity[x]+\n '\"/></td><td><select id=\"tableDefect\">'+myselectoptions+\n '\"</select></td><td><input type=\"text\" id=\"tableSource\" value=\"'+data.source[x]+\n '\"/></td><td><input type=\"text\" id=\"tableFeature\" value=\"'+data.feature[x]+\n '\"/></td><td><input type=\"text\" id=\"tableWater\" value=\"'+data.water[x]+\n '\"/></td><td><input type=\"text\" id=\"tableLocation\" value=\"'+data.location[x]+\n '\"/></td><td><input type=\"text\" id=\"tableProcessDate\" value=\"'+data.processDate[x]+\n '\"/></td><td><input type=\"text\" id=\"tableBookType\" value=\"'+data.booktype[x]+\n '\"/></td><td><input type=\"text\" id=\"tableCreatedBy\" value=\"'+data.created[x]+\n '\"/></td><td><input type=\"text\" id=\"tableModifiedBy\" value=\"'+data.modified[x]+\n '\"/></td></tr>');\n }\n $(\"#inventoryUpdate\").trigger(\"update\");\n\n\nI know that if it was a regular drop down I could use selected=\"selected\"(which I tried to do, \n\n'<option value=\"'+data.defect_id[y]+'\"selected=\"'+data.defect[y]+'\">...\n\n\n), but how to i do that in this case? \n\nEDIT: The data for the selected is in data.defect[x]" ]
[ "jquery", "ajax", "jquery-plugins", "tablesorter" ]
[ "Create a list of dictionaries from host groups in ansible playbook", "I want to dynamically create a list of dictionaries that looks like this:\n\n[ {'host': 'hostname1', 'id': 1}, {'host': 'hostname2', 'id': 2}, ]\n\n\nAnd assign it to a variable in my playbook.\n\nThis variable is needed for a role I am using.\n\nMy attempt is the following:\n\n- hosts:\n - some-hosts\n vars:\n zk_hosts: []\n tasks:\n - name: create my var\n set_fact:\n zk_hosts: \"{{ zk_hosts + [ {'host': item.1, 'id': item.0} ] }}\"\n with_indexed_items: \"{{ groups.some-hosts }}\"\n\n\nHowever, when I run the playbook I have this warning:\n\n [WARNING]: While constructing a mapping from stack.yml, line 16, column 3, found a duplicate dict key (vars). Using last defined value only.\n\n\nAnd and error at this play:\n\nfatal: [192.168.0.21]: FAILED! => {\"failed\": true, \"msg\": \"ERROR! 'zk_hosts' is undefined\"}\n\n\nIf I don't define zk_hosts before trying to set the fact, I get an error that the variable is undefined.\n\nHow can I solve?\n\n\n\nEDIT\n\nEasy fix, I just defined zk_hosts within the same task...\n\n tasks:\n - name: create my var\n vars:\n zk_hosts: []\n set_fact:\n zk_hosts: \"{{ zk_hosts + [ {'host': item.1, 'id': item.0} ] }}\"\n with_indexed_items: \"{{ groups.some-hosts }}\"\n\n\nAnyway, if there is a less cumbersome way of achieving the same, please advise!" ]
[ "dictionary", "ansible" ]
[ "Prevent Submit Button Jquery On unique username", "Trying to check Unique Category Title Using Ajax and Jquery.\n\nJQuery and ajax stuff\n\n<script>\n$(document).ready(function(){\n$('#category_title').change(function(){\nvar category_title = $(this).val();\n$.ajax ({\nurl : \"ajax_calls.php\",\nmethod : \"POST\",\ndata : {category_title :category_title },\ndataType: \"text\",\nsuccess:function(html)\n{\n$('#availablity').html(html);\n}\n});\n});\n</script>\n\n\najax_call.php\n\n<?php\n include 'commands.php';\n if (isset($_POST['category_title'])) {\n $category_title = $_POST['category_title'];\n $obj= new commands();\n $result= $obj->check_category_title($category_title);\n if (empty($result)) {\n echo \"<span class='status-available' style='color:green;'> Username Available.</span>\";\n } else {\n echo \"<span class='status-not-available' style='color:red;'>Category Already Exist</span>\";\n }\n }\n ?>\n\n\nHTML stuff\n\n<form action=\"\" method=\"post\" id=\"my_form\" enctype=\"multipart/form-data\">\n<div class=\"form-group\">\n <label class=\"tags\">Category Title</label>\n <input type=\"text\" name=\"category_title\" class=\"form-control\" id=\"category_title\"><span id=\"availablity\"></span>\n <p class=\"errorMsg\"><?php if(isset($errorTitle) && $errorTitle== 1){echo \"Field Required\" ;} ?> </p>\n</div>\n</form>\n\n\nMySQLi stuff\n\nfunction check_category_title($category_title){\n$stmt = $this->con->prepare(\"SELECT category_title FROM `nm_category` WHERE category_title='$category_title'\");\n$stmt->execute();\n$result=$stmt->fetchAll(PDO::FETCH_ASSOC);\nreturn $result;\n}\n\n\nI want to prevent user to submit if the category already exist in table else allow user to submit" ]
[ "php", "jquery", "html", "ajax" ]
[ "Rails ajax post with simple form: why GET request?", "I'm trying to create an ajax update action with simple form and I don't know why the browser fire a \"get\" request instead of a \"patch\".\n\nIn my view I have\n\n= simple_form_for current_user, url: certificate_webex_employee_path(current_user), remote: true, html: { class: 'edit-profile' }, defaults: { label: false } do |f|\n .form-body\n .form-group.row\n .col-md-12{style: 'color: black'}\n = f.input_field :webex_certification_code, class: \"form-control\"\n\n\nMy routes.rb\n\nresources :users, controller: 'employees', path: 'employees', as: 'employees', only: [:index, :edit, :update, :show, :destroy] do\n get :performance, on: :collection\n member do\n patch :certificate_webex\n end\n end\n\n\nAnd of course in the controller I have the certificate_webex method.\n\nWhy when I submit the action is \"Request Method:GET\" ???\nThe certificate_webex method is not called by my form.\n\nedit\n\nI try also with\n\n=form_for current_user, url: certificate_webex_employee_path(current_user), method: :patch, remote: true, html: { class: 'edit-profile' }, defaults: { label: false } do |f|\n = f.text_field :webex_certification_code, class: \"form-control\"" ]
[ "ruby-on-rails" ]
[ "Can a tcp port break in hardware?", "I have a student who can start mysql like so\ndocker run -e MYSQL_ROOT_PASSWORD=my-secret-pw -dp 3306:3306 mysql:latest\n\nand connect to is on port 3000.\nAny other port works as well, however the following command leads to an authentication issue\ndocker run -e MYSQL_ROOT_PASSWORD=my-secret-pw -dp 3000:3306 mysql:latest\n\nI have no clue what this could imply. the docker container image is restartet without any volume mount. All other ports work just fine. The error is not a timeout but an auth issue.\nIs there some way that the port could break, does that even make sense?" ]
[ "mysql", "docker", "port" ]
[ "Insert an image to a table with insert command", "I have a table:\n\ncreate table Country(\nname char(30) not null primary key,\nregulations varchar(555) not null,\nimg image not null)\n\n\nHow do i insert an image with an insert command?\ni understand that for UPDATE i should use:\n\nSELECT BulkColumn \nFROM Openrowset( Bulk 'image..Path..here', Single_Blob) as img\n\n\nbut how can i insert the image with an insert command, without doing update?\nWhat should i write in the third value?\n\ninsert into Country VALUES('Usa','http://www.diving.org.il', WHAT?)" ]
[ "sql-server" ]
[ "Randomly placing images within a and ensuring uniform distribution", "I have a rectangular html div with dimensions X by Y. Lets say the center of this div is at x(c) and y(c). I have N images of dimension x(i) and y(i). The images sizes are roughly around 1/8th of the containing div and each image size is different from the rest.\n\nWhat could be a good way to place these images inside this div so that they are uniformly distributed (yet randomly placed) on each page load. Looking at a javascript implementation.\n\nEDIT: After dascandys answer, I think I could have worded the question better. I meant a random sequence of image load on each page load yet keeping the look and feel balanced." ]
[ "javascript", "html", "algorithm" ]
[ "Transition on Tooltip hover doesn't work on IE, works well in Google Chrome", "I have checked the relevant posts about transitions not working on IE but I cannot figure out what's wrong with this one.\n\n\r\n\r\n[tooltip] {\r\n position: relative;\r\n margin: 100px;\r\n}\r\n\r\n/* Arrow */\r\n[tooltip]:before {\r\n width: 16px;\r\n height: 6px;\r\n left: 50%;\r\n margin-top: 2px;\r\n top: calc(100% - 10px);\r\n content: '';\r\n position: absolute;\r\n z-index: 10;\r\n box-sizing: border-box;\r\n border-left: 8px solid transparent;\r\n border-right: 8px solid transparent;\r\n border-bottom: 10px solid #00204e;\r\n transform: translate(-50%, 0%);\r\n opacity: 0;\r\n -webkit-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);\r\n -moz-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);\r\n -ms-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);\r\n -o-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);\r\n transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);\r\n pointer-events: none;\r\n}\r\n\r\n/* Text */\r\n[tooltip]:after {\r\n transform: translate(-50%, 0%);\r\n left: 50%;\r\n margin-top: 11px;\r\n top: calc(100% - 10px);\r\n font-weight: normal;\r\n text-shadow: none;\r\n background: #00204e;\r\n border-radius: 4px;\r\n color: #fff;\r\n content: attr(tooltip);\r\n padding: 10px;\r\n position: absolute;\r\n white-space: normal;\r\n width: 150px;\r\n width: max-content;\r\n font-size: 10px;\r\n font-family: 'Helvetica Neue';\r\n line-height: normal;\r\n max-width: 150px;\r\n text-align: left;\r\n height: auto;\r\n display: inline-block;\r\n opacity: 0;\r\n -webkit-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);\r\n -moz-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);\r\n -ms-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);\r\n -o-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);\r\n transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);\r\n pointer-events: none;\r\n z-index: 10;\r\n}\r\n\r\n[tooltip]:hover {\r\n}\r\n\r\n[tooltip]:hover::before,\r\n[tooltip]:hover::after {\r\n opacity: 1;\r\n pointer-events: auto;\r\n top: calc(100% + 0px);\r\n overflow: visible;\r\n z-index: 10;\r\n}\r\n<span tooltip=\"I am a tooltip.\">Tooltip</span>\r\n\r\n\r\n\n\nWhen you hover over the tooltip, the transition effect works perfectly fine in Google Chrome but not in Internet Explorer. I have even tried adding an empty hover CSS as I searched for the similar thing for IE but that too doesn't work. Any help on this one?" ]
[ "html", "css", "internet-explorer", "css-transitions", "transition" ]
[ "MySQL | fetch_array get second of array", "I want to get the first 10 results of an array, but with the current code, it lets my one get the first one.\n\n$query = \"SELECT name FROM `table` ORDER BY `id` DESC LIMIT 10\";\n$result = mysqli_query($sql, $query);\n$row = mysqli_fetch_array($result, MYSQLI_NUM);\n\necho $row['0']; //I can do this.\necho $row['2']; // I can't do this. (It's echoing nothing).\n\n\nHow can I get number 1, 2,3 etc... from an array?\n\nThanks!" ]
[ "php", "mysql" ]
[ "How to transform HTML tags into a real text when displaying in email client?", "When I click a button, an email client pops up through javascript. Which should have prepopulated data stored in form of HTML tags from database.\n\nNow, in my email client I don't want the HTML tags to appear, but I want the real English data with HTML formatting to appear; such as for example:\n\n\n Hello User,\n \n You are invited to join the conference.\n \n Please dial 12345. // <-- here is the HTML formatting\n \n Thank you.\n\n\nHere is the similar question related to PHP." ]
[ "java", "javascript", "html" ]
[ "Programmatically adding a hyperlink to a bulleted list that IS NOT DisplayMode=Hyperlink", "I have a ASP.NET bulleted list control that, until today, was created and used only for plain text. A new design request asks that I turn SOME of those items into hyperlinks. Therefore the bulleted list will ultimately need to contain some plain text items, and some hyperlinks. If I change it to DisplayMode=Hyperlink, even if I leave the value blank, the entries that should just be plain text still become clickable links.\n\nOne solution that I think I can make work, is to use a Literal control and use HTML (<a href...) on the lines that need to be links. That will entail a little bit of re-working some old code, so before I try that I really want to know if this is possible to do with the existing BulletedList. \n\n\n\nEDIT:\n\nI seriously couldn't find anything about this anywhere, and I generally consider myself a pretty good Googler. So for the one or two lost and confused souls who find themselves in the same scenario sometime in the next decade, here is my complete implementation of the excellent answer offered below:\n\nIn the page's code-behind:\n\nforeach (SupportLog x in ordered)\n{\n blschedule.Items.Add(new ListItem(x.Headline, \"http://mysite/Support/editsupportlog.aspx?SupportLogID=\" + x.SupportLogID));\n}\n\nblschedule.DataBind();\n\n\nNote the DataBind at the end --- this is necessary to fall into the DataBound event:\n\nprotected void blschedule_DataBound(object sender, EventArgs e)\n{\n foreach (ListItem x in blschedule.Items)\n {\n if (x.Value.Contains(\"http\")) //an item that should be a link is gonna have http in it, so check for that\n {\n x.Attributes.Add(\"data-url\", x.Value);\n }\n }\n}\n\n\nIn the .aspx page's head:\n\n<script src=\"<%# ResolveClientUrl(\"~/jquery/jquery141.js\") %>\" type=\"text/javascript\"></script>\n <script>\n\n $(document).ready(function () {\n\n $('#<%=blschedule.ClientID %> li').each(function () {\n var $this = $(this);\n var attr = $this.attr('data-url');\n\n if (typeof attr !== 'undefined' && attr !== false) {\n $this.html('<a href=\"' + $this.attr('data-url') + '\">' + $this.text() + '</a>');\n }\n });\n });\n\n </script>\n\n\nThe if statement is required to make sure to only turn the items that have the \"data-url\" attribute into links, and not turn ALL items into links." ]
[ "c#", "asp.net", "controls", "web-controls", "bulletedlist" ]
[ "Talking to iFrame from ASP.NET code behind", "I found this really cool page that allows you to hook up facebook into your site: See here \n\n<iframe id=\"MyIframe\" src=\"http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.EXAMPLE.com%2F&layout=button_count&show_faces=true&width=100&action=recommend&colorscheme=light&height=21\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:100px; height:21px;\" allowTransparency=\"true\"></iframe>\n\n\nI want to be able to call this iframe in my page (I am using ASP.NET) and I want to be able to set the visibilty based on a variable and most important I want to be able to change the src of the iframe based on a string that is build up by variables to change the \"www.EXAMPLE.com\" to another URL based on the location of the page." ]
[ "c#", "asp.net", "vb.net", "facebook", "iframe" ]
[ "Delaunay: Triangulate two point sets with the best fitting mesh", "I got a cloud with randomly distributed points and another cloud with the same points but moved randomly. So each point of cloud A has a corresponding point in cloud B.\n\nNow I want to triangulate both clouds with the same triangle mesh, finding the mesh with the least intersections in both clouds.\n\nAny ideas?\n\nThanks" ]
[ "algorithm", "math", "computational-geometry", "triangulation" ]
[ "VBA conditional random serial number generator doesn’t return unique values", "I’m trying to generate unique random serial number and insert it in each cell in column \"A\" based on condition that I have a value in corresponding cell in column \"E\", I’m also using first letter from column “E” in the finished serial number. . However I get repeated values e.g.\nSYJ3068\nSYJ3068\nSNF9678\nSNF9678\nSNF9678\nSGZ5605\nSGZ5605\nSGZ5605\n\nI’ve search for solution but without success, could you please point me in the right direction, and help me fix my code so each cell gets unique serial number. With my very limited knowledge of VBA I managed to come up with this: \n\nSub SumIt()\nDim rRandom_Number As Long\nDim rRandom_1st_Letter As String\nDim rRandom_2nd_Letter As String\nDim rRandom_Serial As String \nDim CellValue As String\nDim rCell_New_Value As String\nDim RowCrnt As Integer\nDim RowMax As Integer\nDim rCell As Range\n\nWith Sheets(\"Sheet1\")\n\nRowMax = .Cells(Rows.Count, \"E\").End(xlUp).Row\n For RowCrnt = 6 To RowMax\n CellValue = .Cells(RowCrnt, 5).Value\n If Left(CellValue, 1) <> \"\" Then\n For Each rCell In Range(\"A6:A\" & RowMax)\n Rnd -1\n Randomize (Timer)\n rRandom_Number = Int((9999 + 1 - 1000) * Rnd() + 1000)\n rRandom_1st_Letter = Chr(CInt(Int((90 - 65 + 1) * Rnd() + 65)))\n rRandom_2nd_Letter = Chr(CInt(Int((90 - 65 + 1) * Rnd() + 65)))\n rRandom_Serial = _\n rRandom_1st_Letter _\n & rRandom_2nd_Letter _\n & rRandom_Number\n rCell_New_Value = UCase(Left(Trim(CellValue), 1) & rRandom_Serial)\n .Cells(RowCrnt, 1).Value = rCell_New_Value\n Next\n End If\n Next\nEnd With\nEnd Sub\n\n\nMany thanks for all your help." ]
[ "excel", "vba" ]
[ "How to avoid overwrite frame styles?", "I have such a problem, I work with laravel blade, I get the product description through it, everything works perfectly, the problem is that the product description comes with styles that cause problems in UI, the description styles are overwrite to the DOM styles, note that I am not using iframe, Is there any way to block these styles? using JS or CSS?\n\r\n\r\n <div class=\"container\">\n <h1 class=\"desc_heading\">Description</h1>\n <div style=\"pointer-events: none;\">{!! $product[\"Descr\"] !!}</div>\n </div>" ]
[ "javascript", "html", "css" ]
[ "CakePHP Querybuilder & Count Syntax", "Recently I get stuck with seemingly simple task as to output the related count number of referenced items in an query builder statement.\n\nHere the simplified code: \n\n$data = TableRegistry::getTableLocator()->get('tableA')->find()\n ->select(\n [\n 'tableA.term',\n 'tableA.termkey',\n\n 'count(tableA.termkey)' //my first though was this...but it does not work\n 'count' => TableRegistry::getTableLocator()->get('tableA')->find()->func()->count('*') //ok\n ],\n\n ) \n ->join([\n ....\n ]\n ])\n ->where(\n ....\n )->group(\n ....\n )->order(\n .... \n );\n\n\nRight now, after some documentation lookup I had finally find an solution with rather exotic syntax.\n\nTableRegistry::getTableLocator()->get('tableA')->find()->func()->count('*') //ok, works so far..but do I need this all stuff for an simple count?\n\n\nIt is really the desired approach to use a count function within an query builder? \n\nAre there any better solution than this?" ]
[ "php", "cakephp" ]
[ "Trying to figure out where my touches are, when moving a slider control", "I would like to create a variable speed slider control on the iPhone. \nBasically I am using a UISlider control but I would like to add a second dimension to this control by detecting where the finger is in the current view.\n\nE.G. A user can slide the control left and right, but I want to see where their finger is vertically in the view.\n\nMy issue is that when you are manipulating a slider control.\nThe following function is not called. \n\n- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event\n\n\nso this means I cannot detect any touch events because I assume they are being sent to the slider? Anyone tried to do this? Or should I sub class UISlider. Hmmm." ]
[ "iphone", "uislider" ]
[ "X11 and fake keyboard / mouse events", "I want to know as to how do you detect if a key press event or a mouse pointer event has been generated by an (automation like) application like xdotool. Basically, I am writing an application to check if there is no real mouse or keyboard activity. In my application I want to flag idle activity only if we don't have real mouse movement or real key press/release on the keyboard. Any reference regarding this would be great. I want to do this using pure xlib API. Don't want to use XCB. Any extensions such XRecord(which I am currently using to capture events) are fine.\n\nThanks in advance." ]
[ "linux", "ubuntu", "x11", "xlib", "xserver" ]
[ "How do you rename a workspace?", "I need to rename my workspace from \"ABC DEF\" to \"ABCDEF\", closing it and then simply renaming it in the filesystem (as suggested here, Rename a workspace in xcode 4) doesn't work as when I subsequently build it I get an error saying \"ABC DEF.xcworkspace\" is a missing file.\n\nBefore and after renaming it I cleaned the build and deleted Derived Data in Organizer, but there must be something residual somewhere called \"ABC DEF\", but where?\n\nVersion 4.5" ]
[ "xcode" ]
[ "Object Oriented Method Bridge", "Several resources in my system use the concept of Object Collections, based upon Java's Collections.\n\nThis Collection Class (abstract) provides basic functionality to another concrete class, called Lists, which allow to find Objects through Collection's Indexes.\n\nI'll use as example, my HTTP Headers Class to explain.\n\nI have, in its Constructor a instance of this Lists Class. Every HTTP Header Field is added in the Collection through Headers::addHeader() method.\n\nObviously, I have a getter method called getHeaders(), which return the Collection's Storage, not the Collection's Object.\n\nSo, if I need to list the Headers outside this class, I just have to call $obj -> getHeaders() and I have an ArrayObject with all Objects added.\n\nAlright!\n\nBut, recently, came up the necessity to use one of Lists methods, Lists::find(), which finds an Object without even know Object's name or its specific position in Collection's Storage.\n\nSince Lists object is in a private property, Headers::getHeaders() returns the Collection Storage and I don't want to violate the encapsulation, by making the property a public one, I can't access this method.\n\nEverything I code, besides the functionality, must be visually elegant, and create another getter method, let's say getHeadersLists() would produce an invocation like:\n\n$obj -> getHeadersLists() -> find( 'foo' );\n\n\nThis is ugly!\n\nSo, I quickly added a __call() in Headers Class and it worked fine:\n\n$obj -> find( 'foo' );\n\n\nBut someone I know (and he's very versed in Object Orientation theme) told me this is wrong.\n\nMy argument was purely focused on readability, and he counter-argued \"in Object Orientation, Magic Methods and Readability cannot coexist\".\n\nSo what? What should I do to create this \"bridge\" between these two classes, without use a _call() and preserving the Object Orientation's principles?\n\nI know, I could return the Collection Object in Headers::getHeaders() and use something like:\n\n$obj -> getHeaders() -> find();\n\n\nBut something I learned about Object Orientation is responsibility. The responsibility of this method, as its declaration said, it's to return all the Headers added and not an outside object." ]
[ "php", "oop" ]
[ "AWS Aurora is only recording newlines into the error log on failed logins", "Is anyone else having this problem?\n\nI have enabled Cloudwatch logging and toggled publishing to on for general, audit, slow and error logs, BUT I NEVER SEE ENTRIES FOR FAILED LOGINS.\n\nPerhaps AWS-RDS filtering on error logs is TOO aggressive!\n\nThe following example tries to log in as a bogus user and show something that does not exist (in this case the BINLOGS) \n\nThis SHOULD generate two entries for failed logins. \n\nAll I actually get is a bunch of newlines (\\n), proportional in count to the number of failed logins.\n\nsh-4.2$ mysql -utoot -pPoot -hMY_INSTANCE_NAME.cum0ld45s8ef.us-east-1.rds.amazonaws.com -e \"SHOW BINARY LOGS;\"; mysql -utoot -pPoot -hMY_INSTANCE_NAME.cum0ld45s8ef.us-east-1.rds.amazonaws.com -e \"SHOW BINARY LOGS;\"\nERROR 1045 (28000): Access denied for user 'toot'@'172.31.64.XX' (using password: YES)\nERROR 1045 (28000): Access denied for user 'toot'@'172.31.64.XX' (using password: YES)\nsh-4.2$ aws rds download-db-log-file-portion --db-instance-identifier MY_INSTANCE_NAME --no-paginate --log-file-name error/mysql-error-running.log{\n \"Marker\": \"15:106\",\n \"AdditionalDataPending\": false,\n \"LogFileData\": \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"" ]
[ "mysql", "amazon-web-services", "error-logging", "aurora" ]
[ "Open fancybox on third page", "Hi I use opening fancybox for new visitors after 5s. I would like open popup not after time, but after open third (for example) page, which he visit. How can I make it?\n\nMy solution with timeout looks like that:\n\nsetTimeout(function () {\n $.fancybox({\n autoSize: false,\n height: 'auto',\n minHeight: 300,\n width: '50%',\n href: '/index/some-page',\n type: 'iframe',\n afterLoad: function (current) {\n current.content.contents().find('.not-interest').click(function (e) {\n e.preventDefault();\n Cookies.set('not-interest', true, {expires: 14});\n $.fancybox.close();\n });\n current.content.contents().find('.some-form').submit(function () {\n var today = new Date();\n var date = new Date('Jan 1, 2038');\n var oneDay = 24 * 60 * 60 * 1000;\n var diffDays = Math.abs((date.getTime() - today.getTime()) / oneDay);\n Cookies.set('interest', true, {expires: diffDays});\n });\n },\n beforeClose: function () {\n Cookies.set('close', true, {expires: 14});\n }\n });\n}, 5000);\n\n\nMy idea is, count visit pages of user and save it to cookies. It is good way?" ]
[ "jquery", "popup", "fancybox", "fancybox-3" ]
[ "Javascript modules, passing jQuery when it may not be loaded", "I'm learning the module pattern for javascript in order to tidy up my code and reduce the need for a long 'global' javascript file.\nAs a consequence of this, I have a top level 'namespace' module, and a utility module in the same file. The utility module has some functions that require jquery, and others that do not.\n\nOn lightweight pages that use no jQuery, I don't want to load the library (I have a very good reason for not doing so).\nThe problem arises when jQuery is passed as a parameter to the module as in the following:\n\nMODULE.vars = (function (variables,$) {\n variables.cdn = undefined; //global for clientside cdn\n variables.version = undefined; //global for clientside cdn version\n variables.isTouchScreen = undefined; //global for touchscreen status\n\n //Check if jquery exists, if so patch the jquery dependent functions\n if ($) {\n $(document).ready(function () {\n variables.isTouchScreen = $('html').is('.touch');\n });\n }\n\n return variables;\n\n}(MODULE.vars || {}, jQuery));\n\n\nThe code stops on pages that I don't load jquery, stating that jQuery is undefined - fair enough. If I change the last line to:\n\n}(MODULE.vars || {}, jQuery || false));\n\n\nthe code still complains that jQuery is undefined. I thought, perhaps erroneously, that if jQuery was undefined, it would be passed as undefined in this instance and instead take up the value false (which logic dictates wouldn't be necessary anyway).\n\nHow do I get around this problem when jQuery may or may not be present? I attempted to put the following at the top of the script:\n\nvar jQuery = jQuery || false;\n\n\nthinking that this would then take up the value of jQuery if it was loaded. It works in modern browsers with this, but IE8 complains as it gets set to false even if jQuery is being loaded first on a page.\n\nThe scripts are all loaded in the correct order in the html, jQuery first, then my module afterwards.\n\nWhen checking for the cause, IE8 returns $ as an object and jQuery as false. If i do not set the above line in the script, jQuery returns as the same object as $.\n\nSadly I have to cater for IE8 as well, so how do I get around this issue of the optional presence of jQuery?\n\nEdit: This is only a snippet of the module and there are other functions that depend on jquery, but simply won't get implemented if jquery is not available" ]
[ "javascript", "jquery", "internet-explorer-8", "module" ]
[ "Why asp boilerplate says core and uses framework?", "http://www.aspnetboilerplate.com/ (APB) is a more or less popular site to get asp.net core mvc patterned project templates. Using it you can select »ASP.NET Core 1.0« template and they create a solution for you.\n\nBut digging into their project.json files I see they're requesting framework .NET 4.6.1 and NOT netstandard1.x. As of my understanding this is not .NET Core. It's .NET Framework. \n\nWhy is this? What's the »core« part of projects generated with APB?" ]
[ "asp.net", ".net" ]
[ "U-SQL + Pandas Merge_asof", "I am working with Azure Data Lake Analytics for the first time and I am unsure how to merge 2 datasets like I would with pandas in python.\n\nI am merging two datasets that have different timestamps but I need to line them up if they are within a specific timespan. This is straight forward in python.\n\nExample python code: pandas.merge_asof(trades, quotes, on='time', by='ticker', tolerance=pd.Timedelta('2ms'))\n\nFull example can be found here: click here\n\nIt seems like I can use python in my script however, I am not sure how I would get two datasets into the python function to do this merge." ]
[ "python", "pandas", "azure-data-lake", "u-sql" ]
[ "Too much CPU consumption by boost scoped_lock", "I have some code which waits for write operation on Shared Memory.\nIf no one writes it continues to wait.\n\n Test* Foo::Get() \n {\n boost::interprocess::scoped_lock<boost::interprocess::interprocess_mutex> lock ( mutex ) ; // mutex is boost::interprocess::interprocess_mutex\n if ( this->check == 0 )\n this->interprocessCondition.wait ( lock ) ; // interprocessCondition is boost::interprocess::interprocess_condition\n\n...\n }\n\n\nWhen i did sampling, I found out it consumes around 90% of CPU. \n\nCan some one help me fix this performance problem? Please see the attached image." ]
[ "c++", "macos", "boost", "mutex", "boost-interprocess" ]
[ "VBA code:: seperate column into two parts but in each part still got ascending date", "bascially, i have got a column consist of data that i want those starts with \"EMUA-I\" to be place at the front, with the ascending order of date. Then i want the \"non EMUA-I\" part to be placed at the back with the ascending order of date. \n\nplease take a look at this reference file : \nhttp://www.speedyshare.com/files/23397356/1.xls \n\nI need VBA script to perform the job as this documents need future update. \n\nThanks" ]
[ "vba", "excel" ]
[ "How to put the hr line on the specified position in div?", "div.test{width:100px;height:100px;border:1px solid red;}\n\n\nThe css will create a box with 100px width and 100px height .\nHow can draw a hr line which begins with coordinate (0,50) ,ends with coordinate(100,50) in the div.test?" ]
[ "javascript", "html", "css" ]
[ "What is the meaning of the prefix N in T-SQL statements and when should I use it?", "I have seen prefix N in some insert T-SQL queries. Many people have used N before inserting the value in a table.\n\nI searched, but I was not able to understand what is the purpose of including the N before inserting any strings into the table.\n\nINSERT INTO Personnel.Employees\nVALUES(N'29730', N'Philippe', N'Horsford', 20.05, 1),\n\n\nWhat purpose does this 'N' prefix serve, and when should it be used?" ]
[ "sql", "sql-server", "tsql" ]
[ "How to make a bacjground image not to move", "I want to ask how can I make an image/background image not to move when the phone's keyboard is available? Or at least to be cover by the keyboard or something?\n\nIn my situation when I call fro the keyboard the image is moved automatically above the keyboard and it doesn't even stay in back ground." ]
[ "android", "image", "screen" ]
[ "Windows button appearance in a VB 2008 application", "I am creating a Win32-application in Visual Basic 2008. I would like to have a button in the form, with custom color (BackColor), on MouseEnter event. This works fine, but as you can see below, this custom color doesn't cover the whole area of the button. The button border remains as standard (Windows 7). Can I somehow have this color for the whole button? I don't want to use Flat button style, I prefer this Standard style, which has the normal Windows look." ]
[ "vb.net", "button" ]
[ "The most efficient way to calculate rankings in real time games", "I want to know the fastest and most efficient way to compute points and ranking in real time.\n\nI'm doing a betting football game (a game where users try to predict the outcome of a game before it). In my country is called \"Quiniela\".\n\nPlayers put \"predictions\" just before the match starts. My question is: from the moment the game starts, which is the most efficient way (not just code level but to the database and server) to calculate the ranking for the players \"real time\" as their predictions regarding the actual outcome of the game.\n\nFor example:\n\nIf a Team1 vs Team2 plays,\nthe user U1 predicted that the game would end 0-0,\nU2 predicted the game would end 1-0,\nU3 predicted the game would would end 1-1.\n\nWhen starting the game, the U1 would be to first in the ranking because, if the match ends like this, his prediction would be correct, or at least the most accurate.\n\nThen the score switches to 1-0, and the user U1 would be the last of the ranking (because his prediction is not possible anymore), U2 would be the first and U3 second.\n\nIf the score changes to 1-1, U2 would go first, U3 would be second (because he guessed part of the result) and U3 last.\n\nI thought about creating a tree of possibilities with one level (0-0 first node, with 1-0 and 0-1 as child nodes) as you change the score, changes the Ranking \"temporarily\" and I would keep it in cache.\n\nOnce the game is over, I keep the latest Ranking in the database.\n\nThere is a more optimal way to solve this problem? \nIt has been proposed before and already solved? \nI'm using MySQL for database, PHP (Cake Php) for the server and a bunch of mobiles who ask for the ranking once in a while.\n\nSorry for my lame english =(" ]
[ "php", "mysql", "algorithm", "ranking", "ranking-functions" ]
[ "Why placeholder text is not showing of textInput field in react-native?", "I want to make a text input field where placeholder text will show \"Enter your digit\" in react-native, Now problem is, the placeholder text is not showing until i am pressing any key in the keyboard. If i elaborate then when i am running the app placeholder text is empty, if i click on text input field then keyboard appears. Now if i press any digit then it shows those digit perfectly and if i press cross button and delete all digit which i entered only that time that placeholder text shows. I am new in react-native so if someone know about the problem then please explain before answer because so far i have not got any detail about this matter. So far what i have done. \n\n<TextInput style={styles.textField} placeholder=\"Enter your digit\" placeholderTextColor= 'red' keyboardType= 'numeric'> </TextInput>" ]
[ "react-native" ]
[ "Resize a rectangle in Oxyplot", "I am using OxyPlot to plot some data. I want some mouse interaction with the plotted items.\n\nI want to re-size the rectangles in RectangleBarSeries. Something like this.\n\nI am unable to figure out the approach to proceed.\n\nI have created a sample application that enable drag and dropping of rectangular I want to move the element when I click in center of rectangle item (as currently done). And want to re-size by clicking on corners as discussed in the code project link." ]
[ "c#", "wpf", "canvas", "charts", "plot" ]
[ "Override HTML DOM element methods JS", "Short question: \n\nHow may I override DOM built-in function as document.getElementById () or build my own method, in pure JS?\n\n\n\nExplanations:\n\nI am working on an API which uses attributes to locate divs in my HTML page. \n\nI can get the attributes of a div using this method:\n\nfor (var att, i = 0, atts = div.attributes, n = atts.length; i < n; i++) {\n att = atts[i];\n nodeName = att.nodeName; \n nodeValue = att.nodeValue;\n}\n\n\n\n\nThen, I need to use this code to check the attributes of a given HTML object. I built a method which checks the document's div's attributes:\n\ndocument.getElementByIdentifier = function (identifier) {\n for (var i = 0; i < this.children.length; i++) {\n for (var att, i = 0, atts = div.attributes, n = atts.length; i < n; i++) {\n att = atts[i];\n nodeName = att.nodeName; \n nodeValue = att.nodeValue;\n // Here I check the attributes\n }\n }\n} \n\n\nHowever, I can not call this function from an HTML Dom object (except, here, the document object). I do not find how to replace document by something like allHTMLElements in my method above. The goal is to have the same freedom of usage as document.getElementById for example.\n\nHow may I do that?\n\n\n\nNote: I am very surprised because the document.getElementById seems to be located into the document object. However, when I try to build my own method into this object, it does not work. Why?\n\n\n\nOther note: This is (at least for me) an HTML DOM object:var A = document.getElementById (\"C\");. Here the object A is an HTML Dom object calls: \"object\" by google chrome when I try console.log (typeof A);. \n\n\n\nOtherwise note:\n\nThis is an example of one of my divs:\n\n<script identifier=\"OAdgRzf\"></script>\n\n\n\n\nFinally note:\n\nUse document.querySelector is the way I am already using on my library. However, I now have to run updates and tests for elements which are called by the user. I built a function which uses document.querySelector and then runs tests but it is not very pretty.\n\n\n\nTell me a comment if you have some questions." ]
[ "javascript", "dom" ]
[ "center multiple panels with flexbox", "I currently have a set of panels that while in full screen a centered correctly, when they are at a small resolution, they are not.\nBasically I have a container with around 7 panels in it:\n\n<div class\"container\">\n <div class=\"panel\"></div>\n <div class=\"panel\"></div>\n <div class=\"panel\"></div>\n <div class=\"panel\"></div>\n <div class=\"panel\"></div>\n <div class=\"panel\"></div>\n <div class=\"panel\"></div>\n</div>\n\n\nI have created a code pen to show what it looks like in full screen: \nhttps://codepen.io/r3plica/pen/XemvyW?editors=0100\n\nand in a small resolution (i.e. mobile) it looks like this:\nhttps://codepen.io/r3plica/pen/eGJOJN?editors=0100\n\nI have made the background colour pink on the second codepen. I would like the items centering in the second pen without affecting the way it looks in a large resultion.\n\nDoes anyone know how I can achieve this?" ]
[ "html", "css", "flexbox" ]
[ "Keycloak- passed parameter to meet password policy requirements", "I have defined get Keycloak method on my Symfony project.\nI am getting excepted results in the matter of array where I am extracting the list of password policies. Currently it's set just 'not username' rule:\n\nI could not find any other endpoint within keycloak in a documentation where I can pass my password string as parameter and see if it's meeting the requirements defined in password policies.\nI will provide GET function which is returning the thing I just described. I think it will do the work if it could be modified to provide password string.\npublic function validateKeycloakPassword()\n{\n $options = [\n 'headers' => $this->getAuthJsonHeaders()\n\n ];\n\n try {\n $endpoint = sprintf('auth/admin/realms/%s/', $this->realm);\n return $this->request('GET', $endpoint, $options);\n } catch (\\Exception $e) {\n $this->exception('Can`t get password policy information on Keycloak. ' . $e->getMessage());\n }\n}\n\nand in my controller, endpoint:\n /**\n * @Route("/check", name="check")\n */\npublic function validatePassword()\n{\n\n $violations = $this->service->validateKeycloakPassword();\n return $violations['passwordPolicy'];\n}\n\nTo summerize:\nIs there any endpoint in keycloak where I can pass my password variable and check if it meets requirements defined in password policies Probably with PUT method." ]
[ "php", "symfony", "keycloak", "keycloak-services", "keycloak-rest-api" ]
[ "AutoCompleteTextView: Suggest new completions after a suggestion is selected", "My AutoCompleteTextView is kind of \"word-based\". Suppose a valid completion would be:\n\nThis is a valid phrase.\n\nWhen the user enters \"T\", I don't want to suggest the whole phrase immediately. Rather I want to suggesst only \"This \".\n\nNext, when the input is \"This \", the next suggestion is \"This is \", and so on.\n\nThis works fine as long as I type in every letter manually. However, if instead of typing everything I select \"This \" from the drop down, the drop down disappears and won't suggest the follow-up.\n\nI tried with addTextChangedListener(), setOnClickListener() and setOnItemSelectedListener(), but that didn't help.\n\nHas anyone achieved this before?" ]
[ "android", "autocompletetextview" ]
[ "keyboard emulator device behavior on ubuntu", "I'm building a device driver of sorts that consumes data from a keyboard emulating device.\n\nThe device is a card swipe, so its behavior is as follows:\n\n\nUser walks up, swipes card\nI get a string of characters (key codes, really, including modifier keys for capital letters)\nI don't know how many characters I'm going to get\nI don't know when I'm getting something\n\n\nSince I don't know how many characters I'm going to get, blocking reads on the keyboard tty aren't useful - I'd end up blocking after the last character. What I'm doing is, in Ruby, using the IO module to perform async reads against the keyboard device, and using a timeout to determine that the end of data was reached. This works fine logically (even a user swiping his or her card fast will do so slower than the send rate between characters). \n\nThe issue is that sometimes, I lose data from the middle of the string. My hunch is that there's some sort of buffer overflow happening because I'm reading the data too slowly. Trying to confirm this, I inserted small waits in between each key process. Longer waits (20ms+) do exacerbate the problem. However, a wait of around 5ms actually makes it go away? The only explanation I can come up with is that the async read itself is expensive (because Ruby), and doing them without a rate limit is actually slower than doing them with a 5ms delay. \n\nDoes this sound rational? Are there other ideas on what this could be?\n\nThe ruby is actually JRuby 9000. The machine is Ubuntu LTS 16.\n\nEdit: here's a snippet of the relevant code\n\n private def read_swipe(buffer_size, card_reader_input, pause_between_reads, seconds_to_complete)\n limit = Time.now + seconds_to_complete.seconds\n swipe_data = ''\n begin\n start_time = Time.now\n sleep pause_between_reads\n batch = card_reader_input.read_nonblock(buffer_size)\n swipe_data << batch\n rescue IO::WaitReadable\n IO.select([card_reader_input], nil, nil, 0.5)\n retry unless limit < start_time\n end while start_time < limit\n swipe_data\n end\n\n\nwhere card_reader_input = File.new(event_handle, 'rb')" ]
[ "ruby", "device-driver" ]
[ "how to load and handle the meta data on server?", "I want to know that how we handle the meta data on web, for example a share a link on whatsapp like this \nAfter that whatsapp load its meta data against this link on the basis of user id .\nI want to know that what function is called on server side to get user image against the user id like this\nWhat's operation perform on server side to get the meta data on the basis of user id. in first image userId is arslankathia \nHelp me." ]
[ "javascript", "php", "html", "web", "whatsapp" ]
[ "How can i get size of an array in the called function?", "It's just a self-assessment question as a result of curiosity; so please cope with it. \n\nI know that in C we pass things by value. In case of arrays the scenario is different. We cannot pass them by their values and if we don't; a demotion from array type to pointer type will occur. We need to pass the value of the pointer to the first element of the array or pointer to the array itself. Yeah, this is what people call as array decay. As, the original type information of array is lost while passing we cannot obtain the size information of the passed array in the called routine unless we pass by reference. \n\nHave a look at the following code:\n\n#include <stdio.h>\n#include <stdlib.h>\n\nvoid cal(int (*b)[3]) \n{\n printf(\"%d\",sizeof(*b));\n}\n\nint main()\n{\n int a[3] = { 2,3,4 };\n cal( &a ); \n}\n\n\nOutput:\n\n12 \n\n\nOkay, we got what we want.\nBut what I concluded is that the number of elements in the array are always required when you declare a pointer to a non-variable array like this :\n\nint a[] = { 3, 4, 5 }; // declaring an array of size 3\nint (*p)[3]; // declaring a pointer to an array with length 3\np = &a ; // assignment\n\n\nSo, you are implicitly passing the length of the array to called function and there always exist a different way of doing it by passing an extra length argument to the called function in the case when you don't pass the reference of the array.\n\nP.S. You always need to pass the length whether you do in an explicit manner or in implicit one and it is just like hardcoding things.\n\nIs there exist an other techniques for having the size information of the passed array in the called function or I'm hitting right on the money?\nAnd, how will you deal with the dynamic ones'?" ]
[ "c", "arrays", "pointers" ]
[ "Attempting to program ATmega88PB Atmel Studio error 0xc0", "I am attempting to program an ATmega88PB using Atmel Studio 7 and both the AVRISP and Atmel ICE debugger. When attempting to read the device ID I get the following error message:\n\nFailed to enter programming mode. ispEnterProgMode: Error status received: Got 0xc0, expected 0x00 (Command has failed to execute on the tool)\n\n\nThis is on a custom board and I tried to resolder a new chip with no success. I have read that this issue may be due to a poor connector or the clock frequency being too high. I tried lowering the clock speed to 8kHz with no success. \n\nWhen I pulled out the scope I found that the MOSI , sck, and reset pins do seem to be sending properly. However, I am not seeing any response from the MISO line (stays high).\n\nDoes anyone have any other ideas that I could attempt to debug this issue?\n\nMany thanks." ]
[ "avr", "atmega", "atmel", "avr-studio7" ]
[ "VBA Copying Excel Range to Different Workbook", "I am trying to find a way to copy a range in one workbook, in this case A6:J21,to another workbook. I thought it would be something like the following...\n\ncurrentWorksheet = xlWorkBook.Sheets.Item(\"Command Group\")\nexcelRange = currentWorksheet.Range(\"A6:J21\")\nexcelDestination = newXlSheet.Range(\"A6:J21\")\nexcelRange.Copy(excelDestination)\n\n\nBut it gives me an error on excelRange.Copy(excelDestination).\n\nThe below code runs as expected, so I'm not sure where i'm going wrong here..\n\nDim xRng As Excel.Range = CType(currentWorksheet.Cells(7, 7), Excel.Range)\nConsole.WriteLine(xRng.ToString)\nDim val As Object = xRng.Value()\ntestString = val.ToString\nConsole.WriteLine(testString)\nnewXlSheet.Cells(1, 1) = testString" ]
[ "excel", "copy", "range", "paste", "vba" ]
[ "Migrate from SHA256 hashed passwords to BCRYPT in PHP7+MySQL", "I have an old web application with a few users registered that is using the unsecure hash(\"sha256\", trim($_POST[\"password\"])) to store the hashed password in MySQL database. Now I want to update the web application to use the more secure BCRYPT password_hash() however I don't want to email all registered users alerting them to change their password. So I was thinking on implementing BCRYPT on the sha256() hashed password this way:\n\nTo save the password I will sha256() hash the user's password:\n\n$hashed_password = password_hash(hash(\"sha256\", trim($_POST[\"password\"])), PASSWORD_BCRYPT);\n\n\nThen I will save the BCRYPT hashed password in the database.\n\nAnd to verify the user's password I would simply do this:\n\n$hashed_password = \"select hashed_password from users where email = '[email protected]'\";\n\nif(password_verify(hash(\"sha256\", trim($_POST[\"password\"])), $hashed_password))\n{\n echo \"Welcome\";\n}\nelse\n{\n echo \"Wrong Password!\";\n}\n\n\nThis way I will just update the user's password in the MYSQL database by looping each registered user, then I will retrieve the sha256() hashed password, and finally I will just re-save it after it has been BCRYPTed with password_hash():\n\n$new_password = password_hash($old_sha256_hashed_password, PASSWORD_BCRYPT);\n\n$mysql->save_user_password($new_password, $user_id);\n\n\nSo users will still be able to login with their old password.\n\nWhat do you think about this solution?\n\nIs it still safe even if I sha256() hash the password before BCRYPT it?" ]
[ "php", "mysql", "passwords", "bcrypt", "sha256" ]
[ "Devise and current user", "I've set up Devise to manage the authentication to my app. \n\nI have a Category model in which users create their own categories. User has_many :categories. This model has a user_id attribute, so when someone logs in and goes to categories/index for example, from the controller the query would bring categories using current_user.id to filter out which ones to bring.\n\nSo far straight forward and works well, nobody seems to be able to see someone else's categories, but to be honest, unless I'm missing something, this seems a bit insecure. How do I know some hacker will not figure it out and send his own requests modifying the params? \n\nIs this possible or am I being paranoid? Also, I might not be using the functionality properly?" ]
[ "ruby-on-rails-3", "devise" ]
[ "Expected 2D array, got scalar array instead, when using pandas dataframe", "I have trained a model as below and registered it:\ntrain_model.py\nfrom azureml.opendatasets import Diabetes\nfrom sklearn.model_selection import train_test_split\nfrom azureml.core import Run\nfrom sklearn.linear_model import Ridge\nfrom sklearn.metrics import mean_squared_error\nfrom sklearn.externals import joblib\nimport math\n\nrun_context = Run.get_context()\nx_df = Diabetes.get_tabular_dataset().to_pandas_dataframe().dropna()\ny_df = x_df.pop("Y")\nX_train, X_test, y_train, y_test = train_test_split(x_df, y_df, test_size=0.2, random_state=66)\n\nalpha= 0.1\nmodel = Ridge(alpha=alpha)\nmodel.fit(X=X_train, y=y_train)\nrmse = math.sqrt(mean_squared_error(y_true=y_test, y_pred=y_pred))\nrun_context.log('rmse', rmse)\nmodel_name = "model_alpha.pkl"\nfilename = "outputs/" + model_name\n\njoblib.dump(value=model, filename=filename)\n\nI`m have defined the run function in score.py for performing the predictions:\ndef run(raw_data): \n\n data = pd.read_json(np.array(json.loads(raw_data)['data'], orient="records")) \n y_hat = model.predict(x=data) \n return y_hat\n\nAnd try to use the registered end point to perform the predictions:\n from sklearn.model_selection import train_test_split\n from azureml.opendatasets import Diabetes\n import requests\n import pandas as pd\n\n x_df = Diabetes.get_tabular_dataset().to_pandas_dataframe().dropna()\n y_df = x_df.pop("Y")\n X_train, X_test, y_train, y_test = train_test_split(x_df, y_df, test_size=0.2, random_state=66)\n\n test_j = X_test.to_json(orient="records")\n test1= json.loads(test_j)\n test=json.dumps({"data": test1})\n\n y_hat = service.run(input_data=test)\n\nI keep getting the error:\nContent: b'Expected 2D array, got scalar array instead:\\narray={"data": [{"AGE": 54, "SEX": 2, "BMI": 27.3, "BP": 100.0, "S1": 200, "S2": 144.0, "S3": 33.0, "S4": 6.0, "S5": 4.7449, "S6": 76}]}\n\\nReshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.'\n\nI also tried:\ny_hat = model.predict(x=data.reshape(-1, 1)) \n\nAm I doing smth wrong when loading the JSON file?\nThe dataset is a dataframe and it looks like the following:\n AGE SEX BMI BP S1 S2 S3 S4 S5 S6\n377 54 2 27.3 100.00 200 144.0 33.0 6.00 4.7449 76\n96 64 2 27.3 109.00 186 107.6 38.0 5.00 5.3083 99\n235 67 2 25.0 111.67 146 93.4 33.0 4.42 4.5850 103\n246 60 1 23.4 76.67 247 148.0 65.0 3.80 5.1358 77\n19 41 1 24.7 83.00 187 108.2 60.0 3.00 4.5433 78" ]
[ "python", "azure", "regression", "azureml" ]
[ "Logout from WireCloud does not logout from KeyStone", "When logged in to WireCloud via KeyStone it is possible to click logout. But this logout button seems to only log the user out from WireCloud and not from KeyStone. Therefore if the login button is clicked, the user gets logged in as the user currently signed in to KeyStone.\n\nFrom my point of view the logout from WireCloud should also log the user out of KeyStone. Is there a way to achieve this behaviour?" ]
[ "fiware", "keystone", "fiware-wirecloud" ]
[ "Error in calc_nv[1] : object of type 'closure' is not subsettable", "I have coded a function for networth - \n\ncalc_nv <- function(a = d4$Total ,b = dl$`Reserve and Surplus`,\n c = dl$`Satuatory Reserves`, d = dl$`Satuatory Reserves`,\n e = dl$`Capital Reserves` ,f = dl$Deposits ,\n g = dl$Borrowings ,h = dl$`Other Liabilities and Provisions`){\n nv <- a - (b + c + d + e + f + g + h)\n print(nv)\n}\n\n\nWhen I use the function by running the code calc_nv[1] I get Error in calc_nv[1] : object of type 'closure' is not subsettable.\n\nIf I change the brackets from [] to (). For Eg - calc_nv(1). I get Error in b + c : non-numeric argument to binary operator. \n\nCan't understand both the errors. Kindly help." ]
[ "r", "function" ]
[ "Jquery, create table tag with custom ID, then later refer to that ID and append new tags to it", "So essentially I want to append a < table> tag to < body> with a custom ID and then later in my code refer to the table with the custom ID and append < tr>, < td>, or < th> to it.\n\nHere's an example:\n\ndataHold = data[1].split(\"@\")[1]; //just imagine this as \"yahoo.com\"\n\n if( !hold.includes( dataHold ) )\n {\n $(\"body\").append\n (\n \"<table id='\"+dataHold+\"'>\"+\n \"<tr>\"+\n \"<th>\"+dataHold+\"</th>\"+\n \"</tr>\"+\n \"</table>\"\n );\n\n $( \"#\"+dataHold ).append\n (\n \"<tr>\"+\n \"<td>\"+data[1]+\"</td>\"+\n \"<td>\"+data[2]+\"</td>\"+\n \"<td>\"+data[3]+\"</td>\"+\n \"</tr>\"\n );\n }\n\n\nIt does append the < table> tag, but for some reason the < tr> tag appending doesn't work and I can't figure out why. Any ideas?" ]
[ "javascript", "jquery" ]
[ "find and use a 'rel' link with simple_html_dom", "I am using php_simple_html_dom to parse a web site.\nAll is well until I try to access a popup dialog which contains a table with data that I need.\nOn main page is the following:\n\n <div class=\"className\" rel=\"/url-of-popup.htm?section=212\">Link</div>\n\n\nThis is a button which links to new page as a popup.\nUsing the web inspector, I have tried to drill down through all elements but I cannot get to that table.\nIf I hard code the url into my $html variable, there is no problem.\nHowever that section number (212) is different for each new page.\n\nWhat I need help with is how to have the parser find that \"rel\" link and save it in a variable so I can then access the table data.\n\nI hope that all makes sense.\nThanks" ]
[ "php", "html", "parsing" ]
[ "change the uitabbar default color tint", "i want to change the default gray tint on uitabbar when it is not selected. my problem is that i tried the following code but it only shows default gray color first time after that it changes to mu required white color tint which is actually my images color.\n\nin didFinishLaunchingWithOptions\n\n[[tabBarController.tabBar.items objectAtIndex:0] setFinishedSelectedImage:nil withFinishedUnselectedImage:[UIImage imageNamed:@\"mylib\"]];\n[[tabBarController.tabBar.items objectAtIndex:1] setFinishedSelectedImage:nil withFinishedUnselectedImage:[UIImage imageNamed:@\"explore\"]];\n[[tabBarController.tabBar.items objectAtIndex:2] setFinishedSelectedImage:nil withFinishedUnselectedImage:[UIImage imageNamed:@\"radio\"]];\n[[tabBarController.tabBar.items objectAtIndex:3] setFinishedSelectedImage:nil withFinishedUnselectedImage:[UIImage imageNamed:@\"search\"]];\n[[tabBarController.tabBar.items objectAtIndex:4] setFinishedSelectedImage:nil withFinishedUnselectedImage:[UIImage imageNamed:@\"people\"]];\n\n[[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName : [UIColor whiteColor] }forState:UIControlStateNormal];\n [[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName : [UIColor colorWithRed:(191/255.0) green:(2/255.0) blue:(6/255.0) alpha:1] }forState:UIControlStateSelected];\n [[UITabBar appearance] setTintColor:[UIColor colorWithRed:(191/255.0) green:(2/255.0) blue:(6/255.0) alpha:1]];\n\n\n\n\nplease help i want to get rid of this default gray and want it white colored." ]
[ "objective-c", "xcode", "uiviewcontroller", "uitabbarcontroller", "uitabbar" ]
[ "git merge does not trigger pre-merge-commit or post-merge hooks with option --no-commit", "I am currently in the process to add some automation after a user pulls or merge into the current branch (e.g. update user settings, build updated dependencies). I read the hook documentation and found out that pre-merge-commit / post-merge hooks would do that for me. So, the in the use case that we have no merge conflicts, i.e. the merge was successful, both hooks should trigger.\nThis works fine as long as the merge creates no changes on the working copy (as result of the merge). But if there are changes (e.g. a new file has been added) and I run the git merge command with --no-commit option, both pre-merge-commit and post-merge hooks are NOT executed.\nAt least with the pre-merge-commit hook I would expect to get the hook fired as the hook is triggered before the commit!\nIs this by design? Is there another way to trigger a script after a merge has been successful ignoring the option if I want a commit afterall?\nThanks!" ]
[ "git" ]
[ "Orchard CMS work with MediaPickerField defined in Migrations.cs", "MediaPickerFields still elude me. \n\nI've defined a new Part in Migrations.cs and added a Boolean column and a MediaPickerField to the part as follows:\n\nSchemaBuilder.CreateTable(\"ImageContentPartRecord\", table =>\n table.ContentPartRecord()\n .Column(\"DisplayImage\", DbType.Boolean));\n\nContentDefinitionManager.AlterPartDefinition(\"ImageContentPart\", builder =>\n builder\n .Attachable()\n .WithField(\"ImageField\", fld =>\n fld.OfType(\"MediaPickerField\")\n .WithDisplayName(\"Image\")));\n\n\nAssuming I have ImageContentPart and ImageContentPartRecord classes, how can I retrieve the data from my MediaPickerField (url, dimensions, alt text, class, etc) in my Driver and in my Part Templates (Edit / Display)?\n\ni.e. - Parts.ImageContent.cshtml (I want to accomplish something like this):\n\n<div>\n <img src=\"@Model.ImageField.Url\" alt=\"@Model.ImageField.Alt\" />\n</div>\n\n\nAny ideas?" ]
[ "orchardcms" ]
[ "cmap for use with line plot", "I have a list of color values (in either of the formats: hex ('#ffffff') or rgb (255,255,255) if that helps). These colors correspond explicitly with the line segment between points. Currently I plot a line as a collection of line segments via:\n\nimport matplotlib.pyplot as plt\nimport itertools\ncolors = itertools.cycle('#ffffff', '#ffffff', '#ff0320', '#452143', ...)\nt = (0, 1, 2, 3, ...)\nvar1 = (43, 15, 25, 9, ...)\nax = plt.subplot2grid((3,1), (0,0), colspan=3, rowspan=1)\n\nps = [(t,var1) for (t,var1) in zip(t, val)]\nfor start, end in zip(ps[:-1], ps[1:]):\n t, var1 = zip(start, end)\n c = next(colors) \n ax.plot(t, var1, color=c)\n\n\nHowever since I have a color for each point I would much prefer to set a cmap for the plot. How might I accomplish converting a list of colors into a cmap which I can use when plotting a line?" ]
[ "python", "numpy", "matplotlib", "plot" ]
[ "How to differentiate devices for building socket connection", "I'm currently building an application using TCP/IP connection and app establishes connection between server and client by querying an ip address from mysql database. But let's say there are\n\npeople A and B connected to a network NET_A (220.241.XXX.XXX)\n\nAND \n\npeople C and D connected to a network NET_B (221.221.xxx.xxx)\n\nand if I want A and D to be connected using some sort of ip address and B and C to be connected to each others, then what kind of ip address or method should I have to use so that those people can successfully connect to each others? I've successfully connected A and B in network NET_A using local IPv4 address achieved using following code: \n\nInetAddress thisIp =InetAddress.getLocalHost();\nSystem.out.println(\"IP:\"+thisIp.getHostAddress());\n\n\nAlso following is serversocket code: \n\n ServerSocket ss = new ServerSocket(PORT);\n ss.setSoTimeout(10000);\n connection = ss.accept();\n\n\nFollow is client socket code:\n\nconnection = new Socket(InetAddress.getByName(SERVER_IP), PORT);" ]
[ "java", "http", "sockets", "tcp", "ip" ]
[ "Change IME Option of Edittext in Recyclerview", "I am working on a Learning app, it has a Tabview so I'm working with Fragments.\nThe last fragment has buttons on top to navigate through the multiple levels. Below that there is a Recyclerview which contains a Cardview with a Question on the left and an Edittext on the right to answer.\nCurrently the IME Option is actionSend and I want to not only skip to the next Edittext but also evaluate the Answer that was given. I achieved this already by implementing an OnClickListener but it's quite annoying having to click each Cardview in the Recyclerview to get Feedback, so I want to copy it to the setOnEditorActionListener function for the Editext. The problem I have is that I don't know how to get the position of the current Cardview item (to evaluate the givenAnswer with the corresponding item in the Questionlist) in the Recyclerview without actually clicking it just by changing the Editext.\nprivate RecyclerView myrecyclerview;\nprivate ArrayList<Question> QuestionList;\nprivate QuestionAdapter recyclerAdapter;\nprivate EditText givenAnswer;\n\npublic void ClickManager(final ArrayList<Question> list){\n //works perfectly when the item is clicked\n recyclerAdapter.setOnItemClickListener(new QuestionAdapter.OnItemClickListener() {\n @Override\n public void onItemClick(final int position) {\n View itemView = myrecyclerview.getLayoutManager().findViewByPosition(position);\n final EditText givenAnswer = itemView.findViewById(R.id.answer);\n ClickEvaluation(list,givenAnswer,position);\n }\n });\n\n givenAnswer.setOnEditorActionListener(new TextView.OnEditorActionListener() {\n @Override\n public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {\n boolean handled = false;\n if (i == EditorInfo.IME_ACTION_SEND){\n ClickEvaluation(list,givenAnswer,position); //can't access any position\n handled = true;\n }\n\n return handled;\n }\n });\n }\n\nThe evaluation function:\npublic void ClickEvaluation(final ArrayList<Question> list, EditText givenAnswer, int position){\n\n Question currenQuestion = list.get(position);\n if (currenQuestion.correct(givenAnswer.getText().toString())){\n currenQuestion.gaveCorrectAnswer();\n score += 1;\n current.setText(String.format("%d",score));\n }else{\n currenQuestion.showCorrectAnswer();\n }\n givenAnswer.setText("");\n recyclerAdapter.notifyItemChanged(position);\n}\n\nThanks a lot in advance!" ]
[ "java", "android", "android-studio", "android-recyclerview", "android-edittext" ]
[ "How to prevent the enter key from making a new line in a multiple line text box?", "I want to prevent the Enter key from making a new line inside the multiple line text box using the KeyDown event. Despite clearing the textBox using textBox.Text = \"\" or textBox.Clear(), it behaves like this: http://i.imgur.com/3sknAbO.png\n\nprivate void textBox2_KeyDown(object sender, KeyEventArgs e)\n{\n if (e.KeyCode == Keys.Enter)\n {\n listBox1.Items.Add(textBox2.Text);\n textBox2.Text = \"\";\n }\n}" ]
[ "c#", "textbox" ]
[ "taglib jsf core not loading", "i am having problems getting the jsp to compile for tomcat 7. a normal jsp with no f: tags will work correctly. I have these jars in my lib folder. I am only missing a jar or anything else?\n\njars\n\n/lib/javax.servlet.jsp.jstl-api-1.2.1.jar\n/lib/jsf-api-1.2.jar\n/lib/jsp-api.jar\n/lib/jstl-1.2.jar\n/lib/myfaces-api-2.1.13.jar\n\norg.apache.jasper.JasperException: An exception occurred processing JSP page /index2.jsp \nat line 12\n\n9: <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n10: <title>Insert title here</title>\n11: <body>\n12: <f:view>\n13: \n14: </f:view>\n15: </body>\n\n\nStacktrace:\norg.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.jav a:568)\norg.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)\norg.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)\norg.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)\njavax.servlet.http.HttpServlet.service(HttpServlet.java:728)\nroot cause\n\n java.lang.NullPointerException\njavax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java :1856)\norg.apache.jsp.index2_jsp._jspx_meth_f_005fview_005f0(index2_jsp.java:105)\norg.apache.jsp.index2_jsp._jspService(index2_jsp.java:78)\norg.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)\njavax.servlet.http.HttpServlet.service(HttpServlet.java:728)\norg.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)\norg.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)\norg.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)\njavax.servlet.http.HttpServlet.service(HttpServlet.java:728)\n note The full stack trace of the root cause is available in the Apache Tomcat/7.0.35 \nlogs.\n\n\nJSP page\n\n<%@page import=\"org.apache.jasper.tagplugins.jstl.core.ForEach\"%>\n<%@ page language=\"java\" contentType=\"text/html; charset=UTF-8\" pageEncoding=\"UTF-8\"%>\n<%@ taglib prefix=\"f\" uri=\"http://java.sun.com/jsf/core\"%>\n<%@ taglib prefix=\"h\" uri=\"http://java.sun.com/jsf/html\"%>\n<%@ taglib prefix=\"c\" uri=\"http://java.sun.com/jsp/jstl/core\" %>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \n\"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n<title>Insert title here</title>\n<body>\n<f:view>\n\n</f:view>\n</body>\n</html>" ]
[ "java", "jsp", "jar", "tomcat7" ]
[ "How do you list all triggers in a MySQL database?", "What is the command to list all triggers in a MySQL database?" ]
[ "mysql", "triggers" ]
[ "Imgur API: corrective action when x-post-rate-limit-reset is -1?", "I see these response headers when I try to upload an image using the Imgur API:\nx-post-rate-limit-limit: 1250\nx-post-rate-limit-remaining: 0\nx-post-rate-limit-reset: -1\n\nThe docs describe x-post-rate-limit-reset like this:\n\nX-Post-Rate-Limit-Limit: Total POST credits that are allocated.\nX-Post-Rate-Limit-Remaining: Total POST credits available.\nX-Post-Rate-Limit-Reset: Time in seconds until your POST ratelimit is reset\n\nWhat does X-Post-Rate-Limit-Reset = -1 mean in this context, and what corrective action can I take to restore my credits?" ]
[ "api", "imgur" ]
[ "How to implemented for geographic spatial reference systems in mysql", "I want to create a buffer from 10m within a point with latitude and longitude. So I tried\n\nSET @json = ST_GeomFromGeoJSON('{\"type\": \"Point\", \"coordinates\": [139.445699080589, 35.507941895691]}');\nSELECT ST_AsText(ST_Buffer(@json,10));\n\n\nBut I got error:\n\n[22001][3618] Data truncation: st_buffer(POINT, ...) has not been implemented for geographic spatial reference systems.\n\n\nHow to implemente geographic spatial in this situation ??" ]
[ "mysql", "geometry", "buffer", "gis", "geojson" ]
[ "Is it possible to get 2 seconds delay with timer registers in Arduino?", "I'm doing one simple project right now. I need to write a code which changes the value of potentiometer after each seconds with the help of timers and ADC registers. I have used Timer0 for this task, everything is alright, but the output in Serial Monitor changes so fast, not in 2 seconds. Why is it so? \n\nMy code:\n\nvoid setup()\n{\n TCCR0A = 0; //reset the register\n TCCR0B = 0; //reset the register\n OCR0A = 0; //reset the register\n\n TCCR0A = (1 << COM0A1)|(0 << WGM01) | ( 0 << WGM00);\n TCCR0B = (1 << CS02) |(1 << CS00); //1024 prescaler \n\n ADCSRA = (1 << ADEN) | ( 1 << ADSC); \n //enabling the ADC with shifting ADEN by 1\n ADMUX = (1 << REFS0)| (1<<MUX0) | (0 << MUX1) | (1 << MUX2);\n //shifting REFS0 by 1 means setting it as AVCC\n //shifting MUX0 and MUX2 by 1 means setting A5 pin on\n\n Serial.begin(9600);\n\n}\n\nvoid loop() {\n\n int highval = ADCH; //Data Register High\n int lowwal = ADCL; //Data Register Low\n int sensval = analogRead(A5);\n\n uint8_t answer; \n answer = ((highval) * 256 + lowwal) * 5 / 1023; \n\n if(TCNT0 == 0xF1) {\n Serial.println(answer);\n }\n if(TCNT0 == 0x00) {\n Serial.println(answer);\n }\n\n}\n\nvoid timdel() {\n\n TCNT0 = 0xF1; // 2 seconds \n}" ]
[ "timer", "arduino", "adc" ]
[ "Firefox bouncy effect bug", "I have made small fiddle in here http://jsfiddle.net/DV6JA/4/\n\nI don't understand firefox. Long time age IE was a problematic browser but right now there is many bugs in firefox.\n\nWhy in this example, <.txt> element jump on bottom. I try to change font size, but it sometimes help and sometimes doesn't. \nWhen i put some sorter text in <.cnt> it sometimes doesn't jump. So where is problem for firefox?\n\nHTML:\n\n<li class='tag_glass'>\n <a>\n <p class='cnt'>999+</p>\n <p class='txt'>some txt in here</p>\n </a>\n</li>\n\n\nCSS:\n\nli a{\n display:inline-block;\n}\n\n.txt{\n float:left;\n }\n.cnt{\n font-size:9px;\n float:left;\n}\n\n\nJS:\n\n$('li a').mouseenter(function(){\n\n $(this).effect( \"bounce\",{times:3,distance:10},1000 );\n\n});" ]
[ "jquery", "css", "cross-browser" ]
[ "How to get Network Speed in WebRTC", "I have implemented WebRTC for a JavaScript video conferencing application. I need to calculate the internet speed during video/audio calls and depending on it show a message grading the connection as \nPoor/Average/Good/Excellent. Please suggest the best possible way to do this." ]
[ "javascript", "web", "webrtc" ]
[ "SFML 2.0 Targeting a player by a single turret", "At the beginning - sorry for my english (i'm still learning).\nI've created a turret which targets player. It works fine but when i'm moving around within the range of tower, turret no longer targets me. Just take a look at this code and run this in your compilator. \n\n int detection (sf::Sprite statek,sf::RectangleShape linia,sf::Texture textstatku)\n{\n sf::FloatRect rect, rect2;\n rect = linia.getGlobalBounds();\n rect2 = statek.getGlobalBounds();\n\n if(rect2.intersects(rect))\n return 1;\n else\n return 2;\n\n}\n\n\nint _tmain(int argc, _TCHAR* argv[])\n{\n\nsf::Event evente;\nsf::RenderWindow okno ( sf::VideoMode(500,500,32),\" TURRET TEST \");\nsf::Texture textturreta;\ntextturreta.loadFromFile (\"C:\\\\Users\\\\Darono\\\\C++\\\\Projekty\\\\IN PROGGRES\\\\Single turret\\\\Debug\\\\turret.png\");\nsf::CircleShape turret (20.0,100);\nturret.setTexture((sf::Texture *)&textturreta);\nturret.setPosition (240,240);\n\n\nsf::Texture Lufatext;\nLufatext.loadFromFile(\"C:\\\\Users\\\\Darono\\\\C++\\\\Projekty\\\\IN PROGGRES\\\\Single turret\\\\Debug\\\\Lufa.png\");\n\nsf::Sprite lufa;\nlufa.setTexture(Lufatext);\n\nsf::Texture gracztext;\ngracztext.loadFromFile(\"C:\\\\Users\\\\Darono\\\\C++\\\\Projekty\\\\IN PROGGRES\\\\Single turret\\\\Debug\\\\gracz.png\");\nsf::Sprite gracz(gracztext);\n\n\nint orginY=turret.getPosition().y+20;\nint orginX=turret.getPosition().x+20;\n\nlufa.setPosition(turret.getPosition().x+20,turret.getPosition().y+20);\nlufa.setOrigin (2,-20);\n\nsf::RectangleShape liniastrzalu(sf::Vector2f(1,200));\nliniastrzalu.setOrigin(0,-20);\nliniastrzalu.setPosition(turret.getPosition().x+20,turret.getPosition().y+20);\n\n\nint a =0;\nwhile (okno.isOpen())\n{\n if (gracz.getPosition().y >= turret.getPosition().y-240||gracz.getPosition().y <= turret.getPosition().y+280)\n {\n\n if (detection(gracz,liniastrzalu,textturreta)== 1)\n {\n std::cout <<\"lol\";\n }\n if (detection(gracz,liniastrzalu,textturreta)==2)\n {\n lufa.rotate(1);\n liniastrzalu.rotate(1);\n }\n\n\n }\n while (okno.pollEvent(evente))\n {\n //lufa obraca się razem z kołem\n if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))\n {\n gracz.move(-2,0);\n }\n if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))\n {\n gracz.move(2,0);\n }\n if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))\n {\n gracz.move(0,2);\n }\n if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))\n {\n gracz.move(0,-2);\n }\n\n }\n\n\n\n okno.display();\n okno.clear();\n okno.draw(turret);\n okno.draw(lufa);\n okno.draw(gracz);\n //okno.draw(liniastrzalu);\n\n\n}\n\nreturn 0;\n}" ]
[ "c++", "sfml" ]
[ "Slow query when grouping by function of a date column", "I have a fairly large table (around 80m rows) containing aggregated pricing data of the lowest price for a particular vehicle based on a particular finance profile i.e. deposit, contract term and allowed annual mileage. The lowest price is aggregated daily.\nI want to create two more tables; weekly and monthly aggregations taken from this table, updating daily.\nThis is the create table statement for the main table.\nCREATE TABLE `offers_lowest` (\n `cap_id` int(10) unsigned NOT NULL,\n `date` date DEFAULT NULL,\n `lowest_price` decimal(10,2) DEFAULT NULL,\n `deposit` tinyint(3) unsigned DEFAULT NULL,\n `term` tinyint(3) unsigned DEFAULT NULL,\n `mileage` int(11) DEFAULT NULL,\n `finance_type` enum('P','B') DEFAULT NULL,\n `offer_id` int(10) unsigned DEFAULT NULL,\n `broker_id` int(10) unsigned DEFAULT NULL,\n KEY `idx_lowest_price` (`lowest_price`),\n KEY `idx_specials_extra` (`finance_type`,`date`),\n KEY `idx_specials_id_price` (`offer_id`,`lowest_price`),\n KEY `idx_price_history` (`cap_id`,`deposit`,`term`,`mileage`,`finance_type`,`date`,`offer_id`,`broker_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n\nI've created a table for weekly aggregation. This is the query I want to use in the INSERT INTO statement:\nSELECT\n cap_id,\n DATE_ADD(date, INTERVAL(-WEEKDAY(date)) DAY),\n MIN(lowest_price) as lowest_price,\n deposit,\n term,\n mileage,\n finance_type,\n offer_id,\n broker_id\nFROM\n offers_lowest\nGROUP BY cap_id , deposit , term , mileage , finance_type , DATE_ADD(date, INTERVAL(-WEEKDAY(date)) DAY) , offer_id , broker_id\n\nThe query runs in ~50ms without the date function, but runs for minutes with it (I haven't left it long enough to find out exactly how much slower it is).\nI think my indexing is correct, unless you can index on a function of a column? I've read around on this but can't figure it out.\nShould I create a new column in the main table and fill it with the week commencing date of each date value and then create a new index? If so, what's the best way to do this? I've tried:\nALTER TABLE offers_lowest\nADD COLUMN week_start;\nUPDATE TABLE offers_lowest (week_start)\nSET week_start = DATE_ADD(date, INTERVAL(-WEEKDAY(date)) day)\n\nto no avail.\nEDIT: Ideally the week will be displayed as a date (DD/MM/YYY) and the month as the full month name." ]
[ "mysql", "sql" ]
[ "Using joins & then using only a subquery?", "Okay so I'm doing some SQL revision and I am supposed to do a query to \"use a join and not using a subquery, list the publishers who publish psychology books.\" and came up with this:\n\nSELECT DISTINCT p.pub_name, t.category\nFROM publishers p\nINNER JOIN titles t\nON p.pub_id=t.pub_id\nWHERE t.category='psychology';\n\n\nThe next part is to do it using a subquery but I'm not sure how you would do that without using joins in the subquery itself? Also how would I print out every second author?\n\nThe link is a pastebin to the database.\n\nAnd this is the schema(I'm aware of the problem with the schema in regard to the discount table, not my schema)." ]
[ "sql", "oracle", "oracle11g", "oracle-sqldeveloper" ]
[ "S3 kafka connect status api is always return not found status code", "I used S3 kafka connect.\nS3 connect works fine, but the api to detect the status of the connection always returns 404.\nFor example\nGET /connectors\nGET /connectors/{name}\nPOST /connectors\nPUT /connectors/{name}\nDELETE /connectors/{name}\n\nAll of these apis are functioning normally.\nbut API for determining the current state of connect and tasks.\nGET /connectors/{name}/status\nGET /connectors/{name}/tasks/{taskId}\n\nis not operating normally. We are always returning 404.\nIs there an option to activate that api? Or what is wrong with it?" ]
[ "apache-kafka", "apache-kafka-connect" ]
[ "Oradim for Oracle 18c not working on Windows Server 2016", "I installed Oracle 18c on a Windows Server 2016 VM with the following options: Software only, single instance database, Standard edition 2, Use virtual account.\n\nWhen I try to run ORADIM command to create a database, the command never returns control to the prompt and I have to close it forcedly.\n\nThere aren't any error messages in oradim log file, the instance has been created as well as all the related Oracle Services.\n\nThe only error I was able to find in Windows Event Viewer is related to Oracle VSS Writer service:\n\n\"Volume Shadow Copy Service error: The process that hosts the writer with name Oracle Vss Writer - XXXX and ID {yyy} does not run under a user with sufficient access rights. Consider running this process under a local account which is either Local System, Administrator, Network Service or Local Service.\"\n\nMy understanding is that ORADIM command is not returning because the Vss service start fails, can someone confirm thiscould be the case? Is ORADIM command compatible with virtual user installation and what do I need to do to have it working?" ]
[ "windows", "oracle" ]
[ "Displaying image on a Panel", "this i a snippet of my code....\n\n public void btn_browse_Click_Click(object sender, EventArgs e)\n {\n\n try\n {\n OpenFileDialog open = new OpenFileDialog();\n open.Filter = \"Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp\";\n if (open.ShowDialog() == DialogResult.OK)\n {\n scan.Enabled = true;\n pic = new Bitmap(Width, Height, PixelFormat.Format24bppRgb);\n pic2 = new Bitmap(Width, Height, PixelFormat.Format24bppRgb); \n\n pic = new Bitmap(open.FileName);\n pic2 = new Bitmap(open.FileName);\n\n pictureBox1.Image = pic;\n pictureBox2.Image = pic2;\n pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;\n textBox1.Text = open.FileName;\n pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;\n\n\n\n } // end of if opendialog\n\n\n } // end of try\n\n catch (Exception)\n {\n throw new ApplicationException(\"Failed loading image\");\n }\n\n\n }\n\n\nThe question is: Am i able to display my image browsed on a Panel instead of a PictureBox ?" ]
[ "c#", ".net", "panel", "image" ]
[ "Webpack hot reloading stops on wrong typings error", "I've got a project in React + Typescript + Webpack stack and I'm using react-data-grid package with @types/react-data-grid package. The problem is that the typings provided in @types/react-data-grid are not complete. Which results in typescript error when trying to use one of the properties. However I know this property exists and it's just the matter of incomplete typings. So I've got two issues I would like to resolve:\n\n\nAdd appropriate typings that would work together with @types/react-data-grid. Is there and option to that? That somehow typescript compiler would merge my new typings with @types/react-data-grid and stop showing the error?\nEnable Hot Reloading in Webpack. Even thought the typings error is shown ,still the bundle is created and after refreshing page while using webpack-dev-server. So I can actually develope but it would be nicer to have hot reloading. Is there an option to tell webpack-dev-server to ignore typescript errors? I just want to do it in the meantime and later fix the issue with Ad. 1.\n\n\nI am using:\n\n\"ts-loader\" : \"^4.1.0\",\n\"typescript\" : \"^2.7.2\",\n\"webpack\": \"^4.2.0\",\n\"webpack-cli\": \"^2.0.13\",\n\"webpack-dev-server\": \"^3.1.1\"" ]
[ "reactjs", "typescript", "webpack" ]
[ "Google Maps API V3: Zoom out breaks pan limitation; workaround?", "function initialize() {\n var latlng = new google.maps.LatLng(37.7702429, -122.4245789);\n\n var myOptions = {\n zoom: 3,\n center: latlng,\n disableDefaultUI: false,\n mapTypeId: google.maps.MapTypeId.TERRAIN,\n };\n\n var map = new google.maps.Map(document.getElementById(\"map_canvas\"),\n myOptions);\n\n // Limit panning\n // Latitude bounds for map, longitude not important\n var southWest = new google.maps.LatLng(-85.000, -122.591);\n var northEast = new google.maps.LatLng(85.000, -122.333);\n var allowedBounds = new google.maps.LatLngBounds(southWest, northEast);\n\n // Add a move listener to restrict the bounds range\n google.maps.event.addListener(map, \"center_changed\", function() {checkBounds(); });\n\n //If zoom out at bound limit then map breaks; center doesn't change but bounds get broken. Listen for zoom event and try to correct bound break. **Doesn't Work**\n google.maps.event.addListener(map, 'zoom_changed', function() {checkBounds(); });\n\n // If the map position is out of range, move it back\n function checkBounds() {\n\n // Perform the check and return if OK\n if ((allowedBounds.getNorthEast().lat()>(map.getBounds().getNorthEast().lat()))&&(allowedBounds.getSouthWest().lat()<(map.getBounds().getSouthWest().lat()))) {\n lastValidCenter = map.getCenter();\n lastValidZoom = map.getZoom();\n return;\n }\n\n // not valid anymore => return to last valid position\n map.panTo(lastValidCenter);\n map.setZoom(lastValidZoom);\n }\n }\n\n\nBasically I don't want the user to be able to see anything outside of the map, so I have restricted the latitudinal bounds. Works normally.\n\nThe issue is that if a user we to be viewing close to the bound limits and then zooms out so that the center doesn't change, but now the view-port bounds are outside of the bound limit, it does not correct and the map becomes unpannable.\n\nAny help you geniuses can offer is mucho appreciated ." ]
[ "google-maps", "google-maps-api-3" ]
[ "Connect Various Sensors Simultanously Via Bluetooth Serial Port on Raspberry Pi 4", "I already manage to connect a sensor via Bluetooth to a serial port on the Raspberry Pi 4 and check the data it's sending, but I can't manage to connect a second one simultaneously. What I did to connect the first one is the following:\nAdding the SP profile to the Raspberry Pi, by adding the compatibility flag and a new line on the\nfollowing file:\nsudo nano /etc/systemd/system/dbus-org.bluez.service\n\nExecStart=/usr/lib/bluetooth/bluetoothd -C\nExecStartPost=/usr/bin/sdptool add SP\n\nPaired and trust using bluetoothctl:\nbluetoothctl\npair <deviceAddress>\ntrust <deviceAddress>\nexit\n\nThen, I opened a new window and connected the device by running the following line:\nsudo rfcomm connect hci0 <deviceAddress>\n\nThen I opened a mincom window to see the data the sensor was sending:\nminicom -b 9600 -o -D /dev/rfcomm\n\nThis worked fine, but now I want to connect another sensor to a different serial port (and eventually a third sensor), so that I can simultanously see the data the two sensors are sending on two different minicom windows. I managed to pair and trust the new sensor but when I execute the folling line it gives me an error:\nsudo rfcomm connect hci0 <deviceAddress> \n\nThe error is: "Can't create RFCOMM TTY: Address already in use"\nI guess the problem might be with the hci0 but I'm not sure, as I don't completely understand what that is. I tried to use channel 2 by adding a 2 to the prior line (I don't know if this makes sense) and it didn't work either ("Can't create RFCOMM TTY: Address already in use".)\nI also tried to use another device, hci1 instead of hci0, and it says: "Can't connect RFCOMM socket: Host is down". When I run the folowing:\nhcitool dev\n\nonly hci0 appears, so I don't know if I should create another device to be able to connect another sensor or how it is done.\nSo, anyone knows a way to make several Bluetooth serial connections, so that I can see the data several sensors are sending at the same time on different minicom windows?\nThanks." ]
[ "bluetooth", "serial-port", "sensors", "raspberry-pi4" ]
[ "Insert unique values to generic list", "I am using a generic list which is getting duplicated with the values. I just want to add distinct values into the list. Below is the code I am using. Can anybody help me how to avoid duplicates into the list\n\nforeach (Questionnaire_Response questionnaireResponse in Questionnaire_Response.FindWithQuery(query))\n{\n if (questionnaireResponse.Response_Descr == response)\n {\n submitOrderResponseItems.RESP_KEY = questionnaireResponse.Response_Id;\n submitOrderResponseItems.DESCR = questionnaireResponse.Response_Descr;\n submitOrderResponseItems.UPDATED_DATE = currentDate;\n submitOrderResponseItems.UPDATED_TIME = currentDateTime;\n submitOrderResponse.Add(submitOrderResponseItems);\n } \n}" ]
[ "c#" ]
[ "Chronometer doesn't start from 00:00:00", "I have a problem with the chronometer. When I start it, it begins from 01:00:00.\nI don't know why. I think that my code is correct.\n\nCan you understand what the problem is?\n\nThis is my code:\n\nChronometer crono = new Chronometer(this);\ncrono.setBase(SystemClock.elapsedRealtime());\ncrono.start();\n\n\nWhen I print the time I call this method:\n\nlong time = SystemClock.elapsedRealtime() - totalTime.getBase();\nDate date = new Date(time);\nSimpleDateFormat formatter = new SimpleDateFormat(\"HH:mm:ss\");\nformatter.format(date);\n\n\nThanks very much!" ]
[ "java", "android", "chronometer" ]
[ "GameCenter reporting achievements Swift 3", "I'm getting a bit frustrated. I'm implementing achievements using GameCenter and Swift 3\n\nHowever I get the error.\n\nno bundle for bundleID: (null)\n\nI've been following tutorials such as those from raywenderlich.com but can't find any for Swift 3 with achievements (I have leaderboards working) so don't know if my code is incorrect, or how I can just return the bundle IDs programatically to confirm the achievement ID.\n\nTo try to get this working in ViewDidLoad I coded the following, and my ViewController is a GKGameCenterControllerDelegate\n\n var achievements = [GKAchievement]()\n let fullAchievement = GKAchievement(\n identifier: \"ReversedIDforMyApp.FullMarks\")\n achievements.append(fullAchievement)\n GameKitHelper.sharedInstance.reportAchievements(achievements: achievements)\n\n\nI created a helper to report the achievement\n\nfunc reportAchievements(achievements: [GKAchievement],\n errorHandler: ((NSError?)->Void)? = nil) {\n guard gameCenterEnabled else {\n return\n }\n GKAchievement.report(achievements,\n withCompletionHandler: errorHandler as? (Error?) -> Void)\n}\n}\n\n\nI can't work out why the error message would be displayed..." ]
[ "ios", "swift", "game-center" ]
[ "bootstrap scrollspy not working", "Here is what the problem i am facing.\n\nhttp://bittu.github.com/folderGrid/\n\nIt is highlighting last tab at first and when scrolling it switches between only two tags on each step of scroll.\n\nHere is small snippet of code i used.\n\n<body data-spy=\"scroll\" data-target=\".subnav\" data-offset=\"50\">\n\n<div class=\"subnav\">\n <ul class=\"nav nav-pills\">\n <li><a href=\"#contents\">Contents</a></li>\n <li><a href=\"#config\">Config Options</a></li>\n <li><a href=\"#usage\">Usage</a></li>\n <li><a href=\"#examples\">Examples</a></li>\n </ul>\n</div>\n\n<div class=\"row\">\n <div class=\"span12\">\n <section id=\"contents\">\n ....\n </section>\n <section id=\"config\">\n ....\n </section>\n <section id=\"usage\">\n ....\n </section>\n <section id=\"examples\">\n ....\n </section>\n </div>\n</div>\n\n\nIncluded all necessary files. and tried all numbers for data-offset" ]
[ "twitter-bootstrap", "twitter-bootstrap-2" ]
[ "How to fallback from Negotiate method to Basic only when Negotiate fails", "I have a webapplication which does the kerberos and basic authentication as well. I do not know what the client is capable of. So both auth mechanisms are sent in 401 reply.\n\nThe reply header will contain,\n\nWWW-Authenticate: Negotiate\nWWW-Authenticate: Basic realm=\"MyREALM\"\n\n\nBut, I want the client to fall back to basic auth only if negotiate fails.\n\nI want the flow should be like, \n\n\nThe client request\nServer responds with WWW-Authenticate: Negotiate\nThe client re-request with (either with wrong auth data or with some flag indicating it can't proceed)\nThe server response again with WWW-Authenticate: Basic realm=\"MYREALM\"\nClient does basic auth.\n\n\nHow can I do this? I modified the server code to do this. But the browser which is not in any domain (its supposed to do basic auth) does not respond after step2." ]
[ "http", "authentication", "browser", "basic-authentication", "negotiate" ]
[ "Fade out, apply css, fade in - JQUERY", "I'm trying to fade out the block on click, thereafter change block position, and Fade In. But it does not work. Here's the code:\n\n$(\"#info-panel\").fadeOut(\"fast\");\n\n$(\"#info-panel\").css({\n top: (new pos),\n left: (new pos)\n});\n\n$(\"#info-panel\").fadeIn(\"fast\");\n\n\nCSS:\n\n#info-panel {\n display: none;\n position: absolute;\n background-color: #333;\n border: 1px solid #999;\n padding: 15px;\n max-width: 300px;\n -webkit-border-radius: 10px;\n -moz-border-radius: 10px;\n border-radius: 10px;\n -webkit-box-shadow: inset 0px 0px 10px #000;\n -moz-box-shadow: inset 0px 0px 10px #000;\n box-shadow: inset 0px 0px 10px #000;\n border: 3px solid #666666;\n z-index: 5;\n}" ]
[ "jquery", "css", "fade" ]
[ "on editing inserting a new row instead of updating the current row in cakephp 2x", "I m having trouble in updating the student profile form,after i gave the user_id to the student profile.Every time when i try to edit the form, on saving it provide new id to the existing user. I don't know where I'm getting wrong. Plz help.Thanks in Advance.\n Here is my add and edit function in Student Profiles controller: \n\n public function add() {\n if ($this->request->is('post')) {\n $this->StudentProfile->create();\n $data = $this->request->data;\n $data['StudentProfile']['user_id'] = $this->Auth->user('id');\n // code implemented below \n //$this->loadModel('User');\n\n if ($this->StudentProfile->save($data)) {\n //Update user here if Profile saved successfully \n //$this->StudentProfile->id = $this->Auth->user('id');\n\n $this->Session->setFlash(__('Your account profile has been created'));\n $this->redirect(array('controller' => 'studentprofiles', 'action' => 'index'));\n }else{\n $this->Session->setFlash(__('Your Profile was saved, but an error has occurred while updating the Users table'));\n //Email your self the user ID here or something ??\n }\n } \n $h=array(\n\n 'fields' => array('Height.height'),\n 'recrusive' => 0\n);\n\n $this->loadModel('Height');\n $height = $this->Height->find('list',$h);\n $this->set(compact('height'));\n}\n\npublic function edit($id = null) {\n if (!$this->StudentProfile->exists($id)) {\n throw new NotFoundException(__('Invalid student profile'));\n }\n if ($this->request->is(array('post', 'put'))) {\n $this->request->data['StudentProfile']['user_id'] = $this->Auth- >user('id');\n // code implemented below \n // $this->loadModel('User');\n if ($this->StudentProfile->save($this->request->data)) {\n //$this->StudentProfile->id = $this->Auth->user('id');\n $this->Session->setFlash(__('The student profile has been saved.'), 'default', array('class' => 'alert alert-success'));\n return $this->redirect(array('action' => 'index'));\n } else {\n $this->Session->setFlash(__('The student profile could not be saved. Please, try again.'), 'default', array('class' => 'alert alert-danger'));\n }\n } else {\n $options = array('conditions' => array('StudentProfile.' . $this- >StudentProfile->primaryKey => $id));\n $this->request->data = $this->StudentProfile->find('first', $options);\n }\n $h=array(\n\n 'fields' => array('Height.height'),\n 'recrusive' => 0\n);\n\n $this->loadModel('Height');\n $height = $this->Height->find('list',$h);\n $this->set(compact('height'));\n }" ]
[ "cakephp", "edit" ]
[ "Open new file in a new gui window or by splitting the window", "How can emacs open a new file in a new gui window? And how can it be made to open by splitting a window?" ]
[ "emacs", "window", "file-browser" ]
[ "Kubernetes Replicas | Not distributing resource load equally", "I have a Python Application in Pod Foo. This has 5 replicas foo_1, foo_2, foo_3, foo_4, foo_5.\nEach Replica has been assigned resources (in Kubernetes)\nresources:\n limits:\n cpu: 1500m\n memory: 1600Mi\n requests:\n cpu: 500m\n memory: 1200Mi\n\nAfter the application is successfully deployed, I am using a Load Testing Library to simulate load, which again works fine BUT the load is not distributed equally.\nkubectl top pods\nfoo-1 1273m 489Mi \nfoo-2 279m 373Mi \nfoo-3 283m 365Mi \nfoo-4 268m 363Mi \nfoo-5 280m 374Mi \n\nIs there any configuration to make sure CPU load is divided equally amoung all Pods-replicas?\n\nHow are the requests sent:\n\nStep 1. Ingress LoadBalancer (with external IP). Ingress if from https://github.com/kubernetes/ingress-nginx/releases/download/ingress-nginx-2.5.0/ingress-nginx-2.5.0.tgz\nStep 2. NGINX Server (djnago-uwsgi-nginx stack)\nStep 3. Djnago Server is hit where the processing is done" ]
[ "kubernetes" ]
[ "In jQuery, how to use multiple delay() methods with css()?", "How can i achieve the following, understading the if there was only one delay i could use setTimeout:\n\n$(this).css().delay().css().delay().css();\n\n\nEDIT: The CSS values altered are non-numerical." ]
[ "javascript", "jquery", "javascript-events" ]
[ "HomeKit characteristic value updated notification not called to remote device", "I have this configuration:\n - iPhone A connected to a WiFi network\n - AppleTV (3th generation) connected to the same WiFi network\n - HomeKit accessory connected to the same WiFi network\n - iPhone B connected trough cellular\n\nAll the devices (iPhones and AppleTV) have the same Apple ID logged in and the WiFi network has internet connection.\n\nThe issue that we're facing is that changing a characteristic value from the iPhone A the iPhone B is not notified of that update.\nChanging a value directly from the accessory only the iPhone A is notified and not the iPhone B.\nChanging a value from the iPhone B the behavior is correct (accessory and iPhone A receives the update).\n\nWith iPhone B if I try to write or read a (readable, writable and supportsEventNotification) property the change is correctly received by the accessory and by the iPhone A.\n\nWhy can't I receive the notification of the change on the remote device? Should I do something in particular to allow this notification process?" ]
[ "ios", "objective-c", "iphone", "apple-tv", "homekit" ]
[ "aws: error: argument operation: put-bucket-lifecycle-configuration", "Getting following error for put-bucket-lifecycle-configuration :\n\n[root@ADM-PROD-OMNI noc-scripts]# aws s3api put-bucket-lifecycle-configuration --bucket noc-try --lifecycle-configuration lifecycle.json\nusage: aws [options] <command> <subcommand> [parameters]\naws: error: argument operation: Invalid choice, valid choices are:\n\nabort-multipart-upload | complete-multipart-upload\ncopy-object | create-bucket\ncreate-multipart-upload | delete-bucket\ndelete-bucket-cors | delete-bucket-lifecycle\ndelete-bucket-policy | delete-bucket-replication\ndelete-bucket-tagging | delete-bucket-website\ndelete-object | delete-objects\nget-bucket-acl | get-bucket-cors\nget-bucket-lifecycle | get-bucket-location\nget-bucket-logging | get-bucket-notification\nget-bucket-notification-configuration | get-bucket-policy\nget-bucket-replication | get-bucket-request-payment\nget-bucket-tagging | get-bucket-versioning\nget-bucket-website | get-object\nget-object-acl | get-object-torrent\nhead-bucket | head-object\nlist-buckets | list-multipart-uploads\nlist-object-versions | list-objects\nlist-parts | put-bucket-acl\nput-bucket-cors | put-bucket-lifecycle\nput-bucket-logging | put-bucket-notification\nput-bucket-notification-configuration | put-bucket-policy\nput-bucket-replication | put-bucket-request-payment\nput-bucket-tagging | put-bucket-versioning\nput-bucket-website | put-object\nput-object-acl | restore-object\nupload-part | upload-part-copy\nwait | help\n\n\nBut \n\nget-bucket-lifecycle is working this means my aws is configured :\n\n[root@ADM-PROD-OMNI noc-scripts]# aws s3api get-bucket-lifecycle --bucket 4sm-wrapup\nRULES clear multipart failed files Enabled\n\n**OR**\n\n[root@ADM-PROD-OMNI noc-scripts]# aws s3api get-bucket-lifecycle --bucket noc-try\n\nA client error (NoSuchLifecycleConfiguration) occurred when calling the GetBucketLifecycle operation: The lifecycle configuration does not exist\n\n\nAlso tried :\n\n [root@ADM-PROD-OMNI noc-scripts]# aws s3api put-bucket-lifecycle --bucket noc-try --lifecycle-configuration lifecycle.json\n\n Error parsing parameter '--lifecycle-configuration': Expected: '=', received: '.' for input:\n lifecycle.json\n ^\n\n\nPlease let me know what is wrong here ?" ]
[ "amazon-web-services", "amazon-s3", "aws-cli" ]
[ "how to use colon separated values in oracle sql where clause", "Table\n\nColA ColB\n1 Testa:testb:Testc:testd\n\n\nHow can I find matching rows based on a single value found within the colon-delimited values? I've tried this but it doesn't match rows where ColB has more than one embedded value:\n\nSelect * from Table\n Where ColB = 'testc' and ColA =1" ]
[ "sql", "oracle", "oracle-apex" ]
[ "Autofs: cifs_mount failed w/return code = -112", "So I have had a server 2008 file share mounted on my CentOs 7 server for about 3 months with no issues.\n\nToday, the mount went down and refuses to go back up. Every time i try to ls -al the mounted folder I get cifs_mount failed w/return code = -112. No updates were made on either side and I have tried taking both sides completely down and bring them back up to no avail. \n\nautofs.mymount file:\n\nmyshare -fstype=cifs,rw,noperm,credentials=/path/to/credentials ://<ip address>/share/\n\n\ncredential file:\n\nusername=user\npassword=password\ndomain=domain.local\n\n\nI am using autofs version 5.0.7" ]
[ "centos", "automount" ]
[ "How to get piece by piece data from WCF service", "I have created a .Net app which allows to query IIS logs of some web servers.\nThe app calls WCF service to get data. WCF service location has the IIS logs in place.\nThe WCF service internally calls Logparser on the IIS log files and returns the result.\nThere are multiple IIS log files.\nIf I run logparser on all of them in one go, it takes a lot of time to return as there are about 30 huge IIS log files which are queried.\nI want to run logparser on each of these IIS logs one by one and return result one by one.\n\nI am looking for a framework which works over WCF and allows piece by piece data retrieval from the WCF service.\nSo I want to get result of IISlogfile1, then of IISlogfile2, and so on.\nOtherwise the UI will have to wait for a very long time to get full result in one go.\n\nDo you know of any existing framework which allows part by part retrieval of data from WCF service?\n\nPS: The workaround I have is to call the service multiple times, once for each IIS log file, till it responses that all data is sent. But I am looking for a cleaner solution." ]
[ "wcf", "service", "logparser", "piecewise", "iis-logs" ]