texts
sequence
tags
sequence
[ "Activity destroyed after 1 hour", "I'm new to Android development. I'v developed an android application which needs to store the connection/data even after 1 hour. Currently I have all the data and the connections(chromecast mediaplayer) in a singleton class. But, when the user puts the app into the background for about an hour, the activity is destroyed so the connections,data etc are lost causing my app to crash when re-launched. \n\nI've read up on the android services, Can I use these services to hold the singletons so even when the activities are destroyed I can have data binded back to the views when re-launched? \n\nOr is there a way to make sure that the activities are not destroyed when android decides to do a cleanup? \nPlease advise\n\nThanks." ]
[ "android", "android-activity", "android-service" ]
[ "Parse every element of JSON to Array in Java", "JAVA\n\nI want to parse every element of JSON file (using gson will be the best) to Array. I searched for two days and I still can't figure out how to do it correctly. My JSON file looks like this:\n\n{\n \"spawn1\": {\n \"x\": 336.4962312645427,\n \"y\": 81.0,\n \"z\": -259.029426052796\n },\n \"spawn2\": {\n \"x\": 341.11558917719424,\n \"y\": 80.0,\n \"z\": -246.07415114625\n }\n}\n\n\nThere will be more and more elements with different names. What I need is to take all the elements like x, y, z and create an object using it and place it to the array. Class for this object looks like this:\n\npublic class Chest {\n private double x, y, z;\n\n public Chest(double x, double y, double z) {\n this.x = x;\n this.y = y;\n this.z = z;\n }\n}" ]
[ "java", "arrays", "json", "parsing" ]
[ "Using ruby on rails validation helpers inside custom validations", "Let's say I have lots of attributes that can only have a specific set of string values.\n\nTypically we'd see the following. \n\nclass User < ApplicationRecord\n validates :foo, inclusion: { in: ['some', 'array'] }\n validates :bar, inclusion: { in: ['another', 'array'] }\n validates :moo, inclusion: { in: ['one_more', 'array'] }\nend\n\n\n\nI have lots of these types of validations in my model and I want to DRY them up. So I tried the below but I get a error undefined method 'validates' for #User:0x00007fdc10370408.\n\nclass User < ApplicationRecord\n VALIDATION_ENUMS = {\n foo: %w[foo1 foo2],\n bar: %w[bar1 bar2]\n }.freeze\n\n validate :validate_enums\n\n def validate_enums\n VALIDATION_ENUMS.each_key do |attribute|\n validates attribute, inclusion: { in: VALIDATION_ENUMS[attribute] }\n end\n end\nend\n\n\nHow do I get access to the ActiveModel::Validations helper methods from within my function?\n\nOr is there a better way to do this?" ]
[ "ruby-on-rails", "ruby", "validation", "helper" ]
[ "ConnectionString switching within partial class for dbml", "With reference to Point connectionstring in dbml to app.config \n\nhow would you replace the connection name in the partial class with parameter so that you could switch connection strings?" ]
[ "linq", "linq-to-sql" ]
[ "Excel doesn't calculate correctly except if hit enter in the data", "What is happening is the following: I got some numerical data and put it into a Excel sheet. After, I used the function MAX().\n\n|Line| Function | Data|\n|----|-----------|-----|\n| 1 |=MAX(A1:A2)| 12 |\n| 2 | | 20 |\n\n\nThe result was 12.\n\nAfter I selected the cell with 20, I clicked at the Formula bar and pressed enter. The calculation was made correctly.\n\nAnyone know why this has happened?" ]
[ "excel", "vba" ]
[ "tomcat 7 internal logging with log4j2.xml", "I am trying to configure tomcat 7 internal logging with log4j2. I have followed the answer provided at Logging server classes in Tomcat 6 with log4j2.\n\nI am using tomcat 7.0.54, and log4j-core-2.1.jar, log4j-api-2.1.jar.\nI have down loaded the extras and did all the steps below, but when I start tomcat, I get an error:\n\nERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.\n\n\nThese are the steps I performed:\n\n\nput log4j2.xml in $CATALINA_BASE/lib \ndownload tomcat-juli.jar and tomcat-juli-adapters.jar from \"extras\"\nput log4j-api-2.1.jar, log4j-core-2.1.jar, log4j-jul-2.1.jar, and tomcat-juli-adapters.jar from \"extras\" into $CATALINA_HOME/lib.\nreplace $CATALINA_HOME/bin/tomcat-juli.jar with tomcat-juli.jar from \"extras\".\ndelete $CATALINA_BASE/conf/logging.properties\nset the logging manager to use the manager from the log4j2-jul bridge (log4j-jul-2.1.jar). Alter catalina.sh to ensure that the classpath includes bin/tomcat-juli.jar, lib/log4j-jul-2.1.jar, lib/log4j-api-2.1.jar and lib/log4j-core-2.1.jar, and the command used to start tomcat includes\n-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager`\n\n\nI even tried adding this (LOGGING_CONFIG=\"-Djava.util.logging.config.file=$CATALINA_HOME/lib/log4j2.xml\") in catalina.sh but didn't work.\n\nPlease let me know if anyone could configure it successfully." ]
[ "tomcat", "logging", "log4j2", "tomcat-juli" ]
[ "jquery problems with append", "I have a function to load and place images into an empty div (it's some kind of scrolling menu done by me) and to place images one behind another I use append function. All is going well until the upload to the server. The order of the pictures seems to be failed like the append() is not placing them one behind another.\n\nloadContent = function(i){\n var tytul = \"#phot\" + i;\n var photurl = \"../photos/\" + activegal + \"/\" + i + \".JPG\";\n $.ajax({\n url:photurl,\n type:'HEAD',\n error: function()\n {\n\n },\n success: function()\n {\n newid = \"photo\"+i;\n var img = $(\"<img />\").attr({\n\n src: photurl,\n width:\"120\",\n height:\"90\",\n id: newid,\n 'class': \"photon\"\n });\n $(img).appendTo(\"#scrollbar\");\n counter++; \n //$.delay(2);\n }); \n};\n\n<div id=\"scrollbar\">\n </div>" ]
[ "javascript", "jquery", "append" ]
[ "ckeditor get element by id", "What I am try to achieve is to insert some content in a specific container element designated by a unique id. This would help me insert content at positions other than cursor positions.\n\neditor.model.insertContent(modelFragment); is a function that would insert the new fragment at the cursor position, the second parameter that would be accepted is selectable which I am not sure how to specify to match to that particular div id.\n\nWhen I was googling for the same, I found a desirable method in ckeditor4, but unfortunately I am looking for an option in ckeditor5." ]
[ "ckeditor", "ckeditor5" ]
[ "Adding subview on view with changeable frame", "In my app I am currently working on a feature where upon a button tap, a view near the top of the screen is extended downwards to fill the screen (with a gap around the edge). The view is initially about 40 points tall, and when extended it stretches to 20 points from the bottom of the view.\n\nI am trying to figure out the best way to handle the UI in this view, as in it's small form it only contains a button and an imageview, however when expanded it also contains labels, a scrollview, and other imageviews.\n\nShould I be using a xib, which I could then set the frame of to be the same as the expanded view, or some sort of container view?\n\nIf I can avoid it, I would like to avoid creating the layout programmatically.\n\nAnyone have any suggestions?" ]
[ "ios", "swift", "uiview", "uiviewcontroller", "xib" ]
[ "TypeScript Sorting Object by Date", "I have this little code I borrowed from another question for sorting objects in an array by date. However, I can't figure out how to port this to TypeScript. \n\nthis.filteredTxs.sort(function(a,b): any{\n return new Date(b.date) - new Date(a.date);\n});\n\n\nTS Error:\n\n\n ERROR in /transactions-view.component.ts(72,16): error TS2362: The\n left-hand side of an arithmetic operation must be of type 'any',\n 'number' or an enum type.\n \n /transactions-view.component.ts(72,35): error TS2363: The right-hand\n side of an arithmetic operation must be of type 'any', 'number' or an\n enum type." ]
[ "typescript" ]
[ "Shader Reflection With DirectX11", "I'm a new learner of DirectX11, and recent I decide to use VS2015 to run code.\n\nI try to not use EffectFrameWork11, but there's a very unpleasure experience while use it.\n\nI try to change the values in constant buffer, without EffectFramWork, I have to use Map Function,pseudo code just like:\n\nD3D11_MAPPED_SUBRESOURCE mapResource;\nConstBuffer* constStruct = nullptr;\nauto result = m_d3dContext->Map(m_constantBuffer, 0, D3D11_MAP_WRITE_DISCARD,\n 0, &mapResource);\nif (FAILED(result))\n{\n d3dHelper::ShowResultMessage(result);\n return;\n}\n\nconstStruct = (ConstBuffer*)mapResource.pData;\nconstStruct->word = world;\nconstStruct->view = view;\nconstStruct->proj = proj;\nm_d3dContext->Unmap(m_constantBuffer, 0);\n\nm_d3dContext->VSSetConstantBuffers(0, 1, &m_constantBuffer);\nm_d3dContext->DrawIndexed(indexCount, indexOffset, vertexOffset);\n\n\nOK,it work well, but as you can see,I have to write two same struct in C++ code and HLSL code:\n\nc++ code like this:\n\nstruct ConstBuffer\n{\n XMMATRIX word;\n XMMATRIX proj;\n XMMATRIX view;\n};\n\n\nHLSL code like this:\n\ncbuffer cbPerObject : register(b0)\n{\n matrix worldMatrix;\n matrix projMatrix;\n matrix viewMatrix;\n}\n\n\nSo,is there any convenient way to update member with Constant Buffer?" ]
[ "directx-11" ]
[ "Add constant latency to graphical output in XNA 4", "does anyone know of an easy way to add a constant latency (about 30 ms) to the graphical output of an XNA 4 application?\n\nI want to keep my graphical output in sync with a real-time buffered audio stream which inherently has a constant latency.\n\nThanks for any ideas on this!\n\nMax" ]
[ "xna", "xna-4.0" ]
[ "Absolute path of Bazel $(location) macro", "I am using $(location) to pass the location of a built java_library to my java_binary (targets simplified):\njava_binary(\n name = "my_bin",\n main_class = "Bin",\n srcs = [\n "Bin.java"\n ],\n deps = [\n ":my_lib"\n ],\n jvm_flags = [\n "-Dmy_library_path=$(location :my_lib)"\n ]\n)\n\njava_library(\n name = "my_lib",\n srcs = [\n "Lib.java"\n ]\n)\n\nIt looks like this location is relative to the original running location, which means when I use --run_under to run my target in the current directory, it breaks and the location is invalid.\nIs there a way to get the absolute location, or is there a more portable way to pass the jar path to my binary?" ]
[ "java", "bazel" ]
[ "Pybind11: returning a large array in a C++ function significantly increases computing time in python", "I wrote a little C++ Script and used pybind11 to make the C++ function available in python. When called from python, the C++ function takes about 4 seconds to terminate. The C++ functions returns a large array of length 54.346.383.\nOut of curiosity, I modified the C++ function and returned a different array of length 7373 without changing anything else in the code. Now the C++ function terminates in 1 second. So as I understand this the transfer of an object from C++ to Python becomes a huge bottleneck as size of the object increases.\nIs there a smarter approach to handle this issue? Maybe working with pointers? (I am completely new to C++ and pybind11)\n#include <pybind11/pybind11.h>\n#include <pybind11/numpy.h>\n#include <pybind11/stl.h>\n#include <vector>\n#include <numeric>\n\nnamespace py = pybind11;\n\nstd::vector<double> isoCdf_seq(std::vector<double> array_w, std::vector<double> W, std::vector<double> Y, std::vector<int> posY, std::vector<double> array_y) {\n\nstd::vector<double> CDF;\nCDF.reserve(m * mY);\n\n// some code\n\nreturn CDF;" ]
[ "python", "c++", "pybind11" ]
[ "calling -retain multiple times on the same object", "What happens when you call -retain on an object many times? Is it OK to just release it once at when you're done using it?" ]
[ "iphone", "objective-c", "cocoa-touch", "cocoa" ]
[ "Obtain output from a bash command in Ruby", "I'm trying to obtain the output of a bash command. More precisely, I need to store the number of lines that contains a string in a file:\n\nvariable_name = AAAAAAA\nPATH_TO_SEARCH = .\nCOMMAND = \"grep -R #{variable_name} #{PATH_TO_SEARCH} | wc -l\"\n\n\nTo execute the command I tried both methods:\n\nnum_lines = %x[ #{COMMAND} ]\nnum_lines = `#{COMMAND}`\n\n\nbut the problem is: In \"num_lines\" I have 1) the number of lines that contain the string (OK!) and 2) output from grep like \"grep: /home/file_example.txt: No such file or directory\" (NO!).\nI would like to store just the first output." ]
[ "ruby", "bash", "command", "output" ]
[ "T-SQL, Insert into with MAX()+1 in subquery doesn't increment, alternatives?", "I have a query where I need to \"batch\" insert rows into a table with a primary key without identity.\n\n--TableA\n--PK int (Primary key, no-identity)\n--CustNo int\nINSERT INTO TableA (PK,CustNo)\n SELECT (SELECT MAX(PK)+1 AS PK FROM TableA), CustNo\n FROM Customers\n\n\n(simplified example - please don't comment about possible concurrency issues :-))\n\nThe problem is that it doesn't increment the PK \"for each\" processed row, and I get a primary key violation. \n\nI know how to do it with a cursor/while loop, but I would like to avoid that, and solve it in a set-based kind of manner, if that's even possible ?\n\n(running SQL Server 2008 Standard)" ]
[ "sql-server", "tsql", "sql-server-2008", "batch-insert" ]
[ "Autodesk-Forge Hide Properties in Properties Inspector", "I have implemented the custom properties discussed here. While this example code is very helpful for adding properties that were not in the model, I cannot find any code that will allow me to remove/hide properties that were a part of the model except for the Forge RCDB examples found here, which implements an entirely separate DB.\n\nI am hoping that it is possible to display properties from the model, but to hide those that are not necessary and to add custom properties as shown in the adding custom meta properties example. \n\nIs this possible? If so can you assist me in understand how to hide the specific properties I am hoping to hide?\n\nIf is it not possible, is the best guide for adding a parallel external properties DB the Forge RCDB examples?\n\nEDIT...\nI implemented the custom properties panel and it adds the \"Customization\" category and then the \"Node\" attribute. My question is... how can I hide attributes that were part of the model like \"Thermal Mass\",\"Absorptance\", etc.\n\n\n\nThanks...\nBen" ]
[ "autodesk-forge" ]
[ "MySQL query for \"AND\" search form with multiple checkboxes and select menus", "I have a table:\n\nitem_id | property_id | value |\n================================\n1 | 100 | 1 |\n1 | 101 | 1 |\n1 | 102 | 0 |\n2 | 100 | 1 |\n2 | 101 | 1 |\n2 | 102 | 1 |\n2 | 120 | black |\n3 | 100 | 1 |\n3 | 101 | 0 |\n3 | 102 | 1 |\n4 | 121 | big |\n...\n\n\nI would like to perform \"AND\" search by a form with multiple checkboxes and select menus (each checkbox and select menu have name like 'property_id').\n\nExample:\n\n\nWhen I check checkbox 100 and 101, desire result of query is item_id = 1, 2.\nWhen I check checkbox 100, 101 and choose 'black' from select menu 120, desire result is item_id = 2.\nWhen I check checkbox 100, 101, choose 'black' from select menu 120, and choose 'big' from select menu 121, desire result is item_id = NULL.\n\n\nNumber of checked properties (checkboxes and selectmenus) may vary.\n\nI tried:\n\nSELECT item_id\nFROM yourtable\nWHERE property_id IN (100, 101)\nAND value = 1\nGROUP BY item_id\nHAVING COUNT(DISTINCT property_id) = 2\n\n\nBut it's only for checkboxes and values 0 or 1. I have problem to implement it with select menus (example 2. or 3.)\n\nI hope that explains what I'm trying to do.\nThanks in advance!" ]
[ "mysql", "search", "checkbox" ]
[ "Individual studio count in a table", "I have table like this.\n\nRETAIL_SKU STUDIO_NAME REGION MERCHANT SOURCE_TYPE RETOUCH_LEVEL \n\nCCCF9X55FI CCRY1B EU Buy VIP Studio 9 \nCCCHB1Z8EE PCCL3B NA Buy VIP Studio 9 \nCCCFECJQ1I LEJ1A EU Buy VIP Studio 9 \nCCCH296DN0 CCRY1B EU Buy VIP Studio 9 \nCCCEQR38LQ PCCL3B NA Buy VIP Studio 9 \nCCCHSC2X0I PCCL3B NA Buy VIP Studio 9 \nCCCA0IY4OU BV-DE-RETAIL EU Buy VIP Vendor 9 \nCCCGX64C68 PCCL3B NA Buy VIP Studio 9 \nCCCG7U7W4O CCRY1B EU Buy VIP Studio 9 \n\n\nAnd am looking a result like this \n\nSTUDIO_NAME REGION\nCCRY1B 3\nPCCL3B 4\nLEJ1A 1\nBV-DE-RETAIL 1\n\n\nThis is what i tried .(But it throws error)\n\nSELECT DISTINCT(STUDIO_NAME),COUNT(RETAIL_SKU) FROM Sheet7 WHERE MERCHANT='Buy VIP' AND RETOUCH_LEVEL=9 \n\n\ni just started to learn Sql so i have very minimal knowledge. Your assistance will be great help for me \n\nUpdated\n\nstr = \"SELECT STUDIO_NAME,COUNT(*) REGION FROM [Sheet7$] WHERE MERCHANT='Buy VIP' AND RETOUCH_LEVEL=9 GROUP BY STUDIO_NAME\"\n rsEx.Open str, ConEx, adOpenKeyset, adLockOptimistic" ]
[ "sql" ]
[ "IBM Worklight v6.0 - Dojo Package conflict", "I'm installing Worklight 6 into a clean version of Eclipse 4.2.2. Everything appeared to be successful, except upon opening Eclipse there is the followin in the Console Log.\n\n[2013-06-22 20:40:01] The bundle \"com.ibm.imp.worklight.dojo.core_6.0.0.201306140657 [858]\" could not be resolved. Reason: Package uses conflict: Require-Bundle: org.eclipse.jetty.server; bundle-version=\"[8.0.0,9.0.0)\"\n[2013-06-22 20:40:01] The bundle \"com.ibm.imp.worklight.dojo.ui_6.0.0.201306140657 [859]\" could not be resolved. Reason: Missing Constraint: Require-Bundle: com.ibm.imp.worklight.dojo.core; bundle-version=\"6.0.0\"" ]
[ "dojo", "ibm-mobilefirst", "worklight-studio" ]
[ "NSIS Erroring out when being run from Jenkins", "I have a PowerShell script that builds an NSIS installer. It works great if I run it directly on a system. When I add it to my Jenkins pipeline, I get the following error:\n\nInternal compiler error #12345\n\n\nI know all about the 2GB size limitation; the file it's choking on is only 52MB... besides the script runs great outside of Jenkins.\n\nI've tried adding some sleeps, deleting all or part of the Jenkins workspace (occasionally the installer will compile if there's no workspace).\n\nAnyone have any ideas? I'm kinda stumped.\n\nEDIT: Here's the PowerShell call and the lines of source that blow up:\n\nWrite-Output \"Compiling installer\"\n$relmod = $deployXML.'deploy-bundler'.relmod\n$cmd = '& ${env:ProgramFiles(x86)}\\NSIS\\makensis .\\deploy-bundler\\install\\win32\\installer-pieces\\bundle.nsi -DRELMOD=$relmod'\ninvoke-expression $cmd\n\n\nHere's the NSIS:\n\nSection /o \"${PRODUCT_IBMI}\" SECSoftware\n SectionIn 1\n SetOutPath \"$TEMP\\${PRODUCT_BUNDLE_PATH}$uniquePath\"\n SetDetailsView hide\n ; The following lines modify the text display in the progress banner\n GetDlgItem $R0 $HWNDPARENT 1037\n SendMessage $R0 ${WM_SETTEXT} 0 \"${PROGRESS_BANNER_BOLD_TEXT}\" \n GetDlgItem $R0 $HWNDPARENT 1038\n SendMessage $R0 ${WM_SETTEXT} 0 \"${PROGRESS_BANNER_TEXT}\" \n\n File \"deliverables\\${PRODUCT_FILE}\"" ]
[ "powershell", "jenkins", "nsis" ]
[ "How to write data to .txt file(FileWriter) from another class in javafx", "I am making cinema seat booking system as semester project. I saved person name, movie name and seat numbers attributes in a .txt file with javafx, but the problem is that it overwrites previous record when I make bookings for another person. No matter how many bookings I make it only saves last one because this line FileWriter data=new FileWriter(\"reservation.txt\"); is also called every time. So is there a way to make .txt file in another class and write data in another class, or any other solution?\n\ntry{\n FileWriter data=new FileWriter(\"reservation.txt\");\n\n data.write(\"Customer Name: \"+Cinemafx.name+\" \");\n data.write(\"Movie Name: \"+movieselection.movie_name+\" \");\n data.write(\"Seat Numbers: \"+listString+\" \");\n\n data.close();\n}\n catch(Exception ex){\n}" ]
[ "java", "javafx" ]
[ "How to find the maximum resolution link of new Instagram posts?", "I’ve discovered with instaloader (a tool downloadable from github) that Instagram now saves posts with a size larger than 1080 pixels height or width, I think 1440 maximum. But adding “/media/?size=l” to a link post I’m only able to get the image with 1080 pixels (height or width) maximum.\nI certainly know there is a greater quality version of a post that the one “/media/?size=l” gives me because when I compare this version with the one downloaded with instaloader the difference is notable, but I have not been able to find the link of it.\nDoes anyone know how to find it?\nThanks." ]
[ "facebook", "browser", "instagram", "instagram-api" ]
[ "How to set input validation with $setValidity without $scope", "I have often heard that $scope is not best practice any more. In any case, we are using the controller as syntax and not even passing in $scope as a dependency.\n\n<form name=\"passwordForm\" id=\"passwordForm\">\n <input type=\"password\" id=\"newPassword\" name=\"newPassword\" ng-minlength=\"8\" data-ng-model=\"vm.pwdata.newPassword\" required>\n\n$scope.passwordForm.newPassword.$setValidity(*my conditions here*);\n\n\nOf course here I get a $scope undefined error. I have also tried just \n\npasswordForm.newPassword.$setValidity(*my conditions here*); \n\n\nand \n\nvm.passwordForm.newPassword.$setValidity(*my conditions here*);\n\n\nHow can I reference this input?" ]
[ "javascript", "angularjs" ]
[ "Most pythonic way to plot multiple signals", "I would like to plot one ore more signals into one plot.\n\nFor each signal, a individual color, linewidth and linestyle may be specified.\nIf multiple signals have to be plotted, a legend should be provided as well.\n\nSo far, I use the following code which allows me to plot up to three signals.\n\nimport matplotlib\nfig = matplotlib.figure.Figure(figsize=(8,6))\nsubplot = fig.add_axes([0.1, 0.2, 0.8, 0.75])\nSignal2, Signal3, legend, t = None, None, None, None\nSignal1, = subplot.plot(xDataSignal1, yDataSignal1, color=LineColor[0], linewidth=LineWidth[0],linestyle=LineStyle[0])\nif (yDataSignal2 != [] and yDataSignal3 != []):\n Signal2, = subplot.plot(xDataSignal2, yDataSignal2, color=LineColor[1], linewidth=LineWidth[1],linestyle=LineStyle[1])\n Signal3, = subplot.plot(xDataSignal3, yDataSignal3, color=LineColor[2], linewidth=LineWidth[2],linestyle=LineStyle[2])\n legend = subplot.legend([Signal1, Signal2, Signal3], [yLabel[0], yLabel[1], yLabel[2]],LegendPosition,labelspacing=0.1, borderpad=0.1)\n legend.get_frame().set_linewidth(0.5)\n for t in legend.get_texts():\n t.set_fontsize(10)\nelif (yDataSignal2 != []):\n Signal2, = subplot.plot(xDataSignal2, yDataSignal2, color=LineColor[1], linewidth=LineWidth[1],linestyle=LineStyle[1])\n legend = subplot.legend([Signal1, Signal2], [yLabel[0], yLabel[1]], LegendPosition,labelspacing=0.1, borderpad=0.1)\n legend.get_frame().set_linewidth(0.5)\n for t in legend.get_texts():\n t.set_fontsize(10)\n\n\nIs it possible to generalize that code such that it is more Pythonic and supports up to n signals by still making use of matplotlib and subplot?\n\nAny suggestions are highly appreciated." ]
[ "python", "python-2.7", "matplotlib" ]
[ "V-bind class multiple options", "I am trying to give one of two classes to an element depending on one of the three possible input variables.\nMy vue.js code\n\n<input type='text' class='inputwordtext' v-bind:class=\"[{(wordupload.firstchoice.selected == 'Zinnenlijst') : wordlongwidth}, {(wordupload.firstchoice.selected != 'Zinnenlijst') : wordshortwidth}]\">\n\n\nIf wordupload.firstchoice.selected == Zinnenlijst it should get the class wordlongwidth, otherwise it should get the class wordshortwidth, how can this be done?" ]
[ "javascript", "class", "vue.js" ]
[ "Customize radioselect default renderer", "I have the following form with radioselect options :\n\njobStatus = forms.ChoiceField( widget=forms.RadioSelect())\n\n\nHowever, it renders the radio buttons in <ul> <li> .. </li></ul> tags. \n\nCould you suggest me any way to render the only radiobutton input ?\n\nThanks" ]
[ "django", "default", "itemrenderer" ]
[ "How to install \"Gerrit\" in linux machine without any error?", "I am not able to install Gerrit on my Linux server and getting below mentioned error. \n\nMy config file:\n\n\n\nError:\n\nfatal: DbInjector failed\nfatal: Unable to determine SqlDialect\nfatal: caused by com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception: 'java.lang.NumberFormatException: For input string: \"y\"'.\nfatal: caused by java.lang.NumberFormatException: For input string: \"y\"" ]
[ "java", "mysql", "linux", "gerrit" ]
[ "Requiring an async function in NodeJS", "I am trying to get my head around async/await in NodeJS.\n\nI have a function in a file as follows:\n\nconst getAccessToken = async () => {\n return new Promise((resolve, reject) => {\n\n const oauthOptions = {\n method: 'POST',\n url: oauthUrl,\n headers: {\n 'Authorization': 'Basic ' + oauthToken\n },\n form: {\n grant_type: 'client_credentials'\n }\n };\n\n request(oauthOptions)\n .then((err, httpResponse, body) => {\n if (err) {\n return reject('ERROR : ' + err);\n }\n return resolve(body.access_token);\n })\n .catch((e) => {\n reject('getAccessToken ERROR : ' + e);\n });\n });\n};\n\nmodule.exports = getAccessToken;\n\n\nThis file is saved as twitter.js in a lib folder\n\nIn my index.js file I have the following:\n\nconst getAccessToken = require('./lib/twitter');\n\nlet accessToken;\n\ntry {\n accessToken = await getAccessToken();\n} catch (e) {\n return console.log(e);\n}\n\nconsole.log(accessToken);\n\n\nI get an error trying to run this code saying:\n\n> accessKey = await getAccessToken();\n> ^^^^^^^^^^^^^^\n> \n> SyntaxError: Unexpected identifier\n> at createScript (vm.js:74:10)\n> at Object.runInThisContext (vm.js:116:10)\n> at Module._compile (module.js:533:28)\n> at Object.Module._extensions..js (module.js:580:10)\n> at Module.load (module.js:503:32)\n> at tryModuleLoad (module.js:466:12)\n> at Function.Module._load (module.js:458:3)\n> at Function.Module.runMain (module.js:605:10)\n> at startup (bootstrap_node.js:158:16)\n> at bootstrap_node.js:575:3\n\n\nCan I not await the required function as it is marked async ?" ]
[ "javascript", "node.js", "asynchronous", "async-await" ]
[ "How to toggle a slide menu from the left with jQuery?", "For a mobile page to be used on iPhones etc. I am trying to create a menu which will slide in from the left and push the current content out to the right much like in phone apps. With a touch anywhere in the displayed menu (other than a link) the menu should disappear again and the page should be displayed again as before.\n\nI use the http://aozora.github.io/bootplus/index.html Bootplus CSS to have a decent look of the site and make it also responsive.\n\nI was able to get the slide in effect going nicely using the following jQuery code:\n\n$('#leftmenu').hide();\n$('#button').on('click',function(){\n $('#content').css({'position':'fixed'}).animate({\"left\":\"85%\"});\n $('#leftmenu').css({'position':'fixed', 'width':'85%'});\n $('#leftmenu').fadeIn('slow');\n});\n\n\nFor the menu, I have the following html.\n\n<div id=\"leftmenu\" class=\"container\" style=\"width: 85%; left:0%; height: 100%; background-color:silver\">\n <br />\n <p><h3>Quick links</h3></p>\n <p><h4><a href=\"\">Home</a></h4></p>\n <p><h4><a href=\"\">Page 1</a></h4></p>\n <p><h4><a href=\"\">Page 2</a></h4></p>\n</div>\n<div class=\"navbar .navbar-inverse\" style=\"background-color:silver; vertical-align:middle\">\n <a class=\"btn btn-primary dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\">\n <i id=\"button\" class=\"fa fa-bars\"></i>\n </a>\n</div>\n\n\nBut when I hide the menu with the code below, the page no longer shows centered in the middle, but aligned to the left with no left margin anymore. \n\n$('#leftmenu').on('click',function(){\n $('#content').css({'position':'absolute'}).animate({\"left\":\"0%\"});\n $('#leftmenu').fadeOut('slow');\n $('#content').fadeIn('slow');\n});\n\n\nI understand that I do that with the css code, but I struggle to make it work with a toggle mechanism with which I can get back to the previous css settings without having to redefine all from scratch.\n\nAnother issue I face is that whenever I touch the menu on the left, I need to touch twice to make it disappear. To show the menu, it works with a single touch on the Menu button, yet the hiding requires two touches.\n\nThanks a million for your help." ]
[ "jquery", "css" ]
[ "Summing up values of a calculated field on MS Access report", "On a MS Access report,\nI have a calculated textbox field with control source as below:\n\n=([PartsTotal]/[GroupTotal])*DateDiff(\"m\",[ReceivedDate],[Forms]![frm_Inventory Reports]![DateTo])\n\n\nIt's comparing two dates to get number of months then multiplying it by a percentage ([PartsTotal]/[GroupTotal]),\nto calculate aging of inventory lots.\nThe name of the calculated textbox control is txtAge.\nAnd I'm trying to sum the values of the calculated field at a group footer. I tried setting the control source for the other field to:\n\n=sum(Me.txtAge)\n=sum(Reports!rptName!txtAge)\n=sum(([PartsTotal]/[GroupTotal])*DateDiff(\"m\",[ReceivedDate],[Forms]![frm_ Inventory Reports]![DateTo]))\n\n\nNone of it works. Anyone has any idea what I'm doing wrong?\n\nThank you in advance for your help!" ]
[ "database" ]
[ "Symfony2 - HWIOAuthBundle - Facebook login", "I have followed bundle documentation configuring the HWIOAuthBundle for facebook. Then I followed this example for facebook login button display and it seems to be working, but it is not completed. I am stuck and don't know what to do next. After I press facebook login button and login to facebook I get error:\n\nUnable to find the controller for path \"/sign-in/check-facebook\". The route is wrongly configured.\n\n\nconfig.yml\n\nhwi_oauth:\n firewall_name: hwi_oauth\n resource_owners:\n facebook:\n type: facebook\n client_id: \"%facebook_client_id%\"\n client_secret: \"%facebook_client_secret%\"\n scope: email\n options:\n display: popup\n auth_type: rerequest\n csrf: true\n\n\nsecurity.yml\n\nfirewalls:\n hwi_oauth:\n pattern: ^/\n anonymous: ~\n oauth:\n resource_owners:\n facebook: /sign-in/check-facebook\n login_path: /sign-in\n failure_path: /sign-in\n oauth_user_provider:\n service: oauth_user_provider\n\n\nrouting.yml\n\nhwi_oauth_redirect:\n resource: \"@HWIOAuthBundle/Resources/config/routing/redirect.xml\"\n prefix: /connect\n\nhwi_oauth_login:\n resource: \"@HWIOAuthBundle/Resources/config/routing/login.xml\"\n prefix: /sign-in\n\nfacebook_login:\n path: /sign-in/check-facebook\n\n\nSo what is this /sign-in/check-facebook needed for? Why my application can't find it? Do I have to create the controller for it? \n\nIn documentation here it is said to that information can be get through response object, but where do I write this code?" ]
[ "php", "facebook", "symfony", "oauth", "hwioauthbundle" ]
[ "APK not compatible with newest Android build", "I am working onan app that is currently published on the Play Store. When using an Android device with version 5.1.1 on it, the play store says \"Your device isn't compatible with this versions\" and I'm trying to determine the specific reason why and how to work around it.\n\nThe existing app's Android.Manifest file has the following in it:\n\n <uses-sdk minSdkVersion=\"13\" targetSdkVersion=\"21\"/>\n\n\nI thought that maybe it was the \"targetSDKVersion\" causing the problem. I don't have the APK that was originally published, but I figured I could test my hypothesis by generating a new app with the same uses-sdk manifest items.\n\nI created a new app with the latest Android Studio and the same uses-sdk values and published it, and strangely it is available on my 5.1.1 device.\n\nI decided to investigate further and I pulled both APKs down to my desktop and then used apktool to extract the contents of each to see if anything stood out.\n\nWhat I did find is that the non-working APK has this in the extracted manifest:\n\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" package=\"com.redphx.deviceid\" platformBuildVersionCode=\"21\" platformBuildVersionName=\"5.0.1-1624448\">\n\n\nAnd the working APK has the following\n\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" package=\"com.opennetcf.ctacke.androidsample\" platformBuildVersionCode=\"23\" platformBuildVersionName=\"6.0-2166767\">\n\n\nRight now my assumption is that the platformBuildVersionCode must be the culprit.\n\nSo my questions are:\n\n\nIs my assumption correct, that this is why one APK is not working for 5.1.1?\nI assume the APK compiler sets the platformBuildVersionCode attribute. I specifically set the targetSdkVersion to 21 in the working application, and I see that value in the extracted yml, but the platformBuildVersionCode still says 23. Where does that information come from, if not the uses-sdk information?\nIs there a fix, short of rebuilding a new APK and re-publishing?\n\n\nI assume that re-publishing is the likely route, but I'm hoping to head off having this problem recur in the future, so I'd really like to understand the answers to #1 and #2.\n\nupdate\n\nThe merged manifest for the working APK is the same as what is in the application itself, so no reference to 23 at all.\n\n<uses-sdk \n minSdkVersion=\"13\" \n targetSdkVersion=\"21\"/>\n\n\nOn the working system, build.gradle contains the following:\n\nandroid {\n compileSdkVersion 23\n buildToolsVersion \"23.0.1\"\n\n defaultConfig {\n applicationId \"com.opennetcf.ctacke.androidsample\"\n minSdkVersion 13\n targetSdkVersion 21\n versionCode 1\n versionName \"1.0\"\n }\n buildTypes {\n release {\n minifyEnable false\n proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro\n }\n }\n}\n\ndependencies {\n compile filetree(dir: 'libs', include: ['*.jar'])\n compile 'com.android.support:appcompat-v7:23.0.1'\n}\n\n\nSo I assume that this is where that info comes from, but how it gets to the APK still isn't all that clear.\n\nI don't have either for the non-working APK since it was built by the app release team before I came on the project and I have no idea if they keep any of these intermediate outputs. I'm investigating that.\n\nedit 2\n\nThe extracted yml from both APKs (which shows the uses-sdk info) is below. It looks like the non-working minimum version is significatly lower (5) than the working (13).\n\nworking:\n\nversion: 2.0.1\napkFileName: oncf.apk\nisFrameworkApk: false\nusesFramework:\n ids:\n - 1\nsdkInfo:\n minSdkVersion: '13'\n targetSdkVersion: '21'\npackageInfo:\n forced-package-id: '127'\nversionInfo:\n versionCode: '1'\n versionName: '1.0'\ncompressionType: false\nsharedLibrary: false\n\n\nnon-working:\n\nversion: 2.0.1\napkFileName: ytb.apk\nisFrameworkApk: false\nusesFramework:\n ids:\n - 1\nsdkInfo:\n minSdkVersion: '5'\n targetSdkVersion: '21'\npackageInfo:\n forced-package-id: '127'\nversionInfo:\n versionCode: '4'\n versionName: 1.1.2\ncompressionType: false\nsharedLibrary: false" ]
[ "android", "google-play", "apk" ]
[ "Embedded Jetty - IllegalStateException: No SessionManager", "I've found plenty of references to this issue on google but no answers. I'm using the latest version of jetty (8.1.2.v20120308) and I can't seem to get an embedded servlet to be able to use sessions. The example is in scala of course, but it should be readable to any java programmer. \n\nval server = new Server();\nval connector = new SelectChannelConnector()\nconnector.setPort(Integer.getInteger(\"jetty.port\", 8080).intValue())\nserver.setConnectors(Array(connector))\n\nval webapp = new ServletContextHandler(ServletContextHandler.SESSIONS)\nwebapp.setContextPath(\"/\")\nwebapp.setResourceBase(webDir)\nwebapp.setServer(server)\n\nval brzyServ = new ServletHolder(new BrzyDynamicServlet())\nwebapp.addServlet(brzyServ, \"*.brzy\")\n\nserver.setHandler(webapp);\nserver.start()\n\n\nin my servlet code:\n\n...\nlog.debug(\"session manager: {}\",req.asInstanceOf[Request].getSessionManager)\nval session = req.getSession\n...\n\n\nThe req.getSession throws this exception, and the debug line before it, is always null. \n\njava.lang.IllegalStateException: No SessionManager\nat org.eclipse.jetty.server.Request.getSession(Request.java:1173)\n\n\nIn the log I can see this:\n\nDEBUG org.eclipse.jetty.server.session - sessionManager=org.eclipse.jetty.server.session.HashSessionManager@2a8ceeea\nDEBUG org.eclipse.jetty.server.session - session=null\n\n\nI'm not sure if that's relevant, but it would appear that there is a session manager but it's not available on the request. \n\nI've tried this with the WebAppContext with the same result. Not to mention explicitly setting the sessionManager in a dozen different ways." ]
[ "embedded-jetty" ]
[ "PHP: While loop with fetch array running forever?", "I'm trying to display all the records from a database but it's just spamming around 1,000 until it finally reaches 30 second timeout. I've only got 3 records in the database, not sure why it's doing this?\n\nwhile($news = $engine->fetch_array(\"SELECT * FROM `cms_news` ORDER BY `id` DESC\"))\n{\n echo 'lol<br>';\n}\n\n\n\"lol\" gets printed hundreds of times before finally timing out (execution time exceeded)\n\nHere is the fetch_array function from the $engine class:\n\nfinal public function fetch_array($sql)\n{\n $result = $this->connection->query($sql);\n return $result->fetch_array(MYSQLI_ASSOC);\n}" ]
[ "php", "mysql", "mysqli" ]
[ "How to add query to classroom API request?", "I am currently requesting for the coursework of a student using the classroom API using the following code:\nself.oauthswift!.client.get("https://classroom.googleapis.com/v1/courses/\\(id)/courseWork?access_token=\\(access)") { result in\n switch result {\n case .success(let response):\n\nThrough this code I get all the assignments as requested. However, they are in random order. I need them sorted by due date. I know I can do this using a query, but I have no idea where to add the query in the https request." ]
[ "swift", "api", "oauth-2.0", "google-oauth", "google-classroom" ]
[ "Alternative way to reference UI-Bootstrap to AngularJS Project", "Is there a way that I could reference UI-Bootstrap to an AngularJS Project without using any Package Manager or alike program? I tried to make a deep search for it but failed to find one.\n\nI tried to download the UI-Bootstrap package from its home site but it somehow needs NPM to be able to add it on a project" ]
[ "javascript", "angularjs", "angular-ui-bootstrap" ]
[ "How to let client detect updated data from server?", "I am currently making a simple client-server chatroom, but I am struggling with what the server should do when a new message appears.\n\nMy current solution is to just send the updated data to the client when they update theirs. In practice, this would mean that a client would only get new messages when they send a message themselves. Not very useful...\n\nI also thought of another way, which is to have the client request the server for information every 3 or so seconds, but that would clog up the server with a large number of people.\n\nMy third idea would be to have the server connect to the clients when a new message appears, but that would need the server to remember their IP address and have the client use a server too. (Sounds like P2P.)\n\nMost of my code is copied from this part of the docs so you can check against it too.\n\n\n\nHere is my current client side code.\n(Note: To send a 'message', you need to type asyncio.run(echo_client('username', 'message')). This is Python 3.7+ only too.)\n\nimport asyncio\n\nasync def echo_client(user, message):\n reader, writer = await asyncio.open_connection(\n '127.0.0.1', 41001)\n\n user = str(user)\n message = ''.join(message.split('\\n'))\n print(f'Sending from {user}: {message}')\n writer.write((user + '\\n').encode())\n writer.write((message + '\\n').encode())\n await writer.drain()\n\n data = await reader.readline()\n data = data.decode().strip()\n if data == 'Connection closed':\n print('User disconnected')\n else:\n print('Users info')\n for i in range(int(data)):\n user = await reader.readline()\n data = await reader.readline()\n user = user.decode().strip()\n data = data.decode().strip()\n print(f'{user}: {data}')\n # end for\n\n print('Connection closed')\n writer.close()\n\n\n\n\nHere is my server side code. This just relays info stored on its side and updates them when needed.\n\nimport asyncio\n\nusers = {}\n\nasync def handle_echo(reader, writer):\n global users\n\n user = await reader.readline()\n data = await reader.readline()\n addr = writer.get_extra_info('peername')\n\n user = user.decode().strip()\n data = data.decode().strip()\n\n if data == '':\n print(f'Recieved empty message from {addr!r}')\n print(f'Closing connection to {addr!r}')\n writer.write(b'Connection closed')\n writer.close()\n del users[user]\n return\n\n if data != 'update':\n users[user] = data\n\n print(f'Received {data} from {addr!r}')\n\n print(f'Send: {[(i, j) for i, j in users.items()]}')\n writer.write(f'{len(users)}\\n'.encode())\n await writer.drain()\n for user, data in users.items():\n writer.write(f'{user}\\n{data}\\n'.encode())\n await writer.drain()\n # end for\n\n print('Closed the connection')\n writer.close()\n\nasync def main():\n server = await asyncio.start_server(\n handle_echo, '127.0.0.1', 41001\n )\n\n addr = server.sockets[0].getsockname()\n print(f'Serving on {addr}')\n\n async with server:\n await server.serve_forever()\n\nasyncio.run(main())\n\n\n\n\nMy code works all fine, but I'm wondering for a better alternative. Please explain how your implementation works and how it would improve the code.\n\n(I'll be going to bed in a while, so I'll see you tomorrow.)\n(Not immediately of course ^v^)" ]
[ "python", "python-3.x", "asynchronous", "client-server", "python-asyncio" ]
[ "svn/ssh question in windows", "I am trying to do a command line svn update on my windows machine (to use in a batch file), and I want it to emulate what my settings are in the Tortoise SVN GUI.\n\nIn the tortoise settings, we have to specify the following in the SSH client...\n\n\nC:\\Program Files\\TortoiseSVN\\bin\\TortoisePlink.exe -l usernamehere -pw mypassword -i C:\\Users\\Mike\\Documents\\myprivatekey.ppk \n\n\nand I simply right click update...\n\ndoes anyone know how I would use the svn.exe to emulate the above? (using plink with a private key?)\n\nIf I am not clear on something please comment and I will work it out.\n\nBest,\nMike" ]
[ "windows", "svn", "ssh" ]
[ "Need help understanding Alpha Channels", "I have the RGB tuple of a pixel we'll call P. \n\n(255, 0, 0) is the color of P with the alpha channel at 1.0. \n\nWith the alpha channel at 0.8, P's color becomes (255, 51, 51).\n\nHow can I get the color of the pixel that is influencing P's color?" ]
[ "image-processing", "transparency", "alpha", "alphablending", "alpha-transparency" ]
[ "Using the same keystore with the same app but built from scratch again", "I have trouble making a release in playstore now. It says when I upload an appbundle that it has a different sign key. Now to make the long story short, we redo the SAME app (the same app that was released a month ago in playstore) because it has a gazillion tons of bugs. I have used the same key store file that was used by the same app we released a month ago. The problem is playstore wouldnt accept the app bundle saying it was signed differently (mind you, we haven't sign the REDO/NEW version from scratch of the same app since we just plan to use the existing keystore to upload it immediately to playstore.\n\nCan anyone shed me some light here on what to do? Thanks.\n\nIts a flutter app btw" ]
[ "android", "flutter", "google-play", "release", "google-play-console" ]
[ "Wierd deadlock related with make channel", "I met the strange behavior of Go's channel. The question is described as the following.\npackage main\n\nimport "fmt"\n\nfunc main() {\n ch := make(chan int)\n\n fmt.Println("len:", len(ch))\n fmt.Println("cap:", cap(ch))\n fmt.Println("is nil:", ch == nil)\n \n go func(ch chan int){\n ch <- 233\n }(ch)\n\n fmt.Println(<- ch)\n\n}\n\nWhen I run the code above, I got result like this:\nlen: 0\ncap: 0\nis nil: false\n233\n\nThe len and cap of the channel ch seem wierd but the code still works. But when I run this code:\npackage main\n\nimport "fmt"\n\nfunc main() {\n ch := make(chan int)\n\n fmt.Println("len:", len(ch))\n fmt.Println("cap:", cap(ch))\n fmt.Println("is nil:", ch == nil)\n \n ch <- 233 // Here changes!\n\n fmt.Println(<- ch)\n\n}\n\nThe result became:\nlen: 0\ncap: 0\nis nil: false\nfatal error: all goroutines are asleep - deadlock!\ngoroutine 1 [chan send]:\nmain.main()\n /tmp/sandbox640280398/main.go:12 +0x340\n\nWhat's more, when I change the second code piece like the following:\npackage main\nimport "fmt"\n\nfunc main() {\n ch := make(chan int, 1) //Here changes!\n\n fmt.Println("len:", len(ch))\n fmt.Println("cap:", cap(ch))\n fmt.Println("is nil:", ch == nil)\n \n ch <- 233\n\n fmt.Println(<- ch)\n\n}\n\nThings worked again, I got:\nlen: 0\ncap: 1\nis nil: false\n233\n\nSo, can anybody tell me the following questions:\n\nWhy make(chan int) return a channel with zero len and zero cap but still can work well in first code piece?\n\nWhy the second code use the channel in the main function instead of a new goroutine cause the deadlock?\n\nWhy I add a cap parameter to make in third code can fix the problem?\n\nWhat's the difference between the channel(in 1st and 2nd code) with the nil channel?" ]
[ "go", "channel" ]
[ "C++11 binding std function to a overloaded static method", "this question seems a little bit silly to me but I can't find any similar question so sorry if it's trivial\n\nlet's say we have a struct:\n\nstruct C {\n static void f(int i) { std::cerr << (i + 15) << \"\\n\"; }\n static void f(std::string s) { std::cerr << (s + \"15\") << \"\\n\"; }\n};\n\n\nnow somewhere else:\n\nstd::function<void(int)> f1 = C::f; // this does not compile\nvoid (*f2)(std::string s) = C::f; // this compiles just fine\n\n\nthe error I'm getting is \n\n\n error: conversion from ‘’ to\n non-scalar type ‘std::function’ requested\n\n\nis there any way to use std::function in such context? what am I missing?\n\nthanks" ]
[ "c++11", "std-function" ]
[ "setting up 301 redirects: dynamic urls to static urls", "We are currently using a template-based website and are hoping to move to a site with static urls. Our domain will stay the same. I understand that using 301 redirects in a .htaccess file is the preferred method -- and the one that has the highest chance of preserving our google rankings. \n\nI am still new at all this and am having a hard time figuring out the proper way to code it all.\n\nOver a hundred of our pages are indexed. They all have a similar URL but with different pageIDs:\n http://www.realestate-bigbear.com/Nav.aspx/Page=%2fPageManager%2fDefault.aspx%2fPageID%3d2020765\n\nSome link out to provided content, ex.\n /RealEstateNews/Default.aspx\n\nThen there are many that flow from the main featured listings page:\n /ListNow/Default.aspx\nDown to all the specific properties.. where the PropertyId changes\n /ListNow/Property.aspx?PropertyID=2048098\n\nwould a simple set of codes work... like the following....\n redirect 301 /Nav.aspx/Page=%2fPageManager%2fDefault.aspx%2fPageID%3d2020765 www.realestate.bigbear.com/SearchBigBearMLS.htm\n\nor do I need to do something entirely different?" ]
[ ".htaccess", "redirect", "web", "templates", "http-status-code-301" ]
[ "Silverlight, TextBlock inside Grid", "I'm totally new to silverlight and I was given a task to modify it. My problem is very simple (if done in asp.net webforms).\nBasically, in the grid, i want to append year to something like this.\n\nJan + \"-\" + DateTime.Now.Year.ToString()\n\nFeb + \"-\" + DateTime.Now.Year.ToString()\n\n\netc..etc..\n\nThe xaml looks like this\n\n<Grid x:Name=\"ContentGrid\" HorizontalAlignment=\"Stretch\" VerticalAlignment=\"Stretch\" Margin=\"0\">\n <Grid.Resources>\n\n<DataTemplate x:Key=\"mykey1\">\n <Grid >....</Grid>\n</DataTemplate>\n<DataTemplate x:Key=\"mykey2\">\n <Grid >....</Grid>\n</DataTemplate>\n<DataTemplate x:Key=\"mykey3\">\n <Grid >\n<StackPanel Orientation=\"Vertical\">\n<Border BorderBrush=\"{StaticResource LogicaPebbleBlackBrush}\" BorderThickness=\"1\">\n<StackPanel Orientation=\"Vertical\">\n<StackPanel Orientation=\"Horizontal\" Style=\"{StaticResource HeaderStackPanel}\">\n\n\n<TextBlock Style=\"{StaticResource HeaderTextBlock}\" Text=\"Jan-2013\" Width=\"75\" TextAlignment=\"Center\"/>\n<TextBlock Style=\"{StaticResource HeaderTextBlock}\" Text=\"Feb-2013\" Width=\"75\" TextAlignment=\"Center\"/>\n\n\n</StackPanel>\n</StackPanel>\n</Grid>\n</DataTemplate>\n</ Grid>\n</DataTemplate>\n\n\nI just want to make the year dynamic so it changes yearly. Please help." ]
[ "c#", "asp.net", "silverlight" ]
[ "Initializing Device Interfaces for Windows HID Drivers without WdfDeviceCreateDeviceInterface", "I'm working on creating a virtual HID device in Windows 10. To help me with developing the drivers, I've been analyzing the example provided here: https://github.com/Microsoft/Windows-driver-samples/tree/master/hid/vhidmini2.\n\nOne thing that they do has me stumped: in app/testvhid.c, the application sends data to the driver by finding the device interface of the driver, and sending data to that. However, the driver never calls WdfDeviceCreateDeviceInterface, which I had assumed was required to create a device interface. In fact, there appears to be no mention of interfaces at all in the driver code.\n\nMy question is: how would one go about accessing an interface for an HID device, when no calls to WdfDeviceCreateDeviceInterface have been made?" ]
[ "c", "windows", "driver", "hid", "wdf" ]
[ "How to build a Cypher / APOC query in Neo4J 3.x which searches on two different relationship types?", "Currently I use the following Cypher / APOC query to search the relationship type TO by a certain property (user id):\n\nCALL apoc.index.relationships('TO','user:16c01100-aa92-11e3-a3f6-35e25c9775ff') YIELD rel, start, end\nWITH DISTINCT rel, start, end\nMATCH (ctx:Context)\nWHERE rel.context = ctx.uid \nETURN DISTINCT start.uid AS source_id,\nstart.name AS source_name,\nend.uid AS target_id,\nend.name AS target_name,\nrel.uid AS edge_id,\nctx.name AS context_name,\nrel.statement AS statement_id,\nrel.weight AS weight;\n\n\nI want to make it posible to not only search the index TO but also the index AT (AT type of relationships), so that the resulting rel parameter contains both TO and AT relationships. \n\nI would imagine it would be something as simple as adding an OR operator, like this:\n\nCALL apoc.index.relationships('TO','user:16c01100-aa92-11e3-a3f6-35e25c9775ff') OR\napoc.index.relationships('AT','user:16c01100-aa92-11e3-a3f6-35e25c9775ff') YIELD rel, start, end\nWITH DISTINCT rel, start, end\nMATCH (ctx:Context)\nWHERE rel.context = ctx.uid\nRETURN DISTINCT start.uid AS source_id,\nstart.name AS source_name,\nend.uid AS target_id,\nend.name AS target_name,\nrel.uid AS edge_id,\nctx.name AS context_name,\nrel.statement AS statement_id,\nrel.weight AS weight;\n\n\nBut it doesn't work...\n\nMaybe there's somethign I could do that I get the rels from these two apocs and then simply conflate them together into one rel but I don't really get how to do that... Or maybe there's an easier way I don't see?" ]
[ "neo4j", "cypher", "neo4j-apoc" ]
[ "Use startActivityForResult() in a non-activity Class in Android", "I am inflating a Class(no Activity) in an Activity Class. Now what I want to do is I want to Open Gallery from that non-activity Class for which I need to use \"startActivityForResult()\" and also Override \"onActivityResult()\" in the same non-activity Class.\n\nI am not able to do it, though I have found some solutions where I can pass the instance of the Activity Class but it's not working.\n\nCan anybody provide the Working Solution Please.\n\nIntent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n String strFileName = \"temp.jpg\";\n\n fileCameraImage = new File(Environment.getExternalStorageDirectory(), \"/PAPERCLIP\");\n if (!fileCameraImage.exists()) \n {\n fileCameraImage.mkdirs();\n }\n file_paperclip = new File(fileCameraImage, strFileName);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file_paperclip));\n startActivityForResult(intent, 1);\n\n\nNow I need to get back to this non-activity Class after Choosing the Desired Image from the Internal Media. But I am not able to override the \"onActivityResult()\" in this non-activity Class." ]
[ "android", "android-activity" ]
[ "Load FreeMarker Template for sending email", "I am new to FreeMarker, and i want to use it to send e-mails. My application has integration of Spring 3.1, Hibernate 3.0 and Struts 2 frameworks. \n\nSo, basically my code for sending mail is (i'm using java mail api):\n\nMessage message = new MimeMessage(session);\n\nmessage.setFrom(new InternetAddress(fromAddress));\n\nAddress[] addresses = new Address[1];\naddresses[0] = new InternetAddress(fromAddress);\nmessage.setReplyTo(addresses);\n\nmessage.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toAddress));\nmessage.setSubject(subject);\n\n//To set template using freemarker\n\n BodyPart bodyPart = new MimeBodyPart();\n\n Configuration cfg = new Configuration();\n Template template = cfg.getTemplate(\"template.ftl\");\n Map<String, String> rootMap = new HashMap<String, String>();\n rootMap.put(\"toName\", toName);\n rootMap.put(\"message\", sendMessage);\n Writer out = new StringWriter();\n template.process(rootMap, out);\n\n bodyPart.setContent(out.toString(), \"text/html\");\n\n Multipart multipart = new MimeMultipart();\n multipart.addBodyPart(bodyPart);\n\n message.setContent(multipart,\"text/html; charset=ISO-8859-1\");\n\n Transport.send(message);\n\n\nBut when it tries to send mail,it throws an Exception : \n\njava.io.FileNotFoundException: Template \"template.ftl\" not found.\n\n\nThe template.ftl file is in WEB-INF/ftl/ directory.\n\nIn my spring-config.xml file, i have added this :\n\n<bean id=\"freemarkerConfig\" class=\"org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer\">\n <property name=\"templateLoaderPath\" value=\"/WEB-INF/ftl/\"/>\n</bean>\n\n<bean id=\"viewResolver\" class=\"org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver\">\n <property name=\"cache\" value=\"true\"/>\n <property name=\"prefix\" value=\"\"/>\n <property name=\"suffix\" value=\".ftl\"/>\n</bean>" ]
[ "java", "spring", "jakarta-mail", "freemarker" ]
[ "Pandas deleting rows based on same sting in columns", "Manufacturer Buy Box Seller\n0 Goli Goli Nutrition Inc.\n1 Hanes 3rd Street Brands\n2 NaN Inspiring Life\n3 Sports Research Sports Research\n4 Beckham Luxury Linen Thalestris Co.\n\nHello i am using pandas DataFrame to clean this file and want to delete rows which contains the manufacturers name in the buy-box seller column. For example row 1 will be deleted because it contains the string 'Goli' in Buy-Box seller Column." ]
[ "python", "pandas", "dataframe", "data-cleaning" ]
[ "Error In Access JSON Response Using Javascript And jOuery", "i have a web service which returns a String Of JSON response. When i am trying to access that response in my web page using $.ajax function it always generates an error terminates without any response.. can somebody help me and tell whats wrong in the code below..\n\nfunction getdata() {\n\n alert(\"start\");\n $.ajax({\n type: \"POST\",\n data: \"{'value':'10'}\",\n url: \"http://localhost:8080/RESTExample/parameter_url\",\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\",\n success: function (data) {\n alert(\"received \"+data);\n },\n error: function (data) {\n alert(\"error is \"+data);\n }\n});\n alert(\"end\");\n }\n\n\nNow I got an URL which provides JSON response on direct access **\n\n\n \"http://coenraets.org/apps/directory/services/getemployees.php\"\n\n\n**\n\nI am trying to access this Data in my JSP page as\n\n <script language=\"javascript\">\n\n $(document).ready(function()\n {\n $('#login').click(function(event){\n\n event.preventDefault();\n localStorage['serviceURL'] = \"http://coenraets.org/apps/directory/services/getemployees.php\";\n var serviceURL = localStorage['serviceURL'];\n alert(\"start\");\n\n $.ajax({\n dataType: \"jsonp\",\n url: serviceURL,\n success :function SucceedFunc(data) {\n alert(\"success\");\n console.log(data);\n },\n error : function(data, textStatus, errorThrown) {\n alert(\"error\");\n console.log(data);\n }\n}).done(function ( data ) {\n console.log(data);\n});\n\n });\n });\n\n</script>\n\n<div class=\"main_div\">\n\n\n\n<div class=\"loginform\">\n<form> \n <div class=\"login_btn\">\n <input type=\"submit\" class=\"login\" value=\"Login\" id=\"login\"/>\n </div>\n</form>\n</div>\n</div>\n\n\nwhich gives an error.... Now Can any one help me in accessing this data.... PLS..." ]
[ "java", "javascript", "ajax", "json" ]
[ "leap.rb cant find modulo error", "Wondering if anyone can see why I cant call .modulo. I feel like its something like I have to call Math in the class but I Im not sure thats the case.\n\ngit: https://github.com/jbasalone/ja/tree/master/ruby/exercism.io/leap\n\nthe error:\n\ntest_leap_year(YearTest):\n NoMethodError: undefined method `modulo' for nil:NilClass\n /Users/jennyb/ja/ja/ruby/exercism.io/leap/year.rb:26:in `divbyfour?'\n /Users/jennyb/ja/ja/ruby/exercism.io/leap/year.rb:17:in `leap?'\n leap_test.rb:6:in `test_leap_year'\n\n\nThis is my code:\n\nclass Year\n\n def initialize(theyear)\n @theyear = theyear\n end\nclass << self\n\n attr_reader :theyear\n\n def initialize(theyear)\n @theyear = theyear\n end\n\n def leap?(theyear)\n divbyfour? && !acentury? || bcentury?\n end\n #private\n\n def acentury?\n theyear.modulo 100 == 0\n end\n\n def divbyfour?\n theyear.modulo 4 == 0\n end\n\n def bcentury?\n theyear.modulo 400 == 0 \n end\n end\n end\n\n\nAnd this is the test I run against it:\n\nrequire 'minitest/autorun'\nrequire_relative 'year'\n\nclass YearTest < MiniTest::Unit::TestCase\n def test_leap_year\n assert Year.leap?(1996)\n end\n\n def test_non_leap_year\n skip\n refute Year.leap?(1997)\n end\n\n def test_non_leap_even_year\n skip\n refute Year.leap?(1998)\n end\n\n def test_century\n skip\n refute Year.leap?(1900)\n end\n\n def test_fourth_century\n skip\n assert Year.leap?(2400)\n end\nend" ]
[ "ruby" ]
[ "Why does pycharm gives error for importing numpy", "In pycharm, when i try to import numpy , i get a runtime error like this.\n Traceback (most recent call last):\n File "C:\\Users\\user\\PycharmProjects\\deneme\\main.py", line 1, in <module>\n import numpy as np\n File "C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\numpy\\__init__.py", line 305, in <module>\n _win_os_check()\n File "C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\numpy\\__init__.py", line 302, in _win_os_check\n raise RuntimeError(msg.format(__file__)) from None\nRuntimeError: The current Numpy installation ('C:\\\\Users\\\\user\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python39\\\\lib\\\\site-packages\\\\numpy\\\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl .com/y3dm3h86 Process finished with exit code 1\n\nI have searched the internet, there is a solution says "install 1.19.3"\nI have tried to install version 1.19.3 but pycharm still gives error." ]
[ "python", "numpy", "pycharm", "windows-10", "runtime-error" ]
[ "Can't connect to my Odoo server through the web browser", "I recently installed Odoo8 on ubuntu 12.04 server on a virtual machine (VMware workstation 10) but i can't connect remotely to the server using Google Chrome. I got either \"Internal server error\" or \"This webpage is not available\". I used ipaddress:8069 .Maybe I skipped a step during the configuration??" ]
[ "ubuntu", "server", "odoo-8" ]
[ "Xpath search for duplicate", "I have the following xml:\n\n<log>\n <logentry revision=\"11956\">\n <author>avijendran</author>\n <date>2013-05-20T10:25:19.678089Z</date>\n <msg>\n JIRA-1263 - did something\n </msg>\n </logentry>\n\n <logentry revision=\"11956\">\n <author>avijendran</author>\n <date>2013-05-20T10:25:19.678089Z</date>\n <msg>\n JIRA-1263 - did something 22 again\n </msg>\n </logentry>\n</log>\n\n\nI want to ignore any occurrence of the JIRA-1263 after the first one.\n\nThe xpath I am trying is (Which works if the duplicates nodes are following. But if you have duplicates else where(deep down), then it is ignored: \n\n<xsl:variable name=\"uniqueList\" select=\"//msg[not(normalize-space(substring-before(., '
')) = normalize-space(substring-before(following::msg, '
')))]\" />" ]
[ "xslt", "xpath" ]
[ "Not able to work correctly sonata Admin bundle with symfony", "I am new to symfony2 and and now i have installed Sonata Admin bundle.\nI am reading their documentaion but its not clear what should i do after installing it.\n\nHow should i start. I mean there is no example where i can start learning how to use that bundle. Can anyone please help me with this" ]
[ "php", "symfony", "symfony-sonata", "sonata-admin" ]
[ "can.Model with can.view to populate DOM dynamically or once records are loaded", "There is the following can.Model:\n\nvar CaseModel = can.Model.extend({\n findAll: function(args){\n var def = $.Deferred();\n args.sobject.retrieve(args.criteria, function(err, records) {//records should be populated into view\n if(err) def.reject(err);\n else def.resolve(records);\n });\n return def;\n }}, {});\n\n\nHow should I implement the can.Control with init method to populate can.view with deffered=CaseModel.findAll({sobject: new SObjectModel.Case()}) like here:\n\nthis.element.html(can.view('recipes', Deffered));\n\nand how these records are looped in mustache template:\n{{#each ???? }}\n\nThanks" ]
[ "promise", "canjs", "canjs-model" ]
[ "Android ListView to Intents", "How do you set up an onClickListener for a list view so that each list view item takes you to a different intent?" ]
[ "java", "android", "android-intent", "android-emulator", "android-listview" ]
[ "Why does ArrowHelper not hit the target?", "Why does the tip of the below ArrowHelper not directly hit the target sphere? It just misses it a bit. Is the below direction calculation not precise enough?\n\nvar geometry = new THREE.SphereGeometry(1, 16, 16);\nvar material = new THREE.MeshNormalMaterial();\nvar mesh = new THREE.Mesh(geometry, material);\nmesh.type = \"node\";\nmesh.position.set(30, -87, -11);\nscene.add(mesh);\n\ngeometry = new THREE.SphereGeometry(1, 16, 16);\nmaterial = new THREE.MeshNormalMaterial();\nmesh = new THREE.Mesh(geometry, material);\nmesh.type = \"node\";\nmesh.position.set(28, 44, -14);\nscene.add(mesh);\n\nvar sourcePos = new THREE.Vector3(30, -87, -11);\nvar targetPos = new THREE.Vector3(28, 44, -14);\nvar direction = new THREE.Vector3().subVectors(targetPos, sourcePos);\nvar arrow = new THREE.ArrowHelper(direction.clone().normalize(), sourcePos, direction.length(), 0xff0000);\nscene.add(arrow);\n\n\nThis is a direct follow up question to this question (I left it open as there are maybe better algorithms without ArrowHelper, but it seems the inaccuracy there is caused by the ArrowHelper problem described here)." ]
[ "three.js" ]
[ "how to get data from string in javascript", "I have such string test1/test2/test3/test4/test5\nHow can I get those tests in separate variables or in array or smth using javascript or jquery ?" ]
[ "javascript", "jquery" ]
[ "Communication between HDFS clusters", "After struggling through installations, I have few newbie questions. Lets say that I have 3 (lets name them A,B,C) different installations of Hadoop, and i just formatted B and C. \n\n\nIs it possible to copy the data from A to B and C? If so how can I\ndo that?\nIf I have PIG on A, would pig be able to load files from hdfs://B\nor hdfs://C?\n\n\nI have tried the following:\n\n\nExplicitly used hadoop distcp hdfs:A\nhdfs:B, which does not work due to this error : \n\n Invalid arguments: Call From Z77H2-A3/127.0.1.1 to local.research.com:8020\n failed on connection exception: java.net.ConnectException: Connection\n refused; For more details see: \n http://wiki.apache.org/hadoop/ConnectionRefused\n\nSame result on PIG: \n\nmain] ERROR org.apache.pig.tools.grunt.Grunt -\nERROR 2997: Encountered IOException. Call From\nlocal.research.com/127.0.0.1 to 192.168.1.48:9000 failed on connection\nexception: java.net.ConnectException: Connection refused; \nFor more details see: http://wiki.apache.org/hadoop/ConnectionRefused" ]
[ "hadoop", "apache-pig", "hdfs" ]
[ "Convert EMF to BMP (Metafile to Bitmap) using Windows Imaging Component", "I have an .emf file that I want to convert to a bitmap in legacy VC++ 6.0 code.\n\nI've been looking through the WIC documentation and I'm surprised I haven't seen a way to do this.\n\nAm I missing something?\n\nIf WIC ends up not supporting this, is there a method programattically load an .emf file into a CBitmap object?" ]
[ "c++", "windows", "visual-studio", "wic" ]
[ "Windows App and SQL Server", "What's the best practice for a windows app connecting to a SQL Server that is hosted in the internet? I'm currently using an IP based connection string with SQL authentication, nothing special. However, some clients cannot connect using port 1433 and I'm assuming that the whole approach has some security concerns." ]
[ "c#", "sql-server", "linq-to-sql", "ado.net" ]
[ "Why my button in a UItableView didn't respond?", "I've a UItableView with multiple section, In Each section, I've a View which contains a button, and in each of these sections one row is located but I've hided that row.\n\nIn short, my tableview is a collection of sections which in turns contains buttons on each section, when I click on the button it didn't respond but once I scroll ,my table from bottom to top the buttons are responded. What is the issue here? \n\nThanks!\n\nHere is the code:\n\n - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section\n {\n sheettable.scrollsToTop=YES;\n UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 22)];\n CGRect rect= CGRectMake(0, 0, 320,40);\n UIBezierPath *maskPath;\n maskPath = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:(UIRectCornerAllCorners) cornerRadii:CGSizeMake(5.0, 5.0)];\n CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];\n maskLayer.frame =rect;\n maskLayer.path = maskPath.CGPath;\n headerView.layer.mask = maskLayer;\n headerView.backgroundColor=[UIColor greenColor];\n UITextField *label1 = [[UITextField alloc] init] ;\n label1.delegate=self;\n label1.frame = CGRectMake(5, 1, 200, 35);\n\n label1.font = [UIFont boldSystemFontOfSize:16];\n label1.text = [[result2 objectAtIndex:section] objectForKey:@\"cat_desc\"];\n UIButton *btn=[[UIButton alloc]init];\n btn.frame=CGRectMake(5, 1, 200, 35);\n btn.tag=section;\n btn.backgroundColor=[UIColor clearColor];\n [headerView addSubview:label1];\n [btn addTarget:self action:@selector(selectedsections) forControlEvents:UIControlEventTouchUpInside];\n [headerView addSubview:btn];\n cameracategory=section;\n return headerView;\n\n }\n\n -(void)selectedsections\n {\n\n if(cameracategory==0)\n {\n NSLog(@\"At Index\");\n }\n if(cameracategory==1)\n {\n NSLog(@\"At Index\");\n }\n if(cameracategory==2)\n {\n NSLog(@\"At Index\");\n }\n if(cameracategory==3)\n {\n NSLog(@\"At Index\");\n }\n if(cameracategory==4)\n {\n NSLog(@\"At Index\");\n }\n\n }" ]
[ "uitableview", "uibutton" ]
[ "Font Showing Up as Bold", "For some reason, the text underneath the \"Support Us\" section is all in bold. I've tried forcing the font-style to normal, but it remains bold. The JSFiddle looks kind of messy, but if you scroll to the right, you can see my problem.\n\nhttp://jsfiddle.net/4bQjs/\n\nHere is the HTML Code for that section: \n\n<div id=\"rightcolumn\">\n<div id=\"supportus\">\n\n<div class=\"TitleBG\">\n <h5>SUPPORT US</h5>\n </div>\n\n<div style=\"float: left;margin-left:10px;margin-top:10px;outline:#747474 solid thin;\">\n <img src=\"images/marathon.jpg\" width=\"500\" height=\"265\" />\n</div>\n\n<div style=\"float:left; text-align: left\">\n\n\nThe Baltimore Running Festival\n\n<br></br>\n\nOne of the more popular races of the Baltimore Running Festival is the Team Relay. Running the same course as the marathoners, \nthe Team Relay consists of FOUR participants per team with each runner selecting a portion of the marathon course to run. \n\n<br></br>\n\nOur Cause\n\n<br></br>\n\nWe are participating in our first ever team relay to raise money to support our research. With your help, we can raise money\nto continue our fight against Lyme disease and Post-treatment Lyme disease syndrome.\n\n</div>\n\n\nAnd the CSS:\n\n#supportus {\n min-height: 645px;\n margin-top: 20px;\n margin-bottom: 20px;\n background: #ffffff;\n outline:#e8e8e8 solid thin;\n font-family:\"Helvetica\",Arial,sans-serif;\n font-size:16px;\n font-style:normal;\n}" ]
[ "html", "css" ]
[ "filter data frame by applying conditions on different columns by pandas", "I am looking for a way to filter df by the below conditions:\nthe value in created_by column equals the value in the owner column and status equals 'Active'\nenter image description here" ]
[ "pandas" ]
[ "Find street intersections within an area in using Google Maps API", "Given a square area, what is the best way to find the approximate coordinates of every street intersection within the given area ?" ]
[ "algorithm", "google-maps", "google-maps-api-3", "graph" ]
[ "Open *.doc files in LibreOffice and Microsoft Word using python 3.6", "Hello community! \n\nI got quite hard question (at least i think so), my client uses Microsoft Word documents (I omit the naming of those files, many of them have silly names e.g. \"ść ..doc\"), is it possible to open those documents under e.g. Eclipse env using Python 3.6 under Ubuntu?\n\nfor many years I used Windows 7 operating system, but i want some change, so i installed Ubuntu 16.04 LTS, I downloaded environment (Eclipse oxygen 4.7.0), pydev etc... But i forgot that my main document is saved as *.doc file.\n\nIs any possible way to open those files? what do you propose? I was thinking about some king of \"indirect\" *.xml file, but what kind of lib should I use to open *.doc files under LibreOffice software? (I do not want use some \"hack\" to install Microsoft Word under Ubuntu), and what after taking data from file? what kind of lib use to save data to *.doc file under ubuntu? (Cause my client will opened it with Microsoft Office)\n\nThe schema is simple\n\n\nOpen *doc files with Python 3.6 under ubuntu,\nmanipulate those files,\nsave as *.doc files under ubuntu.\n\n\nMaybe use some COM object to open files under different operating systems? could someone share whit some kind of \"documentation\" of COM object used in Python 3.6 under ubuntu? (sorry if I am wrong, I only heard that i can use COM object, I do not use it before)\n\nThanks for all replays,\nGreetings community!\nEldiane" ]
[ "python-3.x", "doc", "odf" ]
[ "Action Event for Photo Album cancel button in iphone", "I'm working with tabBarBased application.At the time of clicking the one of the tabBarButton it opens the photo album .In photo album there is a cancel button on top(navBar) right??Here i want to perform action event for cancel button click...while click on the cancel button i want to go to the another tabBar view...\n\nPlease help me out to do this...\n\nThank You in advance for your consideration and effort...\nRegards,\nRenuga" ]
[ "iphone", "uitabbaritem", "cancel-button" ]
[ "Accessing a webServer hosted on Linux through windows", "I hosted a basic web Server on my Linux System with centOS and tried to access it on my windows system on the same network. But everytime it is throwing connection has timed out on my browser in windows. \nHere is the code of the js file : \n\nexpress = require('express') app = express()\n\napp.get('/', function (req, res) { res.send('Hello World!') })\n\napp.listen(4013,'0.0.0.0', function () { console.log('Example app listening on port 4013!') })\n\n\nOn my windows system I am able to ping the address of linux system but while opening in browser it is not working. Any changes required or Solutions ?" ]
[ "node.js", "linux", "windows", "express", "centos" ]
[ "'net use' over SSL fails unless port 443 is specified", "We are attempting to connect to a WebDAV server using net use over SSL. On some servers we're seeing an issue in which this connection only succeeds if we specify port 443 in the URL.\n\nDoes Map\n\nnet use * \"https://example.com:443/folder\"\nnet use * \"\\\\example.com@SSL@443\\folder\"\n\nand, bizarrely, so does this:\nnet use * \"\\\\example.com@SSLasdf\\folder\"\n\nDoes Not Map\n\nnet use * \"https://example.com/folder\"\nnet use * \"\\\\example.com@SSL\\folder\"\n\nIn the non-working cases we consistently receive the following error:\n\nSystem error 67 has occured.\nThe network name cannot be found.\n\nWe have noticed some things that might be useful information:\n\n\nWe have a test server that's configured the same way as the prod server and it works as expected.\nIn the non-working cases, no incoming requests are ever seen at the prod server from the failing host.\nAll clients are based on the same image.\nThe problem does not manifest uniformly on all clients -- some work, some don't.\nThere is an existing, valid entry for example.com in the client DNS cache.\nFlushing the client DNS cache of the affected servers does not resolve the problem.\nOnce the problem appears, it seems to stick. That is, if I execute one of the working mappings, delete it, and then immediately execute one of the non-working mappings, the problem persists.\n\n\nWe are utterly stumped. Any theories?" ]
[ "windows", "networking", "ssl", "dns", "webdav" ]
[ "Get actual object Rails", "I have two forms in my new view, one is for the product and the other is for fotos. \nWhen I upload the fotos with a select.file field, these are created by Ajax call by a file create.js.erb then when I fill the others fields to the product I've another button to create it. So I have two forms and one way to create each one.\n\nThe problem is the ID, the solution that I've found was to create an object before the user enter to the new view, so I have this code:\n\nProduct's controller:\n\ndef new\n @product = current_user.products.create\nend\n\n\nIt creates an object nil, now I can create my Foto to that object, like this:\n\nPainting's controller:\n\ndef create\n @product = Product.last\n @painting = @product.paintings.create(params[:painting])\nend\n\n\nThe problem is the line \"@product = Product.last\", I know that it isn't the right solution, because when I try the edit action, and when I try to create new objects it goes to the last product and not to the actual edit product.\n\nHow can I find that current product at my new action???\n\nThanks a lot." ]
[ "ruby-on-rails", "ruby", "ruby-on-rails-3", "actionview" ]
[ "Wrap multiple line graphs into a 2x3", "I am looking to make some changes to this graph. I would like:\n\n(1) The lines in the legend to be a lot thicker\n\n(2) The lines on the graph to be slightly thicker\n\n(3) This one might be tricky. I was thinking of having a graph for all 6 MLB divisions, maybe as a 2x3. Right now, it is just the AL East data. Any ideas on how I could do that? I would like to have one title for the whole graph, and a sub title for each graph indicating which division it's for. \n\nAny help with any of these would be greatly appreciated.\n\ndf <- read.table(textConnection(\n 'Year ARI ATL BAL BOS CHC CHW CIN CLE COL DET HOU KCR LAA LAD MIA MIL MIN NYM NYY OAK PHI PIT SDP SFG SEA STL TBR TEX TOR WSN\n 2016 69 68 89 93 103 78 68 94 75 86 84 81 74 91 79 73 59 87 84 69 71 78 68 87 86 86 68 95 89 95\n 2015 79 67 81 78 97 76 64 81 68 74 86 95 85 92 71 68 83 90 87 68 63 98 74 84 76 100 80 88 93 83\n 2014 64 79 96 71 73 73 76 85 66 90 70 89 98 94 77 82 70 79 84 88 73 88 77 88 87 90 77 67 83 96\n 2013 81 96 85 97 66 63 90 92 74 93 51 86 78 92 62 74 66 74 85 96 73 94 76 76 71 97 92 91 74 86\n 2012 81 94 93 69 61 85 97 68 64 88 55 72 89 86 69 83 66 74 95 94 81 79 76 94 75 88 90 93 73 98\n 2011 94 89 69 90 71 79 79 80 73 95 56 71 86 82 72 96 63 77 97 74 102 72 71 86 67 90 91 96 81 80\n 2010 65 91 66 89 75 88 91 69 83 81 76 67 80 80 80 77 94 79 95 81 97 57 90 92 61 86 96 90 85 69\n 2009 70 86 64 95 83 79 78 65 92 86 74 65 97 95 87 80 87 70 103 75 93 62 75 88 85 91 84 87 75 59\n 2008 82 72 68 95 97 89 74 81 74 74 86 75 100 84 84 90 88 89 89 75 92 67 63 72 61 86 97 79 86 59\n 2007 90 84 69 96 85 72 72 96 90 88 73 69 94 82 71 83 79 88 94 76 89 68 89 71 88 78 66 75 83 73\n 2006 76 79 70 86 66 90 80 78 76 95 82 62 89 88 78 75 96 97 97 93 85 67 88 76 78 83 61 80 87 71\n 2005 77 90 74 95 79 99 73 93 67 71 89 56 95 71 83 81 83 83 95 88 88 67 82 75 69 100 67 79 80 81\n 2004 51 96 78 98 89 83 76 80 68 72 92 58 92 93 83 67 92 71 101 91 86 72 87 91 63 105 70 89 67 67\n 2003 84 101 71 95 88 86 69 68 74 43 87 83 77 85 91 68 90 66 101 96 86 75 64 100 93 85 63 71 86 83\n 2002 98 101 67 93 67 81 78 74 73 55 84 62 99 92 79 56 94 75 103 103 80 72 66 95 93 97 55 72 78 83\n 2001 92 88 63 82 88 83 66 91 73 66 93 65 75 86 76 68 85 82 95 102 86 62 79 90 116 93 62 73 80 68\n 2000 85 95 74 85 65 95 85 90 82 79 72 77 82 86 79 73 69 94 87 91 65 69 76 97 91 95 69 71 83 67\n 1999 100 103 78 94 67 75 96 97 72 69 97 64 70 77 64 74 63 97 98 87 77 78 74 86 79 75 69 95 84 68\n 1998 65 106 79 92 90 80 77 89 77 65 102 72 85 83 54 74 70 88 114 74 75 69 98 89 76 83 63 88 88 65'), header = TRUE)\n\n\ndf <- gather(df, Team, Wins, -Year) %>% \n mutate(Team = factor(Team, c(\"BAL\", \"BOS\", \"NYY\",\"TBR\",\"TOR\")))\n\ntheme_set(theme_grey() +\n theme(plot.title = element_text(hjust=0.5),\n axis.title.y = element_text(angle = 0, vjust = 0.5),\n panel.background = element_rect(fill = \"gray\"),\n axis.ticks=element_blank()))\n\n\ncust <- c(\"#FC4C00\", \"#C60C30\", \"#1C2841\", \"#79BDEE\",\"#003DA5\")\nnames(cust) <- levels(df$Team)\n\n\nggplot(df, aes(x=Year, y=Wins, color = Team)) +\n geom_path(aes(color = Team)) + #Change size= here to change size of lines in graph\n scale_color_manual(values = cust) +\n labs(title = \"AL East Wins\",\n y = \"Wins\",\n x = \"Year\")+\n guides(color=guide_legend(\"Team\",override.aes=list(size=3)))" ]
[ "r", "ggplot2" ]
[ "Same Query getting different results in Loopback?", "I have querying a database from two different locations.. The query is identical and the values being passed in are identical. However one query is finding a match, and the other is not.\n\nThis Query returns a result\n\napp.models.OrgProvider.find( {where: { orgId: data.orgId, providertypeId: data.typeID}, include: 'provider' }, function(err, orgprovider){\n\n //data.providerId = orgprovider[0].toJSON().provider.id;\n\n console.log('find provider via Create: ' + orgprovider);\n console.log('orgId: ' + data.orgId);\n console.log('providertypeId: ' + data.typeID);\n\n callback(null, data);\n });\n\n\noutputs to console\n\nfind provider via Create: [object Object]\norgId: 5a029ead07e76372952b4ca0\nprovidertypeId: 1\n\n\nThis Query returns EMPTY\n\napp.models.OrgProvider.find( {where: { orgId: ticket.orgId, providertypeId: typeID}, include: 'provider' }, function(err, orgprovider){\n\n //data.providerId = orgprovider[0].toJSON().provider.id;\n\n console.log('find provider via reAllocate: ' + orgprovider);\n console.log('orgId: ' + ticket.orgId);\n console.log('providertypeId: ' + typeID);\n\n cb(null,ticket);\n });\n\n\noutputs to console\n\nfind provider via reAllocate: \norgId: 5a029ead07e76372952b4ca0\nprovidertypeId: 1\n\n\nParamaters being passed into the find are identical, and yet one is returning a result and the other isn't\n\nIs there a way I can inspect the query for that is being sent to the Database to determine the difference? Or any suggestions on why I would be getting different results?\n\nMany Thanks in advance" ]
[ "node.js", "mongodb", "debugging", "loopbackjs", "loopback" ]
[ "Missing Spaces in the Postfix expression output - Java", "My code successfully converts an infix expression to postfix expression. However, when I enter a number that is more than 1 digit (e.g. 546) I get no spaces between this number and the right operand. \n\nA test run of my code:\nInput: Enter an expression: (24/4) / (15/3) * 10 - 4 + 2\nOutput: The Postfix Expression is: 244/ 153/ / 10 * 4 - 2+\n\nI'd like it to be The Postfix Expression is: 24 4/ 15 3/ / 10 * 4 - 2+\n\nThis is my code: Please suggest any changes that will allow me to insert spaces in the output. \n\nimport java.util.*;\n\npublic class PostfixConversion {\n\n public static void main(String args[]) {\n\n System.out.print(\"Enter an expression: \");\n String infix = new Scanner(System.in).nextLine();\n\n System.out.println(convertToPostfix(infix));\n\n }\n\n\n public static boolean precedence(char first, char second)\n {\n int v1 = 0, v2 = 0;\n //find value for first\n if(first == '-' || first == '+'){\n v1 = 1;\n }else if(first == '*' || first == '/'){\n v1 = 2; \n }//end if\n\n //find value for second\n if(second == '-' || second == '+'){\n v2 = 1;\n }else if(second == '*' || second == '/'){\n v2 = 2; \n }//end if\n\n if(v1 < v2){\n return false;\n }//end if\n\n return true;\n }//end precedence method\n\n //converts infix expression into postfix expression\n public static String convertToPostfix(String infixExp)\n {\n String postFix = \"The Postfix Expression is: \";\n Stack<Character> stack = new Stack<Character>();\n char character = ' ';\n\n for(int i = 0; i < infixExp.length(); i++)\n {\n character = infixExp.charAt(i);\n\n //determine if character is an operator\n if(character == '*' || character == '-' || character == '/' || character == '+')\n {\n while(!stack.empty() && precedence(stack.peek(), character)){\n postFix += stack.pop();\n }//end while\n stack.push(character);\n }\n else if(character == '(') //check for left parenthesis\n {\n stack.push(character);\n }\n else if (character == ')') \n {\n while(!stack.peek().equals('(') && !stack.isEmpty()){ //add characters until left parenthesis\n postFix += stack.pop();\n }//end while\n\n if(!stack.isEmpty() && stack.peek().equals('(')){\n stack.pop(); // pop/remove left parenthesis\n }\n }\n else\n {\n postFix += character;\n }//end if\n }//end for\n while(!stack.empty()) //add the remaining elements of stack to postfix expression\n {\n if(stack.peek().equals('('))\n {\n postFix = \"There is no matching right parenthesis.\";\n return postFix;\n }\n postFix += stack.pop();\n }\n return postFix;\n }//end convertToPo\n}" ]
[ "java", "postfix-notation", "infix-notation" ]
[ "Android shared database development", "Please give me some light regarding to this situation. I'm new in android development and I don't know how to handle this. I need to have my application to be install in many Android devices at least two device. Now I want both of them to share single database at the same time because there will be data to be process by one another. I'm a full pledge ASP.Net programmer so my mindset regarding this situation is to build a host device then the other one will connect to the same network as where the host is connected or is there any other way how this two can be connected then share the same database.\n\nThanks in Advance." ]
[ "android", "database", "sqlite" ]
[ "In-app-purchase2 store product state is approved for expired subscription products in sandbox environment", "I'm using @ionic-native/[email protected] in my ionic 3 project, I have 2 auto-renewable subscriptions (Monthly/Yearly). When I bought any of the plans, then in-app-purchase-2 store product state is approved and when it is the expired state will be valid this is the flow happening in android. But in the IOS sandbox testing environment, even the plan is expired the state remains approved always. Is it a bug? I am using state filed to know the device account owned a plan or not." ]
[ "ionic3", "in-app-purchase", "sandbox" ]
[ "Resolving dynamic reference in EC2 user data cloudformation template", "I have a cloudformation template that creates an EC2 launch template. \n\nIn the UserData section of the template I need to fetch a SSM secure parameter and expose it as an environment variable to initialise my VM. I am trying to use !Sub but my output is not what I expect. Here's my sample code:\n\n TestJenkinsMasterLaunchTemplate:\n Type: 'AWS::EC2::LaunchTemplate'\n UserData:\n Fn::Base64: !Sub\n - | \n #!/bin/bash\n echo ${azure_client_id}\n - azure_client_id: '{{resolve:ssm-secure:/Jenkins/Production/AzureAdClientId:1}}'\n\n\nThe output in the /var/log/cloud-init-output.log file is the template itself: {{resolve:ssm-secure:/Jenkins/Production/AzureAdClientId:1}}.\n\nHow can I resolve the SSM parameter properly?" ]
[ "amazon-web-services", "amazon-cloudformation", "aws-ssm" ]
[ "Python: use a function in pandas lambda expression", "I have the following code, trying to find the hour of the 'Dates' column in a data frame:\n\nprint(df['Dates'].head(3))\ndf['hour'] = df.apply(lambda x: find_hour(x['Dates']), axis=1)\n\ndef find_hour(self, input):\n return input[11:13].astype(float)\n\n\nwhere the print(df['Dates'].head(3)) looks like:\n\n0 2015-05-13 23:53:00\n1 2015-05-13 23:53:00\n2 2015-05-13 23:33:00\n\n\nHowever, I got the following error:\n\n df['hour'] = df.apply(lambda x: find_hour(x['Dates']), axis=1)\nNameError: (\"global name 'find_hour' is not defined\", u'occurred at index 0')\n\n\nDoes anyone know what I missed? Thanks!\n\n\n\nNote that if I put the function directly in the lambda line like below, everything works fine:\n\ndf['hour'] = df.apply(lambda x: x['Dates'][11:13], axis=1).astype(float)" ]
[ "python", "pandas", "lambda", "dataframe" ]
[ "Upload artifacts to artifactory with python", "I am trying to upload artifacts to an artfactory repo with requests, but I am getting 405 errors. I have a working bash script that achieves this goal, but I really need a python implementation. \n\npython\n\nimport os\nimport hashlib\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nusername = 'me'\npassword = 'secrets'\n\n\ntarget_file = '/home/me/app-1.0.0-snapshot.el6.noarch.rpm'\n\nartifactory_url = 'https://artifactory.company.com/artifactory'\n\ndef get_md5(fin):\n md5 = hashlib.md5()\n with open(fin, 'rb') as f:\n for chunk in iter(lambda: f.read(8192), ''):\n md5.update(chunk)\n return md5.hexdigest()\n\ndef get_sha1(fin):\n sha1 = hashlib.sha1()\n with open(fin, 'rb') as f:\n for chunk in iter(lambda: f.read(8192), ''):\n sha1.update(chunk)\n return sha1.hexdigest()\n\n\ndef upload(fin):\n base_file_name = os.path.basename(fin)\n md5hash = get_md5(fin)\n sha1hash = get_sha1(fin)\n headers = {\"X-Checksum-Md5\": md5hash, \"X-Checksum-Sha1\": sha1hash}\n r = requests.post(\"{0}/{1}/{2}\".format(artifactory_url, \"yum-local\", base_file_name),auth=(username,password), headers=headers, verify=False, data=open(fin, 'rb'))\n return r \n\n\nbash\n\nart_url=\"https://artifactory.company.com/artifactory\"\nuser=\"user\"\npass=\"password\"\n\n\nfunction upload {\n local_file_path=$1\n target_folder=$2\n if [ ! -f \"$local_file_path\" ]; then\n echo \"ERROR: local file $local_file_path does not exists!\"\n exit 1\n fi\n\n which md5sum || exit $?\n which sha1sum || exit $?\n\n md5Value=\"`md5sum \"$local_file_path\"`\"\n md5Value=\"${md5Value:0:32}\"\n sha1Value=\"`sha1sum \"$local_file_path\"`\"\n sha1Value=\"${sha1Value:0:40}\"\n fileName=\"`basename \"$local_file_path\"`\"\n\n echo $md5Value $sha1Value $local_file_path\n\n echo \"INFO: Uploading $local_file_path to $target_folder/$fileName\"\n curl -i -k -X PUT -u $user:$pass \\\n -H \"X-Checksum-Md5: $md5Value\" \\\n -H \"X-Checksum-Sha1: $sha1Value\" \\\n -T \"$local_file_path\" \\\n ${art_url}/\"$target_folder/$fileName\"\n }\n\nupload \"/projects/app.war\" \"libs-release-local/com/company/app/app-comp/1.0.0/\"" ]
[ "python", "python-requests", "artifactory" ]
[ "SMS queue Handling for failure SMS", "I am developing an app which perform an action on:\n\n\nReceiving SMS\nSending SMS\nDoing some computational Task to Sender.\n\n\nIs it possible that SMS failed to send. Can any one tell me how to manage the queue of failed sent SMS messages and keep retrying to send them after some time.\n\nI have seen the code but don't know how to handle queue of SMS and resend them. \n\nHere is Code:\n\nprivate void sendSMS(String phoneNumber, String message)\n{ \n String SENT = \"SMS_SENT\";\n String DELIVERED = \"SMS_DELIVERED\";\n\n PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,\n new Intent(SENT), 0);\n\n PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0,\n new Intent(DELIVERED), 0);\n\n //---when the SMS has been sent---\n registerReceiver(new BroadcastReceiver(){\n @Override\n public void onReceive(Context arg0, Intent arg1) {\n switch (getResultCode())\n {\n case Activity.RESULT_OK:\n Toast.makeText(getBaseContext(), \"SMS sent\", \n Toast.LENGTH_SHORT).show();\n break;\n case SmsManager.RESULT_ERROR_GENERIC_FAILURE:\n Toast.makeText(getBaseContext(), \"Generic failure\", \n Toast.LENGTH_SHORT).show();\n break;\n case SmsManager.RESULT_ERROR_NO_SERVICE:\n Toast.makeText(getBaseContext(), \"No service\", \n Toast.LENGTH_SHORT).show();\n break;\n case SmsManager.RESULT_ERROR_NULL_PDU:\n Toast.makeText(getBaseContext(), \"Null PDU\", \n Toast.LENGTH_SHORT).show();\n break;\n case SmsManager.RESULT_ERROR_RADIO_OFF:\n Toast.makeText(getBaseContext(), \"Radio off\", \n Toast.LENGTH_SHORT).show();\n break;\n }\n }\n }, new IntentFilter(SENT));\n SmsManager sms = SmsManager.getDefault();\n sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI); \n}" ]
[ "android", "sms" ]
[ "How Can I create a custom binding for a SpreadJs datagrid to align a defined column?", "When I am creating a new column for my SPreadJs grid, I don't see any property to align my columns. For example: \n\nvar nameColInfo = { name: \"Name\", displayName: \"Name\", size: \"150\", resizable: true };\n\n\nI would like to add a new custom binding to my grid called align. Something like this\n\nvar nameColInfo = { name: \"Name\", displayName: \"Name\", size: \"150\", resizable: true, **align: right** };\n\n\nI don't know if this is already done by someone else. If not I will appreciate your help. I don't want to loop over my datagrid, row by row to align every cell that I need." ]
[ "javascript", "datagrid", "spreadjs" ]
[ "Access 2010 unable to bind recordset to combobox", "Win7, 64 bit, Access 2010, ADO 6.1, App server is Win Server 2008R2\n\nThis is really weird. The code below works on my local machine but it does not work when I log onto an app server and run the same thing.\n\nDim cmd As ADODB.Command\n\nIf cboContractStatus.ListCount <= 1 Then\n Set cmd = getADODBCommand(\"P_getContractStatus\")\n Set cboContractStatusExist.Recordset = rs\n Set cmd = Nothing\nEnd If\n\nIf comboAffiliates.ListCount <= 1 Then\n Set cmd = getADODBCommand(\"B_affGetAllNames\")\n Set comboAffiliates.Recordset = cmd.Execute\n Set cmd = Nothing\nEnd If\n\n\nThe first combo loads properly. The second does not load at all. It gives a msgbox saying \"Cannot find column 'Expr 52>'\" It's not really an error at all. The code doesn't break. And the msgbox has a link saying \"Did this information help?\"\n\nHere is the stored proc that is being called.\n\nSELECT\n FirstName + ' ' + LastName affName\nFROM\n tbl_Affiliate\nORDER BY\n FirstName\n\n\nOne last thing -- as I was coding this yesterday it worked just fine." ]
[ "combobox", "ms-access-2010", "ado" ]
[ "Chaincode should only be installed on endorsing peer nodes?", "According to hyperledger fabric documentation, the chaincode should only be deployed in endorsing peers, and it says still the non endorsing peers can validate and update the ledger. Now I am bit confused if non endorsing peers don't have a chaincode, how can they generate R/W sets. How the non endorsing peers will be able to create new state for the asset, if they aren't aware of the logic (chaincode) behind it ?" ]
[ "hyperledger-fabric", "hyperledger", "hyperledger-composer" ]
[ "how to add both number value when the plus sign is click", "I want to click on a button that has a number value and by clicking the '+' button I want both that value to add and by hitting the \"enter\" button I want the answer to display. How do I do this?\n\nbut there will be other expression not only \"+\" and i want if the user click the \"+\" it add the numbers and if user click \"-\" it subtract the numbers \n\nlink to code : https://jsbin.com/gikuped/1/edit?html,css,js,console,output\n\nvar num1 = document.getElementsByTagName(\"button\")[0].value;\nvar num2 = document.getElementsByTagName(\"button\")[1].value;\nvar numPlus = document.getElementsByTagName(\"button\")[2].value;\nvar Equal = document.getElementsByTagName(\"button\")[2].value;\n\n\nfunction btn(event){\n var theTarget = event.target;\n //testing\n alert(theTarget.value);\n}" ]
[ "javascript" ]
[ "Trouble with for loops", "We just learned for loops in class for about five minutes and we were already given a lab. I am trying but still not getting what I need to get. What I am trying to do is take a list of integers, and then only take the odd integers and add them up and then return them so if the list of integers was [3,2,4,7,2,4,1,3,2] the returned value would be 14\n\ndef f(ls):\n ct=0\n for x in (f(ls)):\n if x%2==1:\n ct+=x\n return(ct)\n\n\nprint(f[2,5,4,6,7,8,2])\n\n\nthe error code reads\n\nTraceback (most recent call last):\n File \"C:/Users/Ian/Documents/Python/Labs/lab8.py\", line 10, in <module>\n print(f[2,5,4,6,7,8,2])\nTypeError: 'function' object is not subscriptable" ]
[ "python", "for-loop" ]
[ "jQuery Mobile List Within a LIst", "I want to create a list within a list item on jQuery mobile here's my code:\n\nhttps://gist.github.com/2886812\n\nEveything works out properly except the top and bottom list items get cut off and look like this:\n\nhttp://imgur.com/em37Y\n\nI don't even know if what I want to do is possible. I'm a novice. Thanks in advance." ]
[ "jquery", "list", "mobile" ]
[ "iOS - Inapp Purchases - setting in server", "I am creating iOS app with in-app purchase feature in it.\nI created the app id, profile etc successfully.\nI also added the in-app purchase ID, etc in apple's itunes connect.\nBut on the top I'm seeing the following message:\n\nYour first In-App Purchase(s) must be submitted with a new app version. Select them from the In-App Purchases section of the Version Details page and then click Ready to Upload Binary.\n\nI didn't understand what does it mean?\nWhen I'm testing, i'm not getting response from server. \nhow to identify and correct the issue.\n\nthis is my first app that will be pushed to app store." ]
[ "ios", "in-app-purchase" ]
[ "Spring RestTemplate Copy property HttpHeader to RequestBody", "Our application is calling other rest service using RestTemplate, its a Spring Boot application. I have some requirement where I need to copy property from http header to request body.\n\nDoing it manually would lead to changes at many places. I am looking for a generic solution ie, I could extend the functionality of RestTemplate and use it across the application.\n\nIs there any way to modify RestTemplate in order to achieve my requirement. I have already gone through possibilities through HttpMessageConverter, I am able to append Json Property but looking for a way where it could be copied from Header.\n\nPlease let me know if I am not clear with my requirements, any pointers would be helpful." ]
[ "java", "spring", "resttemplate" ]
[ "Solr join and faceting possible?", "Some Background info : \nIn our application, we have a requirement to update large number of records \noften. I investigated solr child documents but it requires updating both \nthe child and the parent document . Therefore, I'm investigating adding \nfrequently updated information in an \"auxillary document\" with a custom \ndefined \"parent-id\" field that can be used to join with the static \"parent \ndocument\". - basically rolling my own child document functionality. \n\nThis approach has satisfied all my requirements, except one. How can I \nfacet upon a field present in the auxillary document? \n\nFirst, here's a gist dump of my test core index (4 docs + 4 aux docs) \nhttps://gist.github.com/anonymous/2774b54e667778c71492\n\nNext, here's a simple facet query only on the aux . While this works, it \nonly returns auxillary documents \nhttps://gist.github.com/anonymous/a58b87576b895e467c68\n\nFinally, I tweak the query using a SOLR join ( \nhttps://wiki.apache.org/solr/Join ) to return the main documents (which it \ndoes), but the faceting returns no results. This is what I'm hoping someone \non this list can answer . \nHere is the gist of that query \nhttps://gist.github.com/anonymous/f3a287ab726f35b142cf\n\nAny answers, suggestions ? \n\nThanks" ]
[ "join", "solr", "facet" ]
[ "Can you read a dynamodb managed backup?", "If I create a backup using CreateBackup or UpdateContinuousBackups can I read the backup without restoring the table? I'd like to read from s3 or another source.\n\nI don't want to use Glue or Data Pipelines." ]
[ "amazon-web-services", "amazon-dynamodb" ]
[ "Use glyphicons in razor views in ASP.NET Core 5", "I'm migrating an ASP.NET MVC 5 web app to ASP.NET Core (with .NET 5). In the previous web app I used glyphicons, but in the new one it seems that there are no available.\nI created a new ASP.NET Core Web App (Model-View-Controller) project with .NET 5. I didn't change anything about bootstrap, it is v4.3.1, and if I use this HTML code <span class="glyphicon glyphicon-pencil"> </span> no icon is shown.\nI tried this solution, adding a link to v3.4.0 stylesheet, but this changes the style of the current web page.\nIs it possible to use glyphicons in ASP.NET Core project without changing web's main style?" ]
[ "asp.net-core", "asp.net-core-mvc", ".net-5", "glyphicons", "asp.net-core-5.0" ]
[ "Result window is too large, from + size must be less than or equal to: [10000] but was [100000]", "I got the following Error in elasticSearch:\n\n\n [Result window is too large, from + size must be less than or equal\n to: [10000]\n but was [100000]. \n \n See the scroll api for a more efficient way to\n request large data sets. This limit can be set by changing the\n [index.max_result_window] index level parameter.] and i am not getting\n in which file we have to set\n\n\n index.max_result_window = 50000;" ]
[ "elasticsearch" ]
[ "adding users to answers_watchers table from comment.rb", "I have the following code in my Answer.rb model of my Rails app. After a user has posted an answer (to a question), they get added to a list to be notified if a comment is posted on the answer.\n\nAnswer.rb\n\n has_and_belongs_to_many :watchers, :join_table => \"answer_watchers\", :class_name => \"User\"\n\nafter_create :creator_watches_me\n private \n\n def creator_watches_me\n self.watchers << user\n end \n\n\nThis (together with code not shown) works to notify the user who answered the question if a comment is posted. However, if that same user posts a comment in reply, I want the original commenter to be notified if a comment is added by the answerer or anyone else. Therefore, I want to add anyone who makes a comment on an answer to this same list--but separate lists should be kept for each instance of an answer obviously. Here's where I'm running into trouble. \n\nI'm assuming it (the new commenter) has to be added to the answer instance rather than the class, although I'm not entirely sure how to do that. The code below is all broken. I'm just trying to play around with how it might work without success.\n\nIn my comment.rb model, I added this code that would pass the user to a method add_to_watchers in the Answer model\n\ncomment.rb\n\n after_create :creator_watches_me\n private \n\n def creator_watches_me\n Answer.add_to_watchers(user)\n end \n\n\nand in the Answer.rb model, I had this\n\n def add_to_watchers(user)\n self.watchers << user\n end \n\n\nbut now I can't add a comment at all. I get this error\n\nundefined method `add_to_watchers' for #<Class:0x007faead33f7f8>\n\n\nOne problem I'm guessing I might be having is I don't know how to refer to the instance of the Answer from the comment model and how to pass that instance to Answer.rb so it knows which answer the user should be added to. That could be totally wrong of course :( I've read a few blog posts on instance and class methods but I'm having trouble getting it sorted out in my code, if that's even the issue I'm having. \n\nSo you know, there is an association between Answer and Comment. Answer.rb has_many :comments." ]
[ "ruby-on-rails", "ruby" ]
[ "I have a error in discord.py (purge command)", "I have this Python code for discord.py rewrite:\n\[email protected](pass_context=True)\nasync def clean(ctx):\n if ctx.author.guild_permissions.administrator:\n llimit = ctx.message.content[10:].strip()\n await ctx.channel.purge(limit=llimit)\n await ctx.send('Cleared by <@{.author.id}>'.format(ctx))\n await ctx.message.delete()\nelse:\n await ctx.send(\"You cant do that!\")\n\n\nBut every time i get this error:\n\ndiscord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: '<=' not supported between instances of 'str' and 'int'\n\n\nCan someone here help me?" ]
[ "python", "python-3.x", "discord.py" ]
[ "use Axios.post() to get values from local file", "I am working in React login. I am using Axios.post('/api/users/login', value) in one of my Component. Now I would like to store userName and passWord in a file and fetch values from a local file using Axios. I would like to have user login for a fixed username and password. \n\nIs it possible to use Axios.post() to get values from local file ?" ]
[ "reactjs", "authentication", "axios" ]
[ "Changing background color of selected cell?", "Does anyone know how to change the background color of a cell using UITableViewCell, for each selected cell? I created this UITableViewCell inside the code for TableView." ]
[ "iphone", "uitableview", "colors", "background", "tableview" ]
[ "UITextField to change API URL in Swift 5", "I am new iOS Developer\n\nI want to change the websiteLogo API with a textfield to change the URL.\n\nhow can I change the line with the ***\nwith a var and a textfield in my viewcontroller?\n\nWith screenshoot it's will be easier to understand what I want? Thank you !!! Guys. OneDriveLink. 1drv.ms/u/s!AsBvdkER6lq7klAqQMW9jOWQkzfl?e=fyqOeN \n\nprivate init() {}\n**private static var pictureUrl = URL(string: \"https://logo.clearbit.com/:http://www.rds.ca\")!**\n\nprivate var task: URLSessionDataTask?\n\nfunc getQuote(callback: @escaping (Bool, imageLogo?) -> Void) {\n\n let session = URLSession(configuration: .default)\n task?.cancel()\n\n task = session.dataTask(with: QuoteService.pictureUrl) { (data, response, error) in\n DispatchQueue.main.async {\n\n guard let data = data, error == nil else {\n callback(false, nil)\n return\n }\n\n guard let response = response as? HTTPURLResponse, response.statusCode == 200 else {\n callback(false, nil)\n return\n }\n\n let quote = imageLogo(image: data)\n callback(true, quote)\n print(data)\n }\n }\n task?.resume()\n }" ]
[ "ios", "xcode11", "swift5" ]
[ "How critical is pylint's no-self-use?", "As an example I have a Django custom management command which periodically (APScheduler + CronTrigger) sends tasks to Dramatiq.\nWhy the following code with separate functions:\ndef get_crontab(options):\n """Returns crontab whether from options or settings"""\n\n crontab = options.get("crontab")\n if crontab is None:\n if not hasattr(settings, "REMOVE_TOO_OLD_CRONTAB"):\n raise ImproperlyConfigured("Whether set settings.REMOVE_TOO_OLD_CRONTAB or use --crontab argument")\n crontab = settings.REMOVE_TOO_OLD_CRONTAB\n return crontab\n\n\ndef add_cron_job(scheduler: BaseScheduler, actor, crontab):\n """Adds cron job which triggers Dramatiq actor"""\n\n module_path = actor.fn.__module__\n actor_name = actor.fn.__name__\n trigger = CronTrigger.from_crontab(crontab)\n job_path = f"{module_path}:{actor_name}.send"\n job_name = f"{module_path}.{actor_name}"\n scheduler.add_job(job_path, trigger=trigger, name=job_name)\n\n\ndef run_scheduler(scheduler):\n """Runs scheduler in a blocking way"""\n def shutdown(signum, frame):\n scheduler.shutdown()\n\n signal.signal(signal.SIGINT, shutdown)\n signal.signal(signal.SIGTERM, shutdown)\n\n scheduler.start()\n\n\nclass Command(BaseCommand):\n help = "Periodically removes too old publications from the RSS feed"\n\n def add_arguments(self, parser: argparse.ArgumentParser):\n parser.add_argument("--crontab", type=str)\n\n def handle(self, *args, **options):\n scheduler = BlockingScheduler()\n add_cron_job(scheduler, tasks.remove_too_old_publications, get_crontab(options))\n run_scheduler(scheduler)\n\nis better than a code with methods?\nclass Command(BaseCommand):\n help = "Periodically removes too old publications from the RSS feed"\n\n def add_arguments(self, parser: argparse.ArgumentParser):\n parser.add_argument("--crontab", type=str)\n\n def get_crontab(self, options):\n """Returns crontab whether from options or settings"""\n\n crontab = options.get("crontab")\n if crontab is None:\n if not hasattr(settings, "REMOVE_TOO_OLD_CRONTAB"):\n raise ImproperlyConfigured(\n "Whether set settings.REMOVE_TOO_OLD_CRONTAB or use --crontab argument"\n )\n crontab = settings.REMOVE_TOO_OLD_CRONTAB\n return crontab\n\n def handle(self, *args, **options):\n scheduler = BlockingScheduler()\n self.add_cron_job(scheduler, tasks.remove_too_old_publications, self.get_crontab(options))\n self.run_scheduler(scheduler)\n\n def add_cron_job(self, scheduler: BaseScheduler, actor, crontab):\n """Adds cron job which triggers Dramatiq actor"""\n\n module_path = actor.fn.__module__\n actor_name = actor.fn.__name__\n trigger = CronTrigger.from_crontab(crontab)\n job_path = f"{module_path}:{actor_name}.send"\n job_name = f"{module_path}.{actor_name}"\n scheduler.add_job(job_path, trigger=trigger, name=job_name)\n\n def run_scheduler(self, scheduler):\n """Runs scheduler in a blocking way"""\n\n def shutdown(signum, frame):\n scheduler.shutdown()\n\n signal.signal(signal.SIGINT, shutdown)\n signal.signal(signal.SIGTERM, shutdown)\n\n scheduler.start()\n\nThis code is used in a one single place and will not be reused.\nStackOverflow requires more details, so:\nThe second code is the version that I originally wrote. After that, I runned Prospector with Pylint and besides other useful messages I've got pylint: no-self-use / Method could be a function (col 4). To solve this issue I rewrote my code as in the first example. But I still don't understand why it is better this way." ]
[ "python", "django", "pylint" ]