texts
sequence
tags
sequence
[ "iphone sdk how to catch a long press after 1 second?", "I'm using UILongPressGestureRecognizer to catch a Long Press event. The problem is I can only respond to it after user release his finger.\n\nHow do I implement a function that will respond after user hold for x seconds?" ]
[ "iphone", "sdk", "uigesturerecognizer" ]
[ "Capitalize letter following a number using preg_replace_callback", "I want to convert a pattern like \"5a \" into \"5A \". This pattern may appear at the beginning or middle of a larger string. I've tried this:\n\n$string = preg_replace_callback(\"/(0-9)([a-z]) /\", function($matches) {\n return $matches[1].strtoupper($matches[2]).' ';\n}, $string);\n\n\nBut it doesn't work. No error - the string just stays as \"5a \". Can you see where I've gone wrong?" ]
[ "php", "regex" ]
[ "CDATA not rendering tags", "I'm trying to display XML tags mixed in with plain text on a web page. I do this from a python script that obtains it's data from a database. I've simplified my problem to the program below.\n\n#!/usr/local/bin/python\nprint \"\"\"Content-type: text/html;charset=utf-8\\n\\n\"\"\"\nprint \"\"\"<html><body>\nstart:<![CDATA[This is the <xml> tag </xml>.]]>:end\n</body></html>\"\"\"\n\n\nI'm expecting it to display the following:\n\nstart:This is the <xml> tag </xml>.:end\n\n\nIn both IE8 and Chrome15 it however displays the following:\n\nstart: tag .]]>:end\n\n\nWhen I look at the HTML source of the page in IE, I can see the following:\n\n<html><body>\nstart:<![CDATA[This is the <xml> tagxml.]]>:end\n</body></html>\n\n\nIn Chrome I see the the same when looking at the source, but it seems that the <![CDATA[This is the <xml> part is in green because it is considered a comment. \n\nI particularly want to keep the text (instead of converting the < to <) because via javascript I access the elements, allowing people to edit them in a separate textarea. Converting them would then save them converted, resulting in problems further down in processing. I could convert them back before saving, but this seems like the wrong approach.\n\nAny idea what I'm doing wrong? \n\nThanks in advance,\nGrant" ]
[ "html", "python" ]
[ "Javascript cookie variable problems", "I am trying to change the cookie on a page after a simple form is submitted. Here is the code:\n\n<script>\n\n\nfunction setnewCookie(){\n\nvar frack = $('.value').text();\nvar exp = new Date(); // make new date object\nexp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 30)); // set it 30 days ahead\n\nsetCookie(\"phoneC\", frack, exp); //save the cookie \n}\n\n\n</script>\n\n\nThe var frack = $('.value').text(); seems to be where the issue is. The .value is a class in a span tag with a simple phone number. I want to pass that phone number into the cookie. Can anyone tell me why this isnt working?" ]
[ "javascript" ]
[ "Warning while passing 2d array", "I have the following function\n\nvoid initBoard(int * board[BOARD_ROWS][BOARD_COLS]){\n int z = 0;\n for( z = 0; z<10; z+=1){\n int l;\n for( l = 0; l<10; l+=1){\n board[z][l] = 0;\n }\n }\n}\n\n\nand from main i call it like\n\n int plBoard[10][10];\n initBoard(&pcBoard);\n\n\nwhen compiling it works but i get a warning saying: warning: passing argument 1 of 'initBoard' from incompatible pointer type. array is an integer and and function expects a int pointer i am passing the address of int. What is wrong with it?" ]
[ "c", "arrays", "pointers" ]
[ "How to use SQL server time data type?", "I am using SQL server time data type, I have made an sp which returns records from that table,\nBut its throwing exception \n\n'Unable to cast object of type 'System.TimeSpan' to type 'System.IConvertible''\n\n\nI have checked the InnerException and its saying\n\n 'Input String was not in correct format'\n\n\nWhen I run my query on SQL server its running fine\nbelow is the structure of my table\n\nId bigint\nName varchar(100)\ntimefrom time(0)\ntimeto time(0)\n\n\nbelow is my sp\n\n SELECT * FROM Table1 where condition\n\n\nI am using NHibernate for data access\n\npublic System.Collections.IList GetData(long id)\n {\n string connectionStr = ConfigurationManager.ConnectionStrings[\"FNHConnection\"].ConnectionString;\n IDbConnection conn;\n conn = new SqlConnection(connectionStr);\n conn.Open();\n ISessionFactory sessionFactor = HibernateTemplate.SessionFactory;\n ISession session = sessionFactor.OpenSession(conn);\n\n var result = session.CreateSQLQuery(\"exec dbo.gen_GetData ?\")\n .SetParameter(0, id)\n .List();\n\n return result;\n }\n\n\nits throwing exception on \n\nvar result = session.CreateSQLQuery(\"exec dbo.gen_GetData ?\")\n .SetParameter(0, id)\n .List();" ]
[ "c#", "sql-server" ]
[ "How to fix the error generated while generating SPDK thread", "Hello I am new with SPDK and have done all the steps mentioned in the https://spdk.io/doc/getting_started.html completely and without observing any errors. \n\nBut when I run the following simple code on my system\n\n#include <stdio.h>\n#include <spdk/bdev.h>\n#include <spdk/thread.h>\n#include <spdk/queue.h>\n\nvoid main()\n{\n\n struct spdk_thread* first_reader_thread =\n spdk_thread_create(\"first_reader_thread\", NULL);\n\n if (first_reader_thread == NULL)\n {\n printf(\"First thread creation failed...\\n\");\n return ;\n }\n\n struct spdk_thread* second_reader_thread =\n spdk_thread_create(\"second_reader_thread\", NULL);\n if (second_reader_thread == NULL)\n {\n printf(\"Second thread creation failed...\\n\");\n return ;\n }\n\n printf(\"first reader thread id is: %\"PRIu64\"\\n\",\n spdk_thread_get_id(first_reader_thread));\n printf(\"second reader thread id is: %\"PRIu64\"\\n\",\n spdk_thread_get_id(second_reader_thread));\n printf(\"Hello World!\\n\");\n return;\n}\n\n\nI get the following error:\n\n\"RING: Cannot reserve memory for tailq, \nthread.c: 260:spdk_thread_create: ERROR: Unable to allocate memory for message ring, \nFirst thread creation failed...\"\n\nit will be appraciated if anyone can guide me to fix this error." ]
[ "linux", "multithreading", "huge-pages" ]
[ "Store old selected value in ajax, then use that value to select after page load", "So I have this code when user selects an office in the select option, another select box loads the employees in that office.\n\nMy Problem is how can I store or retain the old selected value from the employee when the 'Confirm' button is pressed and the page loads and then use that old value to select again the same current value if the office is not changed?\n\nHere is the code:\n\n$( document ).ready(function() {\n\n var $option = $('#office_id').find('option:selected');\n var value = $option.val();\n updateSalesDay(value);\n\n $('#office_id').change(function(e){\n var $option = $(this).find('option:selected');\n //Added with the EDIT\n var value = $option.val();\n updateSalesDay(value);\n console.log(value);\n });\n});\n\nfunction updateSalesDay(office_id){\n $('.load-bar').css('display','block');\n $('.panel-body').css('pointer-events','none');\n\n $('#employee_id').empty();\n\n $.ajax({\n type: \"POST\",\n headers: { 'X-CSRF-TOKEN': $('[name=\"csrf-token\"]').attr('content') },\n url: \"{{ route('postFilterEmployee') }}\",\n data: {\n 'office_id': office_id\n },\n dataType: 'json',\n success: function (data) {\n console.log(data);\n employeesList = data;\n\n if (employeesList.length === 0) {\n $('#employee_id').append('<option></option>');\n }else{\n $('#employee_id').append('<option></option>');\n for (index = 0; index < employeesList.length; index++) {\n $('#employee_id').append('<option value=\"'+employeesList[index].id+'\">'+employeesList[index].last_name+' '+employeesList[index].first_name+'</option>');\n }\n }\n $('.load-bar').css('display','none');\n $('.panel-body').css('pointer-events','');\n },\n error: function (data) {\n console.log(data);\n }\n });\n}\n\n\nAny ajax masters here? Please help." ]
[ "javascript", "jquery", "ajax" ]
[ "how to terminate a process created by CreateProcess()?", "I have created a process using CreateProcess(). This is the code:\n\nSTARTUPINFO si = {0};\nPROCESS_INFORMATION pi = {0};\nresult = CreateProcess(\"C:\\\\AP\\\\DatabaseBase\\\\dbntsrv.exe\", NULL, NULL, NULL, FALSE, 0, NULL, \"C:\\\\ADP\\\\SQLBase\", &si, &pi)\n\n\nHow can I get the Handle and processId of this specific process? And eventually use it to close this process?\nThank You." ]
[ "c++", "winapi", "visual-c++", "mfc", "createprocess" ]
[ "How to call a Win 8 project from a Winforms project?", "I have an existing Winforms project that currently runs on our Win 7 machines. Now I need to add camera access to it so that we can also run it on Win 8.1 tablets and take photos.\n\nI understand that I can build WPF application for Win 8.1 to access camera.\nI know that I can run my Winforms application on Win 8.1 as is.\n\nMy question is - do I have to rewrite my whole winforms application into Win 8.1 WPF to get access to the camera, or I can somehow create just the image capture form in Win 8.1 WPF and call it from my existing Winform application?\n\nI was hoping that creating WPF Custom Control would work, but it seems that I only can create WPF Custom Controls for Windows 7, not for Win 8.1." ]
[ "wpf", "winforms", "windows-8.1" ]
[ "helm chart stable/logstash - doesnt see elasticsearch in same ns", "I've installed for local testing elasticsearch and logstash which seems to not see the local es - any idea how es is seen within the cluster/ns ? \n\nhelm repo add elastic https://helm.elastic.co\nhelm install elastic/elasticsearch --name elasticsearch\n\n\nhelm repo add stable https://kubernetes-charts.storage.googleapis.com/\nhelm install stable/logstash --name logstash -f logstash.yaml\n\n\nthis is the error message:\n\n[2020-01-29T07:40:43,368][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>\"http://elasticsearch.cluster.local:9200/\", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>\"Elasticsearch Unreachable: [http://elasticsearch.cluster.local:9200/][Manticore::ResolutionFailure] elasticsearch.cluster.local: Name or service not known\"}\n\n\nThe logstash.yaml is - (full config can be checked with helm inspect values stable/logstash) i trimmed everything and left what's important i presume.\n\nelasticsearch:\n host: elasticsearch.cluster.local\n port: 9200\n\n\n\n\nEDIT:\nEverything works when I put the IP of the pod of elasticsearch master - problem is there are 3 pods and I'd rather hit the dns/fqdn of it rather than particular instance - any idea how it's visible inisde the cluster ?" ]
[ "elasticsearch", "kubernetes", "logstash", "google-kubernetes-engine", "kubernetes-helm" ]
[ "Even though width of subheader is not changed, OverflowToolBar hides items when locale language is changed", "I have a subheader that contains OverflowToolBar which has a SegmentedButton. The problem happens when I change the language of locale to any kind of language by pressing certing button on the application.\nBasically, the view gets re-rendered and the "OverflowToolBar-Button" appears instead of my SegmentedButton (items gets hidden and replaced with three dots icon as below).\n\nIn console, forcing the visibility of SegmentedButton to false & then back to true fixes the issue. However, when I try doing it in "onAfterRendering / onBeforeRendering" nothing happens!\nView:\n <subHeader>\n <OverflowToolbar id="ToolBar" visible="true">\n <ToolbarSpacer/>\n <SegmentedButton selectedKey="example1" id="ToolBarSegmentedButtons">\n <items>\n <SegmentedButtonItem id="Tab1" text="Example1" key="example1"/>\n <SegmentedButtonItem id="Tab2" text="Example2" key="example2"/>\n </items>\n </SegmentedButton>\n <ToolbarSpacer/>\n </OverflowToolbar>\n </subHeader>\n\nSomewhere in the view, I have a Select element that has a list of languages. I'm triggering the locale language from controller by below code:\n onChangeLanguage: function(oEvent) {\n var sLanguage = oEvent.getSource().getSelectedKey();\n // Get current language\n var oLanguage = sap.ui.getCore().getConfiguration();\n\n if (sLanguage === "arabic") {\n oLanguage.setLanguage("ar");\n } else {\n oLanguage.setLanguage("en");\n }\n\n }" ]
[ "sapui5" ]
[ "scheme48: assertion-violation: undefined variable [global] array-dimensions user", "new to scheme48. I'm wondering how to import the arrays module; looking to make 2-d arrays\n\nI've tried importing the arrays functions as described here both these ways:\n\n,open Arrays\n,open arrays\n\n\nBut when I try to run the sample code on that page (copied here:)\n\n(define (transpose array)\n (let ((dimensions (array-dimensions array)))\n (make-shared-array array\n (lambda (x y)\n (list y x))\n (cadr dimensions)\n (car dimensions))))\n(array->vector\n (transpose\n (array '(2 3) 'a 'b 'c 'd 'e 'f)))\n\n\nit always gives me the same error:\n\nassertion-violation: undefined variable [global]\n array-dimensions\n user\n\n\nHow I installed scheme48:\n\nI did everything specified on the official download page here using sudo su, ie.\n\ncd /tmp\nwget http://www.s48.org/1.9.2/scheme48-1.9.2.tgz\nsudo su\ncd /usr/local/src\ngunzip -c </tmp/scheme48-1.9.2.tgz | tar xf -\ncd scheme48-1.9.2\n./configure\nmake\nmake install\n\n\nthen\n\nscheme48" ]
[ "installation", "scheme", "racket", "scheme48" ]
[ "\"Undefined variable: users\" when trying to use @foreach", "I am trying to make foreach loop in laravel to list all users but when I use the code that laravel suggested I get this error:\n\nUndefined variable: users (View: /home/vagrant/Code/SimFly/resources/views/profile.blade.php)\n\n\nThe code causing the error is:\n\n@foreach ($users as $user)\n<p>This is user {{ $user->id }}</p>\n@endforeach\n\n\nPlease can someone help me." ]
[ "php", "html", "laravel" ]
[ "Confusion about happens before relationship in concurrency", "Below is an example given in Concurrency in Action , and the author says the assert may fire, but I don't understand why. \n\n#include <atomic>\n#include <thread>\n#include <assert.h>\nstd::atomic<bool> x,y;\nstd::atomic<int> z;\nvoid write_x_then_y()\n{\n x.store(true,std::memory_order_relaxed);\n y.store(true,std::memory_order_relaxed);\n}\nvoid read_y_then_x()\n{\n while(!y.load(std::memory_order_relaxed));\n if(x.load(std::memory_order_relaxed))\n ++z;\n}\nint main()\n{\n x=false;\n y=false;\n z=0;\n std::thread a(write_x_then_y);\n std::thread b(read_y_then_x);\n a.join();\n b.join();\n assert(z.load()!=0);\n}\n\n\nAs far as I know, in each single thread, sequenced before also means happens before. \nSo in thread a the store to x happens before y, which means x should be modified before y and the result x.store should be visible before y is modified. \n\nBut in this example the author says that the store between x and y could be reordered, why? Does that violate the rule of sequenced before and happens before?" ]
[ "c++", "concurrency", "memory-barriers", "memory-model", "stdatomic" ]
[ "Run play book with multiple conditions", "I have written a playbook which run handlers if the task was successful.Now I want to use some type conditions that if the above task fail then run different handler. Just like simple IF else statement works.\nCurrent PLAYBOOK\n tasks: \n - name: checking file format\n command: named-checkzone example.com /var/named/example.com\n notify: service\n\n\n handlers:\n - name: "service reload"\n command: rndc reload example.com\n listen: "service"\n\nNow I want to omit file name in configuration file if the main tasks fails" ]
[ "ansible" ]
[ "Spring Cloud Bus, RenamingMQ in more readable way", "My Cleint is having 2 instances and I am using below snippet to rename the queue and can see testExchange.testQueue is created\nunder which i can see 2 consumers i.e. my client instances but while /bus/refresh I can see only single instance is getting refreshed and \nI am not getting Cloud Bus feature viz on /bus/refresh all instances should get refreshed, please let me know if I am missing any\nconfiguration to rename the queue in readable format.\n\nspring:\n cloud:\n stream:\n bindings:\n springCloudBusInput:\n destination: testExchange\n group: testQueue\n config:\n bus:\n enabled: true\n uri: https://Config-Server-offshore.com/\n name: ClientApp" ]
[ "rabbitmq", "spring-cloud-stream", "spring-cloud-config", "spring-cloud-bus" ]
[ "REGEX - collapse any combination of non-alphanumeric symbols into a single \".\"", "I desire to collapse any combination of TWO OR MORE non-alphanumberic characters into a single \".\"\n\nI already have one filter before this one, so that the only 3 such characters I need to worry about are \"_\", \"-\", and \".\"\n\nThis is what I came up with\n\nOutNameNoExt:= RegExReplace(OutNameNoExt,\"[\\._-]+\" , \".\")\n\n\nSadly, it fails because I have only read the first 3 chapters of my regex book.\n\nI would like to clean up a string such as this\n\n98788._Interview__with_a_booger..876789_-_.avi\n\n\nso that it would read\n\n98788.Interview.with.a.booger.876789.avi\n\n\nI also believe I would have to use a totally new operator so that the replacement happens with all occurrences and not just the first one, right?\n\nReady for the knowledge to flow!" ]
[ "regex", "autohotkey" ]
[ "What does podman run --expose do?", "I'm new to containers, I don't know Docker, and I'm learning Podman on RHEL. I'm trying to understand what podman run --expose does. All podman-run(1) says for the --expose option is "Expose a port, or a range of ports (e.g. --expose=3300-3310) to set up port redirection on the host system." As I understand/guess it, port redirection is to have an application configured to listen at some port, but have the system expose some other port, and redirect connections to that other to the configured one. In this case, the application would be the container running instance (right?). Edit 2: That's what the --publish option does.\nThere's this article that expands on Docker documentation on the expose directive in the dockerfile, and says that "The EXPOSE instruction exposes the specified port and makes it available only for inter-container communication." which doesn't sound equivalent to my reasoning above.\nCan anybody please explain what exactly $ podman run --expose=4321 imaginedimage does and how to check that it does what's expected to do.\nEdit\n...thinking about it again, I shouldn't expect to see that "exposed" port on $ ss -a\nI'd better ask for an example of "port redirection on the host system" using --expose." ]
[ "podman" ]
[ "JCL for running COBOL program calling subprogram", "I have one COBOL pgm A which is calling another COBOL pgm B.\nIn pgm B I need one file.How can I write JCL so that I would be able to access this file in pgm B? I have written select clause and FD entry for this file in B." ]
[ "cobol", "mainframe", "jcl" ]
[ "group by date in linq", "I've a table with datetime null field in sql server. I'm trying to group the results based on the year in that field. But, when I wrote linq query, I didn't get intellisense for Year when I type that field. It only shows HasValue and Value. I think because it is converted nullable type. How do I do the grouping in this case?" ]
[ "linq-to-sql" ]
[ "How to update GTFS static data stored locally", "How should the regular updates to the GTFS static data provided by the Agencies through their text files be handled?\n\nShould all this static data be deleted from the data stores and then completely reloaded from the Agency's new GTFS text files ?\nT\nhis method would be used if the identifiers of say Route_id, Trip_id or stop_id can be reassigned between updates.\n\nFor example the new GTFS data files show that Stop_id \"x\" which was assigned to Trip \"Y\" is now assigned to Trip \"Z\". \n\nIf these entity identifiers are never reassigned then the new GTFS files need to be compared to the local data and based on the results; records need to be removed, updated or added to each table.\n\nErick." ]
[ "static", "updates", "gtfs" ]
[ "Vuex getter destruct", "I'm using Vue.js with Vuex and wondering is there a way to destruct getters, just like actions do?\n\nThis getter: \n\n doneTodosCount: (state, getters, rootState, rootGetters) => {\n .....\n }\n\n\nto become something like this:\n\n doneTodosCount: ({rootGetters}) => {\n .....\n }\n\n\nAsking this, because in first example, I don't need first three arguments state, getters, rootState but still need to write them to reach the fourth rootGetters" ]
[ "vue.js", "vuex", "store" ]
[ "Java local Servlet debugging with remote connection", "I don't really know where to start with this issue, so I'll just say what's wrong:\n\nI'm running some code in Eclipse that is connecting to our remote \"dev\" server and presumably using the server there. This means that when I update code in the servlet or any code that actually uses the servlet, no changes are reflected on my local machine.\n\nMy question is how can I run the servlet on my local machine and have it connect to the dev server to use its MySQL DB to get the data. Presumably this will allow me to make changes to the servlet locally and still use test data.\n\nI am running Tomcat 5.5 as well, and in Debug Configurations I tell the servlet to run on localhost:8000, but it says it can't connect.\n\nI'm really stuck here and it's disheartening since any changes I make to the code aren't even reflected at all. Moreover I can't see any debug information to tell if my changes are even working at all much less how I intend.\n\nI also tried to make some noticeable changes to parts of the code so that it would be easy to see that I'm affecting it and it doesn't look like they're actually having an effect when I run the code.\n\ntl;dr I'm stupid and don't know what to do." ]
[ "java", "servlets" ]
[ "Botium-core unable to load custom asserter", "I recently updated the dependencies in my test project. After updating, botium-core is unable to load the custom asserters I had defined.\nHere is a snippet of package.json that shows my dependencies.\n"dependencies": {\n"botium-connector-dialogflow": "^0.0.25",\n"botium-core": "^1.11.0",\n"jsonpath": "^1.1.0",\n"lodash": "^4.17.20",\n"minimist": "^1.2.5",\n"mocha": "^8.2.1"}\n\nHere is a snippet of botium.json\n{\n"botium": {\n "Capabilities": {\n "PROJECTNAME": "my-project",\n "CONTAINERMODE": "dialogflow",\n "DIALOGFLOW_PROJECT_ID": "<google project id>",\n "DIALOGFLOW_CLIENT_EMAIL": "<service credentials email>",\n "DIALOGFLOW_PRIVATE_KEY": "<service credentials private key>",\n "ASSERTERS": [\n {\n "ref": "ASSERTER1",\n "src": "./src/asserter1.js"\n }\n ]\n },\n "Sources": {},\n "Envs": {}\n}\n\nI also switched the path to .\\src\\asserter1.js, and it works on my windows machine, but fails in a linux build env." ]
[ "botium-box" ]
[ "solr sunspot - searching belongs_to association", "I have a fabrics model that belongs to multiple other tables.\n\nclass Fabric < ActiveRecord::Base\n validates :name, presence: true\n belongs_to :design\n belongs_to :composition\n belongs_to :collection\n belongs_to :style\n belongs_to :origin\n belongs_to :texture\n belongs_to :supplier\n has_and_belongs_to_many :colours\n\n searchable do\n text :name, :boost => 5 \n text :description\n text :composition do\n composition.name\n end\n text :collection do\n collection.name\n end\n text :style do\n style.name\n end\n text :origin do\n origin.name\n end\n text :texture do\n texture.name\n end\n text :supplier do\n supplier.name\n end\n end\n end\n\n\nI have setup all of the reverse associations (Has_many) etc.\nHowever I do not seem to be able to get the fulltext search to query the name fields of all of these associated tables.\n\nAny help would be greatly appreciated.\n\n @search = Fabric.search do\n fulltext params[:search]\n end\n @fabrics = @search.results\n\n\nRoss" ]
[ "ruby-on-rails", "ruby-on-rails-3", "solr", "full-text-search", "sunspot" ]
[ "Regex match word only if it does not follow another word", "Using Regex, how can I match a word only if it does not follow another word?\ne.g.\nI want to match the word "dog" if the word "cat" does not appear before it\nthe fox jumps over the dog - Match\na cat cannot jump over a big dog - No Match\nHello dog, I'm cat - Match\nHello cat, I'm dog - No Match\nI have tried the following:\n(?<!cat.*)dog\nHowever the quantifier inside the negative lookbehind does not work.\nA solution to this would be greeeaaatly appreciated!" ]
[ "regex", "match", "word", "lookbehind" ]
[ "Is there a proper way of ensuring only one user at a time makes changes to an object with REST+HTTP?", "I've created a Django/Tastypie application where multiple people could possibly be changing attributes of a row in the database at the exact same time or possibly PUT data which is stale.\n\nFor instance:\n\n # the Django model\n class Thing(models.Model):\n name = models.CharField(max_length=100)\n description = models.TextField()\n\n # the Tastypie Resource\n class ThingResource(ModelResource):\n class Meta:\n queryset = Thing.objects.all()\n\n\nNow let's say any number of users could change the name or description of the Thing at any point in time. They could do it at the same time, or someone could leave the application open for a long time and come back and change it then.\n\nWhat I'm trying to avoid is latent changes that are incorrect. Given the following situation:\n\n#1 User 1: Opens app viewing Thing #1 with name = \"my name\", description = \"my description\"\n#2 User 2: Opens app viewing Thing #1 (same state as User 1)\n#3 User 2: Changes description of Thing #1 to \"something\"\n#4 User 1: Changes name of Thing #1 to \"some other name\"\n\n\nAfter line #4, the state of Thing #1 should be name = \"some other name\", description = \"something\" instead of name = \"some other name\", description = \"my description\".\n\nAssuming the application does not know (in real time or via regularly updating the data on the page) ahead of time that the object on the server has changed, how can this situation be prevented?\n\nI've considered adding a field sequence = models.PositiveIntegerField() in which I increment it every time an update is made and so I can tell if the object is out of date when the update happens, but is that the best way? Is there a better way? This seems like it would be a common pattern, right?" ]
[ "javascript", "django", "http", "rest", "tastypie" ]
[ "odoo, qweb: I like to replace attribute's value in odoo report", "In odoo, qweb report. I have created an inherited report whith objective to change t-call attribute value from internal_layout to external layout. i have used the next code:\n\r\n\r\n<template id=\"!!!!!!!!!!!!\" inherit_id=\"!!!!!!!!!!!!!\">\n <xpath expr=\"//t[@t-call='web.internal_layout']\" position=\"attributes\">\n <attribute name=\"attrs\">{'t-call':'web.external_layout'}</attribute>\n </xpath>\n </template>\r\n\r\n\r\n\nThis code did not work, I wonder if there is a way to insert sub part of the same report.\n\r\n\r\n<template id=\"!!!!!!!!!!!!!!!!!!\" inherit_id=\"!!!!!!!!!!!\">\n <xpath expr=\"//t[@t-call='web.internal_layout']\" position=\"replace\">\n <t t-call='web.external_layout'>\n insert here original sub report\n </t>\n </xpath>\n </template>" ]
[ "qweb", "odoo-13" ]
[ "How to catch request and response data call in Web API?", "Based on the diagram\n\n\n\nI want to get the \n\n\nGet request Data\nGet Elapsed time between request and response call\nGet response data \n\n\nI was thinking if I could use BeginRequest, EndRequest under System.Web.HttpApplication inside Global.asax. \n\nThe very reason of this, is that, I want to know if the cause of slow operation is on the server, or just on the client mobile app.\n\nAny suggestion would be appreciated." ]
[ "c#", "asp.net-mvc", "api" ]
[ "How to preserve login tokens in automation for websites like Owler?", "I am trying to develop a scraper for various sites like angel.co. I'm stuck at designing a crawler for the www.owler.com website, as it requires login through mail, when we try to access information about company.\n\nEach time we login we'll get a new login token on email that will expire after some time. So, is there any proper solution to preserve the login session on the browser session using Selenium with Py-bindings?\n\nI'm just looking for guidelines to handle these type of situation. Already tried automating this task using Selenium, but it wasn't a fruitful approach." ]
[ "python", "selenium", "web-scraping", "scrapy" ]
[ "What does googlebot see? Generated code or Source code?", "I am wondering what the googlebot will see when we use jQuery for rounded corners where jQuery generates the outer divs for the corners.\n\nWill this method affect SEO ranking?" ]
[ "jquery", "seo", "search-engine" ]
[ "How to implement a Rust function that modifies multiple elements of a vector?", "I have this code:\n\nstruct Physical;\n\nfn collision(a: &mut Physical, b: &mut Physical) {\n //accelerate a and b depending on their values\n}\n\nfn main_loop(vec: &mut Vec<Physical>) {\n for i in 0..vec.len() {\n for j in i+1..vec.len() {\n collision(&mut vec[i], &mut vec[j]);\n }\n }\n}\n\nfn main() {\n let mut vec = vec![Physical, Physical, Physical];\n loop {\n main_loop(&mut vec);\n }\n}\n\n\nThis doesn't compile, because the mutable references are both in the same vector.\n\nIt would be possible to change collision to take indices and the mutable vector, but it looks ugly. I also want to change the Container type later to make the collision more efficient. I may even want to use multiple containers for my objects, so this won't be an option.\n\nHow can this be done the best way?" ]
[ "loops", "rust", "borrow-checker" ]
[ "JSF2: Is there any way to use a4j:param with rich:select or h:selectOneMenu", "Is it possible to use with dropdown menus or is it also dependent on the parent object implementing ActionSource as the f:setPropertyActionLister is? \n\nIdeally I would have done something like the following: \n\n<h:selectOneMenu value=\"#{myCustomBean.selectedItemIndex}\">\n <f:selectItems value=\"#{adminLetterAdminBean.missingSettings}\" var=\"n\" itemValue=\"#{n.id}\" itemLabel=\"#{n.name}\"/>\n <f:setPropertyActionListener value=\"42\" target=\"#{adminLetterAdminBean.someProperty}\" />\n <a4j:ajax />\n</rich:select>\n\n\nHowever this does not work because h:selectOneMenu does not implement javax.faces.component.ActionSource. The page does not render and it gives me a friendly stack trace to tell me about this dependency. \n\nNot seeing anything in the Richfaces documentation about this constraint, I tried the following: \n\n<h:selectOneMenu value=\"#{myCustomBean.selectedItemIndex}\">\n <f:selectItems value=\"#{adminLetterAdminBean.missingSettings}\" var=\"n\" itemValue=\"#{n.id}\" itemLabel=\"#{n.name}\"/>\n <a4j:param assignTo=\"#{adminLetterAdminBean.someProperty}\" value=\"42\" name=\"randomRequestParamName\"/>\n <a4j:ajax />\n</rich:select>\n\n\nThis does not blow up, but it also does not set the property. I was wondering if there is a set a (or multiple) properties in a similar fashion." ]
[ "ajax", "jsf-2", "richfaces", "ajax4jsf" ]
[ "Oracle nvl not able to handle empty string even after using is not null", "I am trying to return empty or dummy string if select query returns null.I tried using dummy value in NVL(colum,'dummy'), but I am still getting no data found error.\nBelow is what I tried:\n\n1. \n\n SELECT de.destination INTO l_sub_ent\n\n FROM dest de\n\n where de.destination='somevalue' AND de.destination IS NOT NULL; \n\n\n2. \n\n SELECT COALSECE(de.destination, 'dummy') INTO l_sub_ent\n\n FROM dest de\n\n where de.destination ='some value'; \n\n\n3.\n\n SELECT NVL(de.desc_en, 'dummy') INTO l_sub_ent\n\n FROM dest de\n\n where de.destination ='some value';" ]
[ "sql", "oracle", "null" ]
[ "Regex only one alternation", "Regex: (simple|complex)\nText: using simple with key value pairs using complex with key value pairs using simple with key value pairs\n\nIs there any way to match only once the simple value if it's used and not two times?" ]
[ "regex" ]
[ "With mongodb and c# driver, how to deserialize json to anonymous type?", "I need to deserialize a string back to an anonymous type/object but am getting:\n\nA document being deserialized to System.Object must be empty.\n\n\nIs there a way to do this? Saving the doc is fine, just have issues trying to deserialize it. Code below: \n\n[TestFixture]\npublic class ObjectTests\n{\n [Test]\n public void Can_Deserialize_To_Object()\n {\n BsonDefaults.GuidRepresentation = GuidRepresentation.CSharpLegacy;\n BsonClassMap.RegisterClassMap<Thing>(x =>\n {\n x.AutoMap();\n x.SetIdMember(x.GetMemberMap(c => c.Id));\n });\n\n var client = new MongoClient(\"mongodb://localhost\").GetServer().GetDatabase(\"Test\");\n\n var things = client.GetCollection<Thing>(\"Things\");\n things.Drop();\n\n var thing = new Thing();\n thing.Data = new\n {\n Text = \"This is some text\",\n Value = \"This is the value\"\n };\n things.Insert(thing);\n\n // System.IO.FileFormatException : An error occurred while deserializing the Data property of class Soma.Core.Tests.Thing: A document being deserialized to System.Object must be empty.\n var result = things.FindOne();\n\n }\n}\n\npublic class Thing\n{\n public Guid Id { get; set; }\n public object Data { get; set; }\n}" ]
[ "c#", "mongodb-.net-driver" ]
[ "Git setup remote tracking branch", "I want to track a remote master branch from a new remote repository. Both do already exist. \n\nHow do I go about this in git? I can't seem to get it right. I tried:\n\ngit remote add otherRepo git://...\ngit branch -t myTrack otherRepo/master\n\n\nHowever, I get the following error: \n\nfatal: Not a valid object name: 'otherRepo/master'." ]
[ "git" ]
[ "How to center horizontally a position: absolute elment on a position: fixed container", "I need to center horizontally a button with aboslute position (because it must keep on top when to click and launch overlay and click to close overlay) on a position fixed topbar, here is the code:\n\n.topbar {\n text-align: center;\n min-width: 100%;\n height: 50px;\n background-color: #29343a;\n position: fixed;\n top: 0;\n}\n\n.button {\n display: inline-block;\n margin-right: auto;\n margin-left: auto;\n width: 60px;\n height: 50px;\n cursor: pointer;\n background-color: #00c1e2;\n border-bottom: 2px solid #00a8c6;\n z-index: 100;\n position: absolute;\n}\n\n.overlay {\n position: fixed;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: rgba(153,204,51,0.9);\n}\n\n\nThats is just the css of the three parts, the website is more complex but i think that 3 parts are the key. the topbar must be fixed on top, the buton have to be centered into the topbar div, and the overlay launch and the buttop keeps on top of the overlay.\n\nWhat is working: the overlay works fine and the button keeps on top but its not horizontally centered on the topbar.\n\nHow i can hack this?" ]
[ "html", "css" ]
[ "php curl to check ssl connection", "Would like some help with my php curl connection - in my firebug console I keep getting this error \n\n\n Notice: Undefined index: host in C:\\xampp\\htdocs\\labs\\test2\\get.php on line 6\n Error:3 malformed\n\n\nAJAX code:\n\n var hostName = $(\"input#host\").val();\ndataString = hostName;\n\n$.ajax({\n type: \"GET\",\n url: \"get.php\",\n data: dataString,\n dataType: \"json\",\n\n\nPHP CURL code:\n\n\r\n\r\n<?php\r\nif($fp = tmpfile())\r\n{\r\n $ch = curl_init();\r\n curl_setopt($ch, CURLOPT_URL, $_GET['host']);\r\n curl_setopt($ch, CURLOPT_STDERR, $fp);\r\n curl_setopt($ch, CURLOPT_CERTINFO, 1);\r\n curl_setopt($ch, CURLOPT_VERBOSE, 1);\r\n curl_setopt($ch, CURLOPT_HEADER, 1);\r\n curl_setopt($ch, CURLOPT_NOBODY, 1);\r\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);\r\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);\r\n $result = curl_exec($ch);\r\n curl_errno($ch)==0 or die(\"Error:\".curl_errno($ch).\" \".curl_error($ch));\r\n fseek($fp, 0);//rewind\r\n $str='';\r\n while(strlen($str.=fread($fp,8192))==8192);\r\n echo $str;\r\n fclose($fp);\r\n}\r\n?>\r\n\r\n\r\n\n\n-- RESPONSE ---\n\n\n HTTP/1.1 302 Found Cache-Control: private Content-Type: text/html; charset=UTF-8 Location: http://www.google.com.au/?gfe_rd=cr&ei=VbwrVa_RFsPu8wfN54HYBQ Content-Length: 262 Date: Mon, 13 Apr 2015 12:53:41 GMT Server: GFE/2.0 Alternate-Protocol: 80:quic,p=0.5 * Rebuilt URL to: www.google.com/ * Hostname was NOT found in DNS cache * Trying 216.58.220.100... * Connected to www.google.com (216.58.220.100) port 80 (#0) > HEAD / HTTP/1.1 Host: www.google.com Accept: / < HTTP/1.1 302 Found < Cache-Control: private < Content-Type: text/html; charset=UTF-8 < Location: http://www.google.com.au/?gfe_rd=cr&ei=VbwrVa_RFsPu8wfN54HYBQ < Content-Length: 262 < Date: Mon, 13 Apr 2015 12:53:41 GMT < Server: GFE/2.0 < Alternate-Protocol: 80:quic,p=0.5 < * Connection #0 to host www.google.com left intact" ]
[ "php", "jquery", "ssl", "curl" ]
[ "Reducing a list to the sum of the differences of its elements", "I have a simple list with an always even number of integers like\n\n(42 38 15 5)\n\n\nand I want to calculated the total sum of the difference of its pairs, i.e.\n\n(+ (- 42 38) (+ 15 5)) --> 14\n\n\nIt could be 2, 4 or more elements but it will always be an even number. I thought there would be a way using reduce for this but I do not see a way to get the pairs right.\n\nIs there a simple way to do this or is it easier to change the list structure? E.g to something like\n\n((42 38) (15 5))" ]
[ "list", "common-lisp", "reduce" ]
[ "upload restful Web Service for Mobile Apps to cpanel", "I'm trying to upload created restful webservice to be consumed by mobile apps. I started using netbeans IDE 8 to create it but when I got to publishing it on the cpanel, I created a .war file and uploaded it through cpanel. my cpanel server support java and index.jsp file is accessible but I can't seem to access my webservice.\nhow can i access to my webservice on this cpanel?" ]
[ "java", "web-services", "rest" ]
[ "What is the short cut in eclipse to terminate debugging/running?", "What is the shortcut in eclipse to terminate debugging/running? Looking under Preferences -> Keys says Ctrl + F2 but it doesn't work." ]
[ "eclipse", "keyboard-shortcuts" ]
[ "How to get Last digit of number", "How to extract last(end) digit of the Number value using jquery. \nbecause i have to check the last digit of number is 0 or 5. so how to get last digit after decimal point\n\nFor Ex.\nvar test = 2354.55 Now how to get 5 from this numeric value using jquery.\ni tried substr but that is only work for string not for Number format\n\nLike if i am use var test = \"2354.55\";\n\nthen it will work but if i use var test = 2354.55 then it will not." ]
[ "javascript", "jquery" ]
[ "Microsoft Cognitive Services Translator API remaining characters", "Is there a way to get the remaining character allocation for a Translator API subscription in the new Azure Portal, similar to how we could previously using the My Data page on Microsoft Datamarket?" ]
[ "azure", "microsoft-cognitive", "microsoft-translator" ]
[ "javascript based shopping cart - Securing the price attribue", "I am trying to update a javascript based shopping cart. The products are listed like\n\n<ul>\n <li class=\"product\" data-price=\"5.00\">\n <h2>Product Name</h2>\n <p> Product Descriptions>\n ....\n <a href=\"#\" onclick=\"addToCart\">$ 5.00</a>\n </li>\n <li class=\"product\" data-price=\"6.70\">\n <h2>Product Name</h2>\n <p> Product Descriptions>\n ....\n <a href=\"#\" onclick=\"addToCart\">$ 6.70</a>\n </li>\n</ul>\n\n\nand in schopping cart we read data-price to get the price. This means if the user changes this attribute in Firebug or any other tool the price is automatically changed in cart.\n\nI can't rewrite the whole cart, but would also like to secure the price logic. What are the alternatives to resolve this issue" ]
[ "javascript", "php" ]
[ "jQuery filter() traversing doesnt seems to work?", "I dont know what is the problem with this ?\n\n$('.post').live('mouseenter mouseleave', function() { \n $(this).filter('anything here,a,div,.class,#id').toggleClass('hidden');\n });\n\n\nwhere as this works fine.\n\n$('.post').live('mouseenter mouseleave', function() { \n $(this).toggleClass('hidden');\n });\n\n\nThere is an anchor which I would like to show on mouse hover. Similar to Facebook" ]
[ "jquery", "filter", "traversal" ]
[ "Microsoft Visual C++ 2010 Express installation/run problems", "I am running windows 7 and I am trying to get this IDE to work and I am have an incredibly frustrating time making it work.\n\nI am following these instructions\n\nQuick guide:\n\n\nFile > New > Project\nSelect \"Win32 Console Application\"\nEnter a name and location, select OK\nIn the Win32 Application Wizard under \"Application Settings\", select \"Console Application\" and select \"Empty project\".\nClick Finish.\nOn the right (or left) hand pane should be Solution Explorer. Open it and right click on the \"Source Files\" folder and Add > Add New Item.\nSelect C++ file (.cpp)\nWrite code, hit F5 to start with debugging, ctrl+f5 to start without debugging.\n\n\nAfter step 4 I get the error, \"The platform root directory \"E:..........\\MSBuild\\Microsoft.cpp\\v4.0\\Platforms\" does not exist.\n\nWhat do I do? I installed it in my E drive, maybe what it wants is on my C drive? It is not possible for me to install it there though because I am using a SSD for my C drive.\n\nUpdate, I have tried to uninstall and reinstall and then clear my temp folder and then reinstall and then uninstall with the uninstall utility and then reboot and the reinstall and none of that works.\n\nI turning off my firewall and antivirus and installing and running and that did not help at all. Next I am going to format my hard drives and try and install again.\n\nI tried installing the ultimate version and I had the same problem. I have no idea what to do, it seems like I am out of options.\n\nAny ideas?\n\nMy best guess now is that I have to manually install the missing files somehow, where can I find those?\n\nI installed Dev C++ and it works fine, should I just continue using this (as far as I can tell superior program) or try and fix Express?\n\n\n\nMicrosoft Visual C++ 2010 Express\n\nThe platforms root directory \"E:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\Platforms\" does not exist.\n\nOK\n--------------------------- The microsoft.cpp part is missing but it exists in the C drive. I copied that over to the E drive and now when I open a project I get a blank screen, if I open older ones it says I need .net framework 4.0 which I do have.\n\nThis has to be the worst program I have ever had to deal with, I have played video games in beta that worked better than that.\n\nI think I got this working, I am not sure though.\n\nIt appears to be working but I get some strange errors, I am just going to accept this because at least now after an entire weekend I can begin my homework." ]
[ "c++", "visual-studio-2010" ]
[ "LIKE but exclude one post by id?", "can someone help me to make sql select \n\nsample DB\n\nID | name | desc\n23 | saya | ..\n25 | saya-2 | ..\n26 | saya-3 | ..\n27 | wayan-wahyu | ..\n\n\ni select db by \n\nSELECT count(id) FROM data WHERE name like %:name% \n\n\nbut i want to exclude exclude id 23 from count will display total is 2" ]
[ "mysql" ]
[ "Is there any way to use BiConsumers as simply as Consumers?", "This is just a theorical question with no concrete application.\n\nI have the following method which I will not touch. It could (if possible at all) be used as a BiConsumer.\n\nvoid doSmallThing(A a, B b) {\n // do something with a and b.\n}\n\nvoid doBigThing(List<A> as, B b) {\n // What to do?\n}\n\n\nHow can I iterate on as while keeping b constant and use this::doSmallThing in doBigThing?\n\nOf course the following doesn't work.\n\nvoid doBigThing(List<A> as, B b) {\n as.stream()\n .forEach(this::doSmallThing);\n}\n\n\nThe following works nice and is actually what I use everyday.\n\nvoid doBigThing(List<A> as, B b) {\n as.stream()\n .forEach(a -> doSmallThing(a, b));\n}\n\n\nThe following also works well, but is a bit more tricky.\n\nConsumer<A> doSmallThingWithFixedB(B b) {\n return (a) -> doSmallThing(a, b);\n}\n\nvoid doBigThing(List<A> as, B b) {\n as.stream()\n .forEach(doSmallThingWithFixedB(b))\n}\n\n\nBut all of those solutions don't get the simplicity of the Consumer case. So is there anything simple that exists for BiConsumer?" ]
[ "java", "java-8", "method-reference" ]
[ "mongodb - query based on _id timestamp", "How do I write a mongodb shell query that will return the documents (or just document ids) for all objects created after a specific date? I see examples like the following...\n\nreturn query based on date\n\nBut they just return the timestamp, I want to query based on a timestamp. I don't think the logic is as easy as looking for objects higher than a specific objectid, because if mongodb is sharded, then there are multiple servers creating objects." ]
[ "mongodb", "mongodb-query" ]
[ "Foreground Text has same filters as background", "So I needed to darken the background on my web app, but need the foreground to still have 100% brightness. Currently my CSS is as follows:\n\n\r\n\r\n.background {\r\n background-image: url(./background.jpg);\r\n background-size: cover;\r\n background-position: center;\r\n height: 100vh;\r\n width: 100vw;\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n filter: grayscale(30%) brightness(30%);\r\n font-family: Oswald, sans serif;\r\n text-align: center;\r\n color: #FFF;\r\n}\r\n\r\n.name {\r\n margin: 10px;\r\n font-size: 120px;\r\n}\r\n\r\n.foreground {\r\n margin: auto;\r\n filter: unset;\r\n}\r\n<div className=\"background\">\r\n <div className=\"foreground\">\r\n <h1 className=\"name\">\r\n Hello World!\r\n </h1>\r\n </div>\r\n</div>\r\n\r\n\r\n\n\nMy title (in the foreground div, with the class \"name\") is appearing darkened like the background still, how can I make sure it doesn't follow the same filters as the background?" ]
[ "html", "css", "reactjs" ]
[ "Where is the sensible place to modify response data in redux?", "Using a combination of React, Redux and Thunk, I have the following:\n\nactions.js\n\nimport $ from 'jquery';\nimport * as types from '../constants/ActionTypes';\nimport { API_PATH } from '../constants/Config';\n\nexport function coursesLoaded(courses) {\n return { type: types.COURSES_LOADED, courses };\n}\n\nexport function fetchData() {\n return (dispatch) => {\n return $.getJSON(API_PATH).then((response) => {\n dispatch(coursesLoaded(response.result));\n });\n };\n}\n\n\nreducer.js\n\nimport { routerReducer as routing } from 'react-router-redux';\nimport { combineReducers } from 'redux';\nimport * as types from '../constants/ActionTypes';\n\nconst initialState = {\n courses: [],\n};\n\nfunction main(state = initialState, action) {\n switch(action.type) {\n case types.COURSES_LOADED:\n return {\n ...state,\n courses: action.courses,\n };\n default:\n return state;\n }\n}\n\nconst rootReducer = combineReducers({ main, routing });\n\nexport default rootReducer;\n\n\nThe two snippets above sit well, and i feel like they align to the intentions of Redux. I want to now do some modifications to the fields that are returned in the response, before they hit the containers. \n\nFor example, the response might be:\n\n[\n { code: \"R101\", name: \"Intro to Redux\", author: \"Dan\" },\n { code: \"R102\", name: \"Middleware\", author: \"Dan\" },\n]\n\n\nAnd I want to change it to (simple example for simplicity):\n\n[\n { code: \"R101\", name: \"Intro to Redux\", author: \"Dan\", additionalProperty: \"r101_intro_to_redux\" },\n { code: \"R102\", name: \"Middleware\", author: \"Dan\", additionalProperty: \"r102_middleware\" },\n]\n\n\nResearch thus far\n\nOption One\nLooking at the async example on Redux, I can see there is a light touch to the response here:\nhttps://github.com/reactjs/redux/blob/master/examples/async/actions/index.js#L33\n\nOption Two\nLooking at other Stackoverflow questions, it leads me to believe keeping it out of the actions makes more sense, as reducers should be what modifies state (but perhaps this doesn't really count as state?):\nRedux - where to prepare data\n\nOption Three\nI have an inclining that this is the job of middleware - being that's how normalizr handles it, but I can't find any non-passive middleware examples. If middleware is the go here, should the middleware be dispatching some kind of SET_STATE action, or is it free to update state right there in the middleware?\n\nEDIT\n\nExperimented with some middleware, such as:\n\nimport { lowerCase, snakeCase } from 'lodash';\nimport * as types from '../constants/ActionTypes';\n\n export default store => next => action => {\n if(action.type == types.COURSES_LOADED) {\n action.courses = action.courses.map((course) => {\n course.additionalProperty = snakeCase(lowerCase(`${course.code} ${course.name}`));\n return course;\n });\n }\n return next(action);\n }\n\n\nIt seems to work fine - is this indeed the intention of middleware? Original question holds - where it the ideal spot?" ]
[ "reactjs", "redux", "react-redux", "redux-thunk" ]
[ "What CALayer draw(in ctx:) coordinates should be used to draw in the correct point with the correct scale?", "I have a NSView which uses CALayers to created content and want to generate pdf output in vector format. Firstly is this possible, and secondly what is the logical coordinate system that Apple refers to in their documentation, and lastly how are you supposed to get CALayers default background and border properties to draw ? If I use these properties then they are not drawn into the context and if I draw the border then this duplicates the property settings. It's a bit confusing as to when you should or shouldn't use these properties, or whether one should use CALayers at all when creating vector output e.g. pdf document.\n\nThe view has the following layers:\n\n\nThe views layer which is larger than the drawing area\nA drawing layer which contains an image and sublayers\nSublayers which have some vector drawing including text\n\n\nThe NSView class and CALayer subclasses are listed below.\n\nThe view layer and the drawing layer are drawn in the correct locations but all the drawing layer subviews are drawn in the wrong place and are the wrong size.\n\nI assume this is because the drawing layer has a transform applied to is and the drawing below is not taking that into account. Is this the issue and how would I apply the layers transforms to the CGContext - if this is the solution - to get things in the right place?\n\nclass DrawingView: NSView {\n\n override func draw(_ dirtyRect: NSRect) {\n super.draw(dirtyRect)\n guard let context = NSGraphicsContext.current?.cgContext else {\n return\n }\n // In theory should generate vector graphics\n self.layer?.draw(in: context)\n //Or\n // Generates bitmap image\n //self.layer?.render(in: context)\n }\n}\n\nclass DrawingLayer: CALayer {\n\n override func draw(in ctx: CGContext) {\n drawBorder(in: ctx)\n if let subs = self.sublayers {\n for sub in subs {\n sub.draw(in: ctx)\n }\n }\n }\n func drawBorder(in ctx: CGContext){\n let rect = self.frame\n\n if let background = self.backgroundColor {\n ctx.setFillColor(background)\n ctx.fill(rect)\n }\n if let borders = self.borderColor {\n ctx.setStrokeColor(borders)\n ctx.setLineWidth(self.borderWidth)\n ctx.stroke(rect)\n }\n }\n}" ]
[ "vector", "calayer", "nsview" ]
[ "Converting NSString to uint8_t to appendBytes:length", "I need to convert an NSString or an int so that I can use NSData to appendBytes:length.\n\nFrom\n\n@\"734\" or 734\n\n\nto \n\nuint8_t _steps[2];\n_steps[0] = 0x02;\n_steps[1] = 0xde;\n[_data appendBytes:_steps length:2];\n\n\nExample\n\n- (void)sendSteps:(NSString*)steps\n{\n NSMutableData *_data = [[NSMutableData alloc] init];\n\n // Need to get (NSString*)steps converted like below:\n uint8_t _steps[2];\n _steps[0] = 0x02;\n _steps[1] = 0xde;\n\n [_data appendBytes:_steps length:2];\n}\n\n\nWhat I've tried\n\nNSData * _steps = [(NSString*)activity[@\"steps\"] dataUsingEncoding:NSUTF8StringEncoding];\n[_data appendBytes:[_steps bytes] length:[_steps length]];\n\n\nand\n\nuint8_t * _steps = (uint8_t *)[(NSString*)activity[@\"steps\"] UTF8String];\n[_data appendBytes:_steps length:strlen((char*)_steps)];\n\n\nDesired result\n\nThe desired result for \"734\" is 02de." ]
[ "objective-c", "bluetooth", "byte", "nsdata" ]
[ "Swift tableView cell subviews flicker (disappear and then reappear) when cell is selected", "I have a viewCell with a few different subviews. one of them is a label with an orange background. now when I select the cell in the tableview the label background flicker(disappear and then reappear) to its original i cant see what is causing this issue.\n\n//my did select func\n override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\n// let selectedCell:UITableViewCell = tableView.cellForRow(at: indexPath)!\n\n tableView.deselectRow(at: indexPath, animated: true)\n let post = RquestInfoArray[indexPath.row]\n if post[\"status\"] as! String == \"pending\" {\n\n let ac = UIAlertController(title: \"My Rquest\", message: \"Options\", preferredStyle: .actionSheet)\n let detailAction = UIAlertAction(title: \"View Detail\", style: .default, handler: { (action) in\n tableView.deselectRow(at: indexPath, animated: false)\n print(\"view detail pressed\")\n })\n let deleteAction = UIAlertAction(title: \"Delete\", style: .default, handler: { (action) in\n tableView.deselectRow(at: indexPath, animated: false)\n self.tableView.reloadData()\n print(\"Delete\")\n })\n let cancelAction = UIAlertAction(title: \"Cancel\", style: .default, handler: { (action) in\n tableView.deselectRow(at: indexPath, animated: false)\n })\n\n ac.addAction(detailAction)\n ac.addAction(deleteAction)\n ac.addAction(cancelAction)\n self.present(ac, animated: true, completion: nil)\n return\n }\n\n if post[\"status\"] as! String == \"accepted\" {\n let vc = messageViewController()\n let posting = RquestInfoArray[indexPath.row]\n let postId = posting[\"rquestId\"] as! String\n vc.hidesBottomBarWhenPushed = true\n vc.postId = postId\n\n self.navigationController?.pushViewController(vc, animated: true)\n }\n }" ]
[ "ios", "swift", "uitableview" ]
[ "Htaccess rewrite to file located up one level", "I have an htaccess in a subdomain with the following rule:\n\nRewriteEngine On\nRewriteBase /\nRewriteRule ^feed([0-9]+)$ ../image.php?id=$1 [L]\n\n\nSo basically I want to redirect requests from feed which is located in a subdomain to image.php file which is located in the main domain (just one directory above). Using ../ doesn't seem to work like in PHP.\n\nSo how can I rewrite to file in the parent directory?\n\nThanks!" ]
[ "apache", ".htaccess", "mod-rewrite" ]
[ "Calcluating coccurance in grouped items", "I'm working on a project where participants will be sorting pictures into groups. My goal is to use R to create a table that would show a count of how many time pictures were sorted into the same group. The group names are arbitrary and will change between participants. For example, pictures 2 and 4 may be in group B for user 1, but in group C for user 2. I just want to know the number of times they were in the same group. Here's an example of what the data would look like:\n\nID Pic1 Pic2 Pic3 Pic4\n1 GroupA GroupB GroupA GroupC\n2 GroupB GroupA GroupB GroupA\n3 GroupC GroupA GroupB GroupC\n\n\nWhat I'd like as output is this:\n\n Pic 1 Pic2 Pic3 Pic4\nPic1 0 2 1 \nPic2 0 0 1\nPic3 2 0 0\nPic4 1 1 0\n\n\nMy guess is that dplyr could do this somehow, but I can't figure out how to count cooccurence by each user when the group names change. I can do this in Excel using VLookup, but I'd like to avoid that if possible. Any ideas?" ]
[ "r" ]
[ "Swift How to follow CGPath not from begin", "I would be grateful for one more advice:\nI've created a CGPath and I'd like a sprite to follow this path from a point where a sprite made a contact with a path. \n\nHow to follow the CGPath from a selected point?" ]
[ "ios", "swift", "sprite-kit" ]
[ "Paypal auto renewal and maximum limit", "We are building a web application where a company can buy a license which costs $300 and extra users which cost $10 for one year. Suppose company bought a license and 10 users. They will pay $300+$100 = $400.\n\nAfter some months if the company wants to buy extra users, they can buy those but they will have to pay remaining days cost at the prorated basis. Like if they buy 1 extra user after 6 months, they will have to pay $5.\n\nSo after the license is expired, we want that to be auto-renewed with license cost and users cost for next year which will be $400+$10 = $410. Is there any API for such renewal process?\n\nAlso, we are using Paypal API based approach in the application and hence for payment, we need not go to Paypal's gateway. Can I know the maximum limit for such transaction? Is it $10,000?" ]
[ "paypal", "paypal-adaptive-payments", "paypal-subscriptions" ]
[ "How to round Matrix elements in sympy?", "As we know\n\nfrom sympy import *\n\nx = sin(pi/4)\ny = sin(pi/5)\n\nA = Matrix([x, y])\n\nprint(x)\nprint(A.evalf())\n\n\ndisplays\n\nsqrt(2)/2\nMatrix([[0.707106781186548], [0.587785252292473]])\n\n\nSo\n\nprint(round(x.evalf(), 3))\nprint(round(y.evalf(), 3))\n\n\ndisplays\n\n0.707\n0.588\n\n\nBut how can we round all the elements in a Matrix in a terse way, so that\n\nprint(roundMatrix(A, 3))\n\n\ncan displays\n\nMatrix([[0.707], [0.588]])" ]
[ "python", "rounding", "sympy" ]
[ "Determining the best data structure for a problem form a complexity standpoint", "So I have found the following problem proposed a few years ago at a programming Olympiad in Romania:\n\nSay you have a language with exactly N words. Two words are said to be K-similar if they have the same first K letters and the k+1 letter differs.\n\nThe similarity degree between T words it's said to be K if any two words are K-similar but not (K+1)-similar.\n\nGiven M random words determine the degree of similarity between them.\n\nI was wondering what is the data structure that would be best in terms of complexity for implementing this program.\n\nI have tried implementing it by using arrays of strings or arrays of arrays of chars.\n\nExample: For asdf, asdffff and asdg the similarity degree should be 3." ]
[ "data-structures" ]
[ "showing update notification of web page in c#", "iam developing desktop application using c# dot net .iam using c# webbrowser to show web page .In this browser iam showing web page which display rss feed .but now i want notification when ever there is new feed ... how should i do this ." ]
[ "c#", ".net" ]
[ "alarm manager setting selected day to repeat. Am I doing it the correct way?", "users select the days and the time they want the alarm to trigger. Lets say user selects Sunday , Monday and Wednesday and the time to be 23:10. I set the alarmManager.setRepeating the intervals to be 7 * 24 * 60 * 60 * 1000 which is 7 days. Am I doing it in the correct way?\n\n Intent intent = new Intent(this, AlarmReceiver.class);\n PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 234324243, intent, 0);\n\n Calendar calendar = Calendar.getInstance();\n\n calendar.set(Calendar.DAY_OF_WEEK,getDay());\n calendar.set(Calendar.HOUR_OF_DAY, 23);\n calendar.set(Calendar.MINUTE, 10);\n\n AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);\n alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 7 * 24 * 60 * 60 * 1000, pendingIntent);" ]
[ "android", "alarmmanager" ]
[ "how to deal with array subscript warning in C when using isxdigit()?", "I have the following code in C:\n\nchar input[127] = \"hello world\";\n\nisxdigit(input[0]);\n\n\nbut I got the following warning:\n\nwarning: array subscript has type 'char'\n\n\nWhat is the reason and how to fix it?" ]
[ "c", "arrays", "compiler-warnings", "ctype" ]
[ "Rotating through array continuously with jQuery", "I need to fade items from an array in and out continuously and I'm currently doing it as such:\n\nvar rotateHint = function() {\nvar hints = ['fe','fi','fo','fum'];\nvar hint;\nvar p = (function() {\n if (!hint || !hint.length) hint = hints.slice();\n return hint.splice(Math.random() * hint.length | 0, 1);\n}())\n$('#hint').text(p) //THE ERROR IS HERE...\n .fadeIn()\n .delay(1000)\n .fadeOut(200,function(){ \n rotateHint();\n })\n};\n\n\nHowever it seems that .text(p) isn't working however if I look at p with an alert(p) the output is sound." ]
[ "jquery", "arrays" ]
[ "watchman makes fsnotify spuriously detect file changes", "I'm using watchman for Git's core.fsmonitor setting. I'm running a different tool that's using fsnotify to detect file changes & run builds. Something watchman is doing is making fsnotify think that files are changing when they're not (the fsnotify tool is running builds constantly). How can I discover what exactly is happening, so I can adapt the tool to ignore those changes?" ]
[ "linux", "watchman" ]
[ "How to modify environment variable value inside a loop?", "I have following code in a batch file:\n\nset \"start=2\"\n\nFOR /L %%a in (1,1,3) DO (\n FOR /L %%b in (%start%,1,3) DO (\n echo %start% Before Call\n call :changestring\n FOR /L %%c in (1,1,3) DO (\n REM Nothing\n )\n )\n)\n\npause\nGoto :Eof\n\n:changestring\necho %start% Before Set\nset \"start=1\"\necho %start% After Set\npause\ngoto :eof\n\n\nWhat I want is that value of variable start referenced twice in second FOR loop with %start% changes from 2 to 1 after running subroutine changestring with the command line call :changestring.\n\nThe value of the environment variable start is modified in subroutine from 2 to 1 as output by the two echo command lines in subroutine. But in the second FOR loop the value is always 2 and does not change.\n\nHow to modify value of environment variable start on second FOR loop?" ]
[ "batch-file" ]
[ "How to check for hollow_square if soldiers are in formation on board game?", "In game ( it is c++ board game like matrix with soldiers which can use formation) soldiers can be deployed in formations. ( Only one soldier can be deployed on one cell on map/matrix, formation can be in 8 directions with angles 0, 45, 90, 135, 180, 225, 270, 315 degrees with x axis, when soldiers are in formation they are in adjacent cells, for example formation in 0 degree y is the same for all but x2 - x1 =1 and so on, on degree 45 y2-y1=1 and x2-x1=1 ).\nFormations are line and hollow_square. I need on very efficient way to check if soldiers are in formation(soldier has x and y own position in class). For line I sort by x ( i have std::list<std::pair<int,int> > which represents positions of soldiers in unit) and check if diffrenece is 1 between adjancent (in case 0, 180; in case 45, 135 ,225, 315 also check for difference for y is 1 or -1). How to check for hollow_square if soldiers are in formation ?\n\n(Like on this ugly image, to clarify)" ]
[ "c++", "algorithm", "game-engine", "game-physics" ]
[ "Intellij IDEA not performing code inspections", "I use Intellij IDEA for python, and it used to show every error I made on it. For some reason now, even if I do something that is clearly wrong, that check mark on the side always shows up. I tried fixing it, but that didn't work." ]
[ "python", "intellij-idea" ]
[ "How to start then stop movement", "My code stops a red square when it touches a blue square, but I don't want the red square to stop indefinitely. How can I fix that?\n\nI've created the collision detection, and it makes speed = 0 if the red square touches the blue square.\n\n//r=red\nfloat rx = 200;\nfloat ry = 375;\nfloat rw = 50;\nfloat rh = 50;\n\n//b=blue\nfloat bx = 550;\nfloat by = 375;\nfloat bw = 50;\nfloat bh = 50;\n\nfloat speed = 2;\n//float cspeed = 2;\n\nvoid setup() {\n size(800, 800);\n noStroke();\n noSmooth();\n noCursor();\n}\n\nvoid draw() {\n surface.setTitle(mouseX + \", \" + mouseY);\n background(50);\n collision();\n move();\n display();\n}\n\nvoid collision() {\n //Check if blue and red are touching\n boolean hit = rectRect(rx, ry, rw, rh, bx, by, bw, bh);\n if (hit) {\n speed = 0;\n } else {\n speed = 2;\n }\n}\n\nvoid display() {\n\n fill(0, 0, 255); //Blue square\n rect(bx, by, bw, bh);\n\n fill(255, 0, 0); //Red square\n rect(rx, ry, rw, rh);\n}\n\n\n\nvoid move() {\n //Red square movement\n if (keyPressed) {\n if (key == 'd' || key == 'D') {\n rx = rx + speed;\n if (rx > width) {\n }\n }\n }\n\n\n if (keyPressed) {\n if (key == 'a' || key == 'A') {\n rx = rx - speed;\n if (rx > width) {\n }\n }\n }\n\n if (keyPressed) {\n if (key == 'w' || key == 'W') {\n ry = ry - speed;\n if (ry > width) {\n }\n }\n }\n\n if (keyPressed) {\n if (key == 's' || key == 'S') {\n ry = ry + speed;\n if (ry > width) {\n }\n }\n }\n}\n\n\n\n\nboolean rectRect(float rx, float ry, float rw, float rh, float bx, float by, float bw, float bh) {\n\n //is red touching blue?\n\n if (rx + rw >= bx && \n rx <= bx + bw && \n ry + rh >= by && \n ry <= by + bh) { \n return true;\n }\n return false;\n}\n\n\nI don't want the red square and the blue square to overlap, but I want to continue playing if they do touch. Right now the red square stops indefinitely." ]
[ "java", "processing", "collision" ]
[ "Weird GPS latitude values", "App gathers gps location of the user and sometimes coordinates are without fractions digits, but it occurs only for latitude. For example:\n\n\nlon; -0.047041704120082115; lat; 40.0 \nlon -2.5132747513111577; lat; 56.0\n\n\nI thought that it is caused by some casting from double to int, but I double checked all the code, and there is no place with casting.\n\nIs this possible that GPS, returns values with exactly 0, without any fraction digits or it has to be some problem in my code? Maybe the users are mocking location and this is the reason?" ]
[ "android", "gps" ]
[ "Using .after() to add html closing and open tags", "I'm trying to split an unordered list into two columns by finding the halfway point of the list and adding </ul><ul> after that </li>. This could be the complete wrong way to do this but it is how I thought to do it. My js looks like this:\n\n$('.container ul').each(function(){\n\n var total = $(this).children().length;\n var half = Math.ceil(total / 2) - 1;\n $(this).children(':eq('+half+')').after('</ul><ul>');\n\n});\n\n\nThe problem I'm having and what I don't understand is that .after() is reversing the order of the tags and outputs:\n\n<ul>\n\n<li><a href=\"#\">link</a></li>\n\n<li><a href=\"#\">link</a></li>\n\n<li><a href=\"#\">link</a></li>\n\n<ul></ul>\n\n<li><a href=\"#\">link</a></li>\n\n<li><a href=\"#\">link</a></li>\n\n</ul>\n\nPlease let me know if there's a better way to do this, but I really would like to know why .after() is reversing the order of tags. Thanks" ]
[ "javascript", "jquery", "html", "jquery-after" ]
[ "Spring AOP AspectJ trying to advise classes that don't match pointcut", "I have an AOP log setup in one project that's not working in another. \n\nFrom build.gradle: \n\ncompile \"org.springframework.boot:spring-boot-starter-web:1.4.2.RELEASE\" \n[...]\ncompile \"org.aspectj:aspectjrt:1.8.10\"\ncompile \"org.aspectj:aspectjweaver:1.8.10\"\n\n\nI have a base aspect to log around some APIs:\n\n@Aspect\npublic abstract class Profiler {\n private static final Logger logger = LoggerFactory.getLogger(getClass());\n\n protected abstract void toLog(); \n\n @Around(\"toLog()\")\n public Object logAround(ProceedingJoinPoint joinPoint) {\n\n[...]\n\n\nI have derived classes to define pointcuts:\n\n@Aspect\npublic class SDKProfiler extends Profiler {\n @Override\n @Pointcut(\"execution(public * com.company.app.stuff.*.*(..))\")\n protected void toLog() {}\n}\n\n\nI have enabled aspecjtJ with @EnableAspectJAutoProxy on my configuration.\nWhen I try to load the ConfigurableApplicationContext in main, I end up with this exception:\n\n[...] \nCaused by: java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut toLog\n at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:301)\n at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:207)\n at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:193)\n at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:170)\n at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:220)\n at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:279)\n at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:311)\n [...]\n\n\nThis happens while Spring is trying to autowire a class that doesn't in anyway match the pointcut expression. If I remove that bean, it will fail in the same way against another bean that doesn't match the pointcut expression. Looking at previous questions, I've seen people having success by upgrading their version of AspectJ. As of this writing, that's not an option since 1.8.10 is current latest version.\n\nThis code works properly in a similar application where the only obvious difference is the build tool, maven. However, there's no compile time weaving going on, so that shouldn't be a factor. \n\nAny idea why spring is trying to find a 'toLog' pointcut in 3rd party classes that don't match the expression?" ]
[ "java", "spring", "spring-boot", "aop", "aspectj" ]
[ "SELECTS only selects one element", "I'm having some problems with this select. I wanna determine the \"pegada ecológica\" of every product with the type \"lar\".\nWith this select I was able to get the first product with the type \"lar\", but I want every product. I don't know how this happened.\n\nSELECT DISTINCT P.codigo as \"Código Produto\", \n SUM(Compra.quantidade)*SUM(Composto.percentagem)*SUM(E.pegadaEcologica) as \"Pégada Ecológica\"\nFROM Produto P, Elemento E, composto Composto, compra Compra\nWHERE P.tipo = 'lar' AND P.codigo = Composto.produto \n AND Composto.elemento = E.codigo AND P.marca = Composto.prodMarca\n\n\nMy tables:\n\nCreate table Elemento (\n codigo char(3),\n nome varchar(25) not null,\n pegadaEcologica int(2) not null,\n saude int(2) not null,\n constraint pk_Elemento primary key (codigo)\n);\n\nCreate table Produto (\n codigo int(6),\n marca int(7),\n nome varchar(50) not null,\n tipo char(10),\n comercioJusto char(1),\n constraint Produto_tipo_RI004 check (tipo in ('alimentac','lar','jardim','automov','viagem','electrodom')),\n constraint Produto_comercioJusto_RI005 check (comercioJusto in ('A','B','C','D')),\n constraint fk_Produto_marca foreign key (marca) references Marca(numero) on delete cascade,\n constraint pk_Produto primary key (codigo,marca)\n);\n\n\nCreate table compra (\n produto int(6),\n prodMarca int(7),\n consumidor int(9),\n quantidade decimal(10,3) not null,\n constraint compra_quantidade_RI006 check (quantidade>0),\n constraint fk_compra_produto foreign key (produto,prodMarca) references Produto(codigo,marca) on delete cascade,\n constraint fk_compra_consumidor foreign key (consumidor) references Consumidor(numero) on delete cascade,\n constraint pk_compra primary key (produto,prodMarca,consumidor)\n);\n\n\nCreate table composto (\n produto int(6),\n prodMarca int(7),\n elemento char(3),\n percentagem decimal(4,1) not null,\n constraint composto_percentagem_RI007 check (percentagem>0 and percentagem<=100),\n constraint fk_composto_produto foreign key (produto,prodMarca) references Produto(codigo,marca) on delete cascade,\n constraint fk_composto_elemento foreign key (elemento) references Elemento(codigo) on delete cascade,\n constraint pk_composto primary key (produto,prodMarca,elemento)\n);\n\n\nNOTE: If you need INSERTs, I have them, let me know and I'll post those too." ]
[ "mysql", "sql", "select" ]
[ "angular, factory Error: AuthFactory.getUserInfo is not a function", "i'm a new in Angular. I try create factory but got an Error: AuthFactory.getUserInfo is not a function. Could somebody help me?\n\nMy Code:\n\nauth.factory.js:\nangular.module('tsg').factory('AuthFactory', function() {\n return {\n getUserInfo: function getUserInfo(){\n console.log(\"AuthFactory.getUserInfo()\");\n return \"userInfo\";\n }\n };\n\n});\n\n\nheader.js:\n\nangular.module('tsg').controller('HeaderCtrl',HeaderCtrl);\n\nHeaderCtrl.$inject = ['$scope', '$rootScope', '$location','$cookieStore','AuthFactory'];\nfunction HeaderCtrl($scope, $cookieStore, AuthFactory)\n{ \n AuthFactory.getUserInfo();\n $scope.username = \"UserName123\";\n $scope.date = new Date();\n};" ]
[ "angularjs", "factory" ]
[ "Limiting the input of one str[n]", "I am having trouble with a console application I have to make. The problem is that I have a void function, in which I use cin.getline from <iostream> and <cstring>. \n\nMy string is defined like this: char str[50]; and everytime I enter more than 50 symbols i get into an infinite loop and basically my program crashes.\n\nCan any of you think of a function that ignores everything past the limit (in this case 50) so that my program wont crash. By ignores, I mean that when I enter 50+ symbols, the program says: \n\n\n max 50 symbols, please input again:" ]
[ "c++", "string", "input" ]
[ "Getting InvalidParameterException while trying to setup cloudwatch log filter via terraform", "I am trying to setup cloudwatch log filter using terrafom using below resource element (The logs are in the default format):\nresource "aws_cloudwatch_log_metric_filter" "exception-filter" {\n name = "Exception filter"\n pattern = "Exception:"\n log_group_name = "/ecs/application/log"\n metric_transformation {\n name = "Exceptions"\n namespace = "app-custom"\n value = "1"\n default_value = "0"\n }\n}\n\nThe terraform apply command fails stating InvalidParameterException: Invalid metric filter pattern.\nI tried to escape ":" using \\ but doing do also I got an error that the symbol ":" is not a valid escape.\nIs there any other way to specify the pattern here?" ]
[ "amazon-web-services", "terraform", "amazon-cloudwatch" ]
[ "Mongoose Model applying multiple functions to a Model Object", "I'm usting Nodejs Expressjs MongoDB and Mongoose to create rest API for a small service-app I work on. \n\nI did all routes applying single straightforward functions like .find() \n.findOneAndUpdate() and etc. \nLike this one:\n\n router.get('/testTable', function(req, res, next) {\n TestModel.find(function (err, testTableEntries) {\n if (err) return next(err);\n res.send(testTableEntries);\n });\n});\n\n\nPretty simple. But, what if I want to incorporate more functions then just single mongo function .find()\n\nWhat if I want to:\n\n .find().pretty()\n\n\nOr if want to aggregate, make some counts:\n\n.find().count()\n.find({\"fieldName\": \"How many have this value?\"}).count()\n.find({\"fieldName\": \"How many have this value?\"}).count().pretty()\n\n\nI tried something like:\n\n router.get('/testTable', function(req, res, next) {\n TestModel.find(function (err, testTableEntries) {\n if (err) return next(err);\n res.send(testTableEntries);\n }).count();\n});\n\n\nOr maybe you can advice callbackless solution with promise (like Bluebird), my first thought is:\n\nrouter.get('/testTable', function(req, res, next) {\n TestModel.find(function (err, next) {\n if (err) return next(err);\n }).then(function (req, res, next) {\n res.send(testTableEntries);\n }).catch(function (err, next) {\n if (err) return next(err);\n });\n}); \n\n\nMaybe there's some Mongoose built-in functions that can solve it, I'll be grateful, but also would be useful to know how to call functions in chain one after another on Mongoose Models. \n\nI'm grateful in advance for any advises and thoughts!" ]
[ "node.js", "mongodb", "function", "mongoose", "chaining" ]
[ "c alternative to signal() + alarm()", "I'm building some FastCGI apps and it sort of bugs me that lighttpd doesn't kill them off after they've been idle, so I'm trying to have them close on their own.\n\nI tried using\n\nsignal(SIGALRM, close);\nalarm(300);\n\n\nand having the close function execute exit(0), and that works almost well.\n\nThe problem is the close function is being called every time the main program loop runs though (I call alarm(300) each loop to reset it). I've read the man page for alarm() and it doesn't seem as though calling it multiple times with the same value should trip SIGALRM so I'm assuming Lighttpd is sending an alarm signal.\n\nThe big question! Is there a way to run a method after a specific interval, and have that interval be resettable without SIGALRM? I'd be nice if I could have multiple alarms as well.\n\nHere's the whole app thus far:\n\n#include <stdlib.h>\n#include <stdarg.h>\n#include <signal.h>\n#include \"fcgiapp.h\"\n\nFCGX_Stream *in, *out, *err;\nFCGX_ParamArray envp;\nint calls = 0;\n\nvoid print(char*, ...);\nvoid close();\n\nint main(void)\n{\n // If I'm not used for five minutes, leave\n signal(SIGALRM, close);\n\n int reqCount = 0;\n\n while (FCGX_Accept(&in, &out, &err, &envp) >= 0)\n {\n print(\"Content-type: text/plain\\r\\n\\r\\n\");\n\n int i = 0;\n char **elements = envp;\n print(\"Environment:\\n\");\n while (elements[i])\n print(\"\\t%s\\n\", elements[i++]);\n\n print(\"\\n\\nDone. Have served %d requests\", ++reqCount);\n print(\"\\nFor some reason, close was called %d times\", calls);\n\n alarm(300);\n }\n\n return 0;\n}\n\nvoid print(char *strFormat, ...)\n{\n va_list args;\n va_start(args, strFormat);\n FCGX_VFPrintF(out, strFormat, args);\n va_end(args);\n}\n\nvoid close()\n{\n calls++;\n// exit(0);\n}" ]
[ "c", "fastcgi", "lighttpd", "signals", "alarm" ]
[ "How to set data on gridview textboxes and combo boxes columns", "While setting data on GridView the error thrown is\n Index was out of range. Must be non-negative and less than the size of the collection.\nParameter name: index\n\ntry\n{\n con.Open();\n SqlCommand cmd = new SqlCommand(\"gridalldata\", con);\n cmd.CommandType = CommandType.StoredProcedure;\n cmd.Parameters.Add(\"@order_no\", SqlDbType.NVarChar).Value = txt_orderno.Text;\n cmd.ExecuteNonQuery();\n SqlDataAdapter da = new SqlDataAdapter(cmd);\n DataTable dtr =new DataTable();\n da.Fill(dtr);\n MessageBox.Show(\"\"+dtr.Rows[0][0].ToString());\n for (search = 0; search < dtr.Rows.Count-1; search++)\n {\n\n dataGridView1.Rows[search].Cells[0].Value = dtr.Rows[search][0].ToString();\n dataGridView1.Rows[search].Cells[1].Value = dtr.Rows[search][1].ToString();\n dataGridView1.Rows[search].Cells[2].Value = dtr.Rows[search][2].ToString();\n dataGridView1.Rows[search].Cells[3].Value = dtr.Rows[search][3].ToString();\n dataGridView1.Rows[search].Cells[4].Value = dtr.Rows[search][4].ToString();\n dataGridView1.Rows[search].Cells[5].Value = dtr.Rows[search][5].ToString();\n dataGridView1.Rows[search].Cells[6].Value = dtr.Rows[search][6].ToString();\n dataGridView1.Rows[search].Cells[7].Value = dtr.Rows[search][7].ToString();\n dataGridView1.Rows[search].Cells[8].Value = dtr.Rows[search][8].ToString();\n txt_discount.Text = dtr.Rows[search][10].ToString();\n txt_netamount.Text = dtr.Rows[search][11].ToString();\n dataGridView1.Rows[search].Cells[10].Value = dtr.Rows[search][12].ToString();\n dataGridView1.Rows[search].Cells[9].Value = dtr.Rows[search][13].ToString();\n\n }\n\n }\n\n catch (Exception ex)\n {\n MessageBox.Show(ex.Message);\n }\n finally { con.Close(); }\n\n\nCan anyone guide me?" ]
[ "c#" ]
[ "Docker compose of mutiple sub-website", "I am using Docker compose to run nginx+php+mysql environment,OS is centos 7.2, question is about mutiple sub-website on one host:\n\nFor example:\nThere is one host,two projects will run on this host,\nnamed project-a and project-b,\ntwo different docker-compose.yml exsist in project-a and project-b.\n\nQuestion:\n\nWhen executing docker-compose up in project-a and project-b,does nginx+php+mysql environment run two or one? If two, a lot of space is occupied ,how to solve this problem? \n\nAdd: docker-compose.yml\n\nversion: '2'\n\nservices:\n\n nginx:\n container_name: nginx\n image: nginx\n ports:\n - 80:80\n - 443:443\n links:\n - php\n env_file:\n - ./.env\n working_dir: /usr/share/nginx/html # should be `/usr/share/nginx/html/project-a` and `/usr/share/nginx/html/project-b` here?\n volumes:\n - ~/docker/nginx/default.conf:/etc/nginx/conf.d/default.conf\n - ~/docker/nginx/nginx.conf:/etc/nginx/nginx.conf\n - ~/docker/www:/usr/share/nginx/html\n\n php:\n container_name: php\n image: fpm\n links:\n - mariadb\n - redis\n env_file:\n - ./.env\n volumes:\n - ~/docker/www:/usr/share/nginx/html\n\n mariadb:\n container_name: mariadb\n image: mariadb\n env_file:\n - ./.env\n volumes:\n - ~/opt/data/mysql:/var/lib/mysql\n\n redis:\n container_name: redis\n image: redis\n\n\n.env:\nproject-a and project-bhave different DB_DATABASE and APP_KEY,other items are the same.\n\nAPP_ENV=local\nAPP_DEBUG=true\nAPP_KEY=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa # Here different.\n\nDB_HOST=laravel.dev\nDB_DATABASE=project-a # Here different.\nDB_USERNAME=root\nDB_PASSWORD=\n\nCACHE_DRIVER=file\nSESSION_DRIVER=file\nQUEUE_DRIVER=sync\n\nREDIS_HOST=laravel.dev\nREDIS_PASSWORD=null\nREDIS_PORT=6379\n\nMAIL_DRIVER=smtp\nMAIL_HOST=mailtrap.io\nMAIL_PORT=2525\nMAIL_USERNAME=null\nMAIL_PASSWORD=null\nMAIL_ENCRYPTION=null\n\n\nProject files:\nproject-a and project-b have the same catalog.\n \n\nurls:\nproject-a:aaa.xxxxxx.com\nproject-b:bbb.xxxxxx.com \n\nProject folders:\nproject-a:~/docker/www/project-a\nproject-b:~/docker/www/project-b \n\nSubsidiary question:\n\n1、Should working_dir be /usr/share/nginx/html/project-name or /usr/share/nginx/html in docker-compose.yml file? \n\n2、If working_dir is /usr/share/nginx/html,I think docker-compose.yml files have the same content in project-a and project-b,right?Is there any other items to be modified? \n\n3、How to merge the compose file into one? \n\nAdd2:\n\nproject-common: docker-compose.yml\n\nversion: '2'\n\nservices:\n\n nginx:\n container_name: nginx\n image: nginx\n\n php:\n container_name: php\n image: fpm\n\n mariadb:\n container_name: mariadb\n image: mariadb\n\n redis:\n container_name: redis\n image: redis\n\n\nproject-a: docker-compose.yml,and project-b is the same except project name.\n\nversion: '2'\n\nservices:\n\n nginx:\n external_links:\n - project-common:nginx\n ports:\n - 80:80\n - 443:443\n links:\n - php\n env_file:\n - ./.env\n working_dir: /usr/share/nginx/html/project-a\n volumes:\n - ~/docker/nginx/default.conf:/etc/nginx/conf.d/default.conf\n - ~/docker/nginx/nginx.conf:/etc/nginx/nginx.conf\n - ~/docker/www/project-a:/usr/share/nginx/html/project-a\n\n\n php:\n external_links:\n - project-common:php\n links:\n - mariadb\n - redis\n env_file:\n - ./.env\n volumes:\n - ~/docker/www:/usr/share/nginx/html/project-a\n\n\n mariadb:\n external_links:\n - project-common:mariadb\n env_file:\n - ./.env\n volumes:\n - ~/opt/data/mysql:/var/lib/mysql\n\n\n redis:\n external_links:\n - project-common:redis" ]
[ "php", "mysql", "linux", "nginx", "docker" ]
[ "HttpRequestValidationException in Orchard CMS", "Using Orchard 1.9 from GitHub, if I attempt to force a page validation exception by navigating to \n\n\n ~/Users/Account/LogOn?ReturnUrl=<script%20src%3Dhttp%3A%2F%2Flocalhost%2Fj%20 \n\n\nthe end result is a yellow-screen-of-death rather than the Orchard custom exception message.\n\nWhat is the recommended Orchard way to handle this? Ideally I would like to show the Orchard error page.\n\nFYI I notice that the GET LogOn action (AccountController) does not have a ValidateInput attribute but the POST action does.\n\nPotential Solution:\n\nI set the customErrors element in the web.config to have the attribute defaultRedirect=\"Error.html\" where Error.html is a new file. This of course does not meet my original goal of displaying the Orchard error page.\n\nThis does not seem right as modifying the Orchard core (even though it's just the web.config) does not feel right, especially when thinking ahead to updating the Orchard version by pulling the latest Orchard code from the GitHub repository." ]
[ "orchardcms", "request-validation" ]
[ "Python SKLearn training test data", "This is my first time working on machine learning. I have an assignment to run Logistic and Bayesian Regression from Sklearn on apple stock returns and compare that with linear regression + tensor flow. I am not sure if I am correct in understanding that before I run Logistic Regression I have to train my data set. I was trying to do that my data looks like:\n\nClosing_Price Daily_Returns Daily_Returns_1 Daily_Returns_2 Daily_Returns_3 Daily_Returns_4 Daily_Returns_5\nDate \n1980-12-22 0.53 0.058269 0.040822 0.042560 0.021979 -0.085158 -0.040005\n1980-12-23 0.55 0.037041 0.058269 0.040822 0.042560 0.021979 -0.085158\n1980-12-24 0.58 0.053110 0.037041 0.058269 0.040822 0.042560 0.021979\n1980-12-26 0.63 0.082692 0.053110 0.037041 0.058269 0.040822 0.042560\n1980-12-29 0.64 0.015748 0.082692 0.053110 0.037041 0.058269 0.040822\n\n\nWhen I run\n\nfrom sklearn.model_selection import train_test_split\n\nX_train, X_test, y_train, y_test = train_test_split(X,y,test_size = 0.2)\n\nI get an error that NameError: name 'X' is not defined\n\nYour assistance is greatly apprecaited. Thank you in advance for your time." ]
[ "machine-learning", "scikit-learn", "jupyter-notebook", "training-data" ]
[ "NoMethodError: undefined method `has_attached_file'", "Paperclip produces this error, after checking out the plugin's rails3 branch. \nMy Gemfile has following line: \n\ngem 'paperclip', :git => 'http://github.com/thoughtbot/paperclip.git', :branch => 'rails3'\n\n\nAnd the error message is: \n\nNoMethodError: undefined method `has_attached_file' for #<Class:0x2a50530>" ]
[ "ruby-on-rails", "paperclip", "ruby-on-rails-3" ]
[ "GetElementById from imported nodes", "How can I retrieve the ids from the imported nodes?\nIt's possible with the original xml content, but if I import some data I cannot access it by id.\n\n$test = '\n<!DOCTYPE html>\n<html>\n <head/>\n <body>\n <div id=\"test\"></div>\n </body>\n</html>';\n\n\n$test2 = '<div id=\"test2\">test</div>';\n\n$dom = new DOMDocument();\n$dom2 = new DOMDocument();\n\n$dom->loadHTML($test);\n$dom2->loadXML($test2);\n\n$element2 = $dom2->documentElement;\n\n$import = $dom->importNode($element2, true);\n\n$element = $dom->getElementsByTagName('html')->item(0);\n$element->appendChild($import);\n\nvar_dump($dom->getElementById('test'));\nvar_dump($dom->getElementById('test2'));\n\n\nIt is possible to find test but not to find test2 which came by the imported element.\n\nThat is the xml output. The import worked.\n\n <?xml version=\"1.0\" standalone=\"yes\"?>\n<!DOCTYPE html>\n<html>\n <head></head>\n <body>\n <div id=\"test\"></div>\n </body>\n <div id=\"test2\">test</div>\n</html>" ]
[ "php", "html", "dom", "getelementbyid" ]
[ "How do I pass multiple parameters to an @Input decorator function in Angular 4", "My Input decorator looks like this\n\n @Input()\n filler(itemName:any,itemRate:number,itemQty:number,itemDiscount:number,itemSubtotal:number)\n{\n this.cart.push({name:itemName,rate:itemRate,qty:itemQty,discount:itemDiscount,subtotal:itemSubtotal});\n }\n\n\nand the call looks like this \n\n<app-bill [filler]=\"['Name','Rate', 'Qty', 'Discount', 'Subtotal']\"></app-bill>\n\n\nand I need to pass all those 5 values to the \"filler()\"." ]
[ "angular" ]
[ "How to initialize a vector to a certain length in a class?", "I have a simple class with a member that is a vector. I want to initialize that vector to have a specific size in the class, but I get an error. Here is my code:\n\nclass MyClass\n{\nprivate:\nstd::vector<int> m_ray_fbos(5);\n}\n\n\nThis gives me the warning (in Visual Studio 2017) expected a typed identifier\n\nI have also tried std::vector<int> m_ray_fbos(5, 0);\n\nThe only think I can get to work is std::vector<int> m_ray_fbos = { 0, 0, 0, 0, 0 }; but obviously this is not ideal for long vectors.\n\nAm I doing something wrong?\n\nIs there a way to specify the size of a vector in a class definition?" ]
[ "c++", "vector" ]
[ "Powershell quser & logoff", "Trying to create a script to log off users that have been idle for more than 10 minutes. My idle time -gt does not work. \n\nforeach ($user in quser | select ID, username, 'idle time' ) {\n\nif($user.'IDLE TIME' -gt 10) {\n\n logoff /server:localhost $user.ID\n $Output = \"Logging off $user.username\"}\n} \n\nelse {$Output = \"No users to log off\" }\n\n} \n\n\nthank you for any help\n\nThis worked in the end, but I have configured script as following, but did not use idletime, just listed the usernames to be logged off from the server. The below is running via puppet so it only performs the action between 2 - 5 in the morning.\n\n$localServerName = Get-WmiObject -Class Win32_ComputerSystem | Select Name\n$servername = $localServerName.Name\n$Jallie =@()\nforeach($users in Get-WmiObject win32_process -ComputerName $localServerName.Name | where {$_.ProcessName -eq 'explorer.exe'} )\n{\n $temp = \" \" | select Processname,Username,SessionId\n $temp.Processname = $users.ProcessName\n $temp.Username = $users.GetOwner().user\n $temp.Sessionid = $users.SessionId\n $Jallie += $temp\n}\n$servername = $localServerName.Name\nforeach($element in $Jallie)\n{\n if($element.username -eq 'user1')\n {\n logoff $element.Sessionid /SERVER:$servername\n 'Logging off ' + $element.username\n }\n elseif($element.username -eq 'user2')\n {\n logoff $element.Sessionid /SERVER:$servername\n 'Logging off ' + $element.username\n }\n\n}" ]
[ "powershell", "puppet" ]
[ "Bidirectional async Java RPC", "protobuf-rpc-pro provides a bidirectional async RPC implementation for Java based on Protocol Buffers. Are there other like this (Protocol Buffers not necessary)? This question is similar, but received only replies about Python." ]
[ "java", "asynchronous", "rpc", "protocol-buffers" ]
[ "middleware not returning errors in express.js", "I have a middleware that uses express-validator to validate request,\nconst { validationResult } = require("express-validator");\n\nmodule.exports = {\n validate: (req, res, next) => {\n const raw_errors = validationResult(req);\n\n if (raw_errors.isEmpty()) {\n return next()\n }\n const errors = raw_errors.errors.map((err) => ({ message: err.msg }));\n\n return res.status(422).json({ status: "error", errors });\n },\n}\n\nI use it on the route like so:\nconst { validate } = require('../middlewares/validation')\n\nroutes.post('/', validate, (req, res) => {\n postService.add(req.body.name, req.body.description).then(post => {\n res.status(201).json({ message: 'post added', data: post })\n }).catch(error => {\n handleError(error, res)\n })\n})\n\nBut when i try to make an API call with an empty request body, it does not return any errors.\nHere is my model\nconst mongoose = require('mongoose');\n\nconst PostSchema = mongoose.Schema( {\n name: {\n type: String,\n required: [true, 'Please provide a name'],\n },\n description: {\n type: String,\n required: [true, 'Please provide a description'],\n }\n},\n{timestamps: true}\n);\n\nmodule.exports = mongoose.model('Post', PostSchema);\n\nHere is my postService\nmodule.exports = {\n //adds a post\n add : async (name, description) => {\n try{\n const tab = { name, description }\n return postModel.create(tab)\n }\n catch(err){\n throw new ErrorHandler(500, "Unable to add post at this time. Please try again later.")\n }\n },\n}\n\nWhen I log raw_errors from the middleware, I get - Result { formatter: [Function: formatter], errors: [] }\nPlease what might be wrong?" ]
[ "node.js", "express", "express-validator" ]
[ "Can I send performSegueWithIdentifier: to anything other than self?", "I have a category on UIViewController that deals with errors coming from my networking layer. If I get an authentication error in response to a network call, I want to perform an unwind segue which takes me back to my LoginViewController.\n\nHowever, I don't want to have to add the appropriate unwind segue to every single view controller in my Storyboard. Can I simply declare the unwind segue in the UITabBarController that is at the \"top\" of my view controller navigation, and then say\n\n[self.tabBarController performSegueWithIdentifier:@\"UnwindToLoginSegueIdentifier\" sender:self]\n\n... from inside my UIViewController+ErrorHandling category?" ]
[ "ios", "uistoryboard", "uistoryboardsegue" ]
[ "UnReachable code-How to use preprocessor settings", "Can anyone help me,how to make the preprocessor settings starting from 4.5 OS in Blackberry? \n\nif i use preprocessors such as JDE_4_7 and NOT_JDE_4_5(For eg)I am getting the error as unreachable code,\n\nIs there any condition that we should not use preprocessors in a single location?\nHow can i rectify it?" ]
[ "blackberry", "java-me", "preprocessor", "blackberry-eclipse-plugin", "blackberry-jde" ]
[ "Visual Studio 2015 can't start IIS Express", "When I am trying to run an ASP.Net Core project in Visual Studio 2015, a Microsoft Visual Studio dialog appears \"The project doesn't know how to run the profile IIS Express\".\n\nDoes anyone know anything about this message, or how to fix it? I've searched Google and the MSDN. There's nothing in the build logs, or the Windows event log." ]
[ "iis", "visual-studio-2015", "asp.net-core", "iis-express" ]
[ "Wordpress custom REST API", "I have been working on a Wordpress plugin and I come from a background where I usually write my own REST endpoints (Rails etc). My question is, how do I from a WP plugin create rest url endpoints?\n\nE.g.:\n\n/myplugin/save-tutorial (POST takes JSON and returns JSON)\n/myplugin/get-tutorial?id= (GET returns JSON)\n\nHow do I create such REST endpoints? I have looked at admin-ajax.php and that seems about right, but still pretty messy. It seems like a simple problem though. I want to process the responses in my-plugin.php.\n\nThanks in advance!" ]
[ "php", "wordpress", "rest" ]
[ "NSAttributedString loading html with images", "I'm trying to render html-document with NSAttributedString in iOS 7 (as a part of investigation of the alternatives to UIWebView). Here the code:\n\nNSData *htmlData = [NSData dataWithContentsOfFile:self.chapterPath];\n\nNSAttributedString *attrString = [[NSAttributedString alloc] initWithData:htmlData\n options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)} \n documentAttributes:nil error:nil];\n\nself.readerTextView.attributedText = attrString;\nself.readerTextView.editable = NO;\n\n\nAnd images were not displayed. Is it possible to render HTML with images using this approach or did I miss some options or attributes? Thanks.\n\nUPDATE:\n\nSome of the tags that were not displayed:\n\n<img src=\"images/cover.jpg\" alt=\"cover\" style=\"height: 100%\"/>" ]
[ "html", "ios7", "uitextview", "nsattributedstring" ]
[ "How do I write below code in Java 8 using Stream API?", "Is there any way to write the following code using Streams?\n\npublic Map<String, Integer> process() {\n List<String> words = Arrays.asList(message.toLowerCase().split(\"[?.\\\\s]+\"));\n Map<String, Integer> countMap = new HashMap<>();\n\n for (String word : words) {\n if (word.length() > 2) {\n Integer count = countMap.getOrDefault(word, 0);\n countMap.put(word, count + 1);\n }\n }\n return countMap;\n}" ]
[ "java", "lambda", "java-8" ]
[ "How does browser message server identify the particular browser to send message for push notification", "I understand chrome uses GCM message server to send messages that are sent from server. But how does it identify which browser to send.\n\nDoes browser sync with the message server when it gets a active internet connection?" ]
[ "push-notification", "google-cloud-messaging" ]
[ "Create user from the command line in Django", "I am confusing now. I have 3 apps in one project.\n\nApp1 : use from enduser(web view based app)\n\nApp2 : use from service provider(web service)\n\nApp3 : use from system administrator.\n\nI want to use django authentication system for each apps. I can make django project to authenticate App1's user. But, how can I use authentication system of App2 and App3 at the same time.\n\nWhen I run python manage.py createsuperuser command, django make App1's superuser. How can I make for App2 and App3 using this command?\n\nDoes someone have any idea? Please help me. \n\nModels.py\n\n### This table is for end user.\nclass RemoshinUser(models.Model):\n\n user = models.OneToOneField(User)\n user_type = models.SmallIntegerField(default=1)\n kana_name = models.CharField(max_length=128, blank=True)\n date_of_birth = models.DateField(blank=True, null=True)\n sex = models.SmallIntegerField(null=True)\n postno = models.CharField(max_length=7, blank=True)\n address1 = models.CharField(max_length=128)\n address2 = models.CharField(max_length=128, blank=True)\n telno = models.CharField(max_length=16, blank=True)\n photo = models.ImageField(upload_to='users/%Y/%m/%d', blank=True)\n\n create_date = models.DateTimeField(auto_now_add=True)\n modify_date = models.DateTimeField(auto_now=True)\n\n class Meta:\n db_table = 'remosys_remoshin_user_tbl'\n swappable = 'AUTH_USER_MODEL'\n\n\n### This table is for service provider.\nclass RemoshinDoctor(models.Model):\n user = models.OneToOneField(User)\n user_type = models.SmallIntegerField(default=2)\n doctor_id = models.CharField(max_length=16, primary_key=True)\n clinic_id = models.ForeignKey(Clinic)\n photo = models.ImageField(blank=True, null=True)\n create_date = models.DateTimeField(auto_now_add=True)\n modify_date = models.DateTimeField(auto_now=True)\n\n class Meta:\n db_table = 'remosys_remoshin_doctor_tbl'\n\n\n\n### This table is for system administrator.\nclass RemoshinManager(models.Model):\n user = models.OneToOneField(User)\n user_type = models.SmallIntegerField(default=3)\n manager_id = models.CharField(max_length=16, primary_key=True)\n create_date = models.DateTimeField(default=timezone.now)\n modify_date = models.DateTimeField(default=timezone.now)\n\n class Meta:\n db_table = 'remosys_remoshin_manager_tbl'" ]
[ "python", "django", "python-3.x", "django-models" ]
[ "Increase StackSwitcher size in gtk3", "I have a Gtk.StackSwitcher in my python code, and I would like to increase its size to have biggers icons : \n\n\n(source: toile-libre.org) \n\nHere is the relevant code : \n\n stack = Gtk.Stack() # catégories d'applications\n stack.set_transition_type(Gtk.StackTransitionType.SLIDE_UP_DOWN)\n stack.set_transition_duration(1000)\n # some code\n for c in categories:\n icon = Gtk.Image.new_from_icon_name(c['icon'],Gtk.IconSize.DIALOG)\n icon.show()\n stack.add_titled(icon, c['label'], c['label'])\n stack.child_set_property(icon, \"icon-name\", c['icon'])\n\n stack_switcher = Gtk.StackSwitcher(homogeneous=True)\n stack_switcher.set_stack(stack)\n\n\nI can't find anything in the documentation to change icon (or label) size." ]
[ "python", "python-3.x", "gtk3" ]