texts
list
tags
list
[ "How do you flexibly retain useful object functionality between the usage and definition of a method?", "Exposition:\n\nSuppose I have this trivial interface:\n\ninterface Y { Y f(); }\n\n\nI can implement it in 3 different ways:\n\n\nUse the general type everywhere.\n\nclass SubY_generalist implements Y\n{\n public Y f()\n {\n Y y = new SubY_generalist();\n ...\n return y;\n }\n}\n\nUse the special type, but return the same value implicitly cast into general type.\n\nclass SubY_mix implements Y\n{\n public Y f()\n {\n SubY_mix y = new SubY_mix();\n ...\n return y;\n }\n}\n\nUse the special type and return it the same.\n\nclass SubY_specialist implements Y\n{\n public SubY_specialist f()\n {\n SubY_specialist y = new SubY_specialist();\n ...\n return y;\n }\n}\n\n\n\n \n\nMy considerations:\n\nThere is a lengthy conversation nearby here on the benefits of \"programming to an\ninterface\". The most promoted answers do not seem to go deep into the distinction between\nargument and return types, which are in fact fundamentally distinct. Finding therefore that\nthe discussion elsewhere does not provide me with a clean-cut answer, I have no choice but to\nspeculate on it by myself — unless the kind reader can lend me a hand, of course.\n\nI will assume the following basic facts about Java: (Are they correct?)\n\n\nAn object is created at its most special.\nIt may be implicitly cast into a more general type (generalized) at any time.\nWhen an object is generalized, it loses some of its useful properties, but gains none.\n\n\nFrom these simple points, it follows that a special object is more useful, but also more dangerous\nthan the general.\n\nAs an example, I may have a mutable container that I can generalize into being\nimmutable. If I ensure the container has some useful properties before being thus frozen, I can\ngeneralize it at the right time to prevent the user from accidentally breaking the invariant. But\nis this the right way? There is another way to achieve similar isolation: I may always just make\nmy methods package-private. Generalizing seems to be more flexible but easy to omiss and\nintroduce a surface for subtle bugs.\n\nBut in some languages, like Python, it is deemed unnecessary to ever actually protect methods from\noutside access; they just label the internal methods with an underscore. A proficient user may\naccess the internal methods to achieve some gain, provided that they know all the intricacies.\n\nAnother consequence is that inside the method definitions I should prefer specialized objects.\n\n \n\nMy questions:\n\n\nIs this right thinking?\nAm I missing something?\nHow does this relate to the talk of programming to an interface? Some locals here seem to\nthink it is relevant, and I agree that it does, just not immediately, as I see it. It is more\nlike programming against an interface here, or against a subclass in general. I am a bit at\na loss about these intricacies." ]
[ "java", "subclass" ]
[ "Postgres Command Line tool for Import/Exporting data/ddl", "For Postgres is there any sort of command line utilities that allow a database to be \"dumped to a file\" and that allow that same database dump to be imported?\n\nI know this can be done through PGAdmin, but I need to be able to do this on the cmd line." ]
[ "sql", "database", "postgresql", "ddl" ]
[ "Removing everything after \"?\" python", "I get an error when I try to get rid of everything behind the \"?\" in a set of scraped links: \n\ncode: \n\nfrom selenium import webdriver\nimport pandas as pd\nimport time \nfrom datetime import datetime\nfrom collections import OrderedDict\nimport re\n\nbrowser = webdriver.Firefox()\nbrowser.get('https://www.kickstarter.com/discover?ref=nav')\ncategories = browser.find_elements_by_class_name('category-container')\n\ncategory_links = []\nfor category_link in categories:\n category_links.append((str('https://www.kickstarter.com'),\n category_link.find_element_by_class_name('bg-white').get_attribute('href')))\n print(category_links)\n for i in category_link:\n category_links2 = re.sub('?$', '', category_links)\n print(category_links2)\n\n\nerror: \n\n\n TypeError: 'FirefoxWebElement' object is not iterable" ]
[ "python", "pandas", "selenium", "web-scraping" ]
[ "How to improve security with text in a url parameter : .php?parameter=text", "This url contains a parameter with text :\n\n\n my-page.php ?id_article=1&alias=article-name\n\n\nThe result after rewritting is :\n\n\n 1-article-name.php\n\n\nFor id_article parameter, i made this security :\n\nif (isset($_GET[id_article] && $_GET[article] != null && $_GET[id_article] >= 1 && $_GET[id_article] <= 4 && (int) $_GET[id_article])\n\n\nWhat can i do for alias parameter which accept text ?" ]
[ "php", "security", "url", "parameters" ]
[ "Unexpected behaviour Redux navigating on store change", "Hello fellow developers !\nI have a problem wich I cannot seem to resolve.\nI have two screens : HomeScreen and Mapscreen, I navigate from HomeScreen to Mapscreen. In MapScreen I change a state in my store using this code :\n const mapSlice = createSlice({\n name: 'map',\n initialState: initialState,\n reducers: {\n setStateCoordinates(state, {payload}) {\n state.zoomLevel = payload.zoom;\n state.center_coordinate = payload.center;\n },\n },\n}); \n\nI created a dummy component to pin down the problem,\nHere is how i call the store:\nimport React from 'react';\nimport {connect, useDispatch} from 'react-redux';\n\nimport {View, Button} from 'react-native';\nimport {setStateCoordinates, toggleRefresh} from '../features/map/mapSlice';\nconst mapDispatch = {\n setStateCoordinates,\n toggleRefresh,\n};\n\nfunction mapStateToProps(state) {\n return state;\n}\n\nconst TestComponent = (props) => {\n return (\n <View style={{width: 60, height: 60, backgroundColor: 'red'}}>\n <Button\n style={{widt: 40, height: 40}}\n onPress={() => {\n props.setStateCoordinates({zoom: 8.8, center: [4.2, 6.3]});\n }}\n title="Test"\n />\n </View>\n );\n};\n\nexport default connect(mapStateToProps, mapDispatch)(TestComponent);\n\nEdit: here is my store config\nconst rootReducer = combineReducers({\n menu: menuSlice,\n menutoggle: pintpointSlice,\n data: dataSlice,\n map: mapSlice,\n user: userSlice,\n trail: trailSlice,\n customPin: customPinSlice,\n stat: statSlice,\n});\nconst persistedReducer = persistReducer(persistConfig, rootReducer);\n\nexport const store = createStore(persistedReducer, applyMiddleware(thunk));\n\nexport const persistor = persistStore(store);\n\nThe store does change ! My problem is that for some reasons after changing it chooses to navigate (or render) Homescreen instead of the screen it has been called from (MapScreen).\nUppon changes the view navigate back to HomeScreen. I'm using "react-redux": "7.1.3", "redux": "4.0.5", react-native: 0.64\nIf you have any lead please help me, i've been struggling for days...\nFeel free to ask any question for more precisions, any help would be so much appreciated.\nThank you and have a good day" ]
[ "reactjs", "react-native", "redux", "react-redux" ]
[ "I´m stucked creating a new Leaflet custom control", "I´ve read the Leaflet doc and some online tutorials but nothing works for me.\nI´m looking to add a new single button under the Leaflet zoom control (topleft) but can´t find the way to add it.\nI´ve tried something like this:\n var control = L.Control.Button = L.Control.extend({\n options: {\n position: 'topleft'\n },\n onAdd: function(map) {\n this._map = map;\n var container = L.DomUtil.create("div", "leaflet-control-button");\n this._container = container;\n return this._container;\n },\n onRemove: function(map) {},\n \n });\n\ncontrol.addTo(map);\n\nThe button function is show some data that I´ve get from an API (I almost have ready the function).\nPlease, someone help me, I would appreciate it so much!" ]
[ "javascript", "leaflet" ]
[ "How to connect to TfsGit from vsts build task", "I have a ci build that should push changes to the git repo. I am using a PowerShell script to execute git commands. However, it fails with: \n\nYou need the Git 'GenericContribute' permission to perform this action.\n\n\nI have already enabled \n\n\n Allow scripts to access OAuth token\n\n\nHowever, that did not help. I am looking for a way to pass the Personal access token into the Powershell to be able to push to git. Below the error:" ]
[ "git", "tfs", "azure-devops", "azure-pipelines" ]
[ "Assembly language how to use WriteBinB correctly?", "I'm trying to transform a number '2' presented by '*' and ' ' by constructing an array called chstrs like the following code into '0' and '1'.\nIn other words, I want to change ' ' to '0' and '*' to '1', moving the result to bitstrs and print it out.\nMy problem is that I can't print the right answer even though I successfully transform chstrs into bitstrs.\nHere is chstrs and bitstrs after whole program\n \nAfter I printed bitstrs, it turned out like this.\n\nBut this is what I really want. How can I deal with it?\n\nHere's my code.\nTITLE Assembly \n\nINCLUDE Irvine32.inc\n\nmain EQU start@0\n\n.data\n\n chstrs BYTE " *** " \n BYTE "** ** "\n BYTE "** ** "\n BYTE " ** "\n BYTE " ** "\n BYTE " ** "\n BYTE " ** "\n BYTE "********"\n bitstrs BYTE 8 DUP(?)\n.code\n\ntransform PROC ;transform ' ' to 0, '*' to 1\n push ecx\n mov ecx, 8\n mov bl, '*' \nL2:\n mov al, [esi] ;move chrstrs into al\n cmp al, bl ;compare al and '*'\n jb L3 ;if a is below '*', al=' '\n add al, 7 \n jmp L4\nL3: \n add al, 16 \n jmp L4\nL4: \n mov [edi], al ;move al to bitstrs after transforming\n inc edi\n inc esi\n loop L2\n pop ecx\n ret\ntransform ENDP\n\nmain PROC\n mov esi, offset chstrs\n mov edi, offset bitstrs\n mov ecx, 8\n \nL1:\n call transform\n mov eax, bitstrs\n call writebinb ;trying to print bitstrs, but I can't do it right\n call crlf\n loop L1\n \n\n exit\nmain ENDP\nEND main" ]
[ "assembly", "x86", "irvine32" ]
[ "Finding the age from a user input jQuery", "I'm trying to have the user enter a year like 2030, it will take that and tell you that Bob is 34 since he was born in 1996. So I want the output to be \"Bob is YEAR Inputted - 1996 in YEAR INPUTTED\" (Bob is 34 in 2030.) \n\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>\n <script>\n //year\n $(\"#year_button\").on(\"click\", function(){ //on click of year button \n var inputYear = $(\"#yearborn\").val();\n var age = inputYear - 1996;\n if(inputYear > 1996){\n $(\".show-age\").html(\"Bob is \"+age+\" Year old in \"+inputYear+\"\");\n } else {\n $(\".show-age\").html(\"Please add a number more than 1996\");\n }\n });\n </script>\n\n <div id=\"year\">\n <p>Enter a Year: <input id=\"yearborn\" type=\"number\"/> \n <div id=\"year_button\">\n <button type=\"button\" id=\"year_button\">Enter</button> </p>\n </div>\n </div>\n\n <div class=\"show-age\"></div>" ]
[ "javascript", "jquery", "html", "user-input" ]
[ "Protecting a web contact form from spam without PHP?", "I'm supposed to implement some sort of spam protection (captcha, etc.) for an existing web contact form. However the original form uses a .cgi file on the virtual server that I can't access, so I can't work with this script. \nThe PHP mail function is turned off. \n\nI'm guessing I need my own cgi file but I'm not really into perl and cgi :-)\n\nMaybe you can point me to some kind of solution for this problem." ]
[ "php", "cgi", "captcha", "spam", "contact-form" ]
[ "Using FireDac's onUpdateRecord and optionally execute default statements", "I have a query that returns rows with an outer join. This causes records to exist in the results that don't really exist in the table. When those rows are changed FireDac sees the change as an Update instead of an insert. That behavior makes sense from FireDac's side because it has no way to tell the difference. \n\nI am overriding the OnUpdateRecord event to catch those rows that are marked wrong and perform the insert myself. That part is working great. What I can't figure out is how to tell FireDac to perform it's normal process on other records. I thought I could set the AAction to eaDefault and on the return FireDac would continue to process the row as normal. However, that does not seem to be the case. Once OnUpdateRecord is in place it looks like FireDac never does any updates to the server. \n\nIs there a way to tell FireDac to update the current row? Either in the OnUpdateRecord function by calling something - or maybe a different return value that I missed?\n\nOtherwise is there a different way to change these updates into inserts? I looked at changing the UpdateStatus but that is read only. I looked at TFDUpdateSql - but I could not figure out a way how to only sometimes turn the update into an insert.\n\nI am using CachedUpdates if that makes any difference.\n\nHere is what I have for an OnUpdateRecord function:\n\nprocedure TMaintainUserAccountsData.QueryDrowssapRolesUpdateRecord(\n ASender: TDataSet; ARequest: TFDUpdateRequest; var AAction: TFDErrorAction;\n AOptions: TFDUpdateRowOptions);\n{^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^}\nbegin\n if (ARequest = arUpdate) and VarIsNull(ASender.FieldByName('Username').OldValue) then\n begin\n ASender.Edit;\n ASender.FieldByName('RoleTypeID').Value := ASender.FieldByName('RealRoleTypeID').Value;\n ASender.Post;\n MGRDataAccess.ExecSQL('INSERT INTO DrowssapRoles (Username, RoleTypeID, HasRole) VALUES (:Username, :RoleTypeID, :HasRole)',\n [ASender.FieldByName('Username').AsString, ASender.FieldByName('RoleTypeID').AsInteger,\n ASender.FieldByName('HasRole').AsBoolean]);\n\n AAction := eaApplied;\n end\n else\n begin\n // What do I do here to get the default FireDac actions?\n end;\nend;" ]
[ "delphi", "ms-access", "firedac", "delphi-10.1-berlin" ]
[ "SSL encrypted Websockets in Java Using Java WebSockets API", "So, I have been using the Java Websockets API to create a WebSocket server in Java, which worked just fine, until I realized I should be using an SSL encrypted connection using \"wss:myurl.tld\". Basically, the API wants an SSLContext object to work with SSL, but I can't for the life of me figure out how to make one of those.\n\nI looked at some examples and found out that if I could make a Java KeyStore file with a certificate I could make it work, so I tried to do that.\n\nI started fiddling around with trying to get a \"Let's Encrypt\" certificate following these instructions but I ran into to some problems.\n\n\nI run windows and I could find no software using the Let's Encrypt system that worked the same as in the instructions, and homebrew on my mac machine is broken, and it's running a too old OS to update.\nBeing rather inexperienced with SSL I had no real idea what to put in as parameters.\n\n\nSo, in short, how do I make my Java Websocket server use a secure SSL connection?\n\nOh, and pardon my messy English and lack of question-writing skills, I'm a bit new to these sorts of things." ]
[ "java", "ssl", "websocket" ]
[ "Prevent non-admins from using Alfresco's /share/page/type/login (normal users go via SSO)", "In Alfresco, I have implemented an SSO servlet filter and an AuthenticationComponent so that login is done via SSO.\n\nEveryone logs in via SSO... except admin users. So, for unauthenticated users my servlet filter redirects to SSO login all pages except for /share/page/type/login and /share/page/dologin.\n\nProblem: Normal users might be able to learn about this path, and start using it instead of SSO, which I don't want.\n\nI could generate a very complicated random Alfresco password for all non-admin users, but it sounds rather low-tech.\n\nIs there a solution to effectively restrict login via /share/page/type/login to only Alfresco users who belong to the ALFRESCO_ADMINISTRATORS group?" ]
[ "alfresco" ]
[ "Setting variables VBA error", "I am getting an error when trying to execute the following subroutine\n\n\"Runtime Error: 9, Subscript out of range\"\n\nits highlighting the first variable declaration. At first I thought it was due to the wrong datatype but changing and playing around with that had no luck.\n\nI also tried both Cells & Range\n\nPublic vFolderPath As String\nPublic vCMFNewPath As String\nPublic vKBNewPath As String\nPublic vDPI As Integer\n\nPrivate Sub SetGlobal()\n\nDim vGo As String\nDim vTemplateLocation As String\nDim vCMFFilename As String\nDim vKBFilename As String\nDim vDriver As String\nDim vPKG As String\n\n vDPI = Workbooks(\"tools.xlsm\").Sheets(\"SETTINGS\").Range(\"B2\").Value\n\n vFolderPath = Workbooks(\"tools.xlsm\").Sheets(\"SETTINGS\").Range(\"B3\").Value & \"\\\"\n\n\nAny ideas?" ]
[ "vba", "excel", "powerpoint", "vbe" ]
[ "Crash when opening file in Visual Studio 2010", "I have just installed Visual Studio 2010 Beta 2 and it crashes when I try to open a file - also when opening any cpp file through the 'File' menu.\n\nAny ideas? Where is the appropriate forum to ask about this?" ]
[ "visual-studio", "crash" ]
[ "How to look up value with partial text in excel?", "I want to match Address in "summary" with the District on "Sheet1" by using Name in "Sheet1".\nThe Address column in "summary" contains partial text in the Name column in "Sheet1".\nHow can I do it?\nI have tried =VLOOKUP(E2&"*",Sheet1!A:B,2,TRUE), but it shows NA.\nMuch appreciated." ]
[ "excel", "excel-formula" ]
[ "min() error in function with while loop in R -a debugging challenge for the R enthusiast", "I have a function (bobB) that seems to be getting stuck in a while loop. When I hit escape and look at warnings() I get the following error: \n\nWarning message:\nIn min(xf, yf) : no non-missing arguments to min; returning Inf \n\n\nSome example code:\n\n#I have the data: \n\nx<-\"A03\" \ny<-\"A24\"\n\nsitex<-c(\"Sp1\",\"Sp1\",\"Sp3\",\"Sp3\")\nsitey<-c(\"Sp2\",\"Sp4\",\"Sp2\",\"Sp4\")\ngsim<-c(0.2,0.3,0.4,0.1)\ngsim<-data.frame(sitex,sitey,gsim)\n\nsite<-c(\"A03\",\"A03\",\"A03\",\"A03\",\"A24\",\"A24\",\"A24\",\"A24\")\nspecies<-c(\"Sp1\",\"Sp1\",\"Sp3\",\"Sp4\",\"Sp1\",\"Sp1\",\"Sp3\",\"Sp4\")\nfreq<-c(0.2,0.3,0.4,0.1,0.3,0.3,0,0.4)\nssf<-data.frame(site,species,freq,stringsAsFactors=FALSE)\n\n#My function: \n\nbobB <- function (x, y, ssf, gsim) {\n\n#*Step 1.* Create an empty matrix 'specfreq' to fill \n\n#Selects the species frequency data greater than 0 for the two sites being compared \n\nssfx <- ssf[ssf$site == x & ssf$freq >0,]\nssfy <- ssf[ssf$site == y & ssf$freq >0,]\n\n#pull out the species that are present at site x and/or site y using a merge, \n#this is needed to create the initial empty matrix \n\nm<-(merge(ssfx,ssfy,all=TRUE))\nspecies<-unique(m$species)\n\n#Creates an empty matrix of the frequency of each species at site x and y \n\n specfreq <- matrix(0, length(species), 2, dimnames=list(species,c(x,y)))\n\n#*Step 2.* Fill empty matrix 'specfreq' with data from data.frame 'ssf' \n\nfor(i in 1:nrow(ssf{specfreq[rownames(specfreq)==ssf[i,\"species\"],colnames(specfreq)==ssf[i,\"site\"]] <- ssf[i,\"freq\"]}\n\n#*Step 3.* For species present at site x and y remove the minimum of the two from both \n#find minimum frequency for each species for site x and y \n\na <- pmin(specfreq[,x], specfreq[,y])\n\n#subtract 'a' from current 'specfreq' \n\nspecfreq <- specfreq - a\n\n#*Step 4.* Calulate variable B \n\n#Set answer to 0\n\nanswer <- 0\n\n#while 'specfreq' contains data (i.e. is >0) keep doing the following \n\nwhile(sum(specfreq) > 1e-10) {\n\n#Find species remaining at site x \n\nsx <- species[specfreq[,1] > 0]\n\n#Find species remaining at site y \n\nsy <- species[specfreq[,2] > 0] \n\n#Pull out the gsim value for sx and sy\n\ngsimre <-gsim[gsim$sitex %in% sx & gsim$sitey %in% sy,]\n\n#determines the row containing the maximum value for remaining gsim and assigns it to i \n\ni <- which.max(gsimre$gsim)\n\n#once the max gsim value has been found (i) we go back to the specfreq matrix and filter \n#out the frequency of the site x species associated with i \n\nxf <- specfreq[(gsimre$sitex[i]),x]\n\n#and the frequency of the site y species associated with i \n\nyf <- specfreq[(gsimre$sitey[i]),y]\n\n#The frequency of the species at site x associated with the greatest i is multiplied by i \n\nanswer <- answer + xf * gsimre$gsim[i]\n\n#Then take the minimum common frequency for the two species associated with i \n\nf <- min(xf,yf)\n\n#Subtract theminimum common frequency from both the site x and site y column \n\nspecfreq[gsimre$sitex[i],x] <- specfreq[gsimre$sitex[i],x]-f\nspecfreq[gsimre$sitey[i],y] <- specfreq[gsimre$sitey[i],y]-f \n}\nanswer\n}\nbobB(x, y, ssf, gsim)" ]
[ "r", "debugging", "while-loop", "min" ]
[ "How can I limit the CPU usage of solve()?", "Whenever I run R's base-function solve(A), with A being a large matrix, my R instance uses all 8 cores of my Linux machine (Ubuntu 18.04) to 100 % so that my whole system is slowed down. \n\nIs there a way to tell solve() how many cores it should use? \n\nAlternative, is it possible to tell my R instance (from within R) to never use more than say 90 % of a core?\n\nThanks for your help!" ]
[ "r", "parallel-processing", "cpu" ]
[ "Cannot access Cakephp index.html file", "Hello I have a system with Ubuntu 14.04 32bit in which xampp version 7(latest) is installed and I have extracted Cakephp v3 folder in my document root folder. Whenever I access localhost/cakephp in the browser\n\n\n The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again. Error 404 localhost Apache/2.4.18 (Unix) OpenSSL/1.0.2h PHP/7.0.8 mod_perl/2.0.8-dev Perl/v5.16.3 But when i enter localhost/cakphp/index.php the browser displays the the cake PHP page." ]
[ "cakephp-3.0" ]
[ "How to retain contents of datagrid view when applying multiple filters", "I am trying to provide my users a nice search capability. I want to do so using textboxes to filter a datagridview. I have a dgv containing all animals in the database. For simplicity sake let’s say the first two columns are animalName and animal (dog or cat). I have two textboxes used for filtering, one for each of those two columns. Let's say I want to find all dogs named Buddy. In my first text box I type 'Buddy' and, because of the filter code behind the textbox change event the dgv now contains only the Buddys. When I go to textboxAnimal and type 'd' for dog the dgv changes to show all the dogs; not just the ones named Buddy. How can I make it such that the results of the first filter stay in place when I apply the second filter?\n\nI assume I need to use the lostFocus (or gotFocus or leave) event of the first textbox but just don’t know what code to put behind it. I guess I could hard code a select statement that would then be used to repopulate the datagridview but this could get onerous as I’m going to have many textboxes; not just two.\n\nAny help would be greatly appreciated." ]
[ "vb.net", "datagridview", "filtering" ]
[ "argparse: store_true and int at same time", "I'm using argparse for cli arguments. I want an argument -t, to perform a temperature test. I also want to specify the period of temperature measurements.\n\nI want:\n\npython myscript.py -t to perform a measurement every 60 seconds,\n\npython myscript.py -t 30 to perform a measurement every 30 seconds and,\n\npython myscript.py not to do the temperature measurement.\n\nRight now I am doing it like this:\n\nparser.add_argument('-t', '--temperature',\n help='performs temperature test (period in sec)',\n type=int, default=60, metavar='PERIOD')\n\n\nThe problem is that I can not distinguish between python myscript.py and python myscript.py -t.\n\nIt would like to be able to do something like action='store_true' and type=int at the same time. Is it possible? Any other way to do it?\n\nThanks!" ]
[ "python", "argparse" ]
[ "Trying to remove the last character in a char array in C", "So I wrote the following method:\n\nvoid removeEndingColon(char *charArrayWithColon) {\n // remove ':' from variableName\n size_t indexOfNullTerminator = strlen(charArrayWithColon);\n charArrayWithColon[indexOfNullTerminator - 1] = '\\0'; // replace ':' with '\\0'\n}\n\n\nBut when I test it with the following code in eclipse, I get no output and I don't know why my executable isn't able to run.\n\nchar *charArray1 = \"ThisHasAColonAtTheEnd:\";\nremoveEndingColon(charArray1);" ]
[ "c", "string", "arrays", "null-terminated" ]
[ "Is There A List Of Error Codes MVC May Throw?", "I need to catch error codes in an mvc app. Is there a list of error codes mvc throws? Are the the same as the basic HttpCodes? For example if the [Authorized] attribute fails on a class is a 401 error code thrown or is it something different?" ]
[ "asp.net-mvc" ]
[ "How can I make div area on Google map", "How can I make a div area on the Google map iframe. Part of my code is ready here (http://thewebcookies.home.pl/test.html). That image (http://i.stack.imgur.com/92gkt.png) is an example what I want to get." ]
[ "javascript", "html", "css" ]
[ "If point is inside a triangle (help when point is on the boundary of triangle)", "The following code tests whether a point is inside a triangle or not, it does everything correctly but whenever I specify a point on the triangle's boundary it says it is outside (I want it to be inside). Can anyone figure out what's wrong? (I did not write the following code, so please I understand the style is horrible ignore it... trust me it was worse before I cleaned up).\n\nSay if I entered triangle with vertices A(0,0) B(10,0) C(0,10) and point (5,0) it will still show up as outside the triangle!\n\n#include <stdio.h>\n\nint test2( double px, double py, double m, double b ) { \n if (py < m * px + b ) {\n return -1; // point is under line\n }else if ( py == m * px + b ){\n return 0; // point is on line\n } else {\n return 1; // point is over line\n }\n}\n\nint test1(double px, double py, double m,double b, double lx,double ly) { \n return (test2(px,py, m,b) == test2(lx,ly,m,b)); \n}\n\nint tritest (double x0,double y0,double x1,double y1,double x2,double y2,double px, double py) {\n\n int line1, line2, line3; \n double m01 = (y1-y0)/(x1-x0); \n double b01 = m01 * -x1 + y1; \n double m02, m12, b02, b12; \n m02 = (y2-y0)/(x2-x0); \n m12 = (y2-y1)/(x2-x1); \n b02 = m02 * -x2 + y2; \n b12 = m12 * -x2 + y2;\n\n // vertical line checks\n\n if( x1 == x0 ) { \n line1 = ( (px <= x0) == (x2 <= x0) ); \n } else { \n line1 = test1( px, py, m01, b01,x2,y2); \n }\n\n if( x1 == x2 ) { \n line2 = ( (px <= x2) == (x0 <= x2) ); \n } else { \n line2 = test1(px,py, m12, b12,x0,y0); \n }\n\n if( x2 == x0 ) { \n line3 = ( (px <= x0 ) == (x1 <= x0) );} else { \n line3 = test1(px, py, m02,b02,x1,y1); \n }\n\n return line1 && line2 && line3;\n}\n\nint main(int argc, char* argv[]) { \n double x0,y0,x1,y1,x2,y2,px; \n double py; \n int scanfsReturnValueAggregatedOverAllScanfs = 0;\n\n // get input\n\n printf(\"Triangle Vertex A (enter x,y): \"); scanfsReturnValueAggregatedOverAllScanfs += scanf(\"%lf,%lf\", &x0,&y0); \n printf(\"\\nTriangle Vertex B (enter x,y): \"); scanfsReturnValueAggregatedOverAllScanfs += scanf(\"%lf,%lf\", &x1,&y1); \n printf(\"\\nTriangle Vertex C (enter x,y): \"); scanfsReturnValueAggregatedOverAllScanfs += scanf(\"%lf,%lf\", &x2,&y2); \n printf(\"\\nTest Point (enter x,y): \"); scanfsReturnValueAggregatedOverAllScanfs += scanf(\"%lf,%lf\", &px,&py);\n // print error\n\n if( scanfsReturnValueAggregatedOverAllScanfs != 8 ) { \n printf(\"You're stup** and didn't put in the right inputs!\\n\"); \n return 1; \n }\n\n // print answer\n\n printf(\"\\nThe point is \");\n\n if (tritest(x0,y0,x1,y1,x2,y2,px,py)) { \n printf(\"INSIDE\"); \n } else { \n printf(\"OUTSIDE\"); \n }\n\n printf(\" the Triangle\\n\");\n\n // return 0\n\n return 0; \n}" ]
[ "c", "geometry" ]
[ "VIM snipmate tab not working", "I am not having any luck with Snipmate. I've used pathogen to install snipmate along with tlib, addon-utils, and snippets. Here is the output of verbose imap.\n\n<S-Tab> <Plug>snipMateBack\nLast set from ~/.vim/bundle/vim-snipmate/after/plugin/snipMate.vim\n<Plug>snipMateShow * <C-R>=snipMate#ShowAvailableSnips()<CR>\nLast set from ~/.vim/bundle/vim-snipmate/plugin/snipMate.vim\n<Plug>snipMateBack * <C-R>=snipMate#BackwardsSnippet()<CR>\nLast set from ~/.vim/bundle/vim-snipmate/plugin/snipMate.vim \n<Plug>snipMateTrigger * <C-R>=snipMate#TriggerSnippet(1)<CR>\nLast set from ~/.vim/bundle/vim-snipmate/plugin/snipMate.vim\n<Plug>snipMateNextOrTrigger * <C-R>=snipMate#TriggerSnippet()<CR>\nLast set from ~/.vim/bundle/vim-snipmate/plugin/snipMate.vim\n<S-Insert> <MiddleMouse>\nLast set from /usr/share/vim/vim74/debian.vim\n<Tab> <Plug>snipMateNextOrTrigger\nLast set from ~/.vim/bundle/vim-snipmate/after/plugin/snipMate.vim\n<C-R><Tab> <Plug>snipMateShow\nLast set from ~/.vim/bundle/vim-snipmate/after/plugin/snipMate.vim\n\n\nBasically, i've created a file called \"test.html\" and type \"html\" followed by Tab and the auto completion didn't work.\n\nTIA,\n\nThomas" ]
[ "vim", "snipmate" ]
[ "Apache webserver logs rotation issue", "i have the virtual hosting configuration in apache as follows. \n\n<VirtualHost *:80>\nServerName www.example.org\nDocumentRoot /www/example\nServerAdmin [email protected]\nErrorLog \"|/usr/sbin/rotatelogs /www/logs/example/error_log.%Y%m%d 7776000\"\nCustomLog \"|/usr/sbin/rotatelogs /www/logs/example/access_log.%Y%m%d 7776000\" common\n</VirtualHost> \n\n\nFor this setup respctive logs are generating as follows,which i have issues.\n\n-rw-r--r-- 1 root root 1K Jun 07 02:17 error_log.20140701-20140707.gz\n-rw-r--r-- 1 root root 0 Jun 07 02:17 error_log.20140707\n-rw-r--r-- 1 root root 17K Jun 07 02:28 access_log.20140701-20140707.gz\n-rw-r--r-- 1 root root 0 Jun 07 02:28 access_log.20140707\n\n\nHere i have 0 bytes log files which is not keeping today logs content. what will be cause for getting 0 bytes log files for this setup. How to make configuration \nwhich works to keep the today logs file content without 0 bytes.\n\nThank you ." ]
[ "apache", "unix" ]
[ "How to get Exact number of workbooks(excel files)", "How i can get total number of excel files.I am opening my files using below code \n\ntry\n {\n var excelApp = new Excel.Application();\n excelApp.Visible = true;\n Excel.Workbooks book = excelApp.Workbooks;\n Excel.Workbook sheets = book.Open(schemes.ProcessExefilePath);\n }\n catch (Exception ex)\n {\n }\n\n\nand then when i'm getting total number of files . it always return me zero count\n\n Microsoft.Office.Interop.Excel.Application excelApp = null;\n\n try\n {\n excelApp = (Microsoft.Office.Interop.Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject(\"Excel.Application\");\n }\n catch\n {\n\n }\n if (excelApp == null)\n {\n excelApp = new Microsoft.Office.Interop.Excel.Application();\n }\n\n for (int i = 0; i < excelApp.Windows.Count; i++)\n {\n //my work....... \n }\n\n\nwhat is wrong in this code .. or is there any thing else i have to do.." ]
[ "c#", "ms-office" ]
[ "How to figure out if a regex implementation uses DFA or NFA?", "I'm facing the question, whether a certain regex implementation is based on a DFA or NFA.\n\nWhat are the starting points for me to figure this out. One could also ask: What am I looking for? What are the basic patterns and / or characteristics? A good and explanatory link or a little comparisons (even if not directly dedicated to regex) is perfectly fine." ]
[ "regex", "algorithm", "squeak", "dfa", "nfa" ]
[ "How control email confirmations after creating folders and setting permissions", "I am creating a parent folder and then creating a bunch of child folders inside.\n\nI am setting the permissions like:\n\nvar editor = '[email protected]';\nvar owner = '[email protected]';\n\nvar newProjectFolder = projectFolder.createFolder(projectNumber).addEditor(editor).setOwner(owner);\n\nvar child = newProjectFolder.createFolder('00 MEETINGS').addEditor(editor); \n// ...and some more child folders\n\n\nHow do I stop the child folders firing off confirmation emails? I would just prefer that the parent project folder was confirmed via email.\n\nThanks everyone," ]
[ "google-apps-script" ]
[ "Laravel 5 - Moved User model to App/Models causing autoload issues", "Working on a inherited Laravel Spark project that contained two User models.\n\nOne is the standard Spark model inside the App directory but the other is inside App/Models. I have combined the two models and updated the auth.php to reference the User model inside the Models directory but composer dump-autoload is saying it cannot find the App/User model.\n\nHow can I tell the autoloader that the User model is not there any more but \ninstead in the Models directory?\n\nEdit:\n\nI have changed the namespace to App/Models but still receive the error:\n\nclass_parents(): Class App\\User does not exist and could not be loaded\n\n\nIn my terminal when running dump-autload\n\nSecond Edit:\n\nFixed, didn't realise the namespace was referenced so much. Did a find and replace on App\\User and sorted the issue." ]
[ "php", "laravel", "laravel-5", "autoload", "laravel-spark" ]
[ "JPA EntityTransaction flush", "I would like to flush all the entites stored in the current transaction to the database (without ending the current transaction via commit).\n\nDo I need to check if the transaction is Active before doing so?\n\nif (this.entityTransaction.isActive())\n {\n this.entityManager.flush();\n }\n\n\nThank you" ]
[ "java", "jpa", "eclipselink" ]
[ "Multiple http calls angular 7", "I am stuck with a situation where I have to get some data based on the parent Data\n\n\nI made a http get request to get all the components list and in the subscribe I have a forEach loop to iterate through each component. \nIn the for loop for each component I making another http get call to get child for each Components.\nIn the outer loop I have to push only the component name to new array and where as in the inner loop I have to push the child component names to the same array as a property 'children'.\n\n\nNow the problem is outer loop is completing before inner one so the array is coming as below\n\n[{name:'parentcomp1', children:[{}]}]\n\nhere is the code\n\n\r\n\r\nprepareJson() {\r\n\r\nthis.service.getComps().subscribe(res =>{\r\n var comps = res;\r\n var that = this;\r\n \r\n for(var element of comps) {\r\n \r\n that.service.getChilds(element._id).subscribe((res1:any)\r\n =>{\r\n \r\n if(res1.length>0)\r\n \r\n list.push({name:element.name,children:res})\r\n },err => console.log(err));\r\n }\r\n\r\n\r\n},err => console.log(err));\r\n}\r\n\r\n \r\n\r\n\r\n\n\nPlease help." ]
[ "angular" ]
[ "Use Scala constants in Java", "I am currently evaluating Scala for future projects and came across something strange. I created the following constant for us in a JSP:\n\nval FORMATED_TIME = \"formatedTime\";\n\n\nAnd it did not work. After some experimenting I decided to decompile to get to the bottom of it:\n\nprivate final java.lang.String FORMATED_TIME;\n\npublic java.lang.String FORMATED_TIME();\n Code:\n 0: aload_0\n 1: getfield #25; //Field FORMATED_TIME:Ljava/lang/String;\n 4: areturn\n\n\nNow that is interesting! Personally I have been wondering for quite a while why an inspector needs the prefix get and a mutator the prefix set in Java as they live in different name-spaces.\n\nHowever it might still be awkward to explain that to the rest of the team. So is it possible to have a public constant without the inspector?" ]
[ "java", "scala", "scala-java-interop" ]
[ "offline web application handle save in javascript", "I am building an offline web application, and I want to be able to change the html of the page before the user saves it. since I cannot seem to find a way to trigger the save as function from javascript (except from IE), I need to just do some prep work before letting the browser save the page. I am not trying to force the user to do anything, just trying to update the page so that it saves it's state to the actual html of the page being saved. I can do this with a button, but i have to then ask the user to press Ctrl+S which is not smooth at all.\n\nSo I either need to be able to trigger a browser save from JavaScript, or handle the save event myself before allowing the default callback to happen. \n\nCan this be done in a cross-browser supported way? I have found several pages dealing with the issue, but none clear it up as I wished, so sorry if this sounds like a duplicate." ]
[ "javascript", "html", "cross-browser", "save", "offlineapps" ]
[ "pybind11 how to add C++ dependencies using setup.py", "(I am new to Python and Python binding) \nI have a C++ package which uses FCL library, and its data types. The code is working in C++, but when I try to use Pybind11 to access it in Python, it compiles without error, but when I import it in Python I get the error:\n\n\n undefined symbol: _ZTVN3fcl3BoxE\n\n\nHeres my setup.py\n\nfrom distutils.core import setup, Extension\ndef get_pybind_include():\n import pybind11\n return pybind11.get_include()\nimport sys\nextra_compile_args = ['--std=c++11','-lfcl','-libccd']\next_modules = [Extension('Coll', ['src/Coll.cpp'],\n library_dirs=['lib'],\n include_dirs=['include',\n get_pybind_include()],\n\n language='c++',\n extra_compile_args=extra_compile_args), ]\n\nsetup(name='Coll',\n version='0.1',\n description='Python bindings for the Coll v1',\n setup_requires=['fcl'],\n ext_modules=ext_modules,\n)\n\n\nSeems to be problem with linking FCL library, how can I make sure its linked?\n\nEDIT: I am on virtual environment, not sure if this has effect." ]
[ "python", "c++", "c++11", "pybind11" ]
[ "Is returning by rvalue reference more efficient?", "for example:\n\nBeta_ab&&\nBeta::toAB() const {\n return move(Beta_ab(1, 1));\n}" ]
[ "c++", "c++11", "rvalue-reference" ]
[ ".NET Core Web API Bad Request response lacks information about invalid field", "I have a .NET Core API with a basic endpoint\n[HttpPost]\npublic async Task<ActionResult> PostAsync([FromBody] TheDto theDto)\n{\n // ...\n}\n\nThe Dto itself is just a class with many fields with data annotations like so\npublic class TheDto\n{\n [Required]\n public string AField { get; set; }\n\n [Required]\n public string AnotherField { get; set; }\n\n [Range(1, uint.MaxValue)]\n public uint ThirdField { get; set; }\n}\n\nWhen I test the API with tools like Postman I either get a 201 if everything was fine or a 400 if some fields are invalid. The error message listed in the Postman output is detailed.\nThere is one API consumer with a C# application. This application makes use of the RestSharp library. When debugging the error response message in Visual Studio 2019 the response lacks information about the invalid DTO field.\nThis is the response message he gets\n\n{"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One\nor more validation errors\noccurred.","status":400,"traceId":"|4c1fe347-4b32e1de4bb88a58.","errors":{"$":["The\nJSON value could not be converted to MyAssembly.Dtos.TheDto. Path: $ |\nLineNumber: 0 | BytePositionInLine: 172689."]}}\n\nand I'm wondering why he receives information about the project itself MyAssembly.Dtos.TheDto.\n\nThe property itself is missing.\nThere should be the property only. There should be no information about the assembly.\n\nSo the consumer doesn't know which field is invalid. Unfortunately I can't reproduce it and it only happens at the client's C# application using RestSharp and debugging the error message in VS 2019.\nDoes someone know what might be wrong?" ]
[ "c#", ".net-core", "asp.net-core-webapi", "visual-studio-2019", "restsharp" ]
[ "how to print coordinates of an object on terminal?", "i am beginner in opencv. i have a code written in opencv and c++ which is detecting geometric objects like square, triangle, circle etc with the help of camera. i am trying to print the coordinates and name of detected objects on the windows terminal and on the camera output screen.i could not figure out how to do it.\n here is my code \n\nvoid setLabel(cv::Mat& im, const std::string label, std::vector<cv::Point>& contour)\n{\n int fontface = cv::FONT_HERSHEY_SIMPLEX;\n double scale = 0.4;\n int thickness = 1;\n int baseline = 0;\n\n cv::Size text = cv::getTextSize(label, fontface, scale, thickness, &baseline);\n cv::Rect r = cv::boundingRect(contour);\n\n cv::Point pt(r.x + ((r.width - text.width) / 2), r.y + ((r.height + text.height) / 2));\n cv::rectangle(im, pt + cv::Point(0, baseline), pt + cv::Point(text.width, -text.height), CV_RGB(255,255,255), CV_FILLED);\n cv::putText(im, label, pt, fontface, scale, CV_RGB(0,0,0), thickness, 8);\n\n}\n\n\nand i am writing the condition like this\n\n if (approx.size() == 3)\n {\n setLabel(dst, \"TRIANGLE\", contours[i]); // Triangles\n\n } \n\n\nthanks in advance!!!!!" ]
[ "c++", "opencv" ]
[ "Specifying assembly in ResourceManager constructor (c#/.net)", "I'm trying to create an instance of ResourceManager:\n\npublic ResourceManager(baseName, Assembly assembly)\n\n\nI know the name of the assembly that the resource is in (it's not the executingassembly), and it's referenced in the project, but how do I specify it here in the code (using the above constructor)?\n\nMay be a bit of a stupid question, but I'm a bit stuck!\n\nThanks!" ]
[ "c#", ".net" ]
[ "Is the following use of const_cast undefined behavior?", "This is a language lawyer question, not a good practice question.\n\nIs the following code valid or undefined behaviour? A const object ends up calling a non-const function, but it doesn't actually modify the state of the object.\n\nstruct Bob\n{\n Bob() : a(0) {}\n\n int& GetA()\n {\n return a;\n }\n\n const int& GetA() const\n {\n return const_cast<Bob&>(*this).GetA();\n }\n\n int a;\n};\n\nint main()\n{\n const Bob b;\n int a = b.GetA();\n}" ]
[ "c++", "language-lawyer" ]
[ "RuntimeMBeanCallable.call() exception", "When a .wlapp file is deployed in MobileFirst Console, we get the following error in the logs. This happened after we upgraded MobileFirst Server from 6.3 to 7, but don't know if this is related to the version of MobileFirst.\n\n000001c6 BaseTransacti E RuntimeMBeanCallable.call() exception\n java.lang.reflect.UndeclaredThrowableException\n\n at com.sun.proxy.$Proxy166.deployApplication(Unknown Source)\n at com.ibm.worklight.admin.actions.ApplicationDeploymentTransaction.prepareMBean(ApplicationDeploymentTransaction.java:919)\n at com.ibm.worklight.admin.actions.util.RuntimeMBeanWorkerThreadCaller$RuntimeMBeanCallable.call(RuntimeMBeanWorkerThreadCaller.java:76)\n at com.ibm.worklight.admin.actions.util.RuntimeMBeanWorkerThreadCaller.callSynchronously(RuntimeMBeanWorkerThreadCaller.java:183)\n at com.ibm.worklight.admin.actions.util.RuntimeMBeanPoolCaller.callRuntimeMBeans(RuntimeMBeanPoolCaller.java:91)\n at com.ibm.worklight.admin.actions.BaseTransaction.prepare(BaseTransaction.java:450)\n at com.ibm.worklight.admin.actions.BaseTransaction.internalRun(BaseTransaction.java:348)\n at com.ibm.worklight.admin.actions.BaseTransaction$1.run(BaseTransaction.java:235)\n at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)\n at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)\n at java.lang.Thread.run(Thread.java:790)\nCaused by: com.ibm.websphere.management.exception.ConnectorException: ADMC0009E: The system failed to make the SOAP RPC call: invoke\n at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplateOnce(SOAPConnectorClient.java:894)\n at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplate(SOAPConnectorClient.java:689)\n at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplate(SOAPConnectorClient.java:679)\n at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invoke(SOAPConnectorClient.java:665)\n at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invoke(SOAPConnectorClient.java:487)\n at com.sun.proxy.$Proxy121.invoke(Unknown Source)\n at com.ibm.ws.management.AdminClientImpl.invoke(AdminClientImpl.java:224)\n at com.worklight.common.util.jmx.WASRuntimeMBeanHandler$AdminClientMBeanServerConnection.invoke(WASRuntimeMBeanHandler.java:521)\n at com.sun.jmx.mbeanserver.MXBeanProxy$InvokeHandler.invoke(MXBeanProxy.java:146)\n at com.sun.jmx.mbeanserver.MXBeanProxy.invoke(MXBeanProxy.java:160)\n at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:246)\n ... 11 more\nCaused by: [SOAPException: faultCode=SOAP-ENV:Client; msg=Read timed out; targetException=java.net.SocketTimeoutException: Read timed out]\n at org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:479)\n at org.apache.soap.rpc.Call.WASinvoke(Call.java:510)\n at com.ibm.ws.management.connector.soap.SOAPConnectorClient$8.run(SOAPConnectorClient.java:852)\n at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)\n at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplateOnce(SOAPConnectorClient.java:845)\n ... 21 more\n\n\nMobileFirst version 7\nWAS server version 8.5.5.5\nJRE version 1.6" ]
[ "websphere", "ibm-mobilefirst" ]
[ "Generic Class with Static Nested Class of the Same Type", "I am trying to write a generic configuration loader which supports loading into any target data structure by means of using a helper object supplied by the caller. The helper is used to divorce the loader from any knowledge of the data structure, with methods to pre-process member values, create substructures and add/remove members from the structures.\n\nGiven the class and variable declaration:\n\npublic class ConfigLoader<T extends Object>\n...\nprivate final Class<T> stcClass;\n\n\nand the static nested interface:\n\nstatic public interface Helper<T>\n{\npublic Object configValue(String qulfld , String loc);\npublic Object configValue(String qulfld, T val, String loc);\npublic Object configValue(String qulfld, String val, String loc);\npublic Object configValue(String qulfld, Boolean val, String loc);\npublic Object configValue(String qulfld, Number val, String loc);\n\npublic T crtObject();\npublic void addMember(T tgt, String fld, Object val);\npublic void rmvMember(T tgt, String fld);\n}\n\n\nand the base constructor:\n\nprivate ConfigLoader(JsonParser psr, Helper<T> hlp, DataStruct vld) {\n super();\n\n parser =psr;\n helper =hlp;\n stcClass =helper.crtObject().getClass(); // <== error here\n validation =vld;\n errors =new ArrayList<Fail>();\n }\n\n\nI am getting a compiler error in the constructor line indicated:\n\nConfigLoader.java:79: error: incompatible types\n stcClass =helper.crtObject().getClass();\n ^\n required: Class<T>\n found: Class<CAP#1>\n where T is a type-variable:\n T extends Object declared in class ConfigLoader\n where CAP#1 is a fresh type-variable:\n CAP#1 extends Object from capture of ? extends Object\n1 error\n\n\nThe intent is to create one dummy structure up front from which to extract the Class<T> object, which is then used in some other code to validate the structure type and then to invoke the helper visitor method with the T argument using helper.configValue(qulnam,stcClass.cast(val),loc.toString()).\n\nWhat I can't figure out is why the compiler can't validate that the return of the helper's crtObject method is guaranteed to be in fact a T object since the helper passed to the constructor is itself a Helper<T>.\n\nThe only alternative I am seeing is to pass in a Class<T> as a constructor argument.\n\nAny help would be appreciated." ]
[ "java", "generics", "nested-class" ]
[ "Add column to SQL result with unique rows", "I have an query where I get a comma seperated string as result, such as;\nn,n,n,n\nwhere n can be 0 or 1, and will always be the length of four digits.\nI use CROSS APPLY STRING_SPLIT to get the result as rows. I would like to add a column to this result, and on each row have an unique string, which would be one word.\nLike:\nValue|String\n1 | description1\n0 | description2\n1 | description3\n1 | description4\n\nI have googled a lot, but can't seem to find how to do this. I hope it is as easy as something like:\nSELECT myResultAsRows.Value, {'a','b','c','d'} AS String\nFROM table\nCROSS APPLY STRING_SPLIT ...\nWHERE ...\n\nI know this seems strange, but on another forum (specific for the tool) they suggested hard-coding it...\nI also know it might depend on the server used, but in general, is something like this doable?\nAs of right now, the query is this:\nSELECT tagValueRow.Value\nFROM t_objectproperties tag\nCROSS APPLY STRING_SPLIT(tag.Value,',') tagValueRow\nWHERE tag.Object_ID = #OBJECTID# AND tag.Property = 'myTagName'\n\nwhich results in\nValue\n1\n0\n1\n1\n\nfor the specified #OBJECTID#.\nThank you!\nedit: made the question more detailed, with example closer to reality." ]
[ "sql", "sql-server", "tsql" ]
[ "custom metatype for type hinting", "I am trying to define a custom metatype to use for typehinting. For example\n\nprint(Tuple[int, str, bool])\nprint(CustomType[int, str, bool])\n\n\nthe first line works fine, obviously. How would I implement CustomType, so that it works too? I tried this:\n\nclass CustomType(Tuple):\n pass\n\n\nand get the error TypeError: __main__.CustomType is not a generic class.\nMy goal is to have a specialization of Tuple with an additional classmethod" ]
[ "python", "python-3.x", "generics", "type-hinting" ]
[ "Trying to get my head around (x:xs) and lists?", "I have always been challenged by the way lists work and am confused about the whole (x:xs) concept. I just don't seem to be getting my head around it.\n\nExample\n\nselect :: Ord a => a -> [a] -> [a]\nselect y [] = []\nselect y (x:xs)\n | x < y = x : select y xs\n | otherwise = select y xs\n\n\nP.S. I know exactly what the function does, but would anyone be able to explain the process (including especially the weird Ord a and => signs)?\n\nAny effective strategies would be much appreciated.\n\nThanks in advance. Ian." ]
[ "list", "haskell", "syntax", "recursion" ]
[ "AngularJS difference in dependency requirement", "Hi I'm learing AngularJS and I was wondering what the difference is of defining your dependencies:\n\nangular.module('app.controllers')\n.controller('myController', ['$scope', function ($scope) {\n // stuff\n}]);\n\n\nvs:\n\nangular.module('app.controllers')\n.controller('myController', function ($scope) {\n // stuff\n});\n\n\nJust wondering what the difference is :)" ]
[ "javascript", "angularjs", "dependencies" ]
[ "Is memory encrypted?", "I want to store some data in a variable (and I know variables are stored in memory). Does that data in memory get encrypted? Also, is it possible for software to be able to read the variable names stored in memory and be able to actually extract the data from it?" ]
[ "php", "c++" ]
[ "How to use multiple threads in Julia 1.0?", "I have a script that uses the @threads macro. When I execute the script in terminal like\n\n$ julia -p 4 my_script.jl\n\n\nWhere the file contains:\n\nprintln(\"This program is using \", Threads.nthreads(), \" threads\")\n\n\nprints than I'm using only one thread. What could I be doing wrong?" ]
[ "multithreading", "julia" ]
[ "html float right set the span in new line", "How to set two span inline in opera, where the html this:\n\n<section id=\"board-sub-header\">\n <span>\n <span class=\"left\">Text</span>\n </span>\n <span style=\"float:right\"> \n <a href=\"#\" class=\"image-link application-icon popup-link\">\n Applications\n </a>\n </span>\n </section>" ]
[ "html", "css" ]
[ "Matplotlib multicoloredline using lists and an external property as condition", "I have 3 lists that all have same number of elements: \n\ntime_list ###(float - converted from date object with matplotlib.dates.date2num) \n\ntemperature_list ###(float)\n\nheating_list ###(boolean)\n\n\nI want to plot the temperature as a function of time using Matplotlib. I also have the list heating_list that consists of boolean values True/False depending on if there was heating occuring at that time. I want the curve to be for example red if it is being heated, and blue if it is not. \n\nI did find this example: http://wiki.scipy.org/Cookbook/Matplotlib/MulticoloredLine\n\nHowever, I would like to use heating_list to decide the color instead of some temperature values. I would also like to use the lists I already have, rather than numpy arrays as in the example.\n\nEDIT:\n\nWhat have I tried. \n\ncolors = ListedColormap([\"b\", \"k\"])\nnorm = BoundaryNorm([not heating, heating], colors.N) ### I don't really know how to define this condition\nlc = LineCollection(tuple(zip(time_list, temperature_list)), label = \"T1\", cmap=colors, norm=norm)\n###I tried to make my lists the same form as this \"linen = (x0, y0), (x1, y1), ... (xm, ym)\"\n###According to LineCollection found here: http://matplotlib.org/api/collections_api.html\n\nplt.gca().add_collection(lc)\nplt.show()\n\n\nI also tried:\n\n time_plot = plt.plot(time_list, temperature_list, label = \"T1\")\n time_plot.gca().add_collection(lc)\n\n\nThere were some problems that my lists were in a wrong format and thats why I tried to do all those zip/tuple things. Then I realized that it couldn't work anyway, because I don't know how to define when to have which colors. The cookbook example simply defined ranges for the values, whereas I don't want it to be dependant on temperature values, but instead an external property." ]
[ "python", "matplotlib", "plot" ]
[ "Can't publish my google chrome extension", "i am facing an odd problem when i try to publish my chrome extension via the web store. Every time i upload the zip file i get this error:\nAn error has occurred: Can not contain the access permissions to the file.\n\nI even tried to upload a zip file that contains only the manifest file but i am still having the same error.\n\nAny idea ?\n\nThanks\n\nManifest file :\n\n{\n\"name\": \"__MSG_plugin_name__\",\n\"version\": \"0.0.0.1\",\n\"manifest_version\": 2,\n\"description\": \"__MSG_plugin_description__\",\n\"browser_action\": {\n \"default_icon\": \"images/ST_19.png\", \n \"default_title\": \"__MSG_plugin_title__\",\n \"default_popup\": \"popup.html\"\n},\n\"icons\":{\n \"16\": \"images/ST_16.png\",\n \"48\": \"images/ST_48_1.png\",\n \"128\": \"images/ST_128.png\"\n},\n\"default_locale\": \"en\",\n\"permissions\": [\n \"contextMenus\",\n \"tabs\", \"http://*/*\", \"file:///*\",\"https://*/*\", \"ftp://*/*\"\n],\n\"background\": {\n \"persistent\": false,\n \"scripts\": [\"scripts/jquery.min.js\",\"scripts/utils.js\", \"scripts/menus.js\",\"scripts/logic.js\"]\n}\n}" ]
[ "google-chrome-extension" ]
[ "Java framework for hot code deployment and scheduling jar file deployment", "Using JAVA framework i want to achieve the following task.\n\n\nhot code(jar) deployment which will perform certain task in an environment\nAt any time if i update that jar file it should automatically unload old code and load new code\nI want to schedule that deployed jar file to perform tasks.\n\n\nCurrently i see Apache karaf/Felix fulfill this requirement but less help available and difficult to manage.\n\nAny alternate framwork i can use instead of using karaf/felix ?" ]
[ "java", "deployment", "frameworks", "scheduled-tasks" ]
[ "Shape not following path designated", "I am having some issues with a shape following a path, I want MyCircle to follow the path I created. When I run the code, the shape is not following the path I want, it is off center. I'm not sure what the issue is.\n\nHere is some XAML code that generates a canvas with a path and some shapes.\n\n<Window x:Class=\"TestApp.MainWindow\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n Title=\"MainWindow\" Height=\"480\" Width=\"640\">\n<Canvas Margin=\"5\">\n <Path HorizontalAlignment=\"Center\" VerticalAlignment=\"Center\" x:Name=\"MyPathStroke\" Stroke=\"Black\" Canvas.Left=\"100\" Canvas.Top=\"50\">\n <Path.Data>\n <PathGeometry x:Name=\"MyPath\" Figures=\"M421.9,110 C421.9,170.47518 327.5664,219.5 211.2,219.5 C94.833603,219.5 0.5,170.47518 0.5,110 C0.5,49.52482 94.833603,0.5 211.2,0.5 C327.5664,0.5 421.9,49.52482 421.9,110 Z\" />\n </Path.Data>\n </Path>\n <Path Stroke=\"Black\" StrokeThickness=\"3\" Fill=\"Red\" >\n <Path.Data>\n <EllipseGeometry \n x:Name=\"MyCircle\"\n Center=\"110,421.9\" \n RadiusX=\"10\" \n RadiusY=\"10\" />\n </Path.Data>\n </Path>\n <Ellipse x:Name=\"MyQueue\" Fill=\"#FFF4F4F5\" Height=\"80\" Width=\"80\" Stroke=\"Black\" Canvas.Left=\"270\" Canvas.Top=\"10\" />\n <Rectangle x:Name=\"MyActivity\" Fill=\"#FFF4F4F5\" Height=\"50\" Width=\"100\" Stroke=\"Black\" Canvas.Left=\"260\" Canvas.Top=\"240\" />\n</Canvas>\n</Window>\n\n\nHere is my code to assign the circle to the path.\n\nusing System;\nusing System.Windows;\nusing System.Windows.Media;\nusing System.Windows.Media.Animation;\n\nnamespace TestApp\n{\n public partial class MainWindow : Window\n {\n public MainWindow()\n {\n InitializeComponent(); \n\n PointAnimationUsingPath pa = new PointAnimationUsingPath();\n\n pa.PathGeometry = MyPath;\n\n pa.Duration = TimeSpan.FromSeconds(5);\n\n pa.RepeatBehavior = RepeatBehavior.Forever;\n\n MyCircle.BeginAnimation(EllipseGeometry.CenterProperty, pa);\n }\n }\n}" ]
[ "c#", "wpf", "xaml" ]
[ "Button to add an input box and accessing collections of inputs in controllers?", "I'm a form noob and want to know how to create a collection of text-input boxes, along with a button that will allow users to add another input to this collection.\n\nCan this be done purely with ruby and rails? If so, how do I access the individual inputs from the group when doing stuff in the controller? How do I identify each? How can I tell the size of the collection/how many inputs there are?\n\nAny help would be appreciated, thanks!" ]
[ "javascript", "ruby-on-rails", "forms", "frontend", "inputbox" ]
[ "confusion_matrix - too many values to unpack", "I'm trying to use the confusion_matrix function, as follows:\n\ntn, fp, fn, tp = confusion_matrix(y_true, y_predict).ravel()\n\n\ny_true and y_predict are both lists. When I return their shape, I get: (71,).\n\nI'm however getting the following error for the above statement:\n\nValueError: too many values to unpack\n\n\nI'm not sure if it is because of the second (empty) dimension in (71,)? I'm not sure how to remove it if it is the issue here.\n\nAny thoughts?\n\nThanks." ]
[ "python", "list", "scikit-learn", "confusion-matrix" ]
[ "How to store dictionary in Redis Cache/Hash in c#", "I am using cache to store ENUMCACHE like blow.\n\nif (System.Web.HttpContext.Current.Items[\"_ENUMCACHE\"] == null)\n System.Web.HttpContext.Current.Items.Add(\"_ENUMCACHE\",new Dictionary(string,Enumeration>();\n\n\nNow I need to change Redis Cahche/Hash.\n\nHow can I able to store dictionary in Redis." ]
[ "caching", "c#-4.0", "dictionary", "redis" ]
[ "Comparing Blobstore and Google Cloud Storage", "For a GAE application, what are the tradeoffs between using the Blobstore and GCS?\n\n\nas of Aug 2015, the price of blobstore and GCS are the same ($0.312 per GB year)\nGCS has a nicer code interface (data referenced by things that look like file paths)\nGCS has console commands and a web UI for uploading/accessing data\n\n\nAre there some kind of advantages to Blobstore that I'm missing?" ]
[ "google-app-engine", "blobstore", "google-cloud-storage" ]
[ "add swing component into javafx tab", "I have a JavaFX and a separate swing project. Now i need to add that jframe into my JavaFX project inside a Tab. By doing some research i go to know that i can not add jframe directly so i need SwingNode. I am able to add jframe without any error but the frame gui get very disturb. jfram is not visible at first time and when i hover my mouse on over it, it become visible only for that area, except that the hint popup also not visible. \nBelow is the code. Please help me with adding swing component inside javafx successfully.\n\n SyntaxTester ob = new SyntaxTester();\n SwingNode swingnode = new SwingNode();\n swingnode.setContent(ob.getEditor()); //getEditor returns jEditorPane\n tab.setContent(swingnode);" ]
[ "java", "swing", "javafx", "jframe" ]
[ "Webpack ProvidePlugin vs externals?", "I'm exploring the idea of using Webpack with Backbone.js.\n\nI've followed the quick start guide and has a general idea of how Webpack works, but I'm unclear on how to load dependency library like jquery / backbone / underscore.\n\nShould they be loaded externally with <script> or is this something Webpack can handle like RequireJS's shim?\n\nAccording to the webpack doc: shimming modules, ProvidePlugin and externals seem to be related to this (so is bundle! loader somewhere) but I cannot figure out when to use which.\n\nThanks" ]
[ "backbone.js", "requirejs", "amd", "webpack" ]
[ "Push to client using DLNA", "Windows Media Player has a play to feature that can send video files to a client device which start playing. I was wondering if anyone has a starting point to replicate this feature in c#?" ]
[ "c#" ]
[ "How to make only 1 input box do animation on focus using Jquery", "Fiddle And Code: \n\n\r\n\r\n$(document).ready(function(){\r\n $(\"input\").focus(function(){\r\n $(\".fakeplaceholder\").addClass(\"fakeplaceholdertop\");\r\n });\r\n \r\n \r\n $(\"input\").blur(function(){\r\n \r\n if(!$('input').val()) {\r\n $(\".fakeplaceholder\").removeClass(\"fakeplaceholdertop\");\r\n }\r\n });\r\n});\r\n.accountbox {\r\n background-color:#ffffff;\r\n \r\n padding: 15px 120px 50px 50px; \r\n}\r\n\r\n:focus{outline: none;}\r\n\r\n.input1div {\r\n display:inline-block; position: relative;\r\n}\r\n\r\n.input1div input {\r\n font: 15px/24px \"Lato\", Arial, sans-serif; color: #333; width: 100%; box-sizing: border-box; letter-spacing: 1px;\r\n}\r\n\r\n.input1div input {border: 0; padding: 7px 0; border-bottom: 1px solid #ccc;}\r\n\r\n.input1div input ~ .focus-border{position: absolute; bottom: 0; left: 0; width: 0; height: 2px; background-color: #3399FF; transition: 0.4s;}\r\n.input1div input:focus ~ .focus-border{width: 100%; transition: 0.4s;}\r\n\r\n\r\n.fakeplaceholder {\r\n position: absolute;\r\n pointer-events: none;\r\n top: 10px;\r\n color:#8c8c8c;\r\n transition: 0.28s ease all;\r\n}\r\n\r\n.fakeplaceholdertop {\r\n top: -10px;\r\n font-size:10px;\r\n}\r\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js\"></script>\r\n\r\n\r\n<div class=\"accountbox\">\r\n\r\n <p style=\"font-size:25px;font-weight:600;\">Sign Up</p>\r\n \r\n <form class=\"accountform\">\r\n \r\n <div class=\"input1div\">\r\n \r\n <input class=\"firstname\" type=\"text\" name=\"firstname\" />\r\n <span class=\"fakeplaceholder\">First Name</span>\r\n <span class=\"focus-border\"></span>\r\n </div>\r\n \r\n <br/><br/><br/>\r\n \r\n <div class=\"input1div\">\r\n \r\n <input type=\"text\" name=\"lastname\" />\r\n <span class=\"fakeplaceholder\">Last Name</span>\r\n <span class=\"focus-border\"></span>\r\n </div>\r\n \r\n </form>\r\n\r\n</div>\r\n\r\n\r\n\n\nAs you can see, If I click on 1 input box, then the other one also do the same animation. How can i make only the clicked input box do this animation.\n\nExpected Result:\n\n\nOn click, the fake placeholder will go up (only the clicked one)\nThe fake placeholder will stay up, if the input box has some value." ]
[ "javascript", "jquery", "html", "css" ]
[ "Drawing a line between two divs (multiple connections)", "I have a div (\"grid\") full of images (\"components\"). I am able to drag and drop components onto the grid but now I want to be able to draw lines from one component to another. I am using a plugin called jsPlumb where you can pass a source div id and a destination div id and it will draw the line for you. I want the user to be able to make multiple connections to the different components so I am trying to allow a user to right click drag from one component to another and then create the connection. I am not sure how to do this...\n\n$(document).on(\"mousedown\",\".component\", function (e) {\n if (e.which == 3)\n {\n //I get can get the source id fine.\n }\n}).on(\"mouseup\", function (e) {\n if (e.which == 3)\n {\n //Cannot get the destination component id here\n }\n});\n\n\nExample of what it might look like:\n\n\nI want to drag a connection from start to end.... What is the best way of doing this?" ]
[ "javascript", "jquery", "jsplumb" ]
[ "How to use apache to reroute files to other directory?", "I am maintaining a website someone else wrote. He used absolute path in the html to request assets files, and he assumed the project is always installed at the root of the domain.\n\nNow I am testing the website; I installed the project at a subdirectory. And I want to redirect files that start with a certain characters to a subfolder.\n\nFor example, he wrote something like this\n\n<img src=\"/en/wp-content/themes/.....\">\n\n\nSo now the server will start searching files at the root like example.com/en/wp-content/....\n\nI installed the project at /foo/en, example.com/foo/en. I want to use .htaccess to reroute urls that start with /en/wp-content/themes to /foo/en/wp-content/themes. What should I do?\n\nThis is how I wrote it:\n\nRewriteEngine On\n\nRewriteRule ^en/wp-content/themes/(.*)$ /foo/en/wp-content/themes/$1\n\n\nBut it doesn't work...." ]
[ "apache", ".htaccess", "mod-rewrite" ]
[ "I have an icon next to a label and when you click the icon, it should not click the label/radio button that the label is attached to", "I have an issue. I am trying to create a single line that contains a radio, a label, and a clickable icon and I want all of these elements to be inline. I want it to be set up like:\n\nRadio Label Icon\n\n\nin that order. My code HTML looks like this:\n\n <div class=\"wrapper class>\n <div class=\"radio\" label=\"this is my label\">\n <input type=\"radio\" value=\"1\" required>\n <i class=\"material-icons\" ng-click=\"some-action\">info_outline</i>\n </div>\n </div>\n\n\nI have tried to place the icon outside of the label class, but it does not display inline and I have also tried to use display:inline; in my CSS code, to no avail. I am trying to just separate the icon and the label, but I cannot seem to get this to work. \n\nAny and all help would be greatly appreciated!\n\nThank you in advance!" ]
[ "html", "angularjs" ]
[ "Verify only specific interaction within a pool of methods", "I'm currently writing black box test and I have to verify with Mockito that one method out of a pool of methods is called with specific arguments. It doesn't matter if a specific method was called, but one of the methods has to be called at all. Also if the methods get called I want to verify that they are only called with specific arguments.\n\nAt a concrete level:\n\nI have this class which is mocked and injected to my black box:\n\nclass Mock {\n void option1(String arg1)\n void option2(String arg1, int arg2)\n void option3(String arg1, int arg2, int arg3)\n void otherMethod()\n}\n\n\nWithin the blackbox, one or multiple of the \"optionX\" methods are called once or multiple times.\n\nNow I want to verify that at least one of the \"optionX\" methods was called within the black box and that if any of the \"optionX\" methods are called, it's only called with specific arguments.\n\nThe current test code looks like this\n\nMock mock = spy(realObject);\nblackbox.doBlackboxStuff(mock);\n\nverify(mock, atLeast(1)).option1(\"Test\");\nverify(mock, atLeast(1)).option2(\"Test\", 1);\nverify(mock, atLeast(1)).option3(\"Test\", 1, 2);\nverifyNoMoreInteractions(mock);\n\n\nSeparate \"atLeast(1) verifications\" like above won't work, because then every method has to be called. Also, I can't guarantee, that the black box won't call otherMethod(), so that verifyNoMoreInteractions will fail, even if I don't care about the otherMethod() call.\n\nIs there an elegant way to solve this (or at least a way)?" ]
[ "java", "unit-testing", "mockito" ]
[ "Keras custom function \"AttributeError: 'function' object has no attribute 'shape'\"", "Getting \"AttributeError: 'function' object has no attribute 'shape'\" error when compiling model. Trying to create custom loss\n\ndef pair_loss(lamb=0.01, gamma=1):\n #Custom loss\n def loss(y_true,y_pred):\n y1_pred, y2_pred = y_pred\n y1_true, y2_true = y_true\n result = (tf.keras.backend.K.square(y1_pred - y1_true) + tf.keras.backend.K.square(y2_pred - y2_true))\\\n + lamb(tf.keras.backend.max((0,(gamma - ( (y1_pred - y1_true)*(y2_pred - y2_true) ))),))\n return result\n return loss \n\n\nleft_input = tf.keras.Input(shape=(1,), dtype=tf.string) \nright_input = tf.keras.Input(shape=(1,), dtype=tf.string) \n\n\nconvnet = tf.keras.Sequential([\n tf.keras.layers.Lambda(embedding, output_shape=(512, )),\n tf.keras.layers.Dense(64, activation='relu',input_shape=(512,)),\n tf.keras.layers.Dense(64, activation='relu'),\n tf.keras.layers.Dense(64, activation='relu'),\n tf.keras.layers.Dense(1, activation='linear'),\n ])\n\nencoded_left = convnet(left_input)\nencoded_right = convnet(right_input)\n\npair_net = tf.keras.Model(inputs=[left_input,right_input], outputs=[encoded_left,encoded_right])\n\n\noptimizer = tf.keras.optimizers.Adam(0.001, decay=2.5e-4)\npair_net.compile(loss=pair_loss, optimizer=optimizer, metrics=['accuracy'])" ]
[ "python-3.x", "tf.keras" ]
[ "Adding border with width to UIView show small background outside", "I'm trying to add circle border to a UIView with green background, I created simple UIView subclass with borderWidth, cornerRadius and borderColor properties and I'm setting it from storyboard. \n\n@IBDesignable\nclass RoundedView: UIView {\n\n @IBInspectable var cornerRadius: CGFloat {\n get {\n return layer.cornerRadius\n }\n set {\n layer.cornerRadius = newValue\n layer.masksToBounds = newValue > 0\n }\n }\n\n @IBInspectable var borderWidth: CGFloat {\n get {\n return layer.borderWidth\n }\n set {\n layer.borderWidth = newValue\n }\n }\n\n @IBInspectable var borderColor: UIColor {\n get {\n if let color = layer.borderColor {\n return UIColor(cgColor: color)\n } else {\n return UIColor.clear\n }\n }\n set {\n layer.borderColor = newValue.cgColor\n }\n } \n\n}\n\n\nBut when I compile and run an app or display it in InterfaceBuilder I can see a line outside the border that is still there (and is quite visible on white background). \n\n\n\nThis RoundedView with green background, frame 10x10, corner radius = 5 is placed in corner of plain UIImageView (indicates if someone is online or not). You can see green border outside on both UIImageView and white background.\n\n\n\nCan you please tell me what's wrong?" ]
[ "ios", "swift", "uiview", "uikit", "xib" ]
[ "Undirected edges in orientDB", "I am working with orientDB v2.2.10 and I am trying to create edges of class \"E\" between vertices using the graph editor, my question is can create undirected edges between vertices and if yes how to do it via Java API" ]
[ "orientdb" ]
[ "How do I add the tag value and the text value of multiple TextBox, only when the text has changed in WPF?", "I am creating a dictionary with = Tag value, and Text of multiple TextBox in a WPF application when the \"submit button\" is clicked. I only want to add to the dictionary the Tag and text of the Textboxes where the text has changed.\nHow do I add the tag value and the text value of multiple TextBox, only when the text has changed?\nThe code below is what I have so far, but I am stuck:\n\n private void Submit_Button_Click(object sender, RoutedEventArgs e)\n {\n Dictionary<string, string> tagDict = new Dictionary<string, string>();\n foreach(Control ctrl in MainGrid.Children)\n {\n if (ctrl.GetType() == typeof(textBox))\n {\n TextBox tb = ctrl as TextBox;\n if (//I am trying to get a value that represents that the Text has changed here\n )\n {\n string tagString = tb.Tag.ToString();\n string textString = tb.Text;\n tagDict.Add(tagString, textString);\n }\n }\n }\n }" ]
[ "c#", "wpf", "textbox", "buttonclick", "textchanged" ]
[ "didFinishPickingMediaWithInfo function goes on infinite loop", "It looks like the didFinishPickingMediaWithInfo function is going on an infinite loop and it eventually crashes with an error that says in the console: \n\n\n warning: could not execute support code to read Objective-C class data in >the process. This may reduce the quality of type information available.\n\n\nRight when I record a video and press the choose button, it crashes because it calls the didFinishPickingMediaWithInfo. Here is the relevant code: \n\nlet imagePicker: UIImagePickerController! = UIImagePickerController()\nlet saveFileName = \"/test.mp4\"\n\n if (UIImagePickerController.isSourceTypeAvailable(.camera)) {\n if UIImagePickerController.availableCaptureModes(for: .rear) != nil {\n\n //if the camera is available, and if the rear camera is available, the let the image picker do this\n imagePicker.sourceType = .camera\n imagePicker.mediaTypes = [kUTTypeMovie as String]\n imagePicker.allowsEditing = false\n imagePicker.delegate = self as? UIImagePickerControllerDelegate & UINavigationControllerDelegate\n imagePicker.videoMaximumDuration = 60\n imagePicker.videoQuality = .typeIFrame1280x720\n present(imagePicker, animated: true, completion: nil)\n } else {\n postAlert(\"Rear camera doesn't exist\", message: \"Application cannot access the camera.\")\n }\n } else {\n postAlert(\"Camera inaccessable\", message: \"Application cannot access the camera.\")\n }\n}\n\nfunc imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {\n print(123)\n imagePickerController(imagePicker, didFinishPickingMediaWithInfo: [saveFileName : kUTTypeMovie])\n\n let videoURL = info[UIImagePickerControllerReferenceURL] as? NSURL\n print(\"\\(String(describing: videoURL))\" )\n guard let path = videoURL?.path else { return }\n let videoName = path.lastPathComponent\n let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)\n let documentDirectory = paths.first as String!\n let localPath = documentDirectory! + \"/\" + videoName\n guard let imageData = NSData(contentsOfFile: localPath) else { return }\n let image = UIImage(data: imageData as Data)\n\n picker.dismiss(animated: true, completion: nil)\n}\noverride func viewDidLoad() {\n super.viewDidLoad()\n self.imagePicker.delegate = self \n}\n\n\nThank you in advance!" ]
[ "swift", "xcode", "video", "swift3", "infinite-loop" ]
[ "print not working in Xcode 8.3.1?", "Is it just me and my colleagues or is print broken in Xcode 8.3.1? I'm not seeing anything in the xcode interface after upgrading from 8.3.0, both in the simulator and on a device. Breakpoints are hit correctly and I've double checked everything like described in Xcode doesn't write anything to output console" ]
[ "printing", "xcode8" ]
[ "Eto.Forms and SQLite - crossplatform development for Windows/OSX", "I really like Eto.Forms, I think they will be boost the crossplatform developments in the future.\n\nBut after creating my first UI-heavy application (both Windows and OSX) I realized that I need a database engine too.\n\nMy fav for that project is SQLite but I cannot find a corresponding package on NuGet for that.\n\nHas anyone experiences with it?" ]
[ "c#", ".net", "sqlite", "cross-platform" ]
[ "Trying to understand Tuple Relational Calculus", "In what situations would you use domain relational calculus over tuple relational calculus?\n\nFor example this problem I solved using tuple relational:\n\nList the co-authors of John Smith (authors who co-authored an article with John Smith)\n\nwith these relations:\nAuthors(authorID,name)\nAnd Authoring(articleID,authorID)\nPrimary and foreign keys in bold.\n\n{t: articleID, name | ∃ a ∈ Author ∃ au Authoring a.authorID = au.AuthorID ∧ a.name = ‘John Smith’ ∧ a.authorID = au.AuthorID}\n\nIn addition, how would you express set differences in both? I am trying to work on a problem like the following:\n\nWhich author co-authored at least 1 paper with every author (without aggregate functions)." ]
[ "relational", "tuple-relational-calculus" ]
[ "Substitute several words in all files in a folder based on a .txt file", "If I have a .txt file with 4 columns that looks like this:\nFile Genus Species Strain\nKPLB.S001.gbk Corynebacterium tuberculostearicum S001\nKPLB.S098.gbk Corynebacterium propinquum S098\nKPLB.S045.gbk Corynebacterium tuberculostearicum S045\nKPLB.S690.gbk Dolosigranulum pigrum S690\n\nAnd a folder that contains the 4 .gbk files listed in the first column. How could I replace each occurrence of the words "Genus" "Species or "Strain" inside the .gbk files with the corresponding names based on the table?\nAny guidance is appreciated. Thank you!\nAdding info on how the .gbk file looks inside:\nLOCUS NBOOEINI_1 375100 bp DNA linear 19-OCT-2020\nDEFINITION Genus species strain strain.\nACCESSION \nVERSION\nKEYWORDS .\nSOURCE Genus species\n ORGANISM Genus species\n Unclassified.\nCOMMENT Annotated using prokka 1.14.6 from\n https://github.com/tseemann/prokka.\nFEATURES Location/Qualifiers\n source 1..375100\n /organism="Genus species"\n /mol_type="genomic DNA"\n /strain="strain"\n\nAnd this is the desired output\nLOCUS NBOOEINI_1 375100 bp DNA linear 19-OCT-2020\nDEFINITION Corynebacterium tuberculostearicum strain S001.\nACCESSION \nVERSION\nKEYWORDS .\nSOURCE Corynebacterium tuberculostearicum\n ORGANISM Corynebacterium tuberculostearicum\n Unclassified.\nCOMMENT Annotated using prokka 1.14.6 from\n https://github.com/tseemann/prokka.\nFEATURES Location/Qualifiers\n source 1..375100\n /organism="Corynebacterium tuberculostearicum"\n /mol_type="genomic DNA"\n /strain="S001"\n\nThe word strains is going to be more complicated because I need to change only the second occurrence in the DEFINITION line and also in the last line" ]
[ "macos", "sed" ]
[ "How to specify date format for model binding?", "I hope the question is easy, but I am searching around for more than an hour and I just do not find the answer. So I have a asp.net mvc 2 application and one of the forms contains a date textbox with a jquery datepicker. I have set in the datepicker the date format to be dd.mm.yyyy. My problem is that on the model binding this date is interpreted as mm.dd.yyyy, so by the time the model reaches my action method the DateTime attribute of the model is not correct (day and month is reversed, if it is not possible to reverse it client side validation does not let me save the item). I do not want to change culture, but I would like to specify somehow to the model binder how to interpret the date. Is it possible somehow? \n\nThanks a lot" ]
[ "datetime", "asp.net-mvc-2" ]
[ "What is Copied when a Function Parameter is an Interface", "Assumptions: In go, all function arguments are passed by value. To get pass-by-reference semantics/performance, go programmers pass values by pointer. Go will still make a copy of these arguments, but its making a copy of a pointer which is sometimes more memory efficient than making a copy of the actual parameter.\n\nQuestion: What is going on when you pass an interface? i.e., in a program like this\n\npackage main\nimport \"fmt\"\n\ntype Messages struct {\n hello string\n}\n\nfunc main() {\n sayHelloOne(Messages{\"hello world\"});\n sayHelloTwo(&Messages{\"hello world\"});\n sayHelloThree(Messages{\"hello world\"});\n}\n\n\n//go makes a copy of the struct\nfunc sayHelloOne(messages Messages) {\n fmt.Println(messages.hello)\n}\n\n//go makes a *pointer* to the struct\nfunc sayHelloTwo(messages *Messages) {\n fmt.Println(messages.hello)\n}\n\n//go --- ???\nfunc sayHelloThree(messages interface{}) {\n fmt.Println(messages.(Messages).hello)\n}\n\n\nWhat happens with the argument when a programmer calls the sayHelloThree function? Is messages being copied? Or is it a pointer to messages that's copied? Or is there some weird-to-me deferring going on until messages is cast?" ]
[ "performance", "go", "parameter-passing" ]
[ "After the DOM is ready, IE will not show page content when Javascript is modifying the DOM? (but Firefox will show)", "I have a page that will initialize jCarousel when the DOM is ready (by jQuery's $(document).ready()), but on IE 8, the page is not displayed until jCarousel has finished initializing, which can be 1 minute later. On Firefox and Chrome, the page content is shown right away, while letting jCarousel do its job.\n\nSo is it true that IE will not show any page content until it finds out the DOM is not modified for some time (such as 0.5 seconds?)\n\n(I also used setTimeout() to delay initializing jCarousel -- the page content will show fast, but when the initialization is running finally, IE 8 will freeze up -- unresponsive to user action such as page scroll, so it is not a good solution either)." ]
[ "javascript", "internet-explorer", "firefox", "dom", "webpage-rendering" ]
[ "Function assigning values after it returns Swift", "I'm running into a weird bug where my function appends a value to an array AFTER it returns... The code for this is below :\n\nfunc makeUser(first: String, last: String, email: String) -> [User] {\n\n var userReturn = [User]()\n\n RESTEngine.sharedEngine.registerUser(email, firstName: first, lastName: last, age: 12, success: { response in\n if let response = response, result = response[\"resource\"], id = result[0][\"_id\"] {\n\n let params: JSON =\n [\"name\": \"\\(first) \\(last)\",\n \"id\": id as! String,\n \"email\": email,\n \"rating\": 0.0,\n \"nuMatches\": 0,\n \"nuItemsSold\": 0,\n \"nuItemsBought\": 0]\n let user = User(json: params)\n\n userReturn.append(user)\n print(\"\\(userReturn)\")\n\n }\n }, failure: { error in\n print (\"Error creating a user on the server: \\(error)\")\n })\n\n return userReturn\n}\n\n\nI call make user from here: \n\noverride func viewDidLoad() {\n super.viewDidLoad()\n // Do any additional setup after loading the view, typically from a nib.\n var newUser = makeUser(\"Average\", last: \"Person\", email: \"[email protected]\")\n print(\"\\(newUser)\")\n}\n\n\n(This is all still testing so I'm obviously calling my code in weird places.)\n\nSo when I run this what ends up happening is that FIRST my \"newUser\" array gets printed (and it shows up empty), and afterwards the userReturn array that I assign locally within the makeUser function prints, and it contains the new user that I append to it within the \"success\" completion block of \"registerUser\", like so: \n \n\nDoes anyone know whats happening here, and how I could fix it?\n\nFor reference: JSON is simply a typealias I defined for [String: AnyObject] dictionary." ]
[ "swift", "function", "closures" ]
[ "Crushed subplots not occupying the whole plot", "I don't know why but my subplots are completely crushed instead of occupying the whole plot.\n\nAlso, I would like that the subplots have the same length, and the colorbars too. Here it looks like that the first 2 subplots are shorter than the 3rd one because the colorbar is bigger.\n\nIdeally I would like this kind of result : https://stackoverflow.com/questions/33517915/very-low-quality-result-with-imshow-and-colorbar\nbut with the quality of pcolormesh (imshow is giving a really bad quality), and with 2 colorbars.\n\nHere is my code:\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.axes_grid1 import ImageGrid\n\nfig = plt.figure()\n\ngrid_top = ImageGrid(fig, 211, nrows_ncols = (2, 1),\n cbar_location = \"right\", \n cbar_mode=\"single\",\n cbar_pad=.2) \ngrid_bot = ImageGrid(fig, 212, nrows_ncols = (1, 1),\n cbar_location = \"right\", \n cbar_mode=\"single\",\n cbar_pad=.2) \n\nim1 = grid_top[0].pcolormesh(np.arange(0,len(array1[0])),np.arange(0,len(array1)+1),array1, vmin=0, vmax=0.8)\nim2 = grid_top[1].pcolormesh(np.arange(0,len(array2[0])),np.arange(0,len(array2)+1),array2, vmin=0, vmax=0.8)\nim3 = grid_bot[0].pcolormesh(np.arange(0,len(array3[0])),np.arange(0,len(array3)+1),array3, vmin=-0.5, vmax=0.5, cmap='seismic')\n\ngrid_top.cbar_axes[0].colorbar(im1)\ngrid_bot.cbar_axes[0].colorbar(im3)\n\nplt.show()\n\n\nHere the result, why is it so crushed and why the subplots are not occupying the whole plot?" ]
[ "python", "matplotlib", "plot", "subplot", "colorbar" ]
[ "How do you add a filter on a measure / rows without excluding other measures?", "I am trying to add a filter to my table. My table includes measures such as Spends, Installs, Network Installs. The filter is based on a calculation on a measure:\nIF [Network Installs] > 0 then 'Network' else 'Other' END.\nHowever, when I apply Network Installs on this filter, all the other measures - Spends and Installs - in the table disappear. My aim is to have a table that includes a filter that can filter the rows (but not exclude other measures and dimensions) based on the calculation above. Additionally, my table is dynamic (groupable by other dimensions). Can anyone point me in the right direction?\nAny help is appreciated! Thank you in advance." ]
[ "tableau-api" ]
[ "Android notification checking from service?", "I'm currently writing an app, what has an on-boot service. This service simply pops up a notification after a time, and update it in given periods with new info. Currently there's no need for any further battery saving, I just want the update sequence to work.\n\nI've hit a problem tho. Created the boot BroadcastReceiver what then starts my Service. It it, I do the work via a Timer and a TimerTask. But as I saw, there's no easy way to check if the notification was deleted, and thus not try to update it, but re-create it.\n\nWhat I want to do:\n\nprivate Notification n;\n\nNotifTask extends TimerTask {\n public void run() {\n if(n.exists){\n // Update notification\n }else{\n n = Notification.Builder(context).[customize it].build();\n }\n }\n}\n\n\nAnd in the service's onStart, set up a timer what runs this task every 10 seconds.\nNow, my question is: is there any way to do the \"n.exists\" part easily, without intents?" ]
[ "android", "service", "notifications" ]
[ "How to check the XML properties of dynamically created widgets in runtime?", "I am tinkering with dynamically created UI's at the moment and it becomes difficult to know if the properties I gave to a widget were actually applied in runtime. Here is an example of what I want to do:\n\n public void createButton () {\n Button button = new Button();\n button.setLayoutParams(new ConstraintLayout.LayoutParams(\n ConstraintLayout.LayoutParams.MATCH_PARENT,\n ConstraintLayout.LayoutParams.MATCH_PARENT));\n layoutId.addview(button);\n System.out.println(button.getLayoutParams);\n }\n\n\nThis hopefully prints android:layout_width:MATCH_PARENT and android:layout_height:MATCH_PARENT." ]
[ "android" ]
[ "How to get a custom annotation to change variables value?", "I am currently using hibernate validators to validate fields in my bean. One of the variables is an email address which has validations : \n\n @Email(message = \"{notWellFormed}\")\n @Size(max = 30, message = \"{maxLength}\")\n @NotBlank(message = \"{required}\")\n String email;\n\n\nHowever, these annotations do not let me specify what needs to be done in case of leading/trailing white space. The requirement now is to trim the leading/trailing whitespace and carry on. I have googled for java custom annotations but none of the examples use annotations to change a variables value. What can I do, so that the leading and trailing white spaces are taken care of ? \n\nI wrote a custom validator annotation, annotated my field with is @CutWhiteSpace and change the value in the isValid method, but that didnt work so I am obviously not understanding something." ]
[ "java", "spring-mvc", "annotations" ]
[ "Comparing a array with another array values", "Comparing a array with another array values. I have an array with a values below.\n\na = [1,5,6,7,3,8,12];\n\n\nBelow is the array which i to need to check.\n\nb = [3,5,7];\n\n\nI have to check whether a contains the value of b.\n\nfunction contains(n){\n for(var i=0; i<this.length; i++){\n if(this[i] == n)\n return true;\n }\n return false;\n}\n\na.contains(\"12\"); //would work\na.contains(b) //check for an array values?\n\n\nThe above code works fine when i pass in a number, can anyone tell me how would i pass an array and then efficiently compare with another array." ]
[ "javascript", "arrays" ]
[ "Crystal Reports (Visual Studio 2010) - please help with page template", "We are trying to create Crystal Report but have a problem with page template creation.\nReport looks like this:\nIt should be \"stamp\" in the right bottom corner of page. First page stamp looks little different from other pages stamp. \n\nAt the left part of page on the left margin two objects are placed. Both of them oriented vertically and should work as header and footer (should be shown on every page) but take more room than required for usual header and footer. In this case we can't use usual header and footer to place these objects. \n\nTables on pages should work as \"background\" because even 1 record on page should show 20-row table (with first row filled in this example)\n\nIt would be great if we have something like \"left running title\" but we can't see such feature in CR.\n\nI attached couple images to show how the report should look (sorry, i can't post images here because have no enough reputation points):\n\nFirst Page Second Page\n\nCould you please say how such report template can be created? We have no skilled CR developer in our company and have no idea which way of report creation can be used :(\nWe also agree to use another report engine if it is free and can work with .NET applications\n\nThanks for help\nDmitry" ]
[ "crystal-reports" ]
[ "Using CORS to list files on Google Drive", "This is probably a dumb question, but I am new to Web programming. I am trying to communicate with the Google Drive using client side JavaScript and CORS. I first used the jsclient library and that worked fine:\n\nrequest = gapi.client.drive.files.list( {'q': \" trashed = false \" } );\n\n\nUsing CORS, my code looks like:\n\nvar xhr = new XMLHttpRequest();\nxhr.open('GET','https://www.googleapis.com/drive/v2/files');\n\nvar mysearch = encodeURIComponent(\"q=trashed=false\");\n\nxhr.open('GET',\"https://www.googleapis.com/drive/v2/files?\" +mysearch,true);\nxhr.setRequestHeader('Authorization', 'Bearer ' + accessToken);\nxhr.onload = function() { handleResponse(xhr.responseText); };\nxhr.onerror = function() { handleResponse(null); };\nxhr.send();\n\n\nI have tried:\n\nvar mysearch = encodeURIComponent(\"q=trashed=false\");\nvar mysearch = encodeURIComponent(\"trashed=false\");\nvar mysearch = encodeURIComponent(\"q='trashed=false'\");\n\n\nThey all return the list of all the files. If I don't have a search string, I also get all the files.\n\nI would like to have other search parameters also, using &, but I can't get just one to work. \nHow do I format the mysearch string?" ]
[ "javascript", "google-drive-api", "cors" ]
[ "Custom parameter in Auth->Login cakePHP", "Can you pass an extra parameter in cakePHP on $this->Auth->Login\n\nFor example, I have a site table like the following;\n\n \"Site\"\n id\n name\n\n\nI could have 40 sites and you should only be able to login to the site you are assigned too. You could also be a member of multiple sites. To define what site they are logging into i'm setting this on the login page. \n\n e.g. http://localhost/login/$id\n\n\n \"Users\"\n id\n username\n site_id" ]
[ "php", "cakephp" ]
[ "laravel errors \"get_cfg_var()\" has been disabled for security reasons", "I am using Laravel and I want to send email forgot the password.\n\nI did it by localserver but in the online host I get this error from Laravel:\n\n\n Symfony \\ Component \\ Debug \\ Exception \\ FatalErrorException\n \n (E_UNKNOWN) Uncaught ErrorException: get_cfg_var() has been disabled\n for security reasons\n\n\nMy .env\n\nMAIL_DRIVER=smtp\nMAIL_HOST=smtp.mailtrap.io\nMAIL_PORT=2525\nMAIL_USERNAME='421d....a5682e0'\nMAIL_PASSWORD='7b4f....353be7'\nMAIL_ENCRYPTION=tls\n\n\nMy Emailcontroller\n\n<?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse Mail;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nclass EmailController extends Controller\n{\n public function send(Request $request)\n {\n $data = $request->email;\n Mail::send('emails.send', ['title' => 'Reset Your Password ', 'content'` `=> $request->_token ], function ($message) use ($data)\n {\n // dd($data);\n $message->from('[email protected]', 'ABC');\n $message->subject(' (Reset Password)');\n $message->to($data);\n });\n\n return view('auth.passwords.email')->with(['message' => 'Reset Email sent, Please check your inbox']);\n }\n}\n\n\nthanks alot." ]
[ "php", "laravel", "email", "passwords" ]
[ "R - Applying the same script to multiple dataframes", "I have a script which reads a .dat file containing co-ordinates, rainfall and crop area data as below.\n\n East North rain Wheat Sbarley Potato OSR fMaize Total LCA\n10000 510000 1498.73 0.0021 0.5 0.0022 0 0.0056 0.01 0.01\n10000 510000 1498.73 0.0021 0.034 0.0022 0 0.0056 0.01 0.01\n10000 510000 1498.73 0.0021 0.001 0.0022 0 0.0056 0.01 0.01\n10000 515000 1518.51 0.0000 0.12 0.0000 0 0.0000 0.00 0.00\n10000 515000 1518.51 0.0000 0.0078 0.0125 0 0.0000 0.00 0.00\n10000 515000 1518.51 0.0000 0 0.0000 0 0.03 0.00 0.00 \n\n\nThe code below calculates the emissions for Wheat through a series of models before extracting the data and producing a raster file and plotting it in ggplot. Having read these related queries I'm getting rather confused as to whether I need to make a package or am missing something very basic as to how to repeat the code through each crop type.\n\nlibrary(doBy)\nlibrary(ggplot2)\nlibrary(plyr)\nlibrary(raster)\nlibrary(RColorBrewer)\nlibrary(rgdal)\nlibrary(scales)\nlibrary(sp)\n\n### Read in the data\ncrmet <- read.csv(\"data.dat\")\n# Remove NA values\ncrm <- crmet[ ! crmet$rain %in% -119988, ]\ncrm <- crm[ ! crm$Wheat %in% -9999, ]\n\n### Set model parameters\na <- 0.1474\nb <- 0.0005232\ng <- -0.00001518\nd <- 0.000003662\nN <- 182\n\n### Models\ncrm$logN2O <- a+(b*crm$rain)+(g*N)+(d*crm$rain*N)\ncrm$eN2O <- exp(crm$logN2O)\ncrm$whN2O <- crm$eN2O*crm$Wheat\n\n### Prepare data for conversion to raster\ncrmet.ras <- crm\ncrmet.ras <- rename(crmet.ras, c(\"East\"=\"x\",\"North\"=\"y\"))\n\n#### Make wheat emissions raster\nwn <- crmet.ras[,c(1,2,13)]\nspg <- wn\n\n# Set the Eastings and Northings to coordinates\ncoordinates(spg) <- ~ x + y\n# coerce to SpatialPixelsDataFrame\ngridded(spg) <- TRUE\n# coerce to raster\nrasterDF <- raster(spg)\n# Add projection to it - in this case OSBG36\nproj4string(rasterDF) <- CRS(\"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs\")\nrasterDF\n\nwriteRaster(rasterDF, 'wn.tif', overwrite=T)\n\n### Plotting the raster:\nwhplot <-ggplot(wn, aes(x = x, y = y))+\n geom_tile(aes(fill = whN2O))+\n theme_minimal()+\n theme(plot.title = element_text(size=20, face=\"bold\"),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n axis.ticks = element_blank(),\n axis.text.x = element_blank(),\n axis.text.y = element_blank(),\n legend.title = element_text(size=16, face=\"bold\"))+\n scale_fill_gradient(name=expression(paste(\"\", N[2], \"O \", Ha^-1, sep=\"\")))+\n xlab (\"\")+\n ylab (\"\")+\n labs (title=\"Nitrous oxide emissions\\nfrom Wheat\")\n\nwhplot\n\n\nI'm trying to turn as much of the above into functions as I can but they're all rather more complicated than the examples I find on here and in the ?help files. Many thanks in advance for any help/suggestions." ]
[ "r", "function", "dataframe", "multiple-columns" ]
[ "PHP: Unable to echo certain array values from json_decode", "Have JSON as $json\n\nI convert it to an array using:\n\n$myarray = json_decode($json, true);\n\n\nprint_r($myarray) gives this:\n\nArray (\n[0] => Array\n( [ProjectId] => 2765297 [ProjectName] => Acme Example) \n[1] => Array\n( [ProjectId] => 4526847 [ProjectName] => Smiths Example)\n)\n\n\nWhen I try to use foreach like this:\n\nforeach ($results as $key => $result) {\necho $result[ProjectName] . ' Project ID:' . $result[ProjectID];\n}\n\n\nI get the ProjectName but not the ProjectID.\n\nWhen I look as the original JSON ($json), the ProjectID appears to be unquoted like an integer.\n\n[\n {\n \"ProjectId\":2765297,\n \"ProjectName\":\"Acme Example\"\n },\n {\n \"ProjectId\":4526847,\n \"ProjectName\":\"Smiths Example\"\n }\n]\n\n\nWhen I try to convert to a string or run checks to see if it is an integer, it is ether blank or null." ]
[ "php", "arrays", "json", "echo" ]
[ "MD5 password not selecting from db", "if(isset($_POST['login']))\n{\n $pass = md5($_POST['password']);\n $ch=\"SELECT * FROM membership WHERE email='$_POST[email]' AND password='$pass'\";\n $mych=mysqli_query($database,$ch) or die(mysqli_error($database));\n $counter=mysqli_num_rows($mych);\n if($counter>0)\n { \n $_SESSION['userEmail']=$_POST['email'];\n $_SESSION['start'] = time();\n\n // Record now logged in time\n $_SESSION['expire'] = $_SESSION['start'] + (5 * 60) ; \n\n // ending a session in 5 minutes from the starting time\n header(\"Location:userDashboard/\"); \n }else{\n $qstring = '?status=err';\n $_SESSION['LoginAlert']=\"User Account Not Exist\";\n header(\"Location:login.php\".$qstring); \n }\n}" ]
[ "php" ]
[ "Facing Some problem with Firebase InstanceId", "I am facing some errors in an apk build. Here is my code. \n\npackage com.my.mybooks.services;\n\nimport android.util.Log;\nimport com.google.firebase.iid.FirebaseInstanceId;\nimport com.google.firebase.iid.FirebaseInstanceIdService;\n\n\n\n/**\n * FirebaseInstanceIdService Gets FCM instance ID token from Firebase Cloud Messaging Server\n */\n\npublic class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {\n\n //*********** Called whenever the Token is Generated or Refreshed ********//\n\n @Override\n public void onTokenRefresh() {\n super.onTokenRefresh();\n\n String refreshedToken = FirebaseInstanceId.getInstance().getToken();\n Log.i(\"My_Shop\", \"refreshedFCMToken= \" + refreshedToken);\n }\n\n}\n\n\n\n error: cannot find symbol import\n com.google.firebase.iid.FirebaseInstanceIdService;\n ^ symbol: class FirebaseInstanceIdService location: package com.google.firebase.iid\n\n\nMy AndroidManifest.xml is\n\n <service android:name=\"com.atmajaa.atmajaabooks.services.MyFirebaseMessagingService\">\n <intent-filter>\n <action android:name=\"com.google.firebase.MESSAGING_EVENT\" />\n </intent-filter>\n </service>\n\n <service android:name=\"com.atmajaa.atmajaabooks.services.MyFirebaseInstanceIDService\">\n <intent-filter>\n <action android:name=\"com.google.firebase.INSTANCE_ID_EVENT\" />\n </intent-filter>\n </service>" ]
[ "java", "android", "firebase", "firebase-cloud-messaging" ]
[ "Unable to use lag function correctly in sql", "I have created a table from multiple tables like this:\n\nWeek | Cid | CustId | L1\n10 | 1 | 1 | 2\n10 | 2 | 1 | 2\n10 | 5 | 1 | 2\n10 | 4 | 1 | 1\n10 | 3 | 2 | 1\n4 | 6 | 1 | 2\n4 | 7 | 1 | 2\n\n\nI want the output as:\n\nRepeat\n0\n1\n1\n0\n0\n0\n1\n\n\nSo, basically what I want is for each week, if a person (custid) comes in again with the same L1, then the value in the column Repeat should become 1, otherwise 0 ( so like, here, in row 2 & 3, custid 1, came with L1=2 again, so it will get 1 in column \"Repeat\", however in row 4, custid 1 came with L1=1, so it will get value as ).\n\nBy the way, the table isn't ordered (as I've shown).\n\nI'm trying to do it as follows:\n\nselect t.*,\nlag(0, 1, 0) over (partition by week, custid, L1 order by cid) as repeat\nfrom\ntable;\n\n\nBut this is not giving the output and is giving empty result." ]
[ "sql", "oracle", "lag" ]
[ "Spring Boot Maven Application Containerized with Docker - build WAR based on profile flag", "I have a spring boot application that makes use of profile files 'application-dev.properties' and 'application-test.properties'. The project is containerized by using Docker, look at the code below.\nRunning 'RUN mvn package' works, but I want to build based on one of the profiles. Is there a way I can achieve this? Because "RUN mvn package -Dmaven.test.skip=true -P test" doesn't seem like to work..\n FROM maven:3.3.9-jdk-8-alpine as build-env\n COPY pom.xml /tmp/\n COPY settings.xml /root/.m2/settings.xml\n COPY src /tmp/src/\n\n WORKDIR /tmp/\n RUN mvn package -Dmaven.test.skip=true -P test\n\n FROM tomcat:8.0\n COPY --from=build-env /tmp/target/cbm-server-0.0.1-SNAPSHOT.war $CATALINA_HOME/webapps/cbm- server.war\n\n EXPOSE 8009\n EXPOSE 8080\n CMD ["catalina.sh", "run"]" ]
[ "java", "spring-boot", "spring-profiles", "maven-profiles" ]
[ "Where is chrome.app officially documented?", "Looking over http://code.google.com/chrome/extensions/api_index.html , I was unable to find any documentation for chrome.app. I have no trouble getting chrome.app.getDetails() to work, but am wondering if there is any form of official documentation (or why not, if not)." ]
[ "google-chrome-extension" ]
[ "Problem with WM_COMMAND on Lazarus/FPC", "I have form with MainMenu and I want to intercept when the user selects a command item from a menu.\nThis works in Delphi:\n\ntype\n TForm1 = class(TForm)\n ... // Memo and MainMenu created\n protected\n procedure WMCommand(var Info: TWMCommand); message WM_COMMAND;\n end;\n\n\nprocedure TForm1.WMCommand(var Info: TWMCommand);\nbegin\n if (Info.ItemID < 10) then\n Memo1.Lines.Add('WMCommand ' + IntToStr(Info.ItemID));\nend;\n\n\nIn MainMenu I added some items and when I select those items from menu then\nmy Memo1 is filled with:\n\nWMCommand 2\nWMCommand 3\nWMCommand 3\nWMCommand 2\nWMCommand 5\n...\n\n\nI ported this application to FPC/Lazarus, but it seems that WM_COMMAND\nhandler is not called! When I set breakpoint in TForm1.WMCommand in Delphi then Delphi\nstopped many times before main form appeared. Lazarus never stopped\non this breakpoint. I think something is broken with WM_COMMAND\nin Lazarus, but maybe I don't know something. Any idea?\n\nI use Lazarus 0.9.28.2 beta with FPC 2.2.4 on WinXP.\n\nEDIT:\n\nUsing Winspector I checked that MainMenu generates WM_COMMAND:\n\nWM_COMMAND\n Code: 0\n Control ID: 2\n Control HWND: 0x00000000\n Message Posted\n Time: 09:37:14.0968\n\n\nI think there is bug in Lazarus/FPC in WM_COMMAND message method handling and I reported it: http://bugs.freepascal.org/view.php?id=15521" ]
[ "delphi", "message", "lazarus", "freepascal", "fpc" ]
[ "apache2 + django + mod_wsgi doesn't respond", "I'm trying to deploy my working django app using apache2 + mod_wsgi module. This is my apache configuration:\n\nanton@ru:~$ cat /etc/apache2/sites-available/default\nAlias /static/ /home/anton/mysite/static/\n\n<Directory /home/anton/mysite/static>\nOrder deny,allow\nAllow from all\n</Directory>\n\nWSGIScriptAlias / /home/anton/mysite/mysite/wsgi.py\n\n<Directory /home/anton/mysite>\nOrder allow,deny\nAllow from all\n</Directory>\n\n\nand WCGI configuration:\n\nanton@ru:~$ cat /home/anton/mysite/mysite/wsgi.py\nimport os\nimport sys\nsys.path.append('/home/anton/mysite')\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"mysite.settings\")\nfrom django.core.wsgi import get_wsgi_application\napplication = get_wsgi_application()\n\n\nUsing debug output (print 'bla-bla') I found out that wsgi.py works. But then http request doesn't get any response from apache. Could you please help me to understand why? Thanks!\n\nUPDATE:\nI've turned logs on like this:\n\nErrorLog /home/anton/error.log\nCustomLog /home/anton/custom.log combined\n\n\nHere is what happens in error log when reloading the service:\n\n[Wed Nov 06 05:43:14 2013] [notice] Graceful restart requested, doing restart\n[Wed Nov 06 05:43:14 2013] [warn] NameVirtualHost *:80 has no VirtualHosts\n[Wed Nov 06 05:43:14 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.\n[Wed Nov 06 05:43:14 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.\n[Wed Nov 06 05:43:14 2013] [notice] Apache/2.2.22 (Debian) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations\n\n\nWhen requesting \"mysite.com/\" nothing happens in error.log and custom.log. Static data works:\n\n85.141.191.57 - - [06/Nov/2013:05:44:37 -0500] \"GET /static/main.css HTTP/1.1\" 304 213 \"-\" \"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36\"\n85.141.191.57 - - [06/Nov/2013:05:44:38 -0500] \"GET /static/main.css HTTP/1.1\" 304 212 \"-\" \"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36\"\n\n\nSOLUTION:\nThe problem here was that python version didn't match the version of python mod_wsgi was compiled for. I built mod_wsgi from sources and that solved my problem." ]
[ "django", "apache", "mod-wsgi" ]
[ "Is there any way to improve Phaser 2 Game performance?", "I am using Phaser 2 in my game. When I open the game initially it works fine, with 55 to 60 fps, however after some time it slows to fps below 30. This is the url of game: http://139.59.91.216:8082/ .\n\nGame Area\n\ngame = new Phaser.Game(1366, 778, Phaser.AUTO, null);\ngame.state.add('Game', Game);\ngame.state.start('Game');\nglowFilter = new Phaser.Filter.Glow(game);\n\n\nIn the game's update function I am doing this: \n\nupdate: function () { \n // to update the stcik lenght \n for (var i = self.game.snakes.length - 1; i >= 0; i--) {\n self.game.snakes[i].updateStick();\n }\n // to update the FoodGroup \n for (var i = this.foodGroup.children.length - 1; i >= 0; i--) {\n var f = this.foodGroup.children[i];\n f.food.update();\n }\n\n updateAndSendData(self); // to send the data to server from client side\n},\n\n\nCan anyone suggest how I can improve the performance of the game?" ]
[ "javascript", "performance", "phaser-framework" ]
[ "primeNG plugin I am using,but i am facing issue like,it is not removing old breadcrumb", "I am using this plugin. But here, the problem is,\n\nthis.itemBreadcrums.push({ label: 'home', routerLink: ['/home'] });\nthis.itemBreadcrums.push({ label: 'Participant List', routerLink: ['/home'] \n});\nthis.itemBreadcrums.push({ label: participantName});\n\n\nIn this breadcrumb, when I click on home, other two labels are not hiding.\n\nhttps://hassantariqblog.wordpress.com/2016/12/03/angular2-using-breadcrumb-as-angular-service-in-angular-2-application-2/" ]
[ "breadcrumbs", "primeng" ]