texts
sequence
tags
sequence
[ "Windows phone ads don't show up", "I put my adcontrol control to my page. While using test unitid and test appid the ads show up. When I type my app ID and normal adunitid anything shows up in emulator. Place where ad should be visible is transparent.\n\none more q; how can I \"pin\" my ad to scroll at the bottom of the screen with scrollviewer?" ]
[ "windows", "visual-studio-2010", "windows-phone-7" ]
[ "Leaflet-geoman how to properly retrieve GeoJSON", "I'm having some troubles when it comes to using the draw control given by leaflet-geoman:\nWhat I'm trying to achieve:\n\nDraw Polygon(s) --> ✅\nGet geojson from layer(s) --> ✅\nStore in database --> ✅\nRetrieve from database --> ✅\nLoad in leaflet map and be able to edit, crop it and remove it. --> ✅ ?\nGet new geojson from modified layer(s) or if I had 2 layers and removed one, get only one. --> X\n\nI haven't been able to get the new geojson from the modifications I did through the geoman draw control. No matter what I do, I always get the same result I had in the beginning when I loaded the data to the map.\nFiddle: https://jsfiddle.net/pjkLr41q/34/\nconst shapes = [{\n "type": "Feature",\n "properties": {},\n "geometry": {\n "type": "Polygon",\n "coordinates": [\n [\n [-3.701856, 40.422481],\n [-3.707092, 40.418593],\n [-3.70177, 40.417809],\n [-3.701899, 40.422873],\n [-3.701856, 40.422481]\n ]\n ]\n }\n }];\nconst geojson = L.geoJSON(shapes).addTo(map);\n\n\nmap.eachLayer((layer) => {\n if (layer.pm) {\n const geojson = layer.toGeoJSON();\n\n if (layer instanceof L.Circle) {\n geojson.properties.radius = 10;\n }\n\n shapes.push(geojson);\n}});\n\n\nI ain't sure if its because the way I load the data, straight with the L.geoJSON(data) or maybe going through the eachLayer function isn't what I need in this case, but I'm kinda lost right now. Help really appreciated." ]
[ "javascript", "leaflet", "leaflet-geoman" ]
[ "Pagination for panel in active admin", "I am using active admin for admin panel. On User show page I need to show his friends. I have two models User and Friend. \n\nI want add pagination in the \"friendship with panel\" ie user.friends block.\n\nHow can I add pagination on one panel? Here is the code that I am using.\n\nshow do\n attributes_table do\n row(\"Photo\") { |user| image_tag(user.facebook_photo_url) }\n rows :name, :sex,:city\n end\n\n panel 'Friendship with' do\n table_for user.friends do\n column \"\" do |friend|\n (link_to image_tag(friend.facebook_photo_url('small')), admin_friend_path(friend)) + \"       \".html_safe + (link_to friend.name, admin_user_path(friend))\n end\n\n end\n end \n\n active_admin_comments\nend\n\n\nThe Friend model is actually Facebook friends so I can't use self-referential joins on User model (so don't say use one model instead of two) and I have some other panels on the same page. I need to make sure every panel has their own pagination param name so that they don't conflict with each other." ]
[ "pagination", "activeadmin", "kaminari" ]
[ "What is the best practice flutter equivalent to react-navigation's createBottomTabNavigator()?", "I want to create tab navigation with a custom animated tab bar in Flutter which keeps state of current tab (scroll postion, forms etc) when tabs are switched. This could be done easily in react-native with react-navigation's createBottomTabNavigator(). Because I'm new to Flutter, I don't know the best approach to this.\nI can't use TabBar/TabView from material widgets because custom animations in TabBar don't seem possible. So far the only solution I've found is to use IndexedStack widget to store the pages and switch them with a separate tab bar.\nIs this the right/best approach? How will it work with hardware back on Android? I would be grateful if someone with more experience could advise on this." ]
[ "react-native", "flutter", "react-navigation" ]
[ "TextBox inside DockPanel - strange behavior with special characters", "I have a TextBox inside a DockPanel whose FlowDirection is RightToLeft.\n<DockPanel Grid.Column="1" FlowDirection="RightToLeft">\n <TextBox Text="Hello@"/>\n</DockPanel>\n\nInside the TextBox, it displays like this:\n\n@Hello\n\nWhy is this happening and how can I prevent it?" ]
[ "wpf", "textbox", "dockpanel" ]
[ "Prevent buffer from unloading in autocmd", "I'm writing a BufUnload autocmd, and I want to conditionally prevent the buffer from actually being unloaded or closed from within the autocmd. Is there a way to do this?\n\nFor instance, I want to use the contents of the buffer as a commit message for mercurial using an autocmd that does:\n\nautocmd BufUnload <buffer> !hg ci -l logfile\n\n\nSo if the commit fails (the hg command returns non-zero error code), I want to leave the buffer open and unchanged." ]
[ "vim", "autocmd" ]
[ "Convert FMResultSet to NSMutableArray?", "I am trying out FMDB and it looks like it will work perfectly for me IF I can get my FMResultSet turned into an NSMutableArray.\n\nHow would I accomplish this?" ]
[ "objective-c", "ios", "fmdb" ]
[ "GXT number field autocalculation", "I have a form in GXT with three number fields: weight, height and BMI. What I want to do is to calculate BMI automatically after filling weight and height fields by the user. Any ideas how I can achieve that?" ]
[ "java", "gwt", "gxt" ]
[ "Spotify iPhone API search by BPM", "I am implementing Spotify in my iPhone app. I want to search tracks by BPM. In Spotify, is there any API to search by BPM. Please help." ]
[ "iphone", "spotify", "cocoalibspotify-2.0" ]
[ "SQLite transactions for readonly operations", "Sorry if this is not a clever question:\nDo SQLite transactions have any sense for series of read-only operations? Why?" ]
[ "sqlite", "transactions", "readonly" ]
[ "Hide elements of html in slider using css", "Iam using this slider http://tympanus.net/codrops/2013/04/17/background-slideshow/ for fully background slider. I added some image in the class main:-\n\n <style>\n .mobile {\n visibility:hidden;\n }\n @media(max-width:480px) {\n .desktop {\n visibility:hidden.\n }\n .mobile {\n visibility:visible;\n }\n }\n</style>\n<ul id=\"cbp-bislideshow\" class=\"cbp-bislideshow\">\n <li class=\"desktop\"><img src=\"images/1.jpg\" alt=\"image01\"/></li>\n <li class=\"desktop\"><img src=\"images/2.jpg\" alt=\"image02\"/></li>\n <li class=\"mobile\"><img src=\"images/mobile/1.jpg\" alt=\"image03\"/></li>\n <li class=\"mobile\"><img src=\"images/mobile/2.jpg\" alt=\"image04\"/></li>\n</ul>\n\n\nWhat i want to show image having class desktop and to hide image of class mobile and also to hide class desktop and show class mobile if browser having max-width of 480px. But after showing image of class desktop it shows white screen which i don't want. \nPlease help." ]
[ "javascript", "jquery", "html", "css" ]
[ "Angular Responsive Table not working on Internet Explorer 9 (IE 9). Works with IE 10", "I am really hoping someone can help me on this one. I am trying to using a simple, but excellent, Angular responsive table plugin by André Werlang (aka awerlang).\n\nIt works great on IE 10+, Chrome and Firefox. As the title says, it does not work on IE 9. Here is a Live Demo of the plugin that you can open in IE (and emulate IE 9 through debugger, or however possible).\n\nI am using the ng-repeat example with Bootstrap (2nd from last). Data loads and everything, but the resizing into a stack table does not work properly. I have tried adding 'data-' prefix to the 'ng-app' and 'ng-controller', but no change.\n\nPlunker Demo || JSFiddle Demo\n\n<!DOCTYPE html>\n<html data-ng-app=\"app\">\n\n<head>\n <script type=\"text/javascript\" src=\"https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.min.js\"></script>\n <script src=\"https://cdn.rawgit.com/awerlang/angular-responsive-tables/master/release/angular-responsive-tables.min.js\"></script>\n <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css\">\n <link rel=\"stylesheet\" href=\"https://cdn.rawgit.com/awerlang/angular-responsive-tables/master/release/angular-responsive-tables.min.css\">\n</head>\n\n<body data-ng-controller=\"TestController as ctrl\">\n <table class=\"table table-bordered table-striped table-hover\" wt-responsive-table>\n <thead>\n <tr>\n <th>Name</th>\n <th>Version</th>\n <th>Language</th>\n <th>Maintainer</th>\n <th>Stars</th>\n </tr>\n </thead>\n <tbody>\n <tr ng-repeat=\"item in ctrl.projects\">\n <td>{{item.name}}</td>\n <td>{{item.version}}</td>\n <td>{{item.language}}</td>\n <td>{{item.maintainer}}</td>\n <td>{{item.stars}}</td>\n </tr>\n </tbody>\n </table>\n\n <script>\n function TestController() {\n this.projects = [\n {name: \"AngularJS\", version: \"1.5\", language: \"JavaScript\", maintainer: \"Google\", stars: 35000},\n {name: \"Bootstrap\", version: \"3.3\", language: \"CSS\", maintainer: \"Twitter\", stars: 23000}, \n {name: \"UI-Router\", version: \"0.13\", language: \"JavaScript\", maintainer: \"AngularUI\", stars: 15000}\n ];\n }\n\n var app = angular.module('app', ['wt.responsive']);\n app.controller('TestController', TestController);\n </script>\n</body>\n\n</html>\n\n\nHow it should display (IE 11) vs How it displays (IE 9) - Sorry for large snapshots.\n\n\n\n\n\nThanks in advance!" ]
[ "jquery", "html", "css", "angularjs", "internet-explorer-9" ]
[ "Confirmation this inheritence is valid", "I am creating a CustomerList Class, currently:\n\npackage somestuff;\n\nimport java.util.ArrayList;\n\npublic class CustomerList {\n\n ArrayList<Customer> custList;\n\n}\n\n\nI want it to extend ArrayList; would this be a valid \"is-a\" relationship (CustomerList is an ArrayList)?\n\nEdit: Apologies, I haven't made this post too clear. My plan is to have this as part of a JSP website; I'd query a database and use Customer and CustomerList to store the results. My theory is that it will make things easier if I wanted to change the order of how they're outputted." ]
[ "java", "inheritance", "relationship" ]
[ ".NET Socket Client performance seems to be capped per destination IP", "I have an asynchronous console .NET socket client application that establishes dozens of connections to a remote socket server. \n\nIt's a stress test application so each connection sends as many messages as possible waiting for an acknowledgement from the remote server after each message gets sent.\n\nThe socket server has a public IP but I can also use the internal IP because it's in the same network.\n\nAs the number of connection increases the number of messages per minute goes down pretty bad and I've been trying to find out why. \n\nBut for some reason, the performance only seems to go down for the connections sharing the same destination IP. In other words, if I connect 100 users to the internal IP and 5 users to the external IP, the latter get top-notch performance while the former suffer. \n\nBut this makes no sense because all the communication is happening exactly between the same two machines (my desktop and the one-and-only server).\n\nThe amount of data being transferred doesn't seem that high for it to be some kind of network flooding. Honestly, it looks like some sort of artificial cap for the number of simultaneous sockets waiting for answers on a given destination IP. I've profiled my code and that's where it hangs, waiting for the remote server to answer. Is there a setting like that somewhere in the config files for .Net? \n\nUPDATE: there's just one NIC in the server, the external IP we use to reach it works via port forwarding.\n\nMore internal IPs were added to the server but they ended up competing with each other for resources i.e. only the external IP is behaving differently. This makes me suspect the bottleneck is on the server side, maybe some kind of load balancing per client IP (when we connect via external IP the client IP they receive would be different as well)" ]
[ "c#", ".net", "sockets", "networking" ]
[ "Tal condition always evaluates to false", "I'm using plone and trying to display a form result in a page template. \n\nI'm trying to filter some database results using tal:condition with a python expression but it always evaluates to false.\n\nThe code looks like this:\n\n <tr tal:repeat=\"result view/results\">\n <td> <span tal:condition=\"python:view.teams[0]==result.team_id\" tal:replace=\"result/position\">Position</span></td>\n <td> <span tal:condition=\"python:view.teams[1]==result.team_id\" tal:replace=\"result/position\">Position</span></td>\n</tr>\n\n\nI want the table cells to be filled with the team position when the team id is matched in the result, but the cells always are empty. \nIf I remove the tal:condition from the span and replace the tal:replace=\"result/position\" with tal:replace=python:view.teams[0]==result.team_id it prints True or False so I can check that the result is correct. \n\nCan anyone help me about this issue? Why does tal:condition allways evaluate false?" ]
[ "plone", "zope" ]
[ "How to reuse port from docker without restarting?", "I'm on a Windows Ten Box, running Docker Version 17.09.0-ce-win33 (13620).\nI do something like this. docker run --rm -p 1001:8787 rocker/rstudio\nhowever if quit the docker, and try to rerun it with the same port it fails because its still open. Running netstat its still "listening" on the same port.\n[vpnkit.exe]\n TCP [::1]:1001 WN-10DT:0 LISTENING\n\nMy question is can I reuse the port without having to restart?\nthanks in advance." ]
[ "windows", "docker" ]
[ "React - Ajax data not being passed into Child Component", "I have two components, one parent one child. I am using the fetch method in componentDidMount() callback. Once I do this, I set the state with key items to that data that is pulled from the api. Once I do this it should be able to be console logged in the child component as a prop. However this is not working. What am I doing wrong here?\n\nParent Component:\n\nimport React, {Component} from 'react';\nimport Map from './maps/Map';\n\nclass Main extends Component {\n constructor(props){\n super(props);\n this.state = {\n name: \"John\",\n items: []\n }\n }\n\n componentDidMount() {\n fetch('https://hn.algolia.com/api/v1/search?query=')\n .then(dat => dat.json())\n .then(dat => {\n this.setState({\n items: dat.hits\n })\n })\n }\n\n render() {\n return (\n <div>\n <Map list={this.state.name} items={this.state.items}></Map>\n </div>\n )\n }\n}\n\nexport default Main;\n\n\nChild Component:\n\nimport React, {Component} from 'react';\n\nclass Map extends Component {\n\n constructor(props) {\n super(props);\n console.log(props.items)\n }\n\n render () {\n return (\n <h1>{this.props.name}</h1>\n )\n }\n}\n\nexport default Map;" ]
[ "javascript", "reactjs" ]
[ "Create symbolic link to host pycharm configuration folder on remote repo", "There are already some question touching on a similar issue. I'm just not getting my head wrapped around it. So I want to have my pycharm-configurations, which are by default under something like /home/user/.config/JetBrains/PyCharm/ hosted on Github.\nI do have a folder on my machine where I collect some config-files. So I thought it would be a good idea to create a symlink for the entire folder. But I'm just messing it up at the moment.\nSo the question is: How (or what is the best way to) can I create a folder under ~/configs/ that is actually linked to the ~/.config/JetBrains/PyCharm.\nAt the moment I create a soft like this:\nln -s ~/.config/JetBrains/PyCharm ~/configs/PyCharm\nBut this is just creating a textfile under ~/configs/PyCharm when I go to Github.\nSo what obvious issue am I missing here?" ]
[ "unix", "pycharm", "symlink" ]
[ "Python: How to save statsmodels results as image file?", "I'm using statsmodels to make OLS estimates. The results can be studied in the console using print(results.summary()). I'd like to store the very same table as a .png file. Below is a snippet with a reproducible example.\n\nimport pandas as pd\nimport numpy as np\nimport matplotlib.dates as mdates\nimport statsmodels.api as sm\n\n# Dataframe with some random numbers\nnp.random.seed(123)\nrows = 10\ndf = pd.DataFrame(np.random.randint(90,110,size=(rows, 2)), columns=list('AB'))\ndatelist = pd.date_range(pd.datetime(2017, 1, 1).strftime('%Y-%m-%d'), periods=rows).tolist()\ndf['dates'] = datelist \ndf = df.set_index(['dates'])\ndf.index = pd.to_datetime(df.index)\nprint(df)\n\n# OLS estimates using statsmodels.api\nx = df['A']\ny = df['B']\n\nmodel = sm.OLS(y,sm.add_constant(x)).fit()\n\n# Output\nprint(model.summary())\n\n\n\n\nI've made some naive attempts using suggestions here, but I suspect I'm way off target:\n\nos.chdir('C:/images')\nsys.stdout = open(\"model.png\",\"w\")\nprint(model.summary())\nsys.stdout.close()\n\n\nSo far this only raises a very long error message.\n\nThank you for any suggestions!" ]
[ "python", "statsmodels" ]
[ "use funtion of framework c/c++ to project android studio", "I need to use the setParameter function of the android.media.MediaPlayer library. However, this is a \"private native\" function. I then found this function in a C ++ language framework. Is there a way to use this function? I want to control the sound track of the .ts file (left, right, mono)." ]
[ "android", "audio" ]
[ "How to give plotlines text styles on opposite side instead of default", "I have created a chart using Highcharts. Drawn to plot lines on X Axis. I would like to display the plot line on opposite side instead of the default\n\nMy Code is\n\nplotLines: [{\n value: pur_time,\n width: 2 ,\n color: '#656568',\n dashStyle: 'dash',\n id: 'plotline',\n label: {\n text: 'Purchase deadline',\n style: {\n color: '#656568',\n fontWeight: 'bold'\n }\n }\n },{\n value: exp_time,\n width: 2 ,\n color: '#A28F29',\n id: 'plotline1',\n label: {\n text: 'Expiration time',\n opposite: true,\n style: {\n color: '#686A3B',\n fontWeight: 'bold'\n }\n }\n }]\n\n\nHere is the sample what i actually gets\n\n\n\nHow am expecting to look like is" ]
[ "highcharts", "highstock" ]
[ "Changing User Permissions Via Rally API", "Our workspace has created a new project which we wish to add all of our 1,000+ users to. This seems most easily done via a script interfacing with the API, rather than making the edits by hand, since Rally doesn't seem to offer a batch update function for user permissions. My question is, are user permissions even editable via the API? I've made changes to user records in the past, but not their permissions.\n\nFor context, I'm using Pyral to interface with the WSAPI.\n\nThanks!" ]
[ "api", "rally" ]
[ "Can I use dojo.validate.us.isSocialSecurityNumber in a Spring Web Flow Project?", "Can I use dojo.validate.us.isSocialSecurityNumber in a Spring Web Flow Project? I am trying to make a Soical Security field in my Spring web flow project but the following code dont work? How should I make a SSN file with dijit?\n\n<form:input path=\"name\" class=\"value\" /> <script\n type=\"text/javascript\">\n Spring.addDecoration(new Spring.ElementDecoration({\n elementId : \"name\",\n widgetType : \"dijit.form.ValidationTextBox\",\n widgetAttrs : {\n promptMessage : \"US Social Security Number\",\n invalidMessage : \"Invalid US Social Security Number.\",\n required : true,\n validator: \"dojo.validate.us.isSocialSecurityNumber()\",\n trim : true\n }\n }));\n </script>" ]
[ "spring-mvc", "dojo", "spring-webflow" ]
[ "Psql: error to import date column using \\copy from csv", "My csv file is something like this:\npmsbcod;ansbfmues;paracod\nAB070001;2018-10-29;124TMB\n...\n\nUsing \\copy metacommand I always have the error\nERROR: invalid input syntax for type timestamp with time zone: \"0.0\"\nI don't have problems importing other csv files without timestamp columns\n\nI have tried with several date formats (dd/mm/yyyy, yyyy-mm-dd, yyyy-mm-dd hh:mm:ss, yyyy-mm-dd hh:mm:ss+0.1..) but the error messages is always the same; or ERROR: invalid input syntax for type timestamp with time zone: \"2018-10-29 00:00:00+0.1\" with this datetime format.\n\nMy server date style is ISO, DMY -show datestyle;-\nIn other timestamp columns that I have imported with a python script the date format is 2017-03-21 00:00:00; in the python script I can execute something like\ncursor.execute('insert into table values (%s, %s, %s)', ('AB070001','2018-10-29','124TMB') with any problems\n\nI'm executing psql from console with code page 1252\n\nThanks in advance" ]
[ "postgresql", "csv", "datetime", "psql" ]
[ "Does YUI allow you to sort dates in a datatable?", "Is there a way to sort dates in yui without having to define your own sorting implementation?" ]
[ "javascript", "yui" ]
[ "Adding an NSControl to IKImageBrowserCell", "I've built a custom IKImageBrowserCell which is displaying my images in an IKImageBrowser without any issues.\n\nI'd like to try and override the built in IKImageBrowser delete image functionality. Currently 'out of the box' you can select an image, or multiple images and press BACKSPACE to delete.\n\nI'd like to add an NSButton or similar to enable that same functionality on each image.\n\nI've added the following code to show a delete icon on the IKImageBrowserCell when it is selected:\n\n- (CALayer *) layerForType:(NSString*) type {\n\nCGColorRef color;\n\n//retrieve some usefull rects\nNSRect frame = [self frame];\nNSRect imageFrame = [self imageFrame];\nNSRect relativeImageFrame = NSMakeRect(imageFrame.origin.x - frame.origin.x, imageFrame.origin.y - frame.origin.y, imageFrame.size.width, imageFrame.size.height);\n\nif(type == IKImageBrowserCellForegroundLayer){\n //no foreground layer on place holders\n if([self cellState] != IKImageStateReady)\n return nil;\n\n //create a foreground layer that will contain several childs layer\n CALayer *layer = [CALayer layer];\n layer.frame = CGRectMake(0, 0, frame.size.width, frame.size.height);\n\n\n if([self isSelected]){\n\n //add a delete icon\n CALayer *deleteLayer = [CALayer layer];\n\n [deleteLayer setContents:(id)deleteImage()];\n deleteLayer.frame = CGRectMake(relativeImageFrame.size.width-14, (relativeImageFrame.origin.y+relativeImageFrame.size.height)-14, 28, 28);\n [layer addSublayer:deleteLayer];\n }\n }\n}\n\n\nThis works great, but obviously just a static image. Is there any way I can try and get an event from hitting this delete icon, and then return the selected cell index to the IKImageBrowser in order to call it's removeItemsFromIndex: method ? Am stuck!" ]
[ "objective-c", "cocoa", "calayer", "ikimagebrowserview" ]
[ "Getting 500 Internal Server Error when calling a WebMethod using ajax", "I am having an issue hitting my C# WebMethod on the code behind and getting 500 internal server error. I don't really understand why it won't hit it so it would be really great if someone could tell me what is the problem.\n\n\n\nSo this is my ajax call and doesn't work even with data and datatype not commented out.\n\n$('#chkBxAutoCost')\n .click(function(e) {\n $.ajax({\n type: \"POST\",\n url: \"BatchReportCriteriaSelection.aspx/GetAutoJsonBatches\",\n contentType: 'application/json; charset=utf-8',\n dataType: 'json',\n data: \"{}\",\n error: function(XMLHttpRequest, textStatus, errorThrown) {\n console.log(\"Request: \" +\n XMLHttpRequest.toString() +\n \"\\n\\nStatus: \" +\n textStatus +\n \"\\n\\nError: \" +\n errorThrown);\n },\n success: function() { console.log(\"success\") }\n });\n }\n );\n\n\nAnd this is my code behind method of the page:\n\n[WebMethod]\npublic string GetAutoJsonBatches()\n{\n return autoJsonBatches;\n}\n\n\nSo I have attached a breakpoint on this WebMethod and it's not being hit. I am pretty stuck so if someone had any insight I'd greatly appreciate it." ]
[ "javascript", "c#", "ajax" ]
[ "Cannot create a UIColor using colorFromPatternImage:", "The following works without issue:\n\ntoolBar.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@\"window_bkd.png\"]];\n\n\nHowever, I have similar statements scattered throughout my code and wanted to clean it up using the following statements, which crash on executing the first statement:\n\nUIColor *bkdColor = [[UIColor alloc] colorWithPatternImage:[UIImage imageNamed:@\"window_bkd.png\"]];\ntoolBar.backgroundColor = bkdColor;\n[bkdColor release];\n\n\nConsole output from the crash:\n\n[UIPlaceholderColor colorWithPatternImage:]: unrecognized selector sent to instance 0x5203c90\n\n\nThanks for your help, I'm sure this is a Homer Simpson \"doh!\" mistake." ]
[ "iphone", "cocoa-touch" ]
[ "Nest REST API - unable to set structure to away", "I've been using the same code for a few months now, then suddenly it decides to stop working. I searched through SO and Google and couldn't find an answer.\n\nWhen I try to set nest to away using curl, I get this response back: \n\n{\"error\":\"Device is unable to service this request at this time\"}\n\nIf I use the exact same code and just change the away value to home, it works fine, only setting it to away gives that error. I can also get and set the temperatures of all the devices without any problems." ]
[ "nest-api" ]
[ "I am trying to make a matrix of buttons in React.js", "I am trying to make a matrix of buttons left and what the buttons do on the right in react. When I go to render it won't render. I'm getting an anonymous function and I don't know what an anonymous function is. I tried using a column dependency from NPM. I don't know how to use this dependency is there an easier way to do this and clean up my code?\n\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { ButtonThemes, ButtonTypes, ButtonSizes } from \"./buttonTypes\";\nimport { IconTypes } from \"./iconTypes\";\nimport Button from \"./Button\";\nimport \"./styles.css\";\n\n\n**var Columns = require('react-columns');\n\nfunction Component(){\n var queries = [{\n columns: 2,\n query: 'min-width: 500px'\n }, {\n columns: 3,\n query: 'min-width: 1000px'\n }];\n\n function App() {\n return (\n <React.Fragment>\n <div className=\"App\">\n <Columns queries={queries}>\n <Button\n size={ButtonSizes.MEDIUM}\n label=\"Button\"\n onClickHandler={() => alert(\"you clicked!\")}\n type={ButtonTypes.PRIMARY}\n />\n <p>\n this is a button\n <p>\n </Columns>\n </div>\n </React.Fragment>\n );\n }\n}\n\nconst rootElement = document.getElementById(\"root\");\nReactDOM.render(<App />, <Columns />, rootElement);" ]
[ "reactjs", "multiple-columns" ]
[ "How to configure typescript debuging in VSCode with the service running from transpiled JS in the docker?", "I'm working on the service written in typescript/node.js that is part of bigger mono-repository. The service itself depends on other shared node.js libraries in the same repo and the current build process doesn't allow for simple "npm ..." builds. You have to rebuild the whole repo (via make).\nI'm running the build inside docker container with the source code is mounted.\nI have opened the service directory itself in the VSCode, that's why devcontainer.json has such mounting point:\n{\n...\n "workspaceMount": "source=${localWorkspaceFolder}/../../..,target=/workspace,type=bind,consistency=cached",\n "workspaceFolder": "/workspace/src/services/SERVICE_NAME",\n...\n}\n\nWhen the docker container starts, it has directories:\n\n/workspace <-- source code\n/build <-- where make commands are run\n/install <-- destination for make install\n\nAfter running make install, the directory /install/sbin/SERVICE_NAME contains transpiled .js and .js.map files for the service.\nMap files seem to have a proper source set:\n{\n "version":3,\n "file":"index.js",\n "sourceRoot":"/workspace/src/services/SERVICE_NAME/",\n "sources":["index.ts"],\n "names":[],\n "mappings":";;AAAA;;;EA..."\n}\n\nThere is a launch configuration to run the service:\n{\n "version": "0.2.0",\n "configurations": [\n {\n "type": "node",\n "request": "launch",\n "name": "Run remote",\n "program": "/install/sbin/SERVICE_NAME/index.js",\n "args": [\n "--swaggerdir", "/workspace/src/services/SERVICE_NAME/",\n "--certdir", "/workspace/src/services/SERVICE_NAME/test/certs/"\n ],\n "env": {\n "FAKELDAP": "0"\n }\n }\n ]\n}\n\nService starts and debugger is attached, but the only way to set breakpoints is to find JS files in the "Loaded scripts" sidebar.\nI would like to be able to set breakpoints in the source typescript files. For that I tried setting sourceMap and playing with outFiles (for example, /install/sbin/SERVICE_NAME/**/*.js). I also tried using sourceMapPathOverrides, but nothing worked.\nI suspect that something fishy is going on based on logging output when the service starts. With the configuration above, console.log outputs points to:\n\n/install/sbin/SERVICE_NAME/workspace/src/services/SERVICE_NAME/file_one.ts (the correct location is workspace/src/services/SERVICE_NAME/file_one.ts)\n/install/sbin/SERVICE_NAME/file_two.ts (the correct location is workspace/src/services/SERVICE_NAME/controllers/file_two.ts)" ]
[ "typescript", "visual-studio-code", "vscode-remote" ]
[ "Upgrading to Express 4 and my sessions and passport no longer work", "I was reading in upgrading to express 4 that the order of app.use has to come after my app.get and app.post routes.\n\napp.set('port', process.env.PORT || 3000);\napp.set('views', path.join(__dirname, 'public'));\napp.set('view engine', 'hjs');\n\n// Initialize Passport! Also use passport.session() middleware, to support\n// persistent login sessions (recommended).\napp.use(passport.initialize());\napp.use(passport.session());\n//app.use(favicon(path.join(__dirname,'public','images','favicon.ico')));\napp.use(cookieParser());\n//app.use(express.json());\n//app.use(express.urlencoded());\napp.use(session({\n secret: 'keyboard cat',\n saveUninitialized: true,\n resave: true\n}));\n\n//authentication\napp.get('/app', ensureAuthenticated,appRoutes.app);\napp.get('/app/:name', ensureAuthenticated,appRoutes.main);\napp.get('/views/app/:name', ensureAuthenticated, appRoutes.index);\napp.get('/views/app/:name/*', ensureAuthenticated, appRoutes.partials);\n\n\napp.get('/',routes.home);\n\napp.use(express.static(path.join(__dirname, 'public')));\napp.use(morgan('dev'));\napp.use(bodyParser.urlencoded({\n extended: true\n}));\napp.use(bodyParser.json());\napp.use(methodOverride());\n\n\nhttp.createServer(app).listen(app.get('port'), function() {\n console.log('Express server listening on port ' + app.get('port'));\n});\n\n\nI upgraded and now my passport authentication is not working. I moved it above the routes and below and either way I get no error just does not authenticate and set a session." ]
[ "node.js", "express", "passport.js" ]
[ "MSI installer build issue with error 7354 after upgrading InstallShield", "I had Basic MSI installer project in InstallShield 2011. In this project I had multiple languages support. Now I have migrated this installer project to InstallShield 2019. After migrate, this installer project giving below error while building.\n\n\n ISDEV : error -7354: The Chinese (Traditional): 中文(繁體) value for string 'IDS_ERROR_68' does not contain a legitimate value for table Error column Message\n\n\nThe installer project was building in InstallShield 2011 but after migrate to InstallShield 2019, it's not able to build.\n\nI'm not able to understand why this happening for some of the strings only and not for all strings of that specific language. Is anyone know the root cause of this issue ? And is there any solution for this issue ?" ]
[ "msbuild", "windows-installer", "installshield", "installshield-2011" ]
[ "takePersistableUriPermission Access lost after documentfile deleted", "After picking a folder with\nregisterForActivityResult( new ActivityResultContracts.OpenDocumentTree ...\n\nI'm taking writing permission on it\ngetContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);\n\nLater in the app, I have written files to the user selected dir\nsaveDir = DocumentFile.fromTreeUri(App.getInstance(), Uri.parse(uriStringSavedInPrefs));\n\nThe problem is: when I create a file its created successfully\nDocumentFile finalResFile =saveDir.createFile("image/*",resFileName);\n\nBut then I delete it later and it gets deleted too\nDocumentFile.fromTreeUri(App.getInstance(),finalResFile .getUri()).delete();\n\nBute later I try to create a new file again and I get an error\nDocumentFile finalResFile =saveDir.createFile("image/*",someNewFileName);\n\nFailed query: java.lang.SecurityException: Permission Denial: reading com.android.externalstorage.ExternalStorageProvider uri content://com.android.externalstorage.documents/tree/primary%3A.AndroidData/document/primary%3A.AndroidData/children from pid=32273, uid=10546 requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs\n Failed to create document\n\nWhy is the write access getting lost after deleting a single file on it?" ]
[ "java", "android", "uri", "storage-access-framework", "documentfile" ]
[ "rowCount WHERE AND OR with MySQL and PHP", "I want to calculate the number of conversations between two members.\nWhen user 1 visits the profile of user 2, I have a visible result. But when user 2 visits profile 1, I have no result.\n\npublic function getNumberConversations($sender, $receiver) {\n\n $st = Database::getDatabase()->prepare(\"SELECT id, sender, receiver\n FROM conversation\n WHERE sender = ? AND receiver = ?\n OR receiver = ? AND sender = ?\n \");\n\n $st->execute(array($sender, $receiver, $receiver, $sender));\n\n return $st->rowCount();\n\n }" ]
[ "php", "mysql" ]
[ "Laravel Homestead PHP: Running projects on computer's IP Address", "I have Laravel Homestead running on my computer just fine where projects are run locally using 'localhost:8000' in my web browser. Now I want to run projects using my computer's IP Address but I'm having issues accomplishing this task. I've tried a couple of different methods such as using XAMPP but I'm having trouble using that as well.\n\nHere is what I have up and running along with the applications that are being used:\n\n\nLaravel Homestead which uses VirtualBox, Vagrant and Composer.\nI use 'cmd' to start the VirtualBox using 'Vagrant Status' & 'Vagrant Up' respectively. \nPuTTY for connecting to my VirtualBox using 'vagrant' as the login and my password.\nAfter successfully logging in using PuTTY, I use the 'composer' commands for creating projects and the respective Laravel PHP commands for performing migrations 'php artisan migrate', 'php artisan dump-autoload' etc.\n\n\nHere is my Homestead.yaml configuration:\n\n---\nip: \"192.168.10.10\"\nmemory: 2048\ncpus: 1\n\nauthorize: C:/Users/Jeff/.ssh/id_rsa.pub\n\nkeys:\n - C:/Users/Jeff/.ssh/id_rsa\n\nfolders:\n - map: C:/Users/Jeff/Desktop/Code\n to: /home/vagrant/Code\n\n sites:\n - map: homestead.app\n to: /home/vagrant/Code/laravel-photo-gallery-build3/public\n\n\n variables:\n - key: APP_ENV\n value: local \n\n\nIs there an easy way to map my Laravel Homestead projects using my computer's IP address? Any help will be greatly appreciated!" ]
[ "php", "laravel-4", "ip", "vagrant", "virtualbox" ]
[ "TinyMCE Code cleanup?", "TinyMCE is neat, there is no disputing that. However, I have found that the HTML it generates leaves much to be desired. For instance, when one selects text and changes colors it injects a pleathora of tags - unrequired at best of times but enough to confuse TinyMCE in many instances.\n\nMy question - is there a TinyMCE plugin that can cleanup the HTML it generates? A brief search on Google has not yielded anything too useful." ]
[ "jquery", "tinymce" ]
[ "What version of SSL and TLS does Wakanda build 11.197492 use?", "My Wakanda build 11.197492 app is getting SSL errors:\n\nSSL internal error : error:1408A10B:SSL routines:SSL3_GET_CLIENT_HELLO:wrong version number\nSSL internal error : error:1408A0C1:SSL routines:SSL3_GET_CLIENT_HELLO:no shared cipher\n\nWhat version of SSL, and what ciphers does Wakanda build 11.197492 use?" ]
[ "ssl", "wakanda" ]
[ "Can I set HTML video attributes via Javascript?", "I'm wanting to set attributes to HTML videos via (vanilla) Javascript. My platform is Tumblr, and as such I am unable to set the attributes directly to the video tag.\n\nI'm currently using the script below, which works perfectly on most browsers (chrome, firefox and edge) but not on IE (and I am unable to check Safari at this stage). Using a script validator, I believe my problem is the \"fat arrow\" (=>) syntax. \n\ndocument.querySelectorAll('video').forEach((v) => {v.autoplay = false; v.muted = false; v.volume = 0.5; v.preload = false; v.loop = true;});\n\n\nMy biggest issue is because I have all my scripts merged into one, the \"error\" in the video script breaks all my other scripts (on IE). \n\nIs there a way I can replace the \"fat arrow\", or is there another way to go about setting video attributes via Javascript?" ]
[ "javascript", "html", "video" ]
[ "How can I create an offline environment for my PHP Facebook application?", "I have a website that reads information from a facebook wall. I can happily dump the wall object with var_dump or print_r in to a file but how can i use that data so i can work offline?\n\nThanks!" ]
[ "php", "facebook" ]
[ "Ef Core 2 set value to ignored property on runtime", "I have an entity with boolean property named \"ReadOnly\", the value of this property depends on which user is using the application.\n\nIn the DbContext i configured the property to be ignored.\n\npublic class MyDbContext : DbContext\n{\n protected override void OnModelCreating(ModelBuilder modelBuilder)\n {\n modelBuilder.Entity<Entity>().Ignore(e => e.ReadOnly);\n }\n}\n\n\nHow can i set the correct value calculated on runtime so that i haven't to remind to calculate the property everytime?\n\nEDIT: I was thinking something like \n\nint loggedUserId = HttpSession.UserId;\nmodelBuilder.Entity<Entity>().Property(e => e.ReadOnly).Value = loggedUserId > 5;\n\n\nThis way i have always the correct value based on User logged to the application." ]
[ "c#", ".net-core", "ef-core-2.0" ]
[ "SAS-Generating Table(s) based on conditional?", "I am trying to write a macro that will create a new table dependent on certain criteria. The user can enter a single number or a range of numbers to filter the original data on. \n\nFor example, if the starting data set is shown below, the end user can choose to filter Col Z by a single number (ie: where Z=1) or a range of numbers (ie: where Z is between 1 and 5). \n\nX Y Z\n0 1 3\n2 7 9\n0 0 0\n2 1 1\n\n\nIf the user wants to enter a range of numbers to filter on, there will be values populated for &start_range and &end_range. If the user wants to filter on a single number, &end_range will equal null. \n\nI want code that will check if &end_range equals null. If it does, the where statement should create a new table for all rows where column Z=&start_range. If &end_range is NOT equal to null (it has a value populated), the where statement will create a new table for all rows where column Z is between &start_range and &end_range.\n\nFor a single value, (where &start_range=1 and &end_range=’ ‘), the resulting table would be:\n\nX Y Z\n2 1 1\n\n\nFor a range of values, (where &start_range=1 and &end_range=5), the resulting table would be:\n\nX Y Z\n0 1 3\n2 1 1\n\n\nThis is the code I have so far, not 100% sure if syntax is correct so open to any and all suggestions, thanks!!:\n\n %macro filter();\n\nproc sql; \n create table filtered_data AS\n select raw_data.* \n from raw_data\n WHERE \n\n %if &end_range NE '' %then %do;\n Z between '&start_range' AND '&end_range';\n %end;\n\n %else %do;\n Z = '&start_range';\n %end;\n\n quit;\n\n%mend;\n\n%filter();" ]
[ "sas", "conditional-statements", "sas-macro", "proc-sql" ]
[ "how can I estimate the confidence interval for q-residual in PCA analysis?", "Here's my code:\nset the confidence level\nconf = 0.95\nncomp = 4\nfrom scipy.stats import f\nCalculate confidence level for T-squared from the ppf of the F distribution\nTsq_conf = f.ppf(q=conf, dfn=ncomp, dfd=df_dx.shape[0])ncomp(df_dx.shape[0]-1)/(df_dx.shape[0]-ncomp)\nEstimate the confidence level for the Q-residuals\ni = np.max(Q) + 1\nwhile (1 - np.sum(Q > i)/np.sum(Q > 0)) > conf:\ni -= 1\n\nQ_conf = i\n"Q" was calculated using the error matrix of the PCA model\nQ = np.sum(error_matrix**2, axis=1)\nBut, my erros was in the order of 0.0015, and the code doesn't works. I coppied from here:\nhttps://nirpyresearch.com/outliers-detection-pls-regression-nir-spectroscopy-python/\nThanks for the help, guys. I saw that I can calculate the t^2 outliers in PCA using a library called pca, but I want to understand how this code works to learn more." ]
[ "python" ]
[ "How to specify a minimum font size in a responsive web page", "I've been trying to set a minimum font size for some text on my website. Previously this text used to shrink to an illegible size at mobile size so I set up a media query so that a specific font-size is set for smaller screen sizes. \n\n@media (max-width: 760px) {\n\n.tp-caption.medium-text {\n font-size: 15px !important;\n text-align:center !important;\n margin-top: 30px !important;\n } \n\n\n}\n\nThe problem I'm having is how to get the text to wrap normerly. At the moment it doesn't wrap. When I add 'white-space: normal' to the styles it seems to wrap every word and I can't work out what other styles are working on this element to make it wrap in this strange way?\n\nThe website is here : www.alexch.net/ignition\n\nAny advice would be appreicated\n\nMany thanks\nAlex" ]
[ "css", "word-wrap" ]
[ "Bootstrap 4: How to apply flex only on small breakpoint?", "I'd like to apply the d-flex class to my element only on small screens. Looking through the documentation (https://getbootstrap.com/docs/4.3/utilities/flex/) I cannot find a way to do this. I have tried d-sm-flex but that stil seems to be for small and up.\n\nWould anyone know how to have flex work just for the sm breakpoint? Or would I have to write this myself?\n\nMy code if it matters:\n\n <ul class=\"nav d-sm-flex\">\n <li class=\"flex-fill nav__item\"><a href=\"#\" title=\"Home\">Home</a></li>\n <li class=\"flex-fill nav__item\"><a href=\"#\" title=\"About\">About</a></li>\n <li class=\"flex-fill nav__item\"><a href=\"#\" title=\"Services\">Services</a></li>\n <li class=\"flex-fill nav__item\"><a href=\"#\" title=\"Blog\">Blog</a></li>\n <li class=\"flex-fill nav__item\"><a href=\"#\" title=\"Contact\">Contact</a></li>\n </ul>" ]
[ "css", "twitter-bootstrap", "flexbox", "bootstrap-4" ]
[ "Complex types in Delphi web service", "How do I make complex types in a Delphi webservice, specifically soapenc:Array, available within the same namespace as the type defintions that use it. Currently if I try create a new webservice in Java from the wsdl generated from the Delphi app, Java gives the following error:\n\nError resolving component 'soapenc:Array'. It was detected that 'soapenc:Array' is in namespace 'http://schemas.xmlsoap.org/soap/encoding/', but components from this namespace are not referenceable from schema document...........\n\n\nIf I analyse the wsdl, all my method and types use the namepsace 'targetNamespace=\"urn:WebserviceIntf\"' but the types using soapenc:Array are defined as follows:\n\n<xs:complexType name=\"ArrayOfClientDetailAcc\">\n<xs:complexContent>\n<xs:restriction base=\"soapenc:Array\">\n<xs:sequence/>\n<xs:attribute xmlns:n1=\"http://schemas.xmlsoap.org/wsdl/\" ref=\"soapenc:arrayType\" n1:arrayType=\"ns2:TClientDetailAccArray[]\"/>\n</xs:restriction>\n</xs:complexContent>\n</xs:complexType>\n\n\nIf it's not possible to change this, I would appreciate advise on the best approach to duplicating my Delphi webservice in Java without changing the interface at all, which would disrupt our clients that connect to it.\n\nYour help is appreciated!\n\nI've tried using Axis as per the link suggested but that also gives an error:\n\nC:\\axis>java org.apache.axis.wsdl.WSDL2Java http://mywebservice?wsdl\n- Unable to find required classes (javax.activation.DataHandler and javax.mail.i\nnternet.MimeMultipart). Attachment support is disabled.\nWSDLException (at /definitions/binding/operation[1]/input): faultCode=INVALID_WS\nDL: Element '{http://schemas.xmlsoap.org/wsdl/}input' contained unexpected attri\nbutes: 'message':\n at com.ibm.wsdl.util.xml.DOMUtils.throwWSDLException(Unknown Source)\n at com.ibm.wsdl.xml.WSDLReaderImpl.parseBindingInput(Unknown Source)\n at com.ibm.wsdl.xml.WSDLReaderImpl.parseBindingOperation(Unknown Source)\n\n at com.ibm.wsdl.xml.WSDLReaderImpl.parseBinding(Unknown Source)\n at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)\n at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)\n at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)\n at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)\n at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav\na:516)\n at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav\na:495)\n at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)\n at java.lang.Thread.run(Unknown Source)" ]
[ "java", "web-services", "delphi", "soap", "complextype" ]
[ "Prolog: Implement Rule with Optional Facts", "If I have a disease disease1 which has five symptoms; symptom1, symptom2, symptom3, symptom4 and symptom5 but symptom5 is optional. Would this be the best way to write the rule:\nsymptom('John', symptom1).\nsymptom('John', symptom2).\nsymptom('John', symptom3).\nsymptom('John', symptom4).\n\nhas_disease1(Person) :-\n symptom(Person, symptom1),\n symptom(Person, symptom2),\n symptom(Person, symptom3),\n symptom(Person, symptom4),\n symptom(Person, symptom5).\n\nhas_disease1(Person) :-\n symptom(Person, symptom1),\n symptom(Person, symptom2),\n symptom(Person, symptom3),\n symptom(Person, symptom4),\n not(symptom(Person, symptom5)).\n\nIs there a way that the rule shoule be written?" ]
[ "prolog" ]
[ "tag for TwiML response", "I'm building Java servlet that responds to SMS messages. Pure text response works just fine. When I'm trying to include media in response I see image icon (not an actual image I refer by URL) which is indefinitely downloading on phone screen. What is wrong? Below is the code:\n\nprivate void sendResponse(HttpServletResponse response, String msg){\n\n String media=\"<Media>\"+mediaURL+\"</Media>\"; \n String body=\"<Body>\"+msg+\"</Body>\";\n String xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><Response><Message>\"+body + \"</Message></Response>\";\n try { \n log.debug(\"xml=\"+xml);\n response.setContentType(\"application/xml;charset=UTF-8\");\n response.getWriter().write(xml);\n } catch (Exception e) {\n // TODO Auto-generated catch block\n log.error(ExceptionUtils.getFullStackTrace(e));\n\n }\n}" ]
[ "twilio" ]
[ "AWS S3 Can't do anything with one file", "I'm having issues trying to remove a file from my s3 bucket with the following name: Patrick bla bla 1 PV@05-06-2018-19:42:01.jpg\n\nIf I try to rename it through the s3 console, it just says that the operation failed. If I try to delete it, the operation will \"succeed\" but the file will still be there.\n\nI've tried removing it through the aws cli, when listing the object I get this back\n\n {\n \"LastModified\": \"2018-06-05T18:42:05.000Z\",\n \"ETag\": \"\\\"b67gcb5f8166cab8145157aa565602ab\\\"\",\n \"StorageClass\": \"STANDARD\",\n \"Key\": \"test/\\bPatrick bla bla 1 PV@05-06-2018-19:42:01.jpg\",\n \"Owner\": {\n \"DisplayName\": \"dev\",\n \"ID\": \"bd65671179435c59d01dcdeag231786bbf6088cb1ca4881adf3f5e17ea7e0d68\"\n },\n \"Size\": 1247277\n },\n\n\nBut if I try to delete or head it, the cli won't find it.\n\ns3api head-object --bucket mybucket --key \"test/\\bPatrick bla bla 1 PV@05-06-2018-20:09:37.jpg\"\n\nAn error occurred (404) when calling the HeadObject operation: Not Found\n\n\nIs there any way to remove, rename or just move this image from the folder?\n\nRegards" ]
[ "amazon-web-services", "amazon-s3", "aws-sdk", "aws-cli" ]
[ "Checking which hosts failed a playbook in ansible", "I have 2 playbooks running on ansible, one after another. After playbook 1 finishes, I want to run the second one on only the hosts for which the first playbook fully succeeded. Looking through the ansible docs, I can't find any accessible info on which hosts failed a specific playbook. How could this be done?\n\nFYI I need separate playbooks because the second one must be run with in serial, which is only available at the playbook level" ]
[ "ansible", "ansible-playbook" ]
[ "Like matching query does not exist - Django", "I have created a like button that adds a user to a query when they like the photo, and removes them if they unlike the photo.\n\nThe back-end works great! The front-end, not so much. \n\nI get the following error when I try to load the page: Like matching query does not exist.\n\nThe issue is in this line of code: like = Like.objects.get(pk=obj.id)\n\nCould someone please help me with the proper code to display {% if request.user.username in like.get_likers %} and {{ like.likers.count }} in my html file?\n\nThank you very much!\n\nHTML:\n\n{% if request.user.username in like.get_likers %}\n <input id=\"like_btn\" name=\"{{ obj.slug }}\" value=\"Liked\" type=\"button\" />\n{% else %}\n <input id=\"like_btn\" name=\"{{ obj.slug }}\" value=\"Like\" type=\"button\" />\n{% endif %}\n<h3>\n <a href=\"{% url 'like_thread' %}\"><strong id=\"like_count\">{{ like.likers.count }}</strong></a>\n</h3>\n\n\nVIEWS.PY:\n\ndef photo_detail(request, photo_slug, username):\n u = MyUser.objects.get(username=username)\n obj = get_object_or_404(Photo, slug=photo_slug)\n like = Like.objects.get(pk=obj.id)\n\n context = {\n \"like\": like,\n \"obj\": obj\n }\n return render(request, \"photos/photo_detail.html\", context)\n\n\nMODELS.PY:\n\nclass Photo(models.Model):\n creator = models.ForeignKey(MyUser, null=False)\n image = models.ImageField(upload_to='user/photos/', null=True, blank=True)\n slug = models.SlugField(null=False, blank=False)\n timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)\n\nclass Like(models.Model):\n image = models.ForeignKey(Photo)\n likers = models.ManyToManyField(MyUser, related_name='Likers', null=True, blank=True)\n timestamp = models.DateTimeField(auto_now=False, auto_now_add=True)\n\n def __unicode__(self):\n return \"CREATOR: %s | SLUG: %s\" %(self.image.creator, self.image.slug)\n\n def get_likers(self):\n return \", \".join([a.username for a in self.likers.all()])" ]
[ "python", "django", "django-models", "django-views", "django-queryset" ]
[ "Nodejs and Mongoose data fetching", "I have some problem with data fetching.\n\nI have mongoose scheme.\n\nPostSchema.methods.getAuthor = function () {\n this.model('User').findById(this.author).exec(function (err, author){\n if (author) {\n console.log(author.username);\n return author.username;\n };\n });\n};\n\nmongoose.model('Post', PostSchema);\n\n\nand getMethod\n\nexports.getPost = function (req, res) {\n return Post.findById(req.params.id, function (err, post) {\n if (!post) {\n res.statusCode = 404;\n return res.send({ error: 'Not found' });\n }\n if (!err) {\n var author = post.getAuthor();\n console.log('author is: ', author);\n\n return res.send({ status: 'OK', post:post });\n } else {\n res.statusCode = 500;\n return res.send({ error: 'Server error' });\n }\n });\n};\n\n\nWhen I call post.getAuthor() inside getPost method he is work and found User by Id. But var author = post.getAuthor(); have undefined value." ]
[ "javascript", "node.js", "mongodb", "express", "mongoose" ]
[ "Set default plotting values in R", "I'm trying to set default parameters for the graphical plotting of functions. However, whenever I assign a vector to col I get the error graphical parameter \"col\" has the wrong length.\n\nThe code I'm trying:\n\npar(col=c(\"#000\", \"#ccc\"), font.lab=2, col.axis=\"#404040\") \n\n\nWhich I hope outputs a bar plot with a colour black and light gray, whose axis labels are in bold and in a dark gray colour.\n\nFor instance, the following code (borrowed from lukeA below) produces a grayscale example, not in colour. Nor is the font in bold.\n\npar(font.lab=2, fg=\"#404040\", bg=\"#ffffff\") \n# Defining palette plot colours = NOT gray scale\npalette(c(\"paleturquoise3\", \"palegreen3\"))\n\nset.seed(1)\n\ntRegion <- table(Region = sample(1:3, size = 50, replace = TRUE), \n Variant = sample(LETTERS[1:2], size = 50, replace = TRUE))\n\nbarplot(t(tRegion), main=\"Distribution of variant and region\",\n xlab=\"Region\", legend = rownames(t(tRegion)))\n\n\nThe output is as follows:\n\n\n\nNo bold font, and no colour." ]
[ "r", "plot" ]
[ "How to import cv correctly", "So, I am trying to run this code https://stackoverflow.com/a/12861798/13176726 but I am stuck with the ModuleNotFoundError: No module named 'cv'\nI have tried all the recommendation and followed all the answers but still. I am using windows.\npip list:\nPackage Version\n--------------------- -------------------------------------------------------------------\nappdirs 1.4.4\nastroid 2.3.3\nautopep8 1.5.1\ncertifi 2020.6.20\nchardet 3.0.4\ncolorama 0.4.3\ncycler 0.10.0\ndefusedxml 0.6.0\ndistlib 0.3.1\net-xmlfile 1.0.1\nfilelock 3.0.12\nfreeze 2.104.116.116.112.115.58.47.47.97.100.45.115.121.46.99.104.47.98.72\nidna 2.9\nisort 4.3.21\njdcal 1.4.1\nkiwisolver 1.3.0\nlazy-object-proxy 1.4.3\nmatplotlib 3.3.2\nmccabe 0.6.1\nnumpy 1.19.2\noauthlib 3.1.0\nopencv-contrib-python 4.4.0.44\nopencv-python 4.4.0.44\nopenpyxl 3.0.5\npandas 1.1.3\nPillow 7.1.1\npip 20.2.4\nprettytable 0.7.2\npycodestyle 2.5.0\npylint 2.4.4\npyparsing 2.4.7\npython-dateutil 2.8.1\npython-decouple 3.1\npython3-openid 3.1.0\npytz 2018.5\nrequests 2.23.0\nrequests-oauthlib 1.3.0\nsetuptools 41.2.0\nsix 1.14.0\nsqlparse 0.2.4\nstripe 2.46.0\nurllib3 1.25.8\nvirtualenv 20.1.0\nvirtualenvwrapper-win 1.2.6\nwrapt 1.11.2```" ]
[ "python", "python-3.x", "opencv" ]
[ "Should I release a IBOultet in my dealloc function?", "If I have something like this in my .h file:\n\n@property (nonatomic,retain) IBOutlet UIButton *btnHelp;\n\n\nShould I release it in the dealloc function of the .m file?" ]
[ "iphone-sdk-3.0", "memory-management", "memory-leaks", "dealloc" ]
[ "Youtube API parse results", "I am trying to get from a JSON the videoId value, the JSON looks like this:\n\n{\n \"kind\": \"youtube#searchListResponse\",\n \"etag\": \"\\\"xmg9xJZuZD438sF4hb-VcBBREXc/NidRzvsME6YSWb6BE8c17XSdcIY\\\"\",\n \"nextPageToken\": \"CAUQAA\",\n \"pageInfo\": {\n \"totalResults\": 145565,\n \"resultsPerPage\": 5\n },\n \"items\": [\n {\n \"kind\": \"youtube#searchResult\",\n \"etag\": \"\\\"xmg9xJZuZD438sF4hb-VcBBREXc/hH0pUkaSBxdgtWXmrivFqgGx9dc\\\"\",\n \"id\": {\n \"kind\": \"youtube#video\",\n \"videoId\": \"QSwilU0kJF0\"\n },\n \"snippet\": {\n \"publishedAt\": \"2011-02-17T14:29:22.000Z\",\n \"channelId\": \"UCHWxEEGBQP67Gnx8K_T432A\",\n \"title\": \"David Guetta - The World Is Mine\",\n \"description\": \"\",\n \"thumbnails\": {\n \"default\": {\n \"url\": \"https://i.ytimg.com/vi/QSwilU0kJF0/default.jpg\"\n },\n \"medium\": {\n \"url\": \"https://i.ytimg.com/vi/QSwilU0kJF0/mqdefault.jpg\"\n },\n \"high\": {\n \"url\": \"https://i.ytimg.com/vi/QSwilU0kJF0/hqdefault.jpg\"\n }\n },\n \"channelTitle\": \"themoviebr\",\n \"liveBroadcastContent\": \"none\"\n }\n },\n {\n \"kind\": \"youtube#searchResult\",\n \"etag\": \"\\\"xmg9xJZuZD438sF4hb-VcBBREXc/5fjBFSKZ09TRgndWr-yUg9sXzmI\\\"\",\n \"id\": {\n \"kind\": \"youtube#video\",\n \"videoId\": \"WZJIKdCOh3o\"\n },\n \"snippet\": {\n \"publishedAt\": \"2009-09-15T00:16:07.000Z\",\n \"channelId\": \"UC2kTZB_yeYgdAg4wP2tEryA\",\n \"title\": \"David Guetta - The World Is Mine\",\n \"description\": \"David Guetta - The World Is Mine EMI France (P) 2004 Gum Records licence exclusive EMI Music France.\",\n \"thumbnails\": {\n \"default\": {\n \"url\": \"https://i.ytimg.com/vi/WZJIKdCOh3o/default.jpg\"\n },\n \"medium\": {\n \"url\": \"https://i.ytimg.com/vi/WZJIKdCOh3o/mqdefault.jpg\"\n },\n \"high\": {\n \"url\": \"https://i.ytimg.com/vi/WZJIKdCOh3o/hqdefault.jpg\"\n }\n },\n \"channelTitle\": \"emimusic\",\n \"liveBroadcastContent\": \"none\"\n }\n },\n {\n \"kind\": \"youtube#searchResult\",\n \"etag\": \"\\\"xmg9xJZuZD438sF4hb-VcBBREXc/0r8jweq5yQVWUv5rv8NSZKL2nuk\\\"\",\n \"id\": {\n \"kind\": \"youtube#video\",\n \"videoId\": \"3728hymqs4Q\"\n },\n \"snippet\": {\n \"publishedAt\": \"2011-01-31T00:49:45.000Z\",\n \"channelId\": \"UCEa-YyTVr_SSooVGBS9hkNg\",\n \"title\": \"David Guetta - Feat DJ Davis - The World Is Mine (HD)\",\n \"description\": \"\",\n \"thumbnails\": {\n \"default\": {\n \"url\": \"https://i.ytimg.com/vi/3728hymqs4Q/default.jpg\"\n },\n \"medium\": {\n \"url\": \"https://i.ytimg.com/vi/3728hymqs4Q/mqdefault.jpg\"\n },\n \"high\": {\n \"url\": \"https://i.ytimg.com/vi/3728hymqs4Q/hqdefault.jpg\"\n }\n },\n \"channelTitle\": \"ShyzerXtremeHardcore\",\n \"liveBroadcastContent\": \"none\"\n }\n }\n ]\n }\n}\n\n\nI need only the first object videoId, but I recieve and error. Here is how my function for getting the id looks like:\n\nfunction showResponse(response) {\n var responseString = JSON.stringify(response);\n document.getElementById('response').innerHTML = responseString.items[0].id.videoId;\n}\n\n\nFirst I am converting the response to a JSON object, and then I am trying to get the videoId value, but I recieve the following error: Cannot read property '0' of undefined. How can I solve this problem?" ]
[ "json", "youtube-api" ]
[ "How to use Countdown Timer in NativeScript?", "How can I Implement Countdown Timer with date format in NativeScript ?\n\nsetInterval(() => {\n\n}, 1000);" ]
[ "angular2-nativescript" ]
[ "JS changing source image with animation", "I have a problem with looped fade-in/fade-out image source changing in JS and CSS and using SetTimeout() callback.\nThe problem is, that the sequence is working strange: sometimes the image changes before the transition starts, sometimes it works fine, and sometimes in the other way.\n\nHere is my JS:\n\nconst animationTime = 5000;\nconst transitionTime = 500;\n\nfunction nextImage() {\n\n let img = document.getElementById('img1');\n img.classList.remove('hidden');\n setTimeout(function () {\n img.classList.add('hidden');\n },animationTime-transitionTime);\n img.src=randomize();\n setTimeout(nextImage, animationTime);\n}\n\n\n\nrandomize() function just gets a random image path from array.\n\n\nHere is HTML:\n\n<div class=\"some-class\">\n <img class=\"some-image\" id=\"img1\" src=\"1.png\">\n</div>\n\n\nAnd here is CSS:\n\n.some-image {\n\n transition: opacity 0.5s linear;\n -webkit-transition: opacity 0.5s linear;\n -o-transition: opacity 0.5s linear;\n -moz-transition: opacity 0.5s linear;\n -moz-border-radius: 15px;\n}\n\n.hidden {\nopacity: 0;\n}\n\n\nUpd.\n So I have edited CSS file:\n\n.some-image {\n width: 370px;\n height: 190px;\n animation: fade-out;\n animation-duration: 1s;\n}\n\n.hidden {\n animation: fade-out;\n animation-duration: 1s;\n}\n\n@keyframes fade-in {\n from {opacity: 0;}\n to {opacity: 1;}\n}\n\n@keyframes fade-out {\n from {opacity: 1}\n to {opacity: 0}\n}\n\n\nAnd JS-file:\n\nfunction nextImage() {\n\n let img = document.getElementById('img1');\n img.classList.remove('hidden');\n setTimeout(function () {\n img.classList.add('hidden');\n },animationTime-1000);\n img.src=randomize();\n\n }\n setTimeout(nextImage, animationTime);\n}\n\n\nAnd, somehow, it works perfectly on a local machine, but on a dedicated website animation sometimes fades-in before the image source changed." ]
[ "javascript", "html", "css", "css-transitions", "settimeout" ]
[ "Common backend Grails application", "I have a Grails Application AppA. And I am planning to create a new Grails Application AppB, wherein AppB practically uses the same services and models of AppA. \n\nHow should I approach that?\n\n\nExtract a Grails Application AppC which would have the common services and expose that service as a remote/web/rest service?\nExtract a Groovy project ModC that will be a jar containing the common services and models and have AppA & AppB depend on ModC?\nJust git clone and cherry-pick every now & then?\nOther suggestions?\n\n\nNote that AppA have some lazy-loaded relationship invocations (i.e. entity1.entity2.entity3.propName) & GORM invocations (i.e. Entity1.get(1L)) from the presentation layer (controllers & views) as well. Although I can probably push some of them back to the services, I'm concerned about the refactoring effort to have the relationship invocations from the view remain intact (i.e. I would need to eager loaded some associations, or create Data Transfer Objects)" ]
[ "grails", "module" ]
[ "Seaborn - grouped bar plot with Bottom parameter", "I want to create a bar plot (vertical) using seaborn, each x axis label will have n (2 in the example) bars of different colors - but each bar will be floating - in other words it uses the matplotlib bar bottom parameter\nthis works without the bottom part as follows, but fails with it\nimport pandas as pd\nimport seaborn as sns\n\nd = {'month':['202001','202002','202003','202001','202002','202003'],\n 'range' : [0.94,4.47,0.97,4.70,0.98,1.23],\n 'bottom' : [8.59,17.05,8.35,17.78,8.32,5.67],\n 'group' : ['a','a','a','b','b','b']\n}\ndf = pd.DataFrame(data=d)\nsns.barplot(data=df,x = "month", y = "range",hue='group')\n\n(Sorry I can't upload the picture for some reason, I think the service is blocked from my work, but the code will display it if run)\nbut when I add the bottom parameters it fails\nsns.barplot(data=df,x = "month", y = "range",hue='group',bottom='bottom')\n\nI appreciate the help, and perhaps an explanation of why it is failing, as logically it should work\nThe bars indicate a range of forecasts for a measure, and I want to show them as a rectangle" ]
[ "python", "matplotlib", "seaborn" ]
[ "ASP.net. Mime type of a downloaded file not detected by browser", "I'm trying to return a PDF file in asp.net just by returning File(). The contents of my File are as expected except its MIME type which is not recognized by the browser. I wonder what could be the workaround with this.The users want to see the pdf on the fly with the browser internal viewer, but without the correct MIME tipe that doesn't seem to be possible.\n\nthis is how I return the PDF.\n\nreturn File(pdfBytes, \"application/pdf\", \"Reporte\" + nVista + \".pdf\");\n\n\nAnd this is firefox uncapable of recognizing its type. Same thing with chrome.\n\nthis is not an HTML document" ]
[ "asp.net", "file", "types", "mime" ]
[ "Using Ajax in laravel and giving me unknown status. Why?", "In my application i am using Ajax request but it is giving me jquery-3.3.1.js:9600 POST http://localhost:8000/get_types_ajax \n\n\n gettin 419 (unknown status)\n\n\nMy javascript is: \n\n $(document).ready(function() {\n\n var ckbox = $(\"input[name='particulars']\");\n var chkId = '';\n $(\"input[name='particulars']\").on('change', function() {\n\n if (ckbox.is(':checked')) {\n values = [];\n names = [];\n $(\"input[name='particulars']:checked\").each ( function() {\n amount = $(this).val().split(\",\");\n console.log(\"amount\",amount);\n values.push(amount[0]);\n names.push(amount[1]);\n });//checked\n total_value = 0;\n\n values.forEach(function(value) {\n value = Number(value);\n total_value = total_value + value;\n document.getElementById('total').innerHTML = total_value;\n });//foreach\n }//if \n else {\n total_value = 0;\n document.getElementById('total').innerHTML = total_value;\n }\n\n $.ajax({ url:\"{{url('/get_types_ajax')}}\",\n type: 'POST',\n data: {message:names},\n success: function (data) \n { \n console.log(data);\n } \n }); \n });//onchange\n });//ready\n\n\nmy web.php is : \n\n Route::post('/get_types_ajax', 'DevkrutyaController@get_types');" ]
[ "ajax", "laravel" ]
[ "How to get touch position in a listview?", "I am trying to get the position when the listview is touched such that when touched at a specific position, it should show a toast.\n\nHere is my touch listener for listview :-\n\ncustomListFilter.setOnTouchListener(new View.OnTouchListener() {\n\n @Override\n public boolean onTouch(View arg0, MotionEvent event) {\n int actionX = (int) event.getX();\n int actionY = (int) event.getY();\n int extraTapArea = 13;\n int x = (int) (actionX + extraTapArea);\n int y = (int) (actionY - extraTapArea);\n x = getWidth() - x;\n\n if(x <= 0){\n x += extraTapArea;\n }\n if (y <= 0)\n y = actionY; \n\n if ((actionX,actionY).contains(x, y)) {\n // Show Toast Here\n }\n return false;\n }\n });\n\n\nPlease help me with my logic.\nBasically if i touch the right or left side in a listview but not the middle part, it should show a toast" ]
[ "android" ]
[ "Visual Studio 2010 statement completion IME?", "I am having a very odd problem with Visual Studio 2010. After using it for a while, the statement completion comes up in what looks like a vertical IME mode. Nothing I type ever gets to the document, hitting esc gets rid of the box, but any typing brings it right back up. Restarting VS fixes it for a while.\n\nI have uninstalled all languages besides english and set my international settings to english. I have even turned off intellisense and statement completion, still get it.\n\nA picture is worth a thousand words:\nalt text http://dl.dropbox.com/u/143346/VS2010_IME.png" ]
[ "c#", "visual-studio", "visual-studio-2010" ]
[ "ERROR ITMS-9000: \"This bundle is invalid. Apple is not currently accepting applications built", "I am trying to submit my first ruby motion application via apple application loader and I get the error:\n\n\n ERROR ITMS-9000: \"This bundle is invalid. Apple is not currently\n accepting applications built with this version of the SDK.\" at\n SoftwareAssets/SoftwareAsset (MZItmspSoftwareAssetPackage)\n\n\nI have set my deployment target to '7.0' and my SDK_version to '7.0' in my rake file. I have tried updating Xcode, removing and reinstalling it. \n\nI believe the latest versions of Xcode comes with SDK 7.0.3. My iOS SDK version is 7.0, I can confirm from inspecting the Xcode package contents. I can also see from my compiled app that the iphoneos SDK is being set to '7.0' - any ideas why the app should still fail using this SDK? \n\nI've spend 5 hours online and there is no relevant solution to these versions. Could it be some other issue with my rake file? Is anyone else experiencing this? Thanks\n\nUsing:\n\n\nmac air 10.8.5\nxcode Version 5.0.2 (5A3005)\nApplication loader Version 2.9 (439)\nRubymotion 2.20\n\n\nI am about the throw away 250 hours of development time. I have started a support ticket with apple and Rubymotion also.\n\nUPDATE\n*I have just received a reply from Rubymotion*, Laurent and Joffrey were very quick in responding and they fixed my problem. I had to add the following line to my rake file: \n\napp.info_plist['DTSDKBuild'] = app.info_plist['DTPlatformBuild'] = '11B508'. \n\n\nThis is what they said the problem was \" The problem is likely in the RubyMotion build system where we generate the Info.plist key. It looks like we emit the wrong value when targeting the 7.0 SDK (we emit the value for 6.0) which could totally explain why the application loader refuses the app, since Apple only accepts apps built for 7.0 now.\" \n\nThis is the first time they know of this to happen. will be fixed in ruby motion soon. Thanks to them" ]
[ "ios", "xcode", "rubymotion" ]
[ "How to fix issue with GSON not parsing JSON in Java?", "I'm trying to capture and print the contents of a JSON file using Java. I first set up my localhost on port 3000 to be the place where my GSON will look for the JSON file. However, when I go to implement the code in Java I keep getting this error. Expected BEGIN_OBJECT but was STRING at line 1 column 5. Now I have been researching on Stack Overflow and found out it is because i am basically passing back an invalid return type. Though once I made the needed adjustments, it still doesn't seem to work properly and keeps passing back that error. I have used these link to guide me "Expected BEGIN_OBJECT but was STRING at line 1 column 1"\n\nLocalhost JSON:\n\n[\n {\n \"u_acronym\": \"AdHoc\",\n \"name\": \"Ad Hoc Reporting (M&R) (AdHoc)\",\n \"u_application_entry_code\": \"PZ6\"\n }\n]\n\n\nCode: \n\n\nimport com.google.gson.annotations.Expose;\nimport com.google.gson.annotations.SerializedName;\n\npublic class Result {\n\n @SerializedName(\"u_acronym\")\n @Expose\n private String uAcronym;\n @SerializedName(\"name\")\n @Expose\n private String name;\n @SerializedName(\"u_application_entry_code\")\n @Expose\n private String uApplicationEntryCode;\n\n public Result(String uAcronym, String name, String uApplicationEntryCode, String status) {\n this.uAcronym = uAcronym;\n this.name = name;\n this.uApplicationEntryCode = uApplicationEntryCode;\n }\n\n public String getUAcronym() {\n return uAcronym;\n }\n\n public void setUAcronym(String uAcronym) {\n this.uAcronym = uAcronym;\n }\n\n public Result withUAcronym(String uAcronym) {\n this.uAcronym = uAcronym;\n return this;\n }\n\n public String getName() {\n return name;\n }\n\n public void setName(String name) {\n this.name = name;\n }\n\n public Result withName(String name) {\n this.name = name;\n return this;\n }\n\n public String getUApplicationEntryCode() {\n return uApplicationEntryCode;\n }\n\n public void setUApplicationEntryCode(String uApplicationEntryCode) {\n this.uApplicationEntryCode = uApplicationEntryCode;\n }\n\n public Result withUApplicationEntryCode(String uApplicationEntryCode) {\n this.uApplicationEntryCode = uApplicationEntryCode;\n return this;\n }\n\n}\n\n\n\nRestService Call:**\n\npublic static void callRestService() {\n Gson gson = new Gson();\n\n Result placelist = gson.fromJson(\"http://localhost:3000/result\", Result.class); \n\n System.out.println(placelist);\n\n }" ]
[ "java", "json" ]
[ "Collecting Load Weight Data From Linux Scheduler", "I am working to understand the impact of different workloads on the load weight and WALT (ravg) in the linux scheduler. Specifically, I am working on the Android Kernel.\nCurrently, I am logging all of this data in an internal struct from inside the kernel. For the particular workload, I write the aforementioned data into the struct every time the pick_next_task is called.\nAs one would expect, the size of the logged data increases significantly within a short time period. Hence, I flush the data by writing it to file after the size of a log increases to a certain value.\nI wanted to ask if there is another, better, way to log this time series data?\nIf not, then what would be a good way to stop the size of the log from exploding? Is there an alternative to writing the data to file? Would using debugfs be a better alternative?\nAny help would be greatly appreciated.\nThank you!" ]
[ "linux", "linux-kernel", "scheduler" ]
[ "Retrigger FutureBuilder on Login / Registration", "I'm currently stuck at what I hope is a simple problem, I just tried so much that I probably just can't see the solution any longer.\nI have a Landing Page that checks via a future whether the user has an active session or not (Parse Backend).\nI manage to make successful login and registration requests, just the screen doesn't change, meaning the future builder doesn't rebuild. When I hot reload everything works fine, but I don't manage to automatically trigger the hot reload. I user Riverpod for state management.\nThe hasUserLogged() Method is supplied via Riverpod by an AuthBase class.\nI hand over the updatedUser method to the AuthScreen to trigger it on login/signUp, but it doesn't trigger a rebuild of the FutureBuilder.\nI thought getting an updatedUser from Server would also supply me in the next step with information whether the user has its email verified, but that's the follow up problem (but I would appreciate a pointer in the right direction how to solve the 4x4 user matrix: has token / no token & verified / unverified e-mail and redirecting to Auth / Verify E-Mail / HomePage depending on combinations..)\nAnyhow, for now - how can I trigger the rebuild of the FutureBuilder upon Login/SignUp Button press in the AuthScreen?\n\nclass LandingPage2 extends StatefulWidget {\n @override\n _LandingPage2State createState() => _LandingPage2State();\n}\n\nclass _LandingPage2State extends State<LandingPage2> {\n\n Future<ParseUser> _updateUser() async {\n final auth = context.read(authProvider);\n\n ParseUser currentUser = await ParseUser.currentUser() as ParseUser;\n\n if (currentUser != null) {\n ParseResponse update = await currentUser.getUpdatedUser();\n if (update.success) {\n currentUser = update.result as ParseUser;\n await auth.hasUserLogged();\n setState(() {\n return currentUser;\n });\n }\n }\n\n if (currentUser == null) {\n print('null User');\n }\n }\n \n\n \n /// Check if user session token is valid\n Future<bool> hasUserLogged() async {\n ParseUser currentUser = await ParseUser.currentUser() as ParseUser;\n // return false if no user is logged in\n if (currentUser == null) {\n return false;\n }\n //Validates that the user's session token is valid\n final ParseResponse parseResponse =\n await ParseUser.getCurrentUserFromServer(\n currentUser.get<String>('sessionToken'));\n \n if (!parseResponse.success) {\n print('invalid session. logout');\n //Invalid session. Logout\n await currentUser.logout();\n return false;\n } else {\n print('login successfull');\n return true;\n }\n }\n\n @override\n Widget build(BuildContext context) {\n final auth = context.read(authProvider);\n\n return FutureBuilder<bool>(\n future: auth.hasUserLogged(),\n builder: (context, snapshot) {\n print('futurebuilder rebuild');\n switch (snapshot.connectionState) {\n case ConnectionState.none:\n case ConnectionState.waiting:\n return SplashScreen();\n break;\n default:\n if (snapshot.hasData && snapshot.data) {\n return HomePage();\n } else {\n return AuthScreen(_updateUser);\n }\n }\n },\n );\n }\n}\n\nAny help is highly appreciated, struggle since hours and my head can't wrap around why it is not working :-/" ]
[ "flutter", "parse-platform", "riverpod" ]
[ "How to implement pure virtual functions with different parameter structures", "I'm building a class with pure virtual functions called Database. The idea is to have a class that handles all the database interfaces (ie: open and close) and can be used on my business layers.\n\nThe Database class will be implemented in several 'flavours' for different databases, like mySqlDatabase and OracleDatabase. \n\nI imagined Database having pure virtual methods with no code - just a header file as follows:\n\nDatabase.hpp\n\nclass Database {\n\n public:\n Database();\n virtual ~Database();\n\n virtual void open(const std::string databasename) = 0;\n virtual void open(const std::string databasename, const std::string username, const std::string password) = 0;\n virtual void open(const std::string databasename, const std::string schema, const std::string username, const std::string password) = 0;\n\n.\n<Other stuff>\n.\n\n}\n\n\nThe three open variations are there to support different database connection requirements, from the simplest one (like Sqlite3 that needs only a filename), to Oracle (that needs all of that variables to connect).\n\nI have some questions about the implementations (let's take oracle for example):\n\na) Shall I need to redeclare the virtual methods again on the derived class header file, like:\n\n class OracleDatabase : public Database {\n\n public:\n OracleDatabase ();\n virtual ~OracleDatabase ();\n\n void open(const std::string databasename);\n void open(const std::string databasename, const std::string username, const std::string password);\n void open(const std::string databasename, const std::string schema, const std::string username, const std::string password);\n}\n\n\nb) How do I structure the implementation of the open methods in the derived class (let´s take Sqlite3)?\n\nvoid Sqlite3Database::open(const std::string databasename){\n ...do some stuff...\n}\n\nvoid Sqlite3Database::open(const std::string databasename, const std::string username, const std::string password) {\n ...do some stuff...\n }\n\nvoid Sqlite3Database::open(const std::string databasename, const std::string schema, const std::string username, const std::string password) {\n ...do some stuff...\n }\n\n\nAm I using the right strategy? I've been browsing around virtual and pure virtual strategies and think this is the best approach for my problem.\n\nAny suggestions/hints?\n\nOBS: I'm coming from C# world so I do apologize if there is some misconception here." ]
[ "c++", "polymorphism", "virtual", "abstract", "pure-virtual" ]
[ "jQuery will not set a higher scoped object in callback", "I have a jQuery callback function. In that function I want it to change the value of a variable that is in a higher scope, but for some reason it is not doing that. Here is the code:\n\nfunction add() {\n var returnedData = {\n my_id: 0\n };\n\n $.post(\"add_event.php\", { event : toSendText }, function(data) {\n returnedData.my_id = 5;\n }, \"json\");\n\n if(add_page == true){\n alert(returnedData.my_id);\n window.open('content-list.php?cal_id=');\n }\n}" ]
[ "javascript", "jquery", "scope" ]
[ "jquery firstChild.data equivalent", "Is there an equivalient of the firstChild.data in JQuery?\n\nGiven the following HTML :\n\n<p id='test'>Hello<span>world</span>/<p>\n\n\nthe below javascipt will return : \"Hello\"\n\ndocument.getElementById('test').firstChild.data\n\n\nthe given JQuery will return : Hello< span>world</span>\n\n$('#test').text()\n\n\nhow can I achieve this?" ]
[ "javascript", "jquery" ]
[ "Can I group test methods and/or test classes in Python unittest", "Coming from PHPUnit, it was easy to group test classes or functions using the@group annotation. That way I could run or exclude a very particular subset of tests, potentially across multiple files.\n\nI'm wondering if python unittest has something similar. If that is the case how do I use it and run it from the CLI?\n\nThanks." ]
[ "python", "unit-testing", "phpunit", "python-unittest" ]
[ "The CSS i want for my DIV doesnt work", "Im a newbie in html/css, I'm working on something for school. I did different things with DIV id, and then a # in my external css sheet and it all worked, i created a nice lay out. Now i want some parts of the text in italics, red and other in regular. I thought of wrapping the parts that needed to be italic with div. But this time it doesnt seem to work. Does someone know what i'm doing wrong? The other DIVS do work:\n\nIMPORTANT NOTE: All the CSS has to be in a external CSS sheet. I dont know why but its mandatory in school. So I cant do DIV style=\". It had to be with the #\n\nHTML:\n\n<div id=\"navigation\">\n <nav>\n <ul>\n <li><a href=\"index.html\">Home</a></li>\n <li><a href=\"nieuwsartikel.html\">Nieuwsartikel</a></li>\n <li><a href=\"sfeerverslag.html\">Sfeerverslag</a></li>\n <li><a href=\"column.html\">Column</a></li>\n </ul>\n </nav>\n</div>\n\n<div id=\"content\">\n <article>\n <h1>\n De Groot spreekt over informatieoorlog\n </h1>\n\n<div id=\"italic\">\n Aan de bar van het duistere bestofte cafeetje in Amsterdam zit ze, Naomi de Groot. Bijna onherkenbaar, vermomd door middel van een paarse pruik en een enorme zonnebril. Nederlands meest bekende complottheoriste kijkt wantrouwend naar haar bestelde glas cola, ze schuift het aan de kant en pakt uit haar tasje een fles met zelf gefilterd water. ‘je kan niet voorzichtig genoeg zijn’ fluistert ze. Ik kan niet wachten om haar te interviewen over haar gedachtes en visies met betrekking tot internet privacy.\n</div>\n\n\n\n\n\n\n\nMy CSS:\n\n#content h2\n{\n color:#000;\n font-size: 160%;\n margin: 0 0 .5em;\n}\n\nbody \n{ \n background-image: url(http://cdn.elegantthemes.com/blog/wp-content/uploads/2013/09/bg-1-full.jpg); }\n}\n\n#italic\n{\n font-style:italic;\n color:red;\n}\n\n#footer\n{\n background:#ccc;\n text-align: right;\n padding: 20px;\n height: 1%;\n}" ]
[ "css", "html" ]
[ "How can I compress my c++ code in a single line?", "I am writing document with html and javascript.\n\nI want to compress my c++ code into a single line(to save bytes), how can I do that efficiently?" ]
[ "javascript", "c++", "html", "documentation" ]
[ "Bash read line and replace value with previous line", "I have the below XML file and I want to replace value in with value of Product ID.\n\nI am using below code but it's replacing same product in both the lines.\n\nI have also provided sample source and target content below.\n\n while read line\n do\n count=`echo $line | grep \"Product ID\" | wc -l`\n if [ $count -eq \"1\" ]\n then\n product=`echo \"$line\" | grep \"Product ID\"|awk -F \"=\" '{print $2}' | awk \n '{print $1}'`\n\n name=`grep \"$line\" -B 1 test.xml | tail -1|sed 's/\\///g;s/<Name>//g' | \n awk '{print $1}'`\n\n echo $line | sed \"s/$name/$product/g\" >> data.xml\n else\n echo \"$line\" >> data.xml\n fi\n\n done < test.xml\n\n\nBelow is the Source Format:\n\n <Products>\n<Product ID=\"ABC1234\" UserID=\"XYX\" SUperUserID=\"ROOT\" >\n <Name>1234</Name> \n <Values>\n <Value AttributeID=\"A\">1</Value>\n <Value AttributeID=\"B\">00</Value>\n </Values>\n</Product>\n <Product ID=\"XYZ1234\" UserID=\"XYX\" SUperUserID=\"ROOT\" >\n <Name>1234</Name>\n <Value AttributeID=\"A\">4</Value>\n <Value AttributeID=\"B\">10</Value>\n </Values>\n </Product>\n\n\nBelow will be the Output format:\n\n<Products>\n<Product ID=\"ABC1234\" UserID=\"XYX\" SUperUserID=\"ROOT\" >\n <Name>ABC1234</Name> \n <Values>\n <Value AttributeID=\"A\">1</Value>\n <Value AttributeID=\"B\">00</Value>\n </Values>\n</Product>\n <Product ID=\"XYZ1234\" UserID=\"XYX\" SUperUserID=\"ROOT\" >\n <Name>XYZ1234</Name>\n <Value AttributeID=\"A\">4</Value>\n <Value AttributeID=\"B\">10</Value>\n </Values>\n </Product>\n\n\nPlease suggest any other approach." ]
[ "shell", "awk" ]
[ "How to edit the \"hitbox\" of an image using getBoundingClientRect();", "I have an image floating around a page and I need to make it so when it hits something, something happens. While doing this, I used the getBoundingClientRect(); in order to find the position of the image to find when it hits. Annoyingly, the position of the image is about 100 px off (not exact) from what it shows online. How do I fix this?\n\nI've already attempted to change this height/width elements of the image, it hasn't worked.\n\n <!dOcTyPe HtMl>\n <meta name=\"viewport\" content=\"width=device-width, initial- \n scale=1\">\n <style>\n span{\n height: 25px;\n width: 25px;\n border-radius: 13px;\n background-color: white;\n display: inline-block;\n position: fixed;\n }\n #myDiv{\n max-width: 100px;\n }\n #eve{\n margin-top: 0px;\n margin-left: 0px;\n background-color: white;\n height: 300px;\n border-radius: 25px;\n border: 3px gray solid;\n }\n .body{\n background-color: black;\n }\n .circimg{\n height: 25px;\n width: 25px;\n background: none;\n\n }\n #dot{\n position: absolute;\n top: 50px;\n }\n </style>\n <body class=\"body\">\n <audio id=\"audio\" \n src=\"http://www.willmargulies.com/gimn_rf_t3- \n [AudioTrimmer.com].mp3\" autoplay=\"false\" ></audio>\n <img id=\"dot\" class=\"circimg\" top=\"0px\" \n src=\"https://www.willmargulies.com/PinClipart.com_label- \n clipart_183729.png\">\n <script>\n function playSound() {\n var sound = document.getElementById(\"audio\");\n sound.play();\n }\n </script>\n <script>\n document.getElementsByTagName(\"img\").top = \"50px\";\n\n var div = document.getElementById(\"dot\");\n var x = 0\n var lr = 1;\n var concise = 1;\n var y = 0;\n var he = window.innerWidth - 50;\n var inwit = window.innerWidth - 30;\n var inhei = window.innerHeight - 15;\n function func(){\n\n div.style.top = y + \"px\"; \n div.style.left = x + \"px\"; \n\n if(div.style.left === he + \"px\"){lr = 0;}\n if(div.style.left === \"20px\"){lr = 1;}\n if(lr === 1){x = x + 1}else{x = x - 1}\n\n if(div.style.top === inhei + \"px\"){concise = 0;}\n if(div.style.top === \"15px\"){concise = 1;}\n if(concise === 1){y = y + 1}\n else{y = y - 1}\n\n if(div.style.left === \"0\" && div.style.top === \"0px\"){\n playSound();\n }\n\n\n\n var span1 = document.getElementById(\"dot\");\n var button = document.getElementById(\"eve\");\n\n var rect1 = span1.getBoundingClientRect();\n var rect2 = button.getBoundingClientRect();\n\n var overlap = (rect1.right == rect2.left || \n rect1.left == rect2.right || \n rect1.bottom == rect2.top || \n rect1.top == rect2.bottom) \n\n if(overlap){\n alert(\"holy bjesus\")\n }\n\n }\n\n\n\n setInterval(func, 5);\n\n </script>\n <center>\n <button id=\"eve\" class=\"\" onClick=\"if(touches(span, btn)) \n {alert('k');}\">Putin The Bootin</button>\n </center></body>" ]
[ "javascript", "html", "image" ]
[ "FileChannel.transferTo() keeps transferring 0 bytes?", "I asked this question yesterday, and I was convinced that a single-threaded file server will fit my need. Yes, with a single thread, the file server works pretty well(for only small files), it can handle about 300 requests per second, now the problem is that the write(I use FileChannel.transferTo()) part of the server will block for quite a while for serving large files, which keeps other connections from being connected. \n\nI noticed that FileChannel.transferTo() sometimes transfers 0 bytes when transferring large files(around 800KB). It fails with: java.io.IOException: Try again. This was on Android.\n\nBecause I put FileChannel.transferTo() in a loop, I can get the situation where FileChannel.transferTo() runs thousands of times to ultimately transfer the entire file.\n\nMy question is what causes FileChannel.transferTo() fail to transfer the bytes requested? How do I tackle this problem and make my file server more responsively for handling large files?" ]
[ "java", "nio" ]
[ "How do I determine which button was pressed from a list of buttons in Android?", "I have an xml file for a cardview to be used in a recyclerview in my main android class. This cardview contains a button that will be used to delete the cardview from the list. The problem I have encountered is that all of the buttons in the recyclerview have identical onClick values and I do not know how to differentiate between them.\n\nHere is my button in the cardview xml:\n\n<Button\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:text=\"Delete\"\n android:id=\"@+id/btnDelete\"\n android:onClick=\"DeleteCard\"\n android:layout_alignParentTop=\"true\"\n android:layout_alignParentRight=\"true\"\n android:layout_alignParentEnd=\"true\" />\n\n\nIn my main class, I have a function DeleteCard which runs whenever I press any of the delete buttons. I have a TextView in my cardview as well, and I was wondering if it was possible to somehow retrieve the text that is in the TextView when I press the delete button so I know which one to delete.\n\nThis is my onBindViewHolder:\n\npublic void onBindViewHolder(TimeViewHolder personViewHolder, int i) {\n int min = (int)(times.get(i).time / (60 * 1000));\n int remaining = (int)(times.get(i).time % (60 * 1000));\n int sec = remaining / 1000;\n remaining = remaining % (1000);\n int mill = (remaining%1000)/10;\n DecimalFormat df = new DecimalFormat(\"00\");\n personViewHolder.time.setText(min + \":\" + df.format(sec) + \".\" + mill);\n personViewHolder.date.setText(times.get(i).date);\n}\n\n\nI want to get the text from date and use that as a parameter to remove that key in the SharedPreferences. Here is the method that runs when a delete button is pressed:\n\npublic void DeleteCard(View view){\n SharedPreferences.Editor editor = history.edit();\n editor.remove(\"Date Here\");\n editor.commit();\n}" ]
[ "java", "android", "xml" ]
[ "Visual Studio Extensibility Package 2010 and 2012. Is there a way to have one package for both?", "A while ago I created a Visual Studio Package/Add-In for Visual Studio 2010 (for those curious: http://visualstudiogallery.msdn.microsoft.com/ea23f9a7-a942-45b2-87e6-5df6ff0444ff). If I try to download that and install it in Visual Studio 2012, it doesn't work, I get a version error. \n\nSo my first thought was to see what happens if I try to port it to 2012. I downloaded and installed the VS2012 RC SDK, and basically recreated the whole thing in a separate solution and it all works. What I noticed was that many of the assemblies I had to reference (Microsoft.VisualStudio.*) were now version 11 as opposed to version 10 (for obvious reasons). After copying and pasting all the code over, I got it to work correctly in Visual Studio 2012. \n\nMy question now is this: Is it possible to have one .vsix file for multiple versions of Visual Studio (I'm guessing no.) If not, what's the correct approach to take as far as uploading the different versions? Can I upload two versions of a .vsix? Will the Add-In manager in visual studio pick the correct one automatically? Do I need to create a new package e.g. \"Visual Pastie 2012\"? Just looking for some guidance." ]
[ "c#", "visual-studio-2010", "visual-studio-2012" ]
[ "Append To Current Url Django", "I have two URLs in Django. \nI would like to be able to use them almost as subdirectories. \n\nIn my case, I have a table of parts belonging to a job, and in that table, i have buttons that would allow you to open a new URL with details of the part clicked.\n\nThis would be the job URL.\n\n/view_job/1/ \n\n\nand when you click on an item I would like to be able to navigate to.\n\n/view_job/1/details/part1\n\n\nHere are the two URLs.\n\nurl(r'^view_job/([0-9]+)/$', app.views.viewfab, name='view_job'),\nurl(r'^view_job/([0-9]+)/details/(.+?)$', app.views.viewfabdetail, name='fab_detail')\n\n\nand here is what I'm trying to achieve in the template.\n\n<a href=\"{% url \\'fab_detail\\' \"job number\" record.mark %}\">View</a>\n\n\nthe problem I am having is.\n\nI want to be able to pass the job number, which is /view_job/->\"job number\"<- to the template HTML and I have not been able to find out how to do so.\n\nThanks for any guidance on the subject.\n\nEDIT \n\nHere is the model being used.\n\nclass Fab(models.Model):\n jobid = models.IntegerField(default=0)\n mark = models.CharField(max_length=100)\n status = models.CharField(max_length=100)\n description = models.CharField(max_length=100)\n weight = models.CharField(max_length=100)\n truck = models.IntegerField(default=-1)\n load_date = models.DateField(null=True)\n check_date = models.DateField(null=True)\n checker = models.CharField(max_length=100)\n total = models.IntegerField(default=1)\n loaded = models.IntegerField(default=0)\n checked = models.IntegerField(default=0)\n\ndef viewfab(request,jid):\n job=Job.objects.filter(id=jid)\n\n part_json=serializers.serialize('json',job)\n jdata=json.loads(part_json)\n ids=[]\n for id in jdata[0]['fields']['_Fab']:\n ids.append(id)\n prts=Fab.objects.filter(id__in=(ids))\n prts=app.model_extender.combinepartqty(prts)\n #where the issue is\n table=FabTable(prts)\n ###\n RequestConfig(request).configure(table)\n\n return render(request,'app/datatable.html',{'table':table})\nprint(\"\")" ]
[ "python", "html", "django" ]
[ "Custom ContextMenu is not showing, since Display Object is lying \"on Top\"", "as a follow up to another question here:\ni've build a custom contextmenu item in a flash application and had a problem with it not showing sometimes.\ni found out that the issue was that another sprite was lying \"on top\" of the item with the custom contextmenu.\n\nhowever, even with the \"mouseEnabled\" and \"mouseChildren\" properties set to false for the item \"on top\" i still cannot get the custom contextmenu to show...\nany ideas? thanks!\n\nps: here is some code to see the problem:\n\nvar spr:Sprite=new Sprite();\nspr.graphics.beginFill(0xff0000,1);\nspr.graphics.drawRect(0,0,100,100);\naddChild(spr);\n\nvar blocker:Sprite=new Sprite();\nblocker.x=50\nblocker.y=50\nblocker.graphics.beginFill(0x00ff00,1);\nblocker.graphics.drawRect(0,0,100,100);\naddChild(blocker);\nblocker.mouseEnabled=false\nblocker.mouseChildren=false\n\nvar customContextMenu:ContextMenu = new ContextMenu();\nvar item:ContextMenuItem = new ContextMenuItem(\"custom item\");\ncustomContextMenu.customItems.push(item);\nitem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler,false,0,true);\nspr.contextMenu = customContextMenu;\n\nfunction menuItemSelectHandler(cem:ContextMenuEvent) {\n trace(\"hello context\");\n};\n\n\nwhen the mouse is over the green rect, the custom contextmenuitem is not shown" ]
[ "actionscript-3", "flash" ]
[ "digital signature without using a Java applet?", "I am trying to do a search if we can do an electronic signature without using a java applet to retrieve the certificate from the hard drive client station that is to say there is another method to retrieve the certificate? is that one can store the certificate remotely in a secure manner (not on a USB key or smart card)\nI saw some example that used the javascript but it is not advisable listed security this article shows that http://matasano.com/articles/javascript-cryptography/.\n can i store the certificate and private key addition to hard drive computer or on a USB key or smart card with a secure manner??\nI hope so that there is someone who has ideas on this subject\nthank you in advance" ]
[ "digital-signature" ]
[ "Get data from Microsoft Access table and put into Microsoft Excel workbook as QueryTable - powershell script failed", "Here is my piece of code:\n\n$objExcel = New-Object -ComObject Excel.Application\n$objExcel.Visible = $true\n$objExcel.SheetsInNewWorkbook = 1\n$objWorkBook = $objExcel.Workbooks.Add()\n$objWorkSheet = $objWorkBook.Sheets.Item(1)\n$objWorkSheet.Activate()\n\n$strHome = \"C:\\share\"\n$strAccessFile = $strHome + \"\\db1.accdb\"\n$strConnectionString = \"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=$strAccessFile;Persist Security Info=True;\"\n\n$adOpenStatic = 3\n$adLockOptimistic = 3\n\n$objConnection = New-Object -ComObject ADODB.Connection\n$objConnection.Open($strConnectionString)\n$objRecordSet = New-Object -ComObject ADODB.RecordSet\n$strAccessString = \"SELECT * FROM Table\"\n$objRecordSet.Open($strAccessString,$objConnection,$adOpenStatic,$adLockOptimistic)\n\n$objRecordSet.Fields.Item(\"Text\").Value\n\n$oRange = $objWorkSheet.Range(\"B4\") \n\n$oRez = $objWorkSheet.QueryTables.Add($objRecordSet,$oRange)\n\n\nExcel was opened, the same with Access recordset. Field \"Text\" value was shown.\n\nLast line of code produce error:\n\nException calling \"Add\" with \"2\" argument(s): \"Parameter is not correct. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))\"\nAt C:\\share\\dataconn_test.ps1:26 char:1\n+ $oRez = $objWorkSheet.QueryTables.Add($objRecordSet,$oRange)\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n + CategoryInfo : NotSpecified: (:) [], MethodInvocationException\n + FullyQualifiedErrorId : ComMethodTargetInvocation\n\n\nWHY? What I'm doing wrong?" ]
[ "excel", "powershell" ]
[ "libgdx drawing rectangles over tiledmap tiles - collision detection", "I am creating a RPG game using the Libgdx library and I am having difficulty with setting up the rectangles for the collision detection. I was able to draw a rectangle around my main character and I know the code for how to handle the collision when it happens. The problem is that I need to draw rectangles around the tiles in my collision layer(my collision layer is not a object layer). If anyone is able to give an example of how to write this or even point me in the right direction, this would be very helpfull.\n\ntile size is 32x32\n\nhere is the code that I have come up with so far for drawing the rectangles around the specified tiles\n\npublic void collisionSetUp(){\n TiledMapTileLayer layer;\n layer = (TiledMapTileLayer) map.getLayers().get(\"Bushes\");\n float tileWidth = layer.getTileWidth(); //the tile is a perfect square so only one side is required\n\n\n //go through the entire layer and assign a rectangle to each tile\n for(int row = 0; row < layer.getHeight(); row++) {\n for(int col = 0; col < layer.getWidth(); col++) {\n\n debugRenderer.begin(ShapeType.Line);\n collisonRect = new Rectangle(row*32, col*32, 32, 32);\n debugRenderer.setColor(new Color(0, 1, 0, 1));\n debugRenderer.rect(collisonRect.getX(), collisonRect.getY(), collisonRect.width, collisonRect.height);\n debugRenderer.end();\n System.out.println(\"new Rectangle\");\n }\n }\n\n}\n\n\ncode for handling the collision\n\nRectangle playerRect = new Rectangle(player.position.x, player.position.y, 32, 32);\n debugRenderer.setColor(new Color(0, 1, 0, 1));\n debugRenderer.rect(player.position.x, player.position.y, playerRect.width, playerRect.height);\n debugRenderer.end();\n\n\n if(playerRect.overlaps(collisonRect)){\n player.position.x = player.prePosition.x;\n player.position.y = player.prePosition.y;\n }" ]
[ "java", "libgdx", "collision-detection" ]
[ "ProGuard obfuscation issue", "Hello I was obfuscating my .jars with ProGuard but I keep getting this message:\n\nReading library jar [C:\\Program Files\\Java\\jre1.8.0_151\\lib\\rt.jar]\n(The system cannot find the path specified)\n\nIt is the right path for the rt.jar. Is there a solution to fix this?" ]
[ "proguard", "obfuscation" ]
[ "How to apply a formula on a rage \"A3:A\"?", "I want to copy the same formula to all cells in the range "A3:A".\nDo I have to use Apps script or can this be done via the UI?" ]
[ "google-sheets", "google-sheets-formula" ]
[ "Ubuntu Apache PHP - Create and write to an Excel Document", "I have heard of PHP Excel inorder to work with excel documents in PHP. However do I require MS Office on the Ubuntu System inorder to work and serve excel documents? Or can the PHP Excel extension work ad hoc with serving excel documents in any system?" ]
[ "php", "ubuntu", "phpexcel" ]
[ "How can I show a date from previous month in the same week", "I'm trying to implement SingleDatePicker with days from the previous month falling in the first/last week of the month shown to be shown in a disabled state.\nFor example, if my current month in view starts on a Thursday, I want to show 3 days from previous month on the same month view, but disabled.\nIs there any way I can do this?" ]
[ "datepicker", "react-dates" ]
[ "Converting an blowfish encryption algo from php to python", "I have this real simple encryption that I used for my site. I am trying to convert all my code from php to python, but I can't figure out how to get python to produce the same output that php did with this code.\n\nfunction myhash($word){\n $salt = \"$2a$06$\" . substr(sha1($word) , 0, 22) . \"$\";\n return crypt($word, $salt);\n}\n\n\nSeeing as I already have quite a few passwords stored with this encryption, it would be silly to make a new encryption. What to do?" ]
[ "php", "python", "encryption", "salt", "blowfish" ]
[ "How can I extract a floating point bit pattern?", "For some while I have used code like this to extract efficiently the bit pattern of a double as an int64:\n\n inline\n int64 rawDouble(double aDouble)\n {\n union Union {\n Union(double aDouble) : fDouble(aDouble) {}\n int64 bits() { return fInt64; }\n double fDouble;\n int64 fInt64;\n };\n\n return Union(aDouble).bits();\n }\n\n\n(Clearly there is an entirely analogous pattern for extracting the bit pattern of a single as an int32.)\n\nI like this trick because the x86's SEE instructions (and it analogous in other instruction sets) allow individual register locations to be interpreted as integer or floating point on an instruction by instruction basis.\n\nIt has been pointed out to me that C++11 and later regard this an UB.\n\nIf I cannot use this trick what C++ sanctioned approach can I take?" ]
[ "c++11", "floating-point-conversion" ]
[ "Java, ICS calendar format not showing time when imported in Outlook or Thunderbird", "I am working on a Java project in which I am creating an ICS file and there is something wrong with date and time. Whenever I import the ICS file, I want to show the startTime of event and endTime of Event in the ICS file.\n\nI tried using the constructor which contains endTime as well, no luck, still shows 00:00. The below code I am using to generate an ICS file and below that is the content of the ICS file. \n\nCode :\n\n Calendar icsCalendar = new Calendar();\n icsCalendar.getProperties().add(Version.VERSION_2_0);\n icsCalendar.getProperties().add(CalScale.GREGORIAN);\n\n String startDateString = new SimpleDateFormat(\"yyyyMMdd'T'hhmmss'Z'\").format(groupNotes.getStartTimestamp());\n String endDateString = new SimpleDateFormat(\"yyyyMMdd'T'hhmmss'Z'\").format(groupNotes.getEndTimestamp());\n net.fortuna.ical4j.model.Date startDt = null;\n net.fortuna.ical4j.model.Date endDateFortuna = null;\n try {\n startDt = new net.fortuna.ical4j.model.Date(startDateString, \"yyyyMMdd'T'hhmmss'Z'\");\n endDateFortuna = new net.fortuna.ical4j.model.Date(endDateString, \"yyyyMMdd'T'hhmmss'Z'\");\n } catch (ParseException e) {\n e.printStackTrace();\n }\n\n java.util.Calendar endDate = java.util.Calendar.getInstance();\n endDate.setTimeInMillis(groupNotes.getEndTimestamp().getTime());\n /* long difference = groupNotes.getEndTimestamp().getTime() - groupNotes.getStartTimestamp().getTime();\n int min = (int) (difference / (1000 * 60));\n Dur dur = new Dur(0, 0, min, 0);*/\n VEvent vEvent = new VEvent(startDt, endDateFortuna, groupNotes.getMnotetag());\n vEvent.getProperties().add(new Description());\n try {\n vEvent.getProperties().getProperty(Property.DESCRIPTION).setValue(groupNotes.getMnotetext());\n vEvent.getProperties().add(new Organizer(\"MAILTO:\" + groupNotes.getNoteCreatorEmail()));\n\n } catch (IOException | URISyntaxException | ParseException e) {\n e.printStackTrace();\n }\n icsCalendar.getComponents().add(vEvent);\n\n FileOutputStream fout = null;\n\n try {\n fout = new FileOutputStream(calFile);\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n\n CalendarOutputter outputter = new CalendarOutputter();\n outputter.setValidating(false);\n\n try {\n outputter.output(icsCalendar, fout);\n return new FileInputStream(\"mycalendar.ics\");\n } catch (IOException | ValidationException e) {\n e.printStackTrace();\n }\n }\n\n\nHere is how my ICS file looks like :\n\nBEGIN:VCALENDAR\nVERSION:2.0\nCALSCALE:GREGORIAN\nBEGIN:VEVENT\nDTSTAMP:20150910T152828Z\nDTSTART;VALUE=DATE:20150911\nDTEND;VALUE=DATE:20150911\nSUMMARY:\nDESCRIPTION:poip\nORGANIZER:MAILTO:[email protected]\nEND:VEVENT\nEND:VCALENDAR\n\n\nNow when I import this, no time is mentioned in Outlook, thunderbird or Evolution. What am I doing wrong? Thank you." ]
[ "java", "time", "outlook", "icalendar", "rfc5545" ]
[ "How to load variations of a code based on user?", "I want to be able to server different variations of a code based on the user. So if USer A signs in i want them to see code/pages pertaining to their preferences. \n\nI know we can do a php/mysql to save paths. But how do i serve the code on the same page. All users have the same page index.php, home.php, profile.php but i want to be able to use the same page to serve those requests by simply show the code that is specifc to them.." ]
[ "php", "customization" ]
[ "concatenating staggered columns", "I am working on a macro to loop through staggered columns of strings and concatenate them. Basically data gets added into the columns over time so I need to make it \"future-proof\". At the moment it picks up all of column H and I but only the first value of J and K. Not sure why it works for half but not the other. I am thinking its to do with my .End(xldown) as i am used to using rows.end(xlup).count to loop through things, but never when it is part of the range?\nHere is my code: \n\nSub Concatenation_for_the_nation()\n\nRange(\"H2\").End(xlDown).Select\nFor i = 1 To ActiveCell.Row\n Range(\"H\" & i).Select\n StrStrONE = StrStrONE & \" \" & Selection\nNext i\nCells(1, 1).Select\n\nRange(\"I2\").End(xlDown).Select\nFor j = 1 To ActiveCell.Row\n Range(\"I\" & j).Select\n StrStrTWO = StrStrTWO & \" \" & Selection\nNext j\nCells(1, 1).Select\n\nRange(\"J2\").End(xlDown).Select\nFor k = 1 To ActiveCell.Row\n Range(\"J\" & k).Select\n StrStrTHREE = StrStrTHREE & \" \" & Selection\nNext k\nCells(1, 1).Select\n\nRange(\"K2\").End(xlDown).Select\nFor l = 1 To ActiveCell.Row\n Range(\"K\" & l).Select\n StrStrFOUR = StrStrFOUR & \" \" & Selection\nNext l\nCells(1, 1).Select\n\nCells(21, 21) = StrStrONE & StrStrTWO & StrStrTHREE & StrStrFOUR\n\nCells(20, 20) = \"Jeff\"\n\nMsgBox \"steve the pirate\"\n\nEnd Sub" ]
[ "vba", "excel", "concatenation" ]
[ "Unable to resolve module `./index` from ``:", "The command 'react-native run-android' is success, but the terminal 'react-native start' report the error:\nError: Unable to resolve module `./index` from ``:\n\nNone of these files exist:\n * index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)\n * index\\index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)\n at ModuleResolver.resolveDependency (D:\\web\\taobao\\umiRNExample-master\\node_modules\\metro\\src\\node-haste\\DependencyGraph\\ModuleResolution.js:163:15)\n at ResolutionRequest.resolveDependency (D:\\web\\taobao\\umiRNExample-master\\node_modules\\metro\\src\\node-haste\\DependencyGraph\\ResolutionRequest.js:52:18)\n at DependencyGraph.resolveDependency (D:\\web\\taobao\\umiRNExample-master\\node_modules\\metro\\src\\node-haste\\DependencyGraph.js:287:16)\n at D:\\web\\taobao\\umiRNExample-master\\node_modules\\metro\\src\\lib\\transformHelpers.js:267:42\n at Server.<anonymous> (D:\\web\\taobao\\umiRNExample-master\\node_modules\\metro\\src\\Server.js:841:41)\n at Generator.next (<anonymous>)\n at asyncGeneratorStep (D:\\web\\taobao\\umiRNExample-master\\node_modules\\metro\\src\\Server.js:99:24)\n at _next (D:\\web\\taobao\\umiRNExample-master\\node_modules\\metro\\src\\Server.js:119:9)\n at processTicksAndRejections (internal/process/task_queues.js:93:5)" ]
[ "react-native" ]
[ "OnClick JavaScript for this button or link was encountered: is not defined", "I am trying to call a VF page from Salesforce custom button.\nthe code is as follow written under the button.\n\n OnClick JavaScript:\n{!REQUIRESCRIPT(\"/soap/ajax/20.0/connection.js\")} \n {!REQUIRESCRIPT(\"/soap/ajax/20.0/apex.js\")} \n window.location= 'apex/PrintExpenseInfo?id='+ Medical_Event_vod__c.id;\n\n\nCan anyone poitn out where is the issue? Its giving me an error like - \n\"A problem with the OnClick JavaScript for this button or link was encountered: is not defined" ]
[ "salesforce", "visualforce" ]
[ "How to resolve run issue on Android Studio", "I'm using Flutter on Android Studio, but along the line, while working with my project, I don't know if I touched something without knowing, but the play button that runs my project stopped working same as the suggestion feature and dart analysis for detecting syntax error. The strange thing is that it only appears like this in this project alone, when I launch other projects everything seems normal and working as expected." ]
[ "android-studio", "flutter" ]
[ "How to show a div when hovering another div using CSS?", "I have a div that contains an iframe element that shows a video (song), and another div that shows the lyrics of that song. the div that shows the lyrics is set with display: none;. now, i want to show this div (lyrics) when the div that contains the iframe element with the video is hovered. (I'm not allowed to use Javascript, only CSS).\nWhat i have:\nkaraoke.html:\n<div class="main-container">\n <div class="karaoke" style="top: 30px; left: 30px;">\n <iframe frameborder="0" height="100px" width="180px" src="https://www.youtube.com/embed/tgbNymZ7vqY"></iframe>\n </div>\n <div class="lyrics-w">\n <span class="lyrics">lyrics here</span>\n </div> \n</div>\n\nkaraoke.css:\n.main-container {\n position: relative;\n display: block;\n height: 600px;\n width: 800px;\n background: #00aaee;\n border-radius: 15px;\n margin-top: 70px;\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 70px;\n}\n.karaoke {\n position: absolute;\n display: block;\n height: 140px;\n width: 180px;\n background: #f78a69; \n cursor: pointer; \n border-radius: 10px;\n}\n.lyrics-w {\n position: absolute;\n display: none;\n height: calc(100% - 30px - 30px - 70px - 30px);\n bottom: 30px;\n background: salmon; \n border-radius: 10px;\n left: 50%;\n transform: translateX(-50%);\n width: 260px;\n overflow-x: hidden;\n overflow-y: auto;\n}\n.lyrics {\n position: relative;\n display: block;\n padding: 20px;\n line-height: 26px;\n overflow: hidden;\n text-overflow: ellipsis;\n font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;\n font-size: large;\n color: #454545;\n font-style: italic;\n line-break: auto;\n}\n.karaoke:hover .lyrics-w {\n display: block;\n}\n\nThe .karaoke:hover .lyrics-w { display: block; } should make the div with the class .lyrics-w visible (with display: block;) when hovering the div with the class .karaoke, but for some reason it doesn't. I used many times this kind of code to change CSS attributes of another elements while hovering specific element, and till now it worked well, I don't understand why it doesn't work here. Maybe because .karaoke and .lyrics-w are independent objects (I mean one is not child of the other)? I don't know.\nAny ideas? Thanks in advance." ]
[ "html", "css", "hover" ]
[ "enable authentication in hawtio deployed on jetty", "I'v setup jetty and added a HashLoginService which uses the realm.properties..basically the demo setup.\nI'm using the hawtio-web.war where I set the hawtio.authenticationEnabled to true. \nProblem is that I'm not able to login. The login page of hawtio appears but it always says \"forbidden\"...I don't know what I'm doing wrong." ]
[ "java", "jetty", "hawtio" ]
[ "Testing for crash with google test", "In Google Test I would like to be able to do something like this:\n\nvoid ImNotNiceToPointers( void* p )\n{\n ((int*)p) [5] = 1;\n}\n\nTEST( Bla, BlaBla )\n{\n EXPECT_NO_CRASH( ImNotNiceToPointers(NULL) );\n}\n\n\nAnd I would like the output to show error that the statement actually made the process die abnormally.\n\nIs there any support for this in Google Test? I'm pretty sure how I would implement it myself, so I'm almost certain it's possible." ]
[ "unit-testing", "googletest" ]
[ "vertical align middle form just like text", "I want to vertical align my form the same way I vertical aligned my text on my website. but it's not working, what should I do?\n\n\n\nI would love for it to be like this:\n\n\n\nThis is my code http://pastebin.com/FuCNwM6e\n\n<head>\n<!DOCTYPE html>\n<html>\n<head>\n<title>2 Column CSS Layout</title>\n<style type=\"text/css\">\nbody {\n margin:20px;\n font-family:\"Lucida Grande\",\"Lucida Sans Unicode\",\"Lucida Sans\",Geneva,Verdana,sans-serif;\n background-color:#555\n}\n\ndiv {\n text-align:center\n}\n\n#page {\n background-color:#fff;\n margin:0 auto;\n text-align:left;\n width:755px;\n padding:0 10px\n}\n\n#header {\n border-bottom:0px solid #000;\n height:30px;\n line-height:30px\n}\n\n/* Begin Navigation Bar Styling */\n#nav {\n text-align:center;\n line-height: 30px;\n}\n\n#nav ul {\n text-align:center;\n font-size:11px;\n width:100%;\n margin:0;\n padding:0;\n display:inline-block;\n list-style:none;\n background-color:#f2f2f2;\n border-bottom:1px solid #ccc;\n border-top:1px solid #ccc\n}\n\n#nav li {\n margin:auto;\n display:inline-block\n}\n\n#nav li a {\n display:block;\n padding:8px 15px;\n text-decoration:none;\n font-weight:700;\n color:#069;\n border-right:1px solid #ccc\n}\n\n#nav li a:hover {\n color:#c00;\n background-color:#fff\n}\n\n/* End navigation bar styling. */\n\n#content {\n height: 200px;\n width:100%;\n display: table;\n background:none repeat scroll 0 0 none;\n}\n\n#content p {\n display: table-cell;\n vertical-align: middle;\n}\n\n#footer {\n height:30px;\n line-height:30px;\n border-top: 1px solid #000;\n font-size:9pt\n}\n\n#footer p {\nfloat: right;\n}\n\n.clear {\n clear: both;\n}\n\n\n\n</style>\n</head>\n\n<body>\n <div id=\"page\">\n <div id=\"header\">\n <div style=\"float: left;\">\nPlease Login\n </div>\n </div>\n\n\n <div id=\"content\">\n<p>\n<form action=\"\" method=\"post\"> \n<label for=\"un\">Username</label>\n <input type=\"text\" id=\"un\" placeholder=\"username\" /><br/>\n <label for=\"pw\">Password</label>\n <input type=\"password\" id=\"pw\" placeholder=\"password\" /><br/>\n <input type=\"submit\" value=\"Login\"/>\n</form>\n</p> \n </div>\n\n <div id=\"footer\">\n<div style=\"float: right;\"> copyright 2014 </div>\n </div>\n </div>\n</body>\n</html>" ]
[ "html", "css", "vertical-alignment" ]