texts
sequence | tags
sequence |
---|---|
[
"Next.js #text element on the bottom ( full height page)",
"I am making a portfolio and I got min-height: 100vh on the body, but I can scroll and there is a white field which is called #text and its called ";" == $0 in elements(F12 tool). I tried everything from the google and nothing helped. ;/\nI've heard that Next.js generate that layer and there is no chance to get rid of it - depends on React (from posts from 2017 which people were facing that problems)\nSo i got inside my index.js and everything I display there in inside main but #text is out of main\ncodepen\n https://codepen.io/belkocik/pen/OJpOPpe\n\nDo you know how to get rid of it?"
] | [
"reactjs",
"next.js"
] |
[
"symfony assetic get 500 error for js file",
"This just started on production. The file javascript file is there but gives a 500 error, with no other information. \n\n\n 500 Internal\\u0020Server\\u0020Error\n\n\nrunning\n\nbin/console assetic:dump --env=prod\n\n\nshows the compiled file. \n\nconfig part looks like this:\n\nassetic:\n debug: \"%kernel.debug%\"\n use_controller: true\n bundles: [appBundle]\n filters:\n uglifyjs2:\n # the path to the uglifyjs executable\n bin: /usr/bin/uglifyjs\n uglifycss:\n bin: /usr/bin/uglifycss\n #cssrewrite:\n # apply_to: \"\\.css$\"\n # java: /usr/bin/java\n\n\ntemplate reference - \n\n<!-- include javascripts --->\n{% javascripts '@appBundle/Resources/public/js/*' filter='uglifyjs2' %}\n<script src=\"{{ asset_url }}\"></script>\n{% endjavascripts %}\n\n\nhtaccess file - \n\n<IfModule mod_rewrite.c>\n Options +FollowSymlinks\n RewriteEngine On\n RewriteRule ^livemusic/web/app.php - [L]\n RewriteCond %{REQUEST_FILENAME} !-f\n RewriteRule ^(.*)$ livemusic/web/app.php [QSA,L]\n RewriteRule ^\\robots.txt [L] \n</IfModule>"
] | [
"symfony",
"assetic"
] |
[
"How to make manager comments mandatory in SOA Workflow",
"UseCase : I want to make the manager comments mandatory in soa /oim workflow before accepting rejecting any request from user .\n\nPlease suggest .\n\nThanks in advance ."
] | [
"soa",
"composite",
"oid",
"oim",
"oam"
] |
[
"OracleDB NodeJS module connection pool not shared with a module",
"I feel like I'm missing something obvious, but what I'm trying to do seems like it should work.\nI have the main project (server) and I'm trying to modularize various components of it, the first being a module (AQ) to send/receive messages on an Oracle queue using the Node OracleDB module.\nThe server project initializes the database connection pool with an alias of dbpool1. The alias name is stored in a configuration file read by the node-config module. Within the server project, there are some DB queries run, and then it calls AQ.Receive() from the AQ module. I'm importing the AQ module via an import AQ from '@company/aq'; call at the beginning of the file.\nWithin the AQ codebase, the Receive function only contains an OracleDB.getConnection(poolAlias) call - I'm not initializing the database here as the assumption I'm making is the pool is initialized within the main project codebase before I call the AQ module. However, this call returns an error saying the pool is not found.\nIf I pass in the pool object created when the DB connection pool is created in the server project as a param to AQ.Receieve, a call to pool.getConnection() works correctly.\nDoes an imported module share state/memory/whatever with the code doing the importing or do I need to complete reinitialize a connection (or pass it in as a parameter) to whichever module I'm importing?"
] | [
"node.js",
"typescript",
"node-modules",
"node-oracledb"
] |
[
"DatabaseGenerated(DatabaseGeneratedOption.Identity) vs Key",
"Looking at code first, I see some examples that use [DatabaseGenerated(DatabaseGeneratedOption.Identity)] to denote a primary key, and other examples that use [Key].\n\nI haven't been able to find a description of how the two compare.\n\nCan someone tell me when/if I'd want to use one over the other?"
] | [
"c#",
"entity-framework",
".net-core",
"ef-code-first",
"razor-pages"
] |
[
"xamarin.ios httpclient clientcertificate not working with https",
"I have a webservice which only allows https and ssl requests.\n1&1 generated us an certificate from Geo Trust. (.pfx)\n\nIn Android my https request are working with the certificate.\nIt Looks like this:\n\nServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Ssl3;\n\n using (var mmstream = new MemoryStream())\n {\n Android.App.Application.Context.Assets.Open(\"***.pfx\").CopyTo(mmstream);\n byte[] b = mmstream.ToArray();\n\n X509Certificate2 cert = new X509Certificate2(b, \"'''\", X509KeyStorageFlags.DefaultKeySet);\n clientHandler.ClientCertificates.Add(cert);\n }\n\n\n ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return true; });\n\n\nBut in iOS it doesnt work.\nHeres the Code\n\nHttpClientHandler clientHandler = new HttpClientHandler() { ClientCertificateOptions = ClientCertificateOption.Automatic };\n using (var mmstream = new MemoryStream())\n {\n Assembly ass = Assembly.GetExecutingAssembly();\n string[] str = ass.GetManifestResourceNames();\n foreach (string resource in str)\n {\n if (resource.Contains(\"SSL\"))\n ass.GetManifestResourceStream(resource).CopyTo(mmstream);\n }\n\n byte[] b = mmstream.ToArray();\n\n X509Certificate2 cert = new X509Certificate2(b, \"***\", X509KeyStorageFlags.DefaultKeySet);\n clientHandler.ClientCertificates.Add(cert);\n\n return clientHandler;\n }\n\n\nI always get the error Message The Methode is not implemented. (line clienthandler.clientcertificated.add(cert);).\n\nWhat am i doing wrong?"
] | [
"xamarin.ios",
"httpclient"
] |
[
"Differentiate Context, Request Context in django",
"What is the difference between Context, Request Context in django?\nWhy do we need context processors?"
] | [
"django",
"django-templates"
] |
[
"Getting data from WordPress database to use at out of WordPress",
"I set up WordPress, everything is fine. It is under a sub-directory of main website and it use same database with the custom developed website. The path is like below:\n\nhttp://www.blabla.com/blog/blabla-category-name/bla-post-title/\n\nI need to list the latest three posts at main website (out of WordPress). I looked WordPress db, but could not see any cat name at table :/ so how can I generate such link to post from out of WordPress?\n\nappreciate helps!! \n\n\n\njust found this article online. working great!!\n\nhttp://www.corvidworks.com/articles/wordpress-content-on-other-pages"
] | [
"wordpress"
] |
[
"multiple dropzone.js css styling",
"Its my first experince with dropzone.js \n\nI've an HTML registration wizard with multiple Dropzone.js in 3 steps , one appears on the first step with css applied to all dropzone classes .dropzone the first dropzone is styled correctly but the rest are not .\n\non the header i've added links to the dropzone css\n\n <link rel=\"stylesheet\" href=\"{{ url_for('static', filename='css/style.css') }}\"></link>\n <link rel=\"stylesheet\" href=\"{{ url_for('static', filename='css/dropzone.css') }}\"></link>\n\n\nmy HTML file :\n\n<form id=\"fzoneForm\" class=\"fzone\" action=\"/upload\" method=\"post\">\n <div class=\"_dropzone\">General Info:\n<!--- some forms input and lables here -->\n </div>\n</form>\n<form id=\"dropzoneForm\" class=\"dropzone\" action=\"/upload\" method=\"post\"> \n\n<!-- upload form 1-->\n</form>\n\n <form id=\"fzoneForm2\" class=\"fzone\" action=\"/upload\" method=\"post\">\n <div class=\"_dropzone\">General Info:\n<!--- some forms input and lables here -->\n </div>\n</form>\n<form id=\"dropzoneForm2\" class=\"dropzone\" action=\"/upload\" method=\"post\"> \n\n<!-- upload form 2-->\n</form>\n\n<form id=\"fzoneForm3\" class=\"fzone\" action=\"/upload\" method=\"post\">\n <div class=\"_dropzone\">General Info:\n<!--- some forms input and lables here -->\n </div>\n</form>\n<form id=\"dropzoneForm3\" class=\"dropzone\" action=\"/upload\" method=\"post\"> \n\n<!-- upload form 3-->\n</form>\n\n\n <script>\n\n\n Dropzone.autoDiscover = false;\n\nvar dz1 = new Dropzone(\n '#dropzoneForm',\n {\n url : \"upload\",\n autoProcessQueue: false ,\n paramName: 'file',\n addRemoveLinks: true,\n dictDefaultMessage: 'Drop ID',\n acceptedFiles:\".png,.jpg,.gif,.bmp,.jpeg\",\n init: function(){\n var submitButton = document.querySelector('#uploadID');\n myDZ = this;\n submitButton.addEventListener(\"click\",function(){\n myDZ.processQueue();});}});\n\n\nsimilar code for var dz2 and dz3\n\nthe steps are changed by two buttons next and previous which i have added using javascript but there's no need to add it here.\n\neach one of them are basically on the same page but there display:none unless it's the right step for it \n\nthe problem is only the first Dropzone is style correctly the other two are messed up \nI've checked the Dropzone.css and i'm can see that it suppose to be applied to all classes not the first one only and to be fair it looks like it's but the dashing rectangle is like 2 dashing lines on the left and that's it , only the first dropzone is rendered as a full rectangle with 90% width."
] | [
"javascript",
"html",
"css",
"dropzone.js"
] |
[
"Setting up VirtualenvWrapper on Ubuntu 12.04: Location of virtualenvwrapper.sh?",
"I use Virtualenv and VirtualenvWrapper on my local machines and find them wonderful tools. I am trying to set the same up on a virtual machine running Ubuntu 12.04 server and Apache for my production Python applications. \n\nVirtualenv is working fine. But I am having issues configuring VirtualenvWrapper. I have installed it via pip. pip freeze gives me \n\nvirtualenv==1.7.1.2\nvirtualenvwrapper==2.11.1\n\n\nI have followed the instructions on the documentation \n\n$ pip install virtualenvwrapper \n\n\nNOTE: See Edit below virtualenvwrapper was actually installed via apt-get. i did follow the rest fo the instructions though.\n\n...\n$ export WORKON_HOME=~/Envs\n$ mkdir -p $WORKON_HOME\n\n\nbut when I try the next step \n\n$ source /usr/local/bin/virtualenvwrapper.sh\n\n\nI get an error\n\n-bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory\n\n\nMy /usr/local/bin/ only has one file in it django-admin.py\n\nThe documentation states \n\n\n First, some initialization steps. Most of this only needs to be done\n one time. You will want to add the command to source\n /usr/local/bin/virtualenvwrapper.sh to your shell startup file,\n changing the path to virtualenvwrapper.sh depending on where it was installed by pip.\n\n\nHow can i find the location of this file?\n\nUsing find / -name \"virtualenvwrapper.sh\" just outputs a list of Permission denied errors\n\nRunning find / -name virtualenvwrapper gives me\n\n/usr/share/doc/virtualenvwrapper\n/usr/share/pyshared/virtualenvwrapper\n/usr/share/doc-base/virtualenvwrapper\n/usr/share/python/ns/virtualenvwrapper\n/usr/lib/python2.7/dist-packages/virtualenvwrapper\n\n\nAny advice on how to find the file would be great\n\nEDIT:\n\nI actually installed virtualenvwrapper via apt-get due to an issue with my proxy\n\nsudo apt-get install virtualenvwrapper\n\n\nPossibly this pits the virtualenvwrapper.sh in a different place?"
] | [
"ubuntu",
"ubuntu-12.04",
"virtualenvwrapper"
] |
[
"Write script to create multiple users with pre-defined passwords",
"So I would like to make a script that create users from users.txt running\n\nuseradd -m -s /bin/false users_in_the_users.txt\n\n\nand fill the password from passwords.txt twice (to confirm the passwords)\n\nThis is the script\n\n#!/bin/bash\n\n# Assign file descriptors to users and passwords files\nexec 3< users.txt\nexec 4< passwords.txt\nexec 5< passwords.txt\n\n# Read user and password\nwhile read iuser <&3 && read ipasswd <&4 ; do\n # Just print this for debugging\n printf \"\\tCreating user: %s with password: %s\\n\" $iuser $ipasswd\n # Create the user with adduser (you can add whichever option you like)\n useradd -m -s /bin/false $iuser\n # Assign the password to the user, passwd must read it from stdin\n passwd $iuser\ndone\n\n\nThe problem is, it does not fill the passwords. And 1 more thing, I want the script to fill the passwords twice.\n\nAny suggestions?"
] | [
"linux",
"bash",
"shell",
"terminal",
"passwords"
] |
[
"How can I filter, or have multiple options, for a generic function?",
"I have a function that is taking in a value, which I then send to NSUserDefaults to store in its Property List.\n\nfunc store<T>(value: T, key: String) -> Bool {\n // send key, value to NSUserDefaults\n}\n\n\nHow can I set up generic constraints so that the value can only be one of the possible types accepted for the property list?\n\nI was thinking something like:\n\nfunc store<T>(value: T, key: String) -> Bool where T:NSString OR T:NSData OR T:Etc{\n // send key, value to NSUserDefaults\n}\n\n\nwhich of course does not work."
] | [
"swift",
"generics",
"generic-constraints"
] |
[
"User login, authentication, and sign up in Django 1.10",
"I am having trouble distinguishing between logins and signups in Django. I was able to successfully create a signup form (that also logs the user in upon sign up.) I am struggling to make a separate sign in form. \n\nThe following code successfully renders a form with 'username' and 'password' fields. Upon clicking \"submit\" the info gets stored as the user object, then gets normalized, then gets saves to the database, and then is used to log in the user. \n\nI tried to delete the user.save() line because I thought that would make the difference between adding a user and logging in a user. However, my terminal shows an unsuccessful post request (\"POST /polls/ HTTP/1.1\" 200 1227) when this happens. \n\nPlease let me know what I can do to simply let the user sign in if his account info already exists in the database. Thanks!\n\nclass LoginFormView(View):\nform_class = LoginForm\ntemplate_name = 'polls/login_form.html'\n\n#display blank form using get\ndef get(self, request):\n form = self.form_class(None)\n return render(request, self.template_name, {'form': form})\n\n#process the form data using post\ndef post(self, request):\n form = self.form_class(request.POST)\n\n if form.is_valid():\n\n user = form.save(commit=False)\n\n #cleaned and normalized data\n username = form.cleaned_data['username']\n password = form.cleaned_data['password']\n user.set_password(password)\n user.save()\n\n #return user object if credentials are correct\n user = authenticate(username=username, password=password)\n\n if user is not None:\n\n if user.is_active:\n login(request, user)\n return redirect('polls:index')\n\n\n return render(request, self.template_name, {'form': form})"
] | [
"django",
"python-2.7",
"django-models",
"django-forms",
"django-views"
] |
[
"My JS Is Not Manipulating the HTML Elements",
"I am trying to write code to put one image on a whole set of elements but allow a click to reveal certain images in certain elements.\n\nSo far, my JS hasn't changed any of the elements. If someone could look at it and give me suggestions, I would be very appreciative.\n\n\r\n\r\nconst cards = document.querySelectorAll(\".card\");\r\nconst flipAllCards = function() {\r\n for (const card of cards) {\r\n card.innerHTML = `<img src=\"img/cardback.jpeg\" alt=\"\">`;\r\n }\r\n};\r\nflipAllCards();\r\n\r\nfunction assignImages() {\r\n for (const card of cards) {\r\n const cardName = card.id;\r\n const imageName = `${cardName}.jpeg`;\r\n\r\n function flipCard(card) {\r\n card.innerHTML = `<img src=\"img/${imageName}\" alt=\"\">`;\r\n return card.innerHTML;\r\n }\r\n console.log(flipCard(card));\r\n card.addEventListener('click', function() {\r\n flipCard(card)\r\n });\r\n }\r\n}\r\nassignImages();\r\n<div class=\"table\">\r\n <div class=\"card\" id=\"agentbrown\"><img src=\"img/agentbrown.jpeg\" alt=\"\"></div>\r\n <div class=\"card\" id=\"agentjones\"><img src=\"img/agentjones.jpeg\" alt=\"\"></div>\r\n <div class=\"card\" id=\"agentsmith\"><img src=\"img/agentsmith.jpeg\" alt=\"\"></div>\r\n <div class=\"card\" id=\"spoonboy\"><img src=\"img/spoonboy.jpeg\" alt=\"\"></div>\r\n <div class=\"card\" id=\"switch\"><img src=\"img/switch.jpeg\" alt=\"\"></div>\r\n <div class=\"card\" id=\"trinity\"><img src=\"img/trinity.jpeg\" alt=\"\"></div>\r\n</div>"
] | [
"javascript",
"html",
"dom"
] |
[
"Ionic + Account kit phone number = crash on android",
"I want to user accountkit on ionic for connection but when i press the button the app is crashing with no errors\n\nMethod : \n\n(<any>window).AccountKitPlugin.loginWithPhoneNumber({\n useAccessToken: true,\n defaultCountryCode: \"IN\",\n facebookNotificationsEnabled: true,\n}, data => {\n(<any>window).AccountKitPlugin.getAccount(\n info => this.userInfo = info,\n err => console.log(err));\n});\n\n\nSomeone can help me ?"
] | [
"ionic-framework",
"account-kit"
] |
[
"Finding all Well-Ordered Numbers within a range, how to print last value before while loop stops in C and print only 10 values per line?",
"The objective of the C-program is to print out all the well-ordered numbers between 100 and 999. Well-ordered numbers are numbers that have digits that are at least smaller by 1 when compared to the digit on it's right (e.g. 123, 456, and 159 are all well-ordered numbers). \n\nI start off setting three integer values x, y, and z values at 1, 2, and 3 respectively as that is the lowest well-ordered number possible in this range. My idea is to increment z first so that we get: 123, 124, 125, .. 129, then whenever it reaches 9 it increments y by 1 and z is set back down to y+1 and it follows from there: 134, 135, 136..139 etc. The while loop checks if the number has reached the last one in the range between 100 and 999 which is 789. My so far \"working\" code is pasted below. \n\nSo far the logic works to print out every well-ordered number between 100-999, but it can't print the last one which is 789 and stops printing at 689 before x is incremented one last time. I spent so long trying to figure it out but can't seem to find where to place this print or where the logic can be changed in order to access this final print where x is incremented once more so that 789 shows in the answer. \n\nAlso the problem I'm working on mentions to print only 10 numbers before returning, and I also couldn't find a way to do this. I'm quite new to the C language so I was wondering if anyone can figure this out and give me some hints or guidance? Have I completely gone about this the wrong way and there is a simpler way to do this?\n\nThank you all for helping in advance.\n\n#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n int x, y, z; \n x = 1; \n y = 2; \n z = 3; \n\n while(x != 7 || y != 8 || z != 9) {\n printf(\"%d%d%d \\n\", x, y, z); // print well-ordered number\n\n if(y==8) {\n x++; // only increment x when y is reached the last position\n y = x+1; // put y in the next correct position\n z = y; // put z in the next correct position \n }\n if(z==9) {\n y++; // only increment y when z's reached the last position\n z = y; // reset z's position\n }\n\n z++; // increment z as it's always the first priority to maintain a well-ordered number\n\n }\n\n\n return 0; \n\n\n}"
] | [
"c",
"while-loop",
"printf"
] |
[
"How to join the table to itself a few times in hibernate criteria?",
"I have some entity essence. It has a lot of attributes (over one hundred). I need make entities filtering. Filters'es count is Unlimited, one attribute can have some filters (such as \"age > 20 AND age < 50\"). The problem is that, in hibernate criteria I can not attach attribute table arbitrary number of times. The first time I join on the entity field, the second time I can not use this field.\n\nCriteria creating:\n\nvar attributeType = typeof(Attribute);\nvar criteria = tr.CreateCriteria(attributeType, \"ATTRIBUTE\");\ncriteria\n .CreateAlias(\"Essence\", \"ESSENCE\", NHibernate.SqlCommand.JoinType.RightOuterJoin)\n .CreateAlias(\"SomeModel\", \"SOME_MODEL\", NHibernate.SqlCommand.JoinType.LeftOuterJoin)\n .Add(Restrictions.And(\n Restrictions.Eq(\"SOME_MODEL.Code\", someCode),\n Restrictions.IsNull(\"ESSENCE.SomeParameter\")));\n...\n\n\nHere attribute is needed to sort through it.\n\nfor (int i = 0; i < filters.Count; i++)\n{\n string attributeColumnName = \"ATTRIBUTE_\" + i.ToString();\n criteria\n .CreateAlias(\"Essence.EssenceAttribute\", \n attributeColumnName,\n NHibernate.SqlCommand.JoinType.LeftOuterJoin,\n Restrictions.EqProperty(\"ESSENCE.Id\", attributeColumnName + \".EssenceId\"))\n .Add(Restrictions.Eq(\n attributeColumnName + \".AttributeId\",\n (long)filters[i].AttributeId))\n .Add(Restrictions.Eq(\n attributeColumnName + \".Value\",\n filters[i].Value));\n}\n\n\nWhen filters has only one filter, then everything works fine. If filters has two - I will catch error (something like \"duplicate using Essence.EssenceAttribute\"). How I can do it?"
] | [
"c#",
"hibernate",
"join",
"nhibernate-criteria",
"icriteria"
] |
[
"How to use ISAPI WebService",
"I have created an SOAP WebService as an ISAPI DLL ( with Delphi XE6 ) , but when i upload it on my host and when i try to execute it , noyhing happens !\n\nI have tested my webservice as an stand alone application but know i converted it to an ISAPI DLL and I want to use it in my host\n\nfor example when i upload it in \"vault-script/WebService\" folder and when I type this address :\n\n\"http://example.com/vault_scripts/Web_Service/ISAPI.dll\"\n\nOR\n\n\"http://example.com/vault_scripts/Web_Service/ISAPI.dll?wsdl/INPG_WService\"\n\nBrowser says \"Not Found !\"\n\nHow I should use this webService ?!\n\nIn other words I want to get WSDL XML address to import it in my client application !\n\nI`m Using Delphi XE6 and my host is Windows with IIS 7.5\n\nthanks"
] | [
"web-services",
"delphi",
"soap",
"isapi"
] |
[
"run time error while converting string to int in entity framework 4.0",
"protected void GetFinalResult(IQueryable<clsProfileData> result)\n{\n if (ddlHeightFrom.SelectedValue != \"0\" && ddlHeightTo.SelectedValue != \"0\")\n {\n int from = Convert.ToInt32(ddlHeightFrom.SelectedValue); \n result = result.Where(p => Convert.ToInt32(p.Height) > from);\n }\n}\n\n\nI am using Entity Framework 4.0\nand in above method p.Height is error causing conversion(string to int). \nis there any way to handle this ?"
] | [
"c#",
"entity-framework-4"
] |
[
"User events with template engines like pug?",
"I want to create an app using NodeJS, Express and Pug. \nThe app should work similar to an editor and react to different user events. \n\nNow I have a conceptual question: Is the approach with NodeJS and a template engine right for this?\n\nI stumble upon how to get the events into the template engine. In pug, for example, I can embed Javascript, but template engines do not seem to be made to implement user events - because in the documentation as well as here on Stack Overflow I don't find a \"standard solution\" for embedding JS scripts, at best workarounds and embedding JS directly in pug (not the reference to a script). For example here: render inline Javascript with jade/pug\n\nI also tried to include a script myself:\n\nPug file\n\ndoctype html\nhtml\n head\n title= `${title} \n body\n h1 My new App\n block content\n script(src=\"myscript.js\").\n\n\nJS Script\n\nwindow.alert(\"Bingo!\");\n\n\nHtml-Result\n\n<!DOCTYPE html>\n <html>\n <head>\n <title>Title</title>\n </head>\n <body>\n <h1>My new App</h1>\n </body>\n <script src=\"myscript\"></script>\n </html>\n\n\nThe code seems to be correct, but it does not work.\n\nSo do I understand that template engines are not the right approach to implement user events? If this is correct, is client-only Javascript the better approach?"
] | [
"javascript",
"node.js",
"pug",
"dom-events",
"template-engine"
] |
[
"For i loop, calling different dataframes",
"I'm new to loops and I have a problem with calling variable from i'th data frame. \n\nI'm able to call each data frame correctly, but when I should call a specified variable inside each data frame problems come:\n\nExample:\n\nfor (i in 1:15) {\n assign(\n paste(\"model\", i, sep = \"\"), \n (lm(response ~ variable, data = eval(parse(text = paste(\"data\", i, sep = \"\")))))\n )\n plot(data[i]$response, predict.lm(eval(parse(text = paste(\"model\", i, sep = \"\"))))) #plot obs vs preds\n}\n\n\nHere I'm doing a simple one variable linear model 15 times, which works just fine. Problems come when I try to plot the results. How should I call data[i] response?"
] | [
"r",
"for-loop"
] |
[
"Transformable Attributes in Core Data using swift 3",
"I have a Core Data model with a multiple transformable attribute. I also have this attribute use a custom NSValueTransformer, setup in the model properly. I can not found any example of transformable attribute using core date for swift 3.\n\n\nHow to create transformable object in NSManagedObject class?\nHow to create a string transformable and save in core data and fetch\nthe details from core data?\n\n\nIs there any blog example of this? If You have any idea about this please help.\n\nThanks in advance."
] | [
"core-data",
"swift3",
"xcode9",
"transformable"
] |
[
"Problems displaying directions on button click using Aangular JS and the Google Maps JS API",
"Have been trying to get a button to work on in a small app that I have been building using the Ionic Framework.\n\nThe button has a pretty simple job right now, on click show directions on the map. When the function is called within the controller it shows on the map but when I try to call it from the click, I am not able to get the directions showing.\n\nWondering what the issue could be here.\n\nvar directionsDisplay = new google.maps.DirectionsRenderer({\n map: $scope.map\n});\n\n$scope.show_dirs = function(){\n\nvar request = {\n destination: locations[3],\n origin: temp_center,\n travelMode: google.maps.TravelMode.DRIVING\n};\n\nvar directionsService = new google.maps.DirectionsService();\n\ndirectionsService.route(request, function(response, status) {\n if (status == google.maps.DirectionsStatus.OK) {\n // Display the route on the map.\n directionsDisplay.setDirections(response);\n }\n});\n};\n//show function works\n//$scope.show_dirs();\n\n\nThe HTML button:\n\n <div style= \"position: absolute; bottom: -10px; width: 100%\" ng-controller=\"MapCtrl\">\n <button class=\"button button-block button-balanced\" ng-click = \"show_dirs\">Find Parking Near Me</button>\n </div>"
] | [
"angularjs",
"google-maps",
"ionic-framework"
] |
[
"redefinition of class c++ header files",
"The main class:\n#include "otherClass.h"\n\nusing namespace std;\n\nint main() {\n a cl;\n return 0;\n}\n\nThe header file:\n#ifndef OTHERCLASS_H_INCLUDED_\n#define OTHERCLASS_H_INCLUDED_\n\nclass a {\n int add(int a, int b);\n int subtract(int a, int b);\n};\n\n#endif\n\nThe .cpp class that the header files corresponds to\n#include "otherClass.h"\n\nclass a { \n int add(int a, int b) {\n return (a + b);\n }\n \n int subtract(int a, int b) {\n return (a - b);\n }\n};\n\nThe error:\n\nText.cpp:13: error: ‘cl’ was not declared in this scope\notherClass.cpp:3: error: redefinition of ‘class a’ otherClass.h:3:\nerror: previous definition of ‘class a’\n\nI have two questions: First, before I added a class inside my header file , the file worked fine (just holding functions). Once I added classes, I got the above two errors. Can someone please tell me how to arrange my header file to fix these errors? I.e. I want to know how to be able to make a header file for a file that contains a class.\nSecond, how do I get it so the class is declared within the scope of the main function?"
] | [
"c++",
"file",
"header"
] |
[
"Efficiently abstracting over datatype arity",
"As everyone knows, you can easily build n-tuples out of 2-tuples.\n\nrecord Twople (A B : Set) : Set where\n constructor _,_\n field\n fst : A\n snd : B\n\nn-ple : List Set -> Set\nn-ple = foldr Twople Unit\n\n\n(Agda syntax, but it'll work in Idris, and can be made to work in Haskell, Scala...)\n\nLikewise, you can build n-ary sum types out of binary sums.\n\ndata Either (A B : Set) : Set where\n left : A -> Either A B\n right : B -> Either A B\n\nOneOf : List Set -> Set\nOneOf = foldr Either Void\n\n\nSimple, and pretty, but inefficient. Plucking the rightmost item from an n-ple takes O(n) time because you have to unpack every nested Twople on the way. n-ple is more like a heterogeneous list than a tuple. Likewise, in the worst case, a OneOf value lives at the end of n-1 rights.\n\nThe inefficiency can be mitigated by manually unpacking the fields, and inlining the constructor cases, of your datatypes:\n\nrecord Threeple (A B C : Set) : Set where\n constructor _,_,_\n field\n fst : A\n snd : B\n thd : C\n\ndata Threeither (A B C : Set) : Set where\n left : A -> Threeither A B C\n middle : B -> Threeither A B C\n right : C -> Threeither A B C\n\n\nPicking an item from a Threeple and performing case-analysis on a Threeither are both now O(1). But there's a lot of typing involved, and not the good kind - Fourple, Nineither, Hundredple, and so on, must all be separately defined datatypes.\n\nMust I choose between O(1) time and O(1) lines of code? Or can dependent types help me out? Can one efficiently abstract over datatype arity?"
] | [
"haskell",
"agda",
"dependent-type",
"idris"
] |
[
"Running small periodical high-priority background taks on iOS",
"App that I am working on is offering a VPN connection, that can run even when the app is not running at all. This service is paid, but also I would like to offer a free trial limited by session length and maximum data transfered.\n\nThe problem I've encoutered, is with monitoring the data trasnfered when the app is in background or not runing at all. So far the best solution I've came up with, would be to periodically run small task that checks if the user is still within the data limit and if not, the VPN will be disconnected and notification shown to the user. \n\nWill silent notification get priority every time it will be required? According to this quote from developer.apple.com, they are low-priority which isn't what I need, but I was unable to find anything else.\n\n\n Silent notifications are not meant as a way to keep your app awake in the background, nor are they meant for high priority updates. APNs treats silent notifications as low priority and may throttle their delivery altogether if the total number becomes excessive. The actual limits are dynamic and can change based on conditions, but try not to send more than a few notifications per hour.\n\n\nHow can this be done reliably? Is there any other way?"
] | [
"ios",
"iphone",
"swift",
"background-process"
] |
[
"Does the following ARM instruction set generate stalls?",
"Programming the ARM11MP Vfpu, I've looked over the docs and am concerned that the following will stall badly when doing a 4-component dot product (as part of a 4x4 matrix multiply)\n\n\n fmuls s0, s0, s4\n fmacs s0, s1, s5\n fmacs s0, s2, s6\n fmacs s0, s3, s7\n\n\nDoes the accumuate step generate stalls here? If so, I will have to really change stuff around as I only get 32 single registers to work with and then takes 9 as it is. Also, I could setup the vector register to do this in 1 instruction, but am wondering if the 3 instruction cycles will be worth it as I'd have to unset it nearly immediately for a store back to memory unless I overflowed to the ARM registers. Posting from home without my real SO account here..."
] | [
"performance",
"assembly",
"arm"
] |
[
"Compile mapsforge jar files download from github - Android Studio",
"I've started a new project in android Studio because for me it seemed the most obvious thing to do, compile mapsforge so I can use it in my next project create an App .\n\nMy first steps :\n\n\nVia Android Studio : File > New > Project from version control\nDownload mapsforge from Github : https://github.com/mapsforge/mapsforge.git\n\n\nAfter above steps this is my result\n\nOpened and take look at the existing build.gradle file... aaaaargh \nIgnore the whole gradle stuff, just goto : Build > Make Project Ctrl + F9 ... executing taks and gradle build finished, no errors , Nice !\n\n\nQuestions: \n\n\nWhere is the path where the jar files are generated / copied to? How to configure it? In AndroidStudio OR ignore this and just focus on the gradle.build script?\n\n\nNote:\nIt's not about programming or developing its about environment configuration.\nSo I really struggle with gradle, never used it before, started watching tutorials/demos, read stuff about it, ! I know rtfm ! Im missing out on some helpfull documentation.\n\nI just want to compile and generate the jars (one time only) and use them in my App, thats it..."
] | [
"android-studio",
"gradle",
"jar",
"configuration",
"mapsforge"
] |
[
"Ruby sockets not receiving all the messages",
"I wrote a little script on Ruby to connect and login on a IRC server, but when the IRC server sends out a new message, the socket doesn't receive it, for example, a log is:\n\n:irc.someserver.net NOTICE Auth :*** Looking up your hostname...\n:irc.someserver.net NOTICE Auth :Welcome to someserver Net!\n:irc.someserver.net 003 brobot :This server was created 15:40:35 Mar 28 2012\n:irc.someserver.net 005 brobot MAXTARGETS=20 MODES=20 NETWORK=Studio NICKLEN=32 Net PREFIX=(ov)@+ STATUSMSG=@+ TOPICLEN=308 VBANLIST WALLCHOPS WALLVOICES :are supported by this server\n:irc.someserver.net 372 brobot :- Welcome To the someserver Chat Server. Please Select the #Team Channel.\n:irc.someserver.net 252 brobot 1 :operator(s) online\n:irc.someserver.net 265 brobot :Current Local Users: 5 Max: 5\n:irc.someserver.net 353 brobot = #brobot_dev :@Pablo brobot \n:[email protected] PRIVMSG #brobot_dev :f\nPING :irc.someserver.net\n\n\nThat's a sample log, it looks ok, but on :[email protected] PRIVMSG #brobot_dev :f is when it misses messages. For example I send 5 messages and the client only receives 1. This is the client code:\n\nrequire 'socket' # Sockets are in standard library\n\nhostname = '10.1.1.1'\nport = 6667\n\nserver = TCPSocket.open(hostname, port)\n\nloop {\n server.flush\n puts server.gets.chomp\n\n if server.gets.chomp =~ /:.*NOTICE Auth :\\*\\*\\* Found your hostname/\n server.puts \"USER brobot brobot brobot brobot\\r\\nNICK brobot\\r\\n\"\n elsif server.gets.chomp =~ /:\\S* 26*/\n server.puts \"JOIN #brobot_dev\\r\\n\"\n end\n}\n\n\nWhat I'm doing wrong? Thanks!"
] | [
"ruby",
"sockets",
"irc"
] |
[
"How to validate hook block configure form in Drupal 7",
"In Drupal 7 hook_block_configure and hook_block_save provide a method to modify a blocks settings and save these values. \n\nBut how would I carry out validation on the form before saving the values?"
] | [
"php",
"validation",
"drupal",
"drupal-hooks",
"drupal-blocks"
] |
[
"session scope in velocity",
"How can I use session scope in VELOCITY (in view part am using sample.vm like that).\n\nMy requirement is when I login into a page, I want to store the user's name & some details in session and if I press logout I want to clear all the information in that session."
] | [
"java",
"frameworks",
"velocity"
] |
[
"subset matrix by more than one thing fast",
"I have a matrix I would like to subset quickly using two criteria. 1) the colnames match the rownames and 2) the value in one matrix is FALSE\n\nm\n [,1]\nA 1\nB 2\nC 3\nD 4\nE 5\n\ntf\n E B A\n[1,] FALSE FALSE TRUE\n\n\nthe output should be\n\nm2\n [,1]\nE 5\nB 2"
] | [
"r",
"matrix"
] |
[
"Bind DependencyProperty of Usercontrol in ListBox",
"I need ListBox with my UserControl listed in it. My UserControl has TextBox. So I want to display property of List's subitem in UserControl's textBox. I have tried a lot of options with DataContext and ElementName - it just doesn`t work. I just stucked on it. The only way to make it work is to remove DataContext binding of UserControl to itself and change Item Property name so it matches to DependencyProperty name - but I need to reuse my control in different viewmodels with different entities so it is almost not possible to use the approach.\n\nInteresting thing is that if I change my UserControl to Textbox and bind Text property of it - everything works. What the difference between Textbox and my UserControl?\n\nSo let me just show my code.\nI have simplified the code to show only essential:\n\nControl XAML:\n\n<UserControl x:Class=\"TestControl.MyControl\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \n xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\" \n mc:Ignorable=\"d\" \n d:DesignHeight=\"100\" d:DesignWidth=\"200\"\n DataContext=\"{Binding RelativeSource={RelativeSource Self}}\">\n <Grid>\n <TextBlock Text=\"{Binding Text}\"/>\n </Grid>\n</UserControl>\n\n\nControl CS:\n\n public partial class MyControl : UserControl\n {\n public MyControl()\n {\n InitializeComponent();\n } \n public string Text\n {\n get { \n return (string)this.GetValue(TextProperty); }\n set { \n this.SetValue(TextProperty, value); }\n }\n public static DependencyProperty TextProperty = DependencyProperty.Register(\"Text\", typeof(string), typeof(MyControl), new propertyMetadata(\"\"));\n}\n\n\nWindow XAML:\n\n<Window x:Class=\"TestControl.MainWindow\"\n Name=\"_windows\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n xmlns:local=\"clr-namespace:TestControl\"\n Title=\"MainWindow\" Height=\"350\" Width=\"525\" >\n <Grid Name=\"RootGrid\">\n <ListBox ItemsSource=\"{Binding ElementName=_windows, Path=MyList}\">\n <ItemsControl.ItemTemplate >\n <DataTemplate >\n <local:MyControl Text=\"{Binding Path=Name}\"/>\n </DataTemplate>\n </ItemsControl.ItemTemplate>\n </ListBox>\n </Grid>\n</Window>\n\n\nWindow CS:\n\npublic partial class MainWindow : Window\n {\n public MainWindow()\n {\n _list = new ObservableCollection<Item>();\n _list.Add(new Item(\"Sam\"));\n _list.Add(new Item(\"App\"));\n _list.Add(new Item(\"H**\"));\n InitializeComponent();\n\n }\n private ObservableCollection<Item> _list;\n\n public ObservableCollection<Item> MyList\n {\n get { return _list;}\n set {}\n }\n }\n public class Item\n {\n public Item(string name)\n {\n _name = name;\n }\n\n private string _name;\n\n public string Name\n {\n get { return _name; }\n set { _name = value; }\n }\n }"
] | [
"c#",
"wpf",
"binding",
"user-controls",
"datacontext"
] |
[
"can't retrieve correctly tagged photos of my friends with FQL",
"I'm using FQL.I want to retrieve tagged photos of my friends.\nAnd I'm using this Query.\n\nSELECT pid,images FROM photo WHERE pid IN (\n SELECT pid FROM photo_tag WHERE pid IN (\n SELECT pid,images FROM photo WHERE aid IN (\n SELECT aid FROM album WHERE owner IN \n SELECT uid,username,pic FROM user WHERE uid IN \n SELECT uid2 FROM friend WHERE uid1 = me())\n ))))\n\n\nBut It retrieves less than I've expected.\nI think that there's limit when retrieves photos from albums.\n\nHow do I retrieve more photos?"
] | [
"ruby-on-rails",
"facebook",
"api",
"facebook-graph-api",
"facebook-fql"
] |
[
"PHP MySQL Query to check if record exists or not",
"I have following data in the table..\n\n+-------------+---------------+--------------+\n| activity_id | activity_name | main_unit_id |\n+-------------+---------------+--------------+\n| 1 | DEA | 67 |\n| 2 | DEB | 68 |\n| 3 | DEC | 68 |\n| 4 | fasdfsadf | 74 |\n+-------------+---------------+--------------+\n\n\ni want to add another activity, but before adding i have to make sure that same activity name is not there against an main_unit_id...\nI write following query,\n\n$SQL_CHECK_ACTIVITY = mysql_query(\n \"SELECT count(*) FROM activities \" .\n \"WHERE main_unit_id = '67' and activity_name = 'DEA'\"\n);\n$RESULT_SQL_CHECK_ACTIVITY = mysql_num_rows($SQL_CHECK_ACTIVITY);\necho $RESULT_SQL_CHECK_ACTIVITY;\n\n\nthen it print 1 which means a activity against this project already exists...\n\n$SQL_CHECK_ACTIVITY = mysql_query(\n \"SELECT count(*) FROM activities \" .\n \"WHERE main_unit_id = '78' and activity_name = 'afsdaf'\"\n);\n$RESULT_SQL_CHECK_ACTIVITY = mysql_num_rows($SQL_CHECK_ACTIVITY);\necho $RESULT_SQL_CHECK_ACTIVITY;\n\n\nthen it print 1 which means a activity against this project already exists...\nbut there is no record in this case...."
] | [
"php",
"mysql",
"sql"
] |
[
"Dynamically add values from a csv in an html table using javascript/jquery",
"I have a dynamically generated CSV file from another vendor that I am puling in and need to show in a table on my site. The problem is I need to be able to manipulate the data from the CSV so it can show the corrected values in the html table. In the end I need the HTML table to just display the Products, not the Mixed Sets.\n\nI am using jquery and the papaparse library to get the data and parse it in a table in html. My codepen is here:\n\nhttps://codepen.io/BIGREDBOOTS/pen/YQojww\n\nThe javascript pulls the initial csv values and display in a table, but I can't figure out how to to add together the values. If there is a better way of going about this, like converting the CSV to some other form of data like JSON, That is fine too.\n\nMy CSV looks like this:\n\nproduct_title,product_sku,net_quantity\nProduct 1,PRD1,10\nProduct 2,PRD2,20\nProduct 3,PRD3,30\nMixed Set 1,MIX1,100\nMixed Set 2,MIX2,50\nMixed Set 3,MIX3,75\n\n\nThe Javascript I am using is:\n\n\r\n\r\n function arrayToTable(tableData) {\r\n var table = $('<table></table>');\r\n $(tableData).each(function (i, rowData) {\r\n var row = $('<tr class=\"rownum-' + [i] + '\"></tr>');\r\n $(rowData).each(function (j, cellData) {\r\n row.append($('<td class=\"' + [i] + '\">'+cellData+'</td>'));\r\n });\r\n table.append(row);\r\n });\r\n return table;\r\n }\r\n\r\n $.ajax({\r\n type: \"GET\",\r\n url: \"https://cdn.shopify.com/s/files/1/0453/8489/t/26/assets/sample.csv\",\r\n success: function (data) {\r\n $('body').append(arrayToTable(Papa.parse(data).data));\r\n }\r\n });\r\n\r\n\r\n\n\nMy rules for the mixed set:\n\n\nMixed Set 1 should add 100 to Product 1 and Product 2.\nMixed Set 2 should add 50 to Product 2 and Product 3.\nMixed Set 3 should add 75 to Product 1, Product 2 and Product 3.\n\n\nI'd like to end up with Just the products output, and the correct numbers added to the formula.\nThe end result would be a table with Product 1 = 185, Product 2 = 245, and Product 3 = 155.\n\nWhile it would be even better if the top THEAD elements were in a \"th\", It's fine if that is too complicated.\n\n<table>\n <tbody>\n <tr class=\"rownum-0\">\n <td class=\"0\">product_title</td>\n <td class=\"0\">product_sku</td>\n <td class=\"0\">net_quantity</td>\n </tr>\n <tr class=\"rownum-1\">\n <td class=\"1\">Product 1</td>\n <td class=\"1\">PRD1</td>\n <td class=\"1\">185</td>\n </tr>\n <tr class=\"rownum-2\">\n <td class=\"2\">Product 2</td>\n <td class=\"2\">PRD2</td>\n <td class=\"2\">245</td>\n </tr>\n <tr class=\"rownum-3\">\n <td class=\"3\">Product 3</td>\n <td class=\"3\">PRD3</td>\n <td class=\"3\">155</td>\n </tr>\n </tbody>\n</table>"
] | [
"javascript",
"jquery",
"ajax",
"csv",
"papaparse"
] |
[
"Return remainder of a variable if started with given character",
"If the value of a variable (i.e. $var=\"^hello\";) starts with a given character (i.e. ^), how could I return the remainder of that variable (i.e. hello), and returnFALSE (or NULL or 0 if easier) if it doesn't start with the given character? Note that there is no guarantee that the variable will be a string. I tried the following, but it results in errors if the value is NULL.\n\n$var='^hello'; //Works\n$var=123; //Works\n$var=NULL; //Doesn't work\necho ($var[0]=='^')?substr($var,1):false;\necho($new);"
] | [
"php"
] |
[
"drag down your mouse at left mouseclick in python",
"I am trying for a while to get a code that drags the mouse down when I press left mouse button.\nI now have:\ndef onclick(event):\n print ('---')\n \n pyautogui.drag(0,-500,5, button='left')\n print("click")\n return True\n\n hm = pyHook.HookManager() \n hm.SubscribeMouseAllButtonsDown(onclick) \n hm.HookMouse() \n pythoncom.PumpMessages()\n\nI now experience that the program will make my mouse stutter after I have used it, and it keeps on running, so I have no clue on how to stop that\nI have tried to use\nbut that just generated the same issue"
] | [
"python",
"pyautogui",
"pyhook",
"pythoncom"
] |
[
"Flexsurvreg - applying covariates",
"I am using flexsurvreg from the flexsurv package in order to fit a Gompertz model to survival data. An example of this with one categorical and one continuous covariate on each parameter is below:\n\nlibrary(survival)\nlibrary(flexsurv)\nCall:\nflexsurvreg(formula = Surv(time, status) ~ sex + shape(ph.ecog), \ndata = lung, dist = \"gompertz\")\n\nEstimates: \n data mean est L95% U95% se exp(est) L95% U95% \nshape NA 0.000659 -0.000210 0.001527 0.000443 NA NA NA\nrate NA 0.003355 0.002042 0.005512 0.000850 NA NA NA\nsex 1.396476 -0.525441 -0.852719 -0.198163 0.166982 0.591294 0.426254 0.820236\nshape(ph.ecog) 0.951542 0.000937 0.000375 0.001498 0.000287 1.000937 1.000375 1.001500\n\nN = 227, Events: 164, Censored: 63\nTotal time at risk: 69522\nLog-likelihood = -1139.932, df = 4\nAIC = 2287.864\n\n\npar$coefficients\nshape rate sex shape(ph.ecog) \n0.0006588492 -5.6973226550 -0.5254411364 0.0009368314 \n\n\nNote, the difference between the rate terms in the summary and the par$coefficients call is that the latter is shown as the natural logarithm of the former\n\nFrom the vignette - https://cran.r-project.org/web/packages/flexsurv/flexsurv.pdf - the Gompertz Hazard function is defined as - \n\nGompertz distribution with shape parameter a and rate parameter b has hazard function H(x: a, b) = b.e^{ax}\n\n\nMy question is, how are the covariates applied to the shape and rate parameters to derive the new hazard function?\n\nWould the new shape parameter be shape_new = shape + ph.ecog_value(between 1-5)*shape(ph.ecog) = 0.0006588492 + (some value between 1 and 5)*0.0009368314 and the new rate be rate_new = rate + sex = -5.6973226550 - 0.5254411364 (as per the variables in my prior example)? \n\nNote - this prior question is relevant, however, it did not concern the inclusion of covariates on the shape/rate parameters -Gompertz Aging analysis in R"
] | [
"r",
"statistics",
"survival-analysis"
] |
[
"Use #ifdef in .lib and defining variable in linkin project",
"I am creating a library (.lib) in c++ with Visual Studio 2008. I would like to set a variable to change the behaviour of the library depending on the variable. Simplifying a lot, something like this:\n\n#ifdef OPTION1\ni = 1;\n#else\ni = 0;\n#endif\n\n\nBut the variable (in this case OPTION1) should not be defined in the library itself, but in the code that links to the library, so that just changing the definition of the variable I could obtain different behaviours from the program, but always linking to the same library.\n\nIs this possible, and how? Or is there a more elegant way to achieve what I want?"
] | [
"c++",
"libraries"
] |
[
"Javascript PHP/MySQL - Insert row value from database into textfield",
"Possibly very easy to do but I cannot work it out!\n\nI'm trying to make a button which inserts row value pulled out from the database into a textfield.\n\n<?php while ($row = mysql_fetch_array($query)) { ?> <tr> \n<td><?php echo $row['mobile_number']; ?></td>\n<td><input type=\"button\" value=\"select\" onclick=\"clickMe()\" /></td>\n</tr>\n<?php } ?>\n\n<input type=\"text\" id=\"textfield\" />\n\n\nso when the button \"select\" is clicked, the textfield would get populated with the mobile number. \n\nMany thanks for your help in advance."
] | [
"javascript",
"php",
"mysql"
] |
[
"What is the purpose of the MB_CASE_*_SIMPLE constants?",
"According to the manual, the following constants have been added in PHP 7.3:\n\n\nMB_CASE_FOLD\nMB_CASE_LOWER_SIMPLE\nMB_CASE_UPPER_SIMPLE\nMB_CASE_TITLE_SIMPLE\nMB_CASE_FOLD_SIMPLE\n\n\nI found an example of what MB_CASE_FOLD does:\n\necho mb_convert_case('ẞ', MB_CASE_FOLD, 'UTF-8'); // ss\n\n\nHowever, I could not find any reference to what the MB_CASE_*_SIMPLE constants do.\n\nAt first glance, with simple latin1 characters, MB_CASE_LOWER_SIMPLE behaves just like MB_CASE_LOWER.\n\nWhat do the MB_CASE_*_SIMPLE do different from their MB_CASE_* counterparts?"
] | [
"php",
"mbstring"
] |
[
"Pandas groupby on empty DataFrame results in no columns",
"I have an empty DataFrame with columns but no rows. \nI want to apply groupby on it but it results in no columns. \nHow to apply groupby and keep columns?\n\ndf = pd.DataFrame(data={'a':[], 'b': []})\ndf = df.groupby('a').apply(lambda g: g).reset_index(drop=True)\n\n\noutput:\n\nEmpty DataFrame\nColumns: []\nIndex: []\n\n\ndf.index\n\nFloat64Index([], dtype='float64', name='a')"
] | [
"python",
"pandas",
"apply"
] |
[
"Flattening hierarchical data with Linq in VB.NET",
"Given the following structure:\n\nPublic Class Vendor\n Public Property Accounts As Account()\nEnd Class\n\nPublic Class Account\n Public Property Services As Service()\nEnd Class\n\nPublic Class Service\n Public Property Name As String\nEnd Class\n\n\nHow do I get a flat list of all included Services in all accounts given a single Vendor? This is what I've tried so far:\n\nvendor.Accounts.Select(Function(acct) acct.Services) 'Returns a collection of services collections\n\n\nI know I'm just missing an obvious operator."
] | [
"linq"
] |
[
"Not able to push/pull to google repository",
"My colleague cloned my repository on google cloud and I was able to push/pull properly and now he is gone. On google I accidentally created new credentials and I lost my access to repository which I think I need to use new credentials if I am right.\n\n\n\n\nAt the moment I am following this:\n \n\nBy clicking on Generate and store your git credentials I have this:\n\n\nWould you please help me what should I do? I am confused as my repository is cloned earlier maybe I just need to change the credentials only.\nMany thanks"
] | [
"git",
"google-cloud-platform",
"atlassian-sourcetree",
"google-cloud-repository"
] |
[
"How to store error exception in a variable and return as json",
"Im working with an API used by Android Development.\nMy Framework: Laravel 4.2 and PHP: PHP5.6\n\nI already found a library but couldn't make it work: https://github.com/Radweb/JSON-Exception-Formatter\n\nMy problem, I have this error exception (attached images)\n\n\nI can't see it properly in Mobile, it just crashes. Im using https://www.getpostman.com/ for testing my API.\n\nWhat I wanted to do is return this error exception as json so that the android can catch it.\n\n{\n \"status\" : \"fail\",\n \"messsage\" : \"syntax error, unexpected 's'(T_STRING), expecting ']'\",\n \"file\" : \"/app/controller/v1/UserController.php\",\n \"line\" : \"31\"\n}"
] | [
"api",
"exception",
"laravel-4",
"error-handling",
"php-5.6"
] |
[
"import SDK in Android Studio",
"I just finished an application for Android and I would like to put ads on it to earn some money... I decided to use the network Unity Ads but I have a problem : I do not know how to import the SDK library project in Android Studio (this is only explained for Eclipse and I work on Android Studio). Could you explain me how to do that ?"
] | [
"android",
"android-studio",
"import",
"sdk"
] |
[
"SQL Alchemy many to many relationship with current table",
"For my application I need to create a link with points which is the same entity. Currently I do it this way.\n\nassociation_table = db.Table('main_connectedpoints', Base.metadata,\n db.Column('point_id', db.Integer, db.ForeignKey('main_placepoint.id')),\n db.Column('connected_point_id', db.Integer, db.ForeignKey('main_placepoint.id')))\n\n\nclass PlacePoint(db.Model):\n __tablename__ = 'main_placepoint'\n\n id = db.Column(db.Integer, primary_key=True)\n name = db.Column(db.String())\n lat = db.Column(db.Float())\n lon = db.Column(db.Float())\n address = db.Column(db.String())\n organizations = db.relationship('Organization', backref='main_placepoint',\n lazy='dynamic')\n related_points = db.relationship(\"PlacePoint\",\n secondary=lambda: association_table)\n\n def __init__(self, dict_):\n self.name = dict_['name']\n self.lat = dict_['lat']\n self.lon = dict_['lon']\n self.address = dict_['address']\n\n def __repr__(self):\n return \"Place %r\" % self.address\n\n def as_dict(self):\n return {\"name\": self.name, \"lat\": self.lat, \"lon\": self.lon, \"address\": self.address}\n\n\nBut I have the following error: NoReferencedTableError: Foreign key associated with column 'main_connectedpoints.point_id' could not find table 'main_placepoint' with which to generate a foreign key to target column 'id'\n\nI suppose that it is because PlacePoint class is not instantiated. Any idea to fix it?"
] | [
"python",
"python-2.7",
"sqlalchemy",
"flask-sqlalchemy"
] |
[
"Flatten list of lists",
"I'm having a problem with square brackets in Python. I wrote a code that produces the following output:\n\n[[180.0], [173.8], [164.2], [156.5], [147.2], [138.2]]\n\n\nBut I would like to perform some calculations with that, but the the square brackets won't let me.\n\nHow can I remove the brackets? I saw some examples to do that but I could not apply them to this case."
] | [
"python",
"arrays",
"list",
"brackets"
] |
[
"How to order table retrieved via .Include(\"table\") using LINQ?",
"I have this LINQ code and it works well. I can order the Posts, but I need also to order the Comments retrieved via Include(\"Comments\"): orderby comment.DateAndTime descending\n\nHow to achieve that in LINQ code; (ordering comments)?.\n\nAlso I am wondering if there is a way to achieve that directly in the underlying database table definition?; Comments table definition.\n\npublic IQueryable<Post> ListViewPosts_GetData()\n{\n FacebookDataEntities entities = new FacebookDataEntities();\n\n var friends_A = from f in entities.Friends\n where f.Friend_B == User.Identity.Name && f.AreFriends\n select f.Friend_A;\n\n var friends_B = from f in entities.Friends\n where f.Friend_A == User.Identity.Name && f.AreFriends\n select f.Friend_B;\n\n return from p in entities.Posts.Include(\"Comments\")\n let userName = p.UserName\n where userName == User.Identity.Name\n || friends_A.Concat(friends_B).Contains(userName)\n orderby p.DateAndTime descending\n select p;\n}"
] | [
"c#",
"asp.net",
"linq",
"include",
"sql-order-by"
] |
[
"Why single layer MLP is better than multilayer in digit classifier?",
"I am doing digit classifier with MNIST dataset using MLP Classifier. I observe very strange behaviour. Single layer classifier is better than multilayer. While increasing number of neurons in single layer seems to be increasing accuracy. Why multilayer is not better than single layer?\nHere is my code:\n\nparam_grid={'hidden_layer_sizes':[400,300,200,100,70,50,20,10]}\ngrid=GridSearchCV(MLPClassifier(random_state=1),param_grid,cv=3,scoring='accuracy')\ngrid.fit(train_data.iloc[:,1:],train_data.iloc[:,0])\ngrid.grid_scores_\n\n\noutput:\n\n[mean: 0.97590, std: 0.00111, params: {'hidden_layer_sizes': 400},\n mean: 0.97300, std: 0.00300, params: {'hidden_layer_sizes': 300},\n mean: 0.97271, std: 0.00065, params: {'hidden_layer_sizes': 200},\n mean: 0.97052, std: 0.00143, params: {'hidden_layer_sizes': 100},\n mean: 0.96507, std: 0.00262, params: {'hidden_layer_sizes': 70},\n mean: 0.96448, std: 0.00150, params: {'hidden_layer_sizes': 50},\n mean: 0.94531, std: 0.00378, params: {'hidden_layer_sizes': 20},\n mean: 0.92945, std: 0.00320, params: {'hidden_layer_sizes': 10}]\n\n\nFor multilayer:\n\nparam_grid={'hidden_layer_sizes':[[200],[200,100],[200,100,50],[200,100,50,20],[200,100,50,20,10]]}\ngrid=GridSearchCV(MLPClassifier(random_state=1),param_grid,cv=3,scoring='accuracy')\ngrid.fit(train_data.iloc[:,1:],train_data.iloc[:,0])\ngrid.grid_scores_\n\n\nOutput:\n\n[mean: 0.97271, std: 0.00065, params: {'hidden_layer_sizes': [200]},\n mean: 0.97255, std: 0.00325, params: {'hidden_layer_sizes': [200, 100]},\n mean: 0.97043, std: 0.00199, params: {'hidden_layer_sizes': [200, 100, 50]},\n mean: 0.96755, std: 0.00173, params: {'hidden_layer_sizes': [200, 100, 50, 20]},\n mean: 0.96086, std: 0.00511, params: {'hidden_layer_sizes': [200, 100, 50, 20, 10]}]\n\n\nAbout dataset: 28*28 pixel images of handwritten digits."
] | [
"python-3.x",
"machine-learning",
"scikit-learn",
"neural-network"
] |
[
"Best way to pair off all users in Rails?",
"I currently have a DB with a large group of users, and am looking for a way to pair them all up, based on a certain number of things.\n\nWhat is the best way to randomly iterate through the db of users, and pair them all up with each other? Ensuring that nobody misses out, and that time you do so everything is randomized. \n\nHas anyone had any experience with this before? Any help would be much appreciated."
] | [
"sql",
"ruby-on-rails",
"ruby"
] |
[
"OpenCV throwing Unhandled Exception when using the findContours function in opencv_core310.dll",
"I am writing a function that finds and returns the center of any image given to the system (they are mostly circular objects.)\n\nWhen running the findContours method using OpenCV3.10, the function throws an error in the vector class. Here is my code:\n\ncv::Mat image = next_image(cam);\ncv::Mat gray; cv::Mat thresh; cv::Mat conv;\n\ncv::Mat canny_output; cv::Mat nImg;\nstd::vector<std::vector<cv::Point>> contours;\nstd::vector<cv::Vec4i> hierarchy;\n//threshold and contour the image\n\ncv::cvtColor(image, conv, cv::COLOR_GRAY2RGB);\n\ncv::cvtColor(conv, gray, CV_BGR2GRAY);\ncv::blur(gray, gray, cv::Size(5, 5));\ncv::threshold(gray, thresh, 60, 355, cv::THRESH_BINARY);\ncv::findContours(thresh, contours, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE);\n\n\nVisual Studio throws the Exception Unhandled when it hits findContours (and specifically in the vector file that it uses) and the message says\n\n\n Unhandled exception at 0x5825AF78 (opencv_core310.dll) in Laser_Tracking.exe: 0xC0000005: Access violation reading location 0xDDDDDDD9.\n\n\nI am currently using Visual Studios 2019 to run OpenCV."
] | [
"c++",
"visual-studio",
"opencv",
"exception",
"image-processing"
] |
[
"Array with Protocol elements can't call array extension method",
"I want to make array with protocol elements call array extension method. The code in playground get error:\n\n\n error: type 'ObjectProtocol' does not conform to protocol 'Equatable'\n\n\nThe code:\n\nextension Array {\n func good() {\n }\n}\n\nprotocol ObjectProtocol {\n\n}\n\nextension ObjectProtocol where Self: Equatable {\n func isEqualTo(_ other: ObjectProtocol) -> Bool {\n guard let otherX = other as? Self else { return false }\n return self == otherX\n }\n}\n\nextension Array where Element: Equatable {\n func bad() {}\n}\n\nvar protocolArray = [ObjectProtocol]()\nvar array = [1,3,2,5]\n\narray.good() // OK\narray.bad() // OK\n\nprotocolArray.good() // OK\nprotocolArray.bad() // error: error: type 'ObjectProtocol' does not conform to protocol 'Equatable'\n\n\nAny way to achieve it?"
] | [
"swift",
"protocols"
] |
[
"how do I get maven to tell me what jar it would build without building it?",
"Given a particular pom.xml, maven will build a given package based on the settings. \n\nIs there any way on the command-line I can ask maven to tell me what output file it would build, without actually building?\n\nE.g., if part of my pom.xml is\n\n<artifactId>foo</artifactId>\n<version>0.2.5</version>\n<packaging>jar</packaging>\n\n\nI would want to do something like mvn package:tell-me-name-without-doing-anything and get an output like target/foo-0.2.5.jar"
] | [
"maven",
"maven-3"
] |
[
"Whats is the right way to get elapsed time and reset it",
"In my android program I am using two Calendar instances to get the elapsed time in my program, first I set a level starting time as follows:\n\nlevel_Start_TimeCal = Calendar.getInstance(); \n\n\nand in my thread I am calculating elapsed time as follows:\n\nlevel_current_TimeCal = Calendar.getInstance();\ngameTime = level_current_TimeCal.getTimeInMillis()- level_Start_TimeCal.getTimeInMillis(); \ndsecs = (gameTime / 1000)%60;\ndminutes = (gameTime / (60 * 1000))%60;\ndhours = (gameTime / (60 * 60 * 1000))%60;\n\n\nRecently I came to read the following:\n\n\n Calendar's getInstance method returns a Calendar object whose calendar\n fields have been initialized with the current date and time\n\n\nI want to know if I am in right path?\nAm I creating an object each time the thread running?\nIf yes is there any alternative to avoid creating unwanted objects and calculating elapsed time?\nFinal question: at some point I want to reset the time in my restart method I reset it by just calling getInstance in my reset method as follows:\n\npublic void restart() {\n level_Start_TimeCal = Calendar.getInstance();\n}\n\n\nIs this the correct way to reset the Calendar?"
] | [
"java",
"android"
] |
[
"Debugging .NET memory leaks - how to know what is holding a reference to what?",
"I am working on a .NET application where there appears to be a memory leak. I know the text-book answers, that events should be unsubscribed, disposable objects should be disposed etc... \n\nI have a test harness that can reproduce the error. In the finalizer of a certain class I write to console \n\npublic class Foo\n{\n // Ctor\n public Foo()\n {\n }\n\n ~public Foo()\n {\n Console.WriteLine(\"Foo Finalized\");\n }\n}\n\n\nIn the test harness, I am creating a single instance of Foo (which in turn creates and interacts with hundreds of other types) then removing it and invoking the Garbage collector. \n\nI am finding the Foo Finalizer is never called. I have a similar class with this setup which is finalized as a control test. \n\nSo my question is this: \n\n\n How can I determine using commercial or open source tools exactly what\n is holding a reference to Foo?\n\n\nI have a professional license to dotTrace Memory profiler but can't figure out from the help files how to use it. \n\nUpdate: I am now using dotMemory 4.0, which is the successor to the (good, but unusable) dotTrace Memory 3.5."
] | [
"c#",
"memory-leaks",
"garbage-collection"
] |
[
"How to debug a Meteor plugin file?",
"I've followed Meteor Doc to register a plug-in package.\nCreated a plug-in file in the package/plugin/ folder\nAdded a debugger; in that file.\nran $ meteor debug;\n\n\nProblem: debugger; directive is ignored. How to debug the plug-in file?\n\nThx!\n\n\n\nplugin/compile-atscript.js:\n\nPlugin.registerSourceHandler(\n 'ats'\n , function (compileStep) {\n var source = compileStep.read().toString('utf8');\n console.log('source: ' + source);\n debugger;\n console.log('compiled source: ' + source);\n });"
] | [
"meteor"
] |
[
"Group different selection option dropdown list",
"I am not sure if this is a html or javascript tech.\nI want to achieve like that, only show two select boxes,\nonce I clicked India, another select box will shows only Indiacities options name=\"listtwo\" id=\"listtwo\", if clicked US, shows us cities options.\nCould someone please give an example. Many thanks\n\n\n India\n US\n Germany\n \n\n <select name=\"listtwo\" id=\"listtwo\">\n <option value=\"Indiacity1\">Indiacity1</option>\n <option value=\"Indiacity2\">Indiacity1</option>\n <option value=\"Indiacity3\">Indiacity1</option>\n </select>\n\n <select name=\"list3\" id=\"list3\">\n <option value=\"Germany1\">Germany1</option>\n <option value=\"Germany2\">Germany1</option>\n <option value=\"Germany3\">Germany1</option>\n </select>\n\n<select name=\"list4\" id=\"list4\">\n <option value=\"US1\">US1</option>\n <option value=\"US2\">US1</option>\n <option value=\"US3\">US1</option>\n </select>"
] | [
"javascript",
"jquery",
"html"
] |
[
"Python MongoDB JSON schema validator \"unresolved reference\"",
"I am relatively new to both Python and MongoDB, I am using python to set up a MongoDB database and create a collection with schema validation. However, when I create the collection as specified in the MongoDB documentation like so:\n\ndb.create_collection(\"collection\", {\n validator: {\n \"$schema\": \"schema_stuff\",\n \"property1\":\"...\"\n }\n\n\nPycharm throws an error saying: \"Unresolved reference 'validator' \"\n\nI suspect it may have something to do with my import but I'm not sure.\n\nfrom pymongo import MongoClient\n\n\nAny ideas why this might be happening?"
] | [
"python",
"mongodb",
"pycharm",
"jsonschema",
"json-schema-validator"
] |
[
"Build protoc for C++ with CMake",
"I'm currently working on a C++ project that reference gRPC as a git submodule and I'm using CMake to compile the dependencies and my sources. For that I basically have this in my CMakeLists.txt:\n\nADD_SUBDIRECTORY(lib/grpc)\n\n\nThen I run:\n\nmake grpc_cpp_plugin\nmake my_project\n\n\nEven though I specify cpp_plugin here, when it's time to compile protoc I'm actually compiling for all the languages supported, eg (Java, Csharp, ...) :\n\n/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc.o\n/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc.o\n/src/google/protobuf/compiler/java/java_context.cc.o\n/src/google/protobuf/compiler/java/java_doc_comment.cc.o\n\n\nAfter looking around for some info on how to build protoc only for C++, I found that someone opened an issue on the github protobuf directory (link). However, it doesn't seem to give a clear answer.\n\nIs there a 'clean' way to only compile the c++ dependency here ?"
] | [
"c++",
"cmake",
"protocol-buffers",
"grpc",
"protoc"
] |
[
"How can I use actual screen heigth in a ConverterParameter?",
"<Image Source=\"{Binding Image}\" HorizontalAlignment=\"Center\" \n VerticalAlignment=\"Center\" \n Height = \"<Get current Height - some layout pixels>\"\n Width=\"{Binding Size, Converter={StaticResource WidthConverter}, \n ConverterParameter=<Get current Height - some layout pixels>\" />\n\n\nI want to calculate Height and Width of the image before image is loaded. How to pass current screen Height to ConverterParameter?\n\nUPDATED: It is possible to use Window.Current.Bounds.Height in IValueConverter so there is no need now to pass it as a parameter."
] | [
"xaml",
"winrt-xaml"
] |
[
"Incrementing a value using javascript and php and saving it in POST array",
"I am incrementing a value of a hidden element using javascript , \nand posting it in the $_POST array.\nBut it increases only once , and then remains the same. Please help.\n\nMy file is incrementing.php with the below code: \n\n<script language=\"Javascript\">\n\nfunction NextClicked()\n{ \n document.getElementById(\"LabelClicked\").value = \n document.getElementById(\"LabelClicked\").value + 1 ; \n\n document.forms[\"incrementing\"].submit();\n\n}\n</script>\n\n\n<?php\n\nif(isset($_POST['LabelClicked']) && $_POST['LabelClicked']>=1)\n{\n $_POST['LabelClicked'] = $_POST['LabelClicked'] +9; \n\n}\n\n?>\n<?php\n if(isset($_POST['clickednext']))\n {\n echo 'Value ='.$_POST['LabelClicked'];\n }\n else\n {\n echo \"Not Clicked Yet\";\n } \n?>\n<form name = \"incrementing\" method=\"post\" action=\"incrementing.php\">\n <div class=d2 align=left><a href=\"#\" onclick=\" NextClicked(); submit();\">Next</a>\n<input type = \"hidden\" id=\"LabelClicked\" name=\"LabelClicked\" />\n</form>"
] | [
"php",
"javascript",
"post",
"increment"
] |
[
"C++ Iterating Over va_list",
"I'm trying to write a function which works like C#'s String::Format, where instead of taking arguments starting in '%' (\"%d %s %i\"), it takes arguments like \"{0} {1} {2}\", and I've gotten it to work (mostly).\n\nIt finds and replaces all occurrences correctly, but then breaks when it gets to the end of args. Right before it breaks the debugger shows 'result' getting set to \"\\f;@\" where the final character is a random, \"non-standard\" character.\n\nNotes**: 'string' is std::string, String::Format1 works correctly and uses vsnprintf_s, and String::Replace finds and replaces all occurrences of find with replace.\n\nstring String::Format2(const string format, ...)\n{\n string output = format;\n\n va_list args;\n va_start(args, format);\n {\n uint i = 0;\n while (args[i] != NULL)\n {\n string find = String::Format1(\"{%i}\", i);\n\n // Breaks here\n string replace = va_arg(args, const char*);\n\n output = String::Replace(output, find, replace);\n\n i++;\n }\n }\n va_end(args);\n\n return output;\n}"
] | [
"c++",
"string-formatting",
"variadic-templates",
"variadic-functions"
] |
[
"Web2py AJAX autofilling of form",
"i've a from an i want to fill it automatically based on information from a data base and filled fields :\n\nin db_wizard.py \n\ndb.define_table('sender',\n Field('name'), # e.g. Daniel\n Field('email'),# e.g. [email protected]\n Field('opening'), # e.g. Dear Daniel\n ...) \n\ndb.define_table('receiver',\n Field('name'), # e.g. John\n Field('email'), # e.g. [email protected]\n Field('tel'), # e.g. 111 222 111\n ...)\n\ndb.define_table('letter',\n Field('sender', db.sender.id), # e.g. Daniel\n Field('receiver', db.receiver.id), # e.g. John\n Field('opening'), # should be filled automatically when choosing/changing the value of \"sender\"\n ...)\n\n\nso letter.opening should get the value of receiver.opening[letter.sender.id], that means the value of opening of the chosen sender"
] | [
"python",
"web2py",
"autofill"
] |
[
"For some reason loop doesn't print out correct array values",
"I'm having some trouble getting the correct output when printing an array. Essentially what I'm trying to do is set up an array in the main method, then send that array to another method that would print out something like this:\n\n 89 12 33 7 72 42 76 49\n 69 85 61 23\n\n\nWith it being 3 spaces to the right and starting a new print line after the 8th number. Seems easy enough but I get something like this instead. \n\n 89\n 69 85 61 23\n\n\nIt doesn't print out the values between position 1 and 7 for some reason. This is what I have.\n\npublic class Test\n{\n public static void main (String [] args)\n {\n int [] myInches = {89,12,33,7,72,42,76,49,69,85,61,23};\n printArrayValues(myInches);\n }\n\n public static void printArrayValues(int [] myInchesParam) {\n for (int i = 0; i < 8; i++) {\n System.out.print(\" \" + myInchesParam[i]);\n System.out.println();\n for (i = 8; i < 12; i++) {\n System.out.print(\" \" + myInchesParam[i]);\n }\n }\n }\n}\n\n\nShould I use a do-while instead? Or can I still do it with a for loop and I'm just doing it wrong?"
] | [
"java",
"arrays",
"loops",
"output"
] |
[
"Why is a GWT application crashing on blackberry OS7?",
"I tried the following code on a blackberry os7 browser:\n\n<html>\n<body>\ntest page\n<script>\ni = 0;\nif(i < -2147483647) {\n alert(\"very low\")\n} \n\nif(i < -2147483648) {\n alert(\"very very low\")\n} \n\nif(i < -2147483649) {\n alert(\"very very very low\")\n}\n</script></body></html>\n\n\nAnd surprisingly it came out with very very low!!\n\nI thought that integers in javascript were supposed to support more than that. Of course this code works well on other browsers...\n\nThe tricky thing is, I discovered that trying to run a gwt app on a blackberry. It worked fine on OS6 but not on OS7. I debugged my code compiled by GWT and it happens that the javascript implementation of Integer.parseInt has a test using the extreme high and extreme low of an int. As OS7 browser doesn't seem to support those extreme values properly (bit overflow?) I get an exception and my app doesn't start... \n\nI'm trying to find a solution for that. I'm thinking about rewriting the GWT integer.parseInt implementation just for blackberry. what do you think? Any other ideas?"
] | [
"gwt",
"blackberry",
"crash",
"parseint"
] |
[
"Why method passed as argument wont work here",
"I have this code in my Node/Express API. It works\n\nrouter.get('/auth',function(req, res, next){\n\n var callback = function(redirectUrl){\n return res.redirect(redirectUrl);\n }\n\n auth.beginOauth(callback);\n\n});\n\n\nBut if I modify this code to something like this. It will not work -\n\nrouter.get('/auth',function(req, res, next){\n\n auth.beginOauth(res.redirect);\n\n});\n\n\nWhy when method is passed directly, it wont work?"
] | [
"javascript",
"node.js",
"express"
] |
[
"jQuery sortable lags when hidden elements are present",
"I have a problem where jQuery sortable items are struggling to find their place in the sortable element if there are hidden elements present. In the following jsfiddle, there are 2 examples. In the first, there are 6 elements with 3 of them hidden (this is the sortable that feels sluggish and doesn't seem like the elements know where to place themselves). In the second, there are 6 elements with none of them hidden. They will move smoothly into place unlike the first example. \n\nDoes anyone know why this could be happening? It seems like it's probably a css problem, but I'm not sure where. I have a larger problem much like this at work but tried to simplify the code to a jsfiddle. \n\nhttp://jsfiddle.net/e234g/4/\n\n\n\n<div class=\"sortable leftPanels\">\n <div class=\"panel hide\">panel 1</div>\n <div class=\"panel hide\">panel 2</div>\n <div class=\"panel hide\">panel 3</div>\n <div class=\"panel\">panel 4</div>\n <div class=\"panel\">panel 5</div>\n <div class=\"panel\">panel 6</div>\n</div>\n<br /><br />\n<div class=\"sortable leftPanels\">\n <div class=\"panel\">panel 1</div>\n <div class=\"panel\">panel 2</div>\n <div class=\"panel\">panel 3</div>\n <div class=\"panel\">panel 4</div>\n <div class=\"panel\">panel 5</div>\n <div class=\"panel\">panel 6</div>\n</div>\n\n\n\n\n.panel{\n background-color:#eee;\n display:inline-block;\n margin:5px;\n}\n\n.sortable{\n padding: 10px;\n padding-top:15px;\n background-color:#999;\n list-style-type: none;\n height:50px;\n}\n\n.panel-placeholder{\n background-color:#333;\n display:inline-block;\n}\n.hide{\n display:none;\n}\n\n\n\n\n$(\".sortable\").sortable({\n placeholder: 'panel-placeholder',\n start: (event, ui) ->\n $('.panel-placeholder').width(ui.item.width()).height(ui.item.height()) \n}).disableSelection();\n\n\nThanks for the help"
] | [
"javascript",
"jquery",
"css",
"jquery-ui"
] |
[
"What are some good UX books?",
"I am interesting in creating a better User Experience (UX). There are a lot of books out there, what are some that would be useful to a software engineer?"
] | [
"user-interface"
] |
[
"Why spread operator is missing out data?",
"I am working with Github API using Octokit library.\n\nI have a function which list out all the repository of a user(username). I have called this function on click of a button called Fetch\n\nFor sake of simplicity, I am rendering out only 1st repository(using index 0).\n\nconst list = []\n\n function fetchRepos() {\n octokit.repos\n .listForUser({\n username: 'abhinav-anshul',\n })\n .then((details) => list.push(details.data[0].name))\n\n console.log('List Array', list)\n\n const list2 = [...list]\n console.log(list2)\n }\n\n\nAs we can see in the code, I am handling a promise chain, and in that promise chain, I am pushing the repo result in the empty array called list.\n\nIn the console.log('List Array', list), I am able to get the '0th' repo name correctly, as given in the image below:\n\n\n\nBut when I try to use spread operator to pass the list array to a new array called list2 and do a console.log(list2) I get the following :\n\n\n\nWhy I have lost the name of the repo here? Am I doing something conceptually wrong?\nAny help is really appreciated.\n\nThank you"
] | [
"javascript",
"rest",
"promise",
"javascript-objects",
"octokit-js"
] |
[
"Python command-line breakdown (for \"scrapy\")",
"I was trying to install SCRAPY and play with it. \n\nThe tutorial says to run this: \n\n scrapy startproject tutorial\n\n\nCan you please break this down to help me understand it. I have various releases of Python on my Windows 7 machine for various conflicting projects, so when I installed Scrapy with their .exe, it installed it in c:\\Python26_32bit directory, which is okay. But I don't have any one version of Python in my path. \n\nSo I tried: \n\n\\python26_32bit\\python.exe scrapy startproject tutorial \n\n\nand I get the error: \n\n\\python26_32bit\\python.exe: can't open file 'scrapy': [Errno 2] No such file or directory. \n\n\nI do see scrapy installed here: c:\\Python26_32bit\\Lib\\site-packages\\scrapy \n\nI cannot find any file called scrapy.py, so what exactly is \"scrapy\" in Python terminology, a lib, a site-package, a program, ?? and how do I change the sample above to run? \n\nI'm a little more used to Python in Google App Engine environment, so running on my local machine is often more challenging and foreign to me."
] | [
"python",
"windows-7",
"scrapy"
] |
[
"Why flatten API responses in Node application",
"I've been asked to look at flatting API responses on a Node.js project I'm working on but I'm not entirely sure why it needs to be flattened. No responses are nested beyond 2 levels so to me it's not too bad. Can anybody tell me why an API response would be flattened? I'd be keen to know the pros and cons aswell an hear any suggestions on how to do it? I'm currently looking at npm package flat.\n\nHere's an example response:\n\n{\n \"users\": [\n {\n \"id\": 1,\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"suppliers\": [\n {\n \"id\": 1,\n \"name\": \"Supplier1\",\n }\n ]\n },\n {\n \"id\": 2,\n \"name\": \"Jane Doe\",\n \"email\": \"[email protected]\",\n \"suppliers\": [\n {\n \"id\": 1,\n \"name\": \"Supplier1\",\n },{\n \"id\": 2,\n \"name\": \"Supplier2\",\n }\n ]\n }\n ]\n}"
] | [
"javascript",
"node.js",
"rest",
"api"
] |
[
"How to thread with Ruby",
"Firstly, is it standard to have one master thread (t2 in my case), starting and ending all other threads (t1)?\n\nrequire 'curses'\ninclude Curses\n\ninit_screen\n\ndef counter(window_name, positionx, positiony, times_factor, sleep_factor)\n window_name = Window.new(10,10,positionx,positiony)\n window_name.box('|', '-')\n window_name.setpos(2, 3)\n window_name.addstr(window_name.inspect)\n times_factor.times do |i|\n window_name.setpos(1, 1)\n window_name.addstr(i.to_s)\n window_name.refresh\n sleep sleep_factor \n end\nend\ndef thread1\n counter(\"One\",10,10,50,0.01)\n counter(\"Two\",20,20,200,0.01)\n counter(\"Three\",30,30,3,1.0)\nend\ndef thread2\n t1 = Thread.new{thread1()}\n x = 4\n chars = [\" \",\"* \",\"** \",\"***\",\"***\",\"** \",\"* \",\" \"]\n four = Window.new(20,20,10,100)\n four.box('|', '-')\n four.setpos(1, 1)\n i = 3\n while t1.alive?\n four.setpos(1, 1)\n four.addstr chars[0] \n four.addstr i.to_s\n four.refresh\n sleep 0.1 \n chars.push chars.shift\n end\n t1.join\nend\n\nt2 = Thread.new{thread2()}\nt2.join\n\n\nSecondly, how can I change the while t1.alive? loop so that rather than simply displaying a star animation during the operation of t1, I can give feedback on what is actually happening within the t1 thread? E.g.,\n\ncounter1 has now finished\ncounter2 has now finished\ncounter3 has now finished\n\n\nTo do this, will each counter method actually have to be in its own thread within t1? Within the while t1.alive? loop, should I have a case loop that continually tests which loop is currently alive? \n\nThis approach would mean the whole program is happening at once, rather than following the order its written in. Is this how larger programs actually work? Is this how I should give feedback? Only telling the user when a certain thread has been joined?"
] | [
"ruby",
"multithreading"
] |
[
"Max users in XMPP roster?",
"Assume there is a bot who relays presence information of any user on the system to any other user on the system.\n\nFor this to work- it seems every user must be added to that bot's roster, correct?\n\nIs this a problem- i.e. is there a limit to the max number of user's per roster?"
] | [
"xmpp",
"ejabberd"
] |
[
"Handling malformed XML tag using SOAP Web Service in C#",
"I have created an ASMX Web Service to handle requests from a third party application. I used a WSDL that they gave us as specs for the request and response. I have matched those requirements and have my service up and running. I can test the application just fine using Storm. When we try to access the web service from the third party app, the request fails, so we setup WireShark to watch the requests. \n\nWhat we saw from the packet captures is \"[InvalidOperationException]: Request format is unrecognized for URL unexpectedly ending in /MyMethodName\". With a little research, I found this article. We tried that and started receiving a different error message. This was the error message/stack:\n\nSystem.IndexOutOfRangeException: Index was outside the bounds of the array.\n at System.Web.Services.Protocols.HttpServerType..ctor(Type type)\n at System.Web.Services.Protocols.HttpServerProtocol.Initialize()\n at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)\n\n\nI have tried most of the suggestions from the SO article, and decided to take a step back and remove the web service protocols all together from the web config. So, back to square one as it were. After further investigation, I noticed that the request being sent to our web service has what I would consider a malformed XML declaration. \n\n<?requestXml version='1.0' encoding='UTF-8'?>\n\n\nCould this be the cause of my headaches? If so, how do I handle this? I obviously can't make changes to the third party application."
] | [
"c#",
"xml",
"web-services",
"soap"
] |
[
"EXCEL - IF statement with RowHeight as condition not working",
"I have a long Excel database which I created running a VBA Macro I didn't originally create (thus I don't know exactly how it works). The issue is that for some reason, the VBA Macro shrinks the height of some rows, which makes the text contained inside not always 100% visible. I've already made some changes to the Excel file, so I don't really want to search for the flaw in the VBA I used, so I wanted to write a short VBA code that would increase the height of the rows with shrinked height: \n\nSub Macro1()\n Dim rowIndex As Integer\n Dim lastRowIndex As Integer\n lastRowIndex = 15000\n For rowIndex = 7 To lastRowIndex:\n If ActiveSheet.Rows(rowIndex).RowHeight = 9.6 Then\n ActiveSheet.Rows(rowIndex).RowHeight = 10.8\n End If\n Next rowIndex\nEnd Sub\n\n\nFor some reason this code isn't executing the way I thought (it does nothing). I checked whether I used the right height value, but everything seemed fine.\n\nDid I miss something?"
] | [
"vba",
"excel"
] |
[
"Using a .delay() function before .css() manipulation in jQuery",
"I have this:\n\nvar $ul = $(this).children(\"ul\");\n$ul.animate({opacity: 0}, 1000);\n$ul.delay(1000).css(\"display\", \"none\")\n\n\nIt's for my dropdown menu, and I want it to fade off before it disappears using the display: none; CSS property. However, it appears that the .delay() cannot be used on the .css(); it doesn't work, the $ul just disappears right away. \n\nI can't use $ul.animate({opacity: 0, display: \"none\"}, 1000); either."
] | [
"javascript",
"jquery",
"drop-down-menu",
"jquery-animate"
] |
[
"QML, Qt 5.11: SwipeView acting instead of SwipeDelegate",
"I have a SwipeView and inside I have a Repeater with a SwipeDelegate. The problem is that sometimes when I swipe the repeater item it registers as a swipe on the SwipeDelegate, which I want, but sometimes it registers as a swipe on the SwipeView and changes the page, which I don't want. Code below for clarity.\n\nIs there anyway to give priority to the SwipeDelegate so it always takes priority over the SwipeView? Or is it just bad practice to implement this type of nested swipe areas?\n\nI tried using z-order as seen in the code but that doesn't help.\n\nTabBar {\n id: appTabBar\n contentContainer: swipeView\n\n TabButton {\n text: \"Add History\"\n }\n\n TabButton {\n text: \"View History\"\n }\n}\n\nQC2.SwipeView {\n id: swipeView\n anchors.top: appTabBar.bottom\n anchors.bottom: parent.bottom\n width: parent.width\n clip: true\n z: 1\n\n Item {}\n\n Item {\n\n Column {\n id: table\n width: parent.width\n spacing: 3\n\n Repeater {\n id: foodTableRepeater\n height: dp(20)\n model: []\n delegate: QC2.SwipeDelegate {\n id: swipeDelegate\n width: parent.width\n\n Rectangle {\n height: parent.height\n width: parent.width\n color: (index % 2 === 0) ? \"#D3F2FF\" : \"#FFFFFF\"\n border.color: \"blue\"\n border.width: dp(1)\n z: 2\n\n Row {\n height: parent.height\n width: parent.width\n AppText {\n id: date\n leftPadding: dp(10)\n width: parent.width\n anchors.verticalCenter: parent.verticalCenter\n text: JSFuns.getLocaleDateTime(app.locale, modelData[2], app.use_24)\n }\n }\n }\n\n swipe.right: QC2.Label {\n id: deleteLabel\n verticalAlignment: QC2.Label.AlignVCenter\n padding: 5\n width: parent.width * 0.4 / 3\n height: parent.height\n anchors.right: parent.right\n z: 3\n Icon {\n width: parent.width\n anchors.verticalCenter: parent.verticalCenter\n icon: IconType.close\n size: parent.height\n color: \"red\"\n }\n\n QC2.SwipeDelegate.onClicked: console.debug(index)\n\n background: Rectangle {\n color: deleteLabel.QC2.SwipeDelegate.pressed ?\n Qt.darker(app.color_secondary_light, 1.1) :\n app.color_secondary_light\n }\n }\n }\n }\n } \n }\n}"
] | [
"qt",
"qml",
"swipe"
] |
[
"Multi line Headers in react-data-grid",
"I would like to display more than one row in my headers. \n\n\n\nPreviously I was able to change the header height.\n\nNow I want to display multi line text, preferably passed in as an array.\n\nThe closest I have come to is digging through some forums and coming across a HeaderRenderer, which can be added to my columns like so : \n\n this._columns.push({ \n key: 'key_empty_' + i,\n name: \"asdfasdfasdf \",\n headerRenderer: HeaderRenderer,\n\n }) \n\n\nAs far as I can see the HeaderRenderer just takes in a column and this column can then be manipulated.\n\nIn order to solve my problem one of these solutions should suffice :\n\n\nhave the ability to add a component into the Header object\nHave an option to add multi line text into the header\nAllow the code to interpret line breaks. ie. If I currently add \"asdfasdf<br>asdfasdf\" then it just displays as is."
] | [
"reactjs",
"react-data-grid"
] |
[
"SQL Server Query Performance, Large where statements vs. queries",
"I am wondering which is a more efficent method to retrieve data from the database. \n\nex.\nOne particular part of my application can have well over 100 objects. Right now I have it setup to query the database twice for each object. This part of the application periodically refreshes itself, say every 2 minutes, and this application will probably end of being installed on 25-30 pc's. I am thinking that this is a large number of select statements to make from the database, and I am thinking about trying to optimize the procedure. I have to pull the information out of several tables, and both queries are using join statements.\n\nWould it be better to rewrite the queries so that I am only executing the queries twice per update instead of 200 times? For example using a large where statement to include each object, and then do the processing of the data outside of the object, rather than inside each object?\n\nUsing SQL Server, .net No indexes on the tables, size of database is less than 10-5th"
] | [
"sql",
"sql-server"
] |
[
"Possible issue in JSRender with spaces",
"i have some problem with rending this jsrender code, it works if title == 'Teamledare Redo' but if i have more words like this: 'teamledare Redovisning', then it not works..\n\nWhy does it not render when there is more words ?\n\n <script id=\"oc_template\" type=\"text/x-jsrender\">\n\n <div class=\"node\">\n\n {{if title == 'Teamledare Redovisning'}}\n <div><a href= {{>id}} >{{>title}}</a><br />{{>subtitle}}</div>\n {{else title == 'VD'}}\n <div><a href= {{>id}} >{{>title}}</a><br />{{>subtitle}}</div> \n {{else}}\n <div><a href='#'>{{>title}}</a><br />{{>subtitle}}</div>\n {{/if}}\n\n </div>"
] | [
"javascript",
"jsrender"
] |
[
"HTML/CSS form alignment of radio and checkbox subsequent options with main label",
"I can't figure out why the alignment of radio/checkbox subsequent options (after the first option) is aligning to the left of the page rather than stacking up underneath the first option, with the main label aligned to the left of the options and white space underneath. Any ideas?\n\nSee screenshot here: http://bit.ly/1jpqp1R\n\nI can give a margin-left on the inputs, but then the first option is indented too far. I just want them to stack up neatly underneath each other.\n\nCSS\n\nform.form p label {\n font-size: 120%;\n line-height: 140%;\n display: inline-block;\n vertical-align: middle;\n float: left;\n margin: 0;\n padding: 3px 13px 0 0;\n text-align: right;\n width: 200px;\n color: #333333 !important;\n}\nform.form input[type = radio], form.form input[type = checkbox] {\n width: 22px;\n height: 22px;\n border: 1px solid #bbb;\n vertical-align: middle;\n margin-top: -1px;\n -webkit-appearance: none;\n -moz-appearance: none;\n}\nform.form p label.inline {\n background: 0;\n display: inline;\n float: none;\n font-weight: normal;\n line-height: 2em;\n margin-right: 10px;\n margin-left: 2px;\n padding: 0;\n text-align: left;\n vertical-align: baseline;\n font-size: 100%;\n font-family: Tahoma, Verdana, Segoe, sans-serif;\n}\n\n\nEDIT: This problem is only occurring on the iPad version of my form (desktop version is fine and code is the same, which is what is stumping me the most)."
] | [
"css",
"forms",
"checkbox",
"alignment",
"radio"
] |
[
"Why does C_GenerateKeyPair return error (PKCS#11)?",
"I want to create a ECC key pair on a security card via PKCS#11. The curve to be used shall be BrainpoolP256r1 (1.3.36.3.3.2.8.1.1.7), the DER encoding is 06 09 2b 24 03 03 02 08 01 01 07\n\nThe function is:\n\nCK_RV create_ECC_key_pair()\n{\n CK_RV rv;\n CK_OBJECT_HANDLE publicKey, privateKey;\n CK_MECHANISM mechanism = {\n CKM_EC_KEY_PAIR_GEN, NULL_PTR, 0\n };\n\n CK_BYTE subject[] = \"myKey\";\n CK_BYTE id[] = {0xa1};\n CK_BBOOL xtrue = CK_TRUE;\n CK_BBOOL xfalse = CK_FALSE;\n CK_BYTE ecparams[] = {0x06, 0x09, 0x2b, 0x24, 0x03, 0x03, 0x02, 0x08, 0x01, 0x01, 0x07};\n\n CK_ATTRIBUTE publicKeyTemplate[] = {\n {CKA_LABEL, subject, sizeof(subject)},\n {CKA_TOKEN, &xtrue, sizeof(xtrue)},\n {CKA_MODIFIABLE, &xfalse, sizeof(xfalse)},\n {CKA_EC_PARAMS, &ecparams, sizeof(ecparams)}\n };\n\n CK_ATTRIBUTE privateKeyTemplate[] = {\n {CKA_TOKEN, &xtrue, sizeof(xtrue)},\n {CKA_MODIFIABLE, &xfalse, sizeof(xfalse)},\n {CKA_LABEL, subject, sizeof(subject)}\n };\n\n rv = FunctionPtr->C_GenerateKeyPair(Session,\n &mechanism,\n publicKeyTemplate, 4,\n privateKeyTemplate, 3,\n &publicKey,\n &privateKey);\n if (rv != CKR_OK) \n {\n printf(\"Error C_GenerateKeyPair (ECC): 0x%X\\n\", rv);\n return rv;\n }\n\n return CKR_OK;\n}\n\n\nThe C_GenerateKeyPair call returns 0x13 = CKR_ATTRIBUTE_VALUE_INVALID \n\nI have no idea what attribute could be wrong.\nI know that the information is poor, but I tried different things and have still this error. Is something fundamentally wrong?"
] | [
"c",
"cryptography",
"pkcs#11",
"key-pair"
] |
[
"How can I convert 2d to 1d array with df.apply (lambda) in Pandas? Tooked some errors",
"I have a function that converts a 2 dimensional array into a one dimensional array.\ndef twoone(list1):\n list2 = []\n a = ""\n for x in range(len(list1)):\n for y in range(len(list1[1])):\n list1\n if list1[0][0] == list1[x][y]:\n a+=""+str(list1[x][y]) \n elif list1[1][0] == list1[x][y]:\n a+=""+str(list1[x][y]) \n else:\n a+=" "+str(list1[x][y])\n \n list2.append(a)\n a = ""\n return list2\n\ndata.csv is as follows:\nMake,Model,Year,Engine Fuel Type,Engine HP,Engine Cylinders,Transmission Type,Driven_Wheels,Number of Doors,Market Category,Vehicle Size,Vehicle Style,highway MPG,city mpg,Popularity,MSRP\nBMW,1 Series M,2011,premium unleaded (required),335,6,MANUAL,rear wheel drive,2,Factory Tuner,Luxury,High-Performance,Compact,Coupe,26,19,3916,46135\nBMW,1 Series,2011,premium unleaded (required),300,6,MANUAL,rear wheel drive,2,Luxury,Performance,Compact,Convertible,28,19,3916,40650\nBMW,1 Series,2011,premium unleaded (required),300,6,MANUAL,rear wheel drive,2,Luxury,High-Performance,Compact,Coupe,28,20,3916,36350\nBMW,1 Series,2011,premium unleaded (required),230,6,MANUAL,rear wheel drive,2,Luxury,Performance,Compact,Coupe,28,18,3916,29450\nBMW,1 Series,2011,premium unleaded (required),230,6,MANUAL,rear wheel drive,2,Luxury,Compact,Convertible,28,18,3916,34500\nBMW,1 Series,2012,premium unleaded (required),230,6,MANUAL,rear wheel drive,2,Luxury,Performance,Compact,Coupe,28,18,3916,31200\n\ndataframe looks like below:\nX = [['200', 2017, 'flex fuel (unleaded/E85)', 184, 4, 'AUTOMATIC',\n 'front wheel drive', 4, 'Flex Fuel', 'Midsize', 'Sedan', '36',\n '23', 1013, 22490, nan, nan],\n ['100', 1993, 'regular unleaded', 172, 6, 'MANUAL',\n 'front wheel drive', 4, 'Luxury', 'Midsize', 'Sedan', '24', '17',\n 3105, 2000, nan, nan]]\n\nI want to add another column into the dataframe, using df.apply\nWhen I use follow code:\ndf['context'] = df.apply(twoone(X), axis=1) \n\nI get this error\n\nSpecificationError: Function names must be unique if there is no new column names assigned\n\nAnd using this style : df['context'] = df.apply(twoone, axis=1)\nI get this error\n\nTypeError: 'int' object is not subscriptable\n\nSamples that generally using lambda...\nHow can we create lambda or solve this problem?\nThanks a lot."
] | [
"python",
"pandas",
"dataframe"
] |
[
"Why does glm::mat3 and glm::value_ptr creates a black hole through time and universe and is destroying any possible logic in my mind?",
"I was creating a beautiful graphic engine with the all so famous OpenGL framework but then an unexpected problem came to me (like every problems do).\n\nI had to create a function that modifies a specific value in a glm::mat3. to do so I created a simple function that return me a simple reference to a specific float in a glm::mat3 but nothing seems to work for I don't know which reason.\n\nHere is my function:\n\nfloat& mat3ValueAt(glm::mat3& m, int l, int c) {\n // l is the line index and c is the column index...\n return glm::value_ptr(m)[3 * l + c];\n}\n\n\nTo see if it worked, I had to use a function that was able to display my matrix:\n\nstd::ostream& operator<<(std::ostream& stream, glm::mat3 m) {\n for (int i = 0; i < 9; i++) {\n stream << GLS::mat3ValueAt(m, i / 3, i % 3) << ((i + 1) % 3 ? ' ' : '\\n');\n }\n return stream;\n}\n\n\nAll of this DIDN'T work... but that's ok... it must be my bad... so I reduced my not-working code that seems good to the smallest code in which I could find an anomalie...\n\nAnd here is what I ended up being totally mad about and it turned me insane:\n\nint main() {\n glm::mat3 m;\n std::cout << \"display uninitialised value...\" << std::endl;\n std::cout << *(glm::value_ptr(m) + 5) << std::endl; // should display an uninitialised value\n *(glm::value_ptr(m) + 5) = 42;\n std::cout << \"display the initialised value\" << std::endl;\n std::cout << *(glm::value_ptr(m) + 5) << std::endl; // should display 42\n}\n\n\nand the result of this small code is...\n\ndisplay uninitialised value...\n42\ndisplay the initialised value\n42\n\n\nSo the fact that my two previous functions aren't working is ok, maybe I just don't know how value_ptr works... but I'm pretty sure of one thing...\nA value CAN'T have the value that we're gonna assign it BEFORE it was assigned to it!\n\nAnd it doesn't matter the value I put instead of 42, it will always be assign before I assign it!\n\nHow is this possible?"
] | [
"c++",
"glm-math"
] |
[
"Adding include files information to library in CMake",
"I'd like to use imported and internal libraries in my CMake projects so that the projects don't need to know the details of the library. (By \"Internal library\" I mean other CMake library targets, not sure about the correct term...)\n\nThe information should contain:\n\n\nlibrary locations for each configuration type (including dll's and .pdb files)\nlibrary include files folder\n\n\nIn some project I'd like to write something like:\n\n SET(TARGET_DEPENDS ext_lib1 ext_lib2 internal_lib1)\n\n\nand let the build system take care of all the include folder and configuration stuff.\n\nWhat is the best way to achieve this?\n\nAFAIK the add_library(... IMPORTED) supports pretty much everything else, but the include folder information."
] | [
"include",
"cmake",
"libraries"
] |
[
"How to override the Open button of Java SWT FileDialog class",
"I want the file selction dialog to be popping up when i press a button.For this i am using org.eclipse.swt.widgets.FileDialog class and opening the dialog. By default there are two buttons \"Open\"(the button we press after selecting the file) and \"Cancel\" button.\n\nI want the name on the button to change from \"Open\" to \"Import\".\n\nIs it possible to override this button on FileDialog?"
] | [
"java",
"swt"
] |
[
"how to connect base64 image and send it using multipart?",
"Hi I am using NgimgCrop and i successfully got the base64 image Now I want to send it using multipart form data in http post request.\n\nMy file upload code look something look like this\n\nscope.myCroppedImage = '';\n $scope.uploadFile = function (file) {\n if (file) {\n // ng-img-crop\n var imageReader = new FileReader();\n imageReader.onload = function (image) {\n $scope.$apply(function ($scope) {\n $scope.myImage = image.target.result;\n $scope.profileData.data = $scope.myImage;\n console.log($scope.profileData.data);\n });\n };\n imageReader.readAsDataURL(file);\n }\n };\n\n\nIs there any way it convert it multipart after base64 in angular ? I tried various links but nothing worked."
] | [
"angularjs",
"image",
"file",
"upload",
"ng-img-crop"
] |
[
"Passing data to a php script with ajax",
"Am stuck here. I've been trying to upload some photos and at the same time pass the id of the album (value is in a hidden form in the form) to the same php script that processes the upload. but i dont know how to pass the album id seprately this is the code.\n\nJs\n\ninput.addEventListener(\"change\", function (evt) {\n document.getElementById(\"response\").innerHTML = \"<img src='../assets/admin/images/loading.gif' />\"\n var i = 0, len = this.files.length, img, reader, file;\n\n for ( ; i < len; i++ ) {\n file = this.files[i];\n\n if (!!file.type.match(/image.*/)) {\n if ( window.FileReader ) {\n reader = new FileReader();\n reader.onloadend = function (e) { \n showUploadedItem(e.target.result, file.fileName);\n };\n reader.readAsDataURL(file);\n }\n if (formdata) {\n formdata.append(\"images[]\", file);\n }\n } \n }\n\n if (formdata) {\n $.ajax({\n url: \"../assets/admin/ajaxupload/upload.php\",\n type: \"POST\",\n data: formdata,\n processData: false,\n contentType: false,\n success: function (res) {\n document.getElementById(\"response\").innerHTML = res; \n }\n });\n }\n\n\nPHP\n\n//how do i retrieve the given album id value that was passed.\n\nforeach ($_FILES[\"images\"][\"error\"] as $key => $error) {\n if ($error == UPLOAD_ERR_OK) {\n $name = $_FILES[\"images\"][\"name\"][$key];\n move_uploaded_file( $_FILES[\"images\"][\"tmp_name\"][$key], \"../../uploads/pics/\" .$_FILES['images']['name'][$key]);\n\n\n }\n}\necho \"<p>Successfully Uploaded Images</p>\";\n\n\nPlease i need a reply asap thanks."
] | [
"php",
"javascript",
"ajax"
] |
[
"Automapper : copy some properties",
"I have a 2 instances my class \"Person\"\n\npublic class Person\n{\n public int Id { get; set; }\n public string FirstName { get; set; }\n public string LastName { get; set; }\n public List<Address> PropertyName { get; set; } \n}\n\nvar pers1 = new Person();\nvar pers2 = new Person();\n\n\nIs it possible to copy a specific properties of \"pers2\" to \"pers1\" ? Is it possible to copy all properties except one from \"pers2\" to \"pers1\" ?\n\nThanks,"
] | [
"automapper"
] |
[
"instantiating a new object or change values of existing object C#",
"I'm having trouble deciding which way to implement my code for drawing a collision rectangle. What is the best practice for doing this. Is it ok to instantiate a new rectangle on every drawcall, with the correct size and location like this:\n\npublic void Draw(SpriteBatch spriteBatch)\n {\n Rectangle topLine = new Rectangle(CollisionRect.X, CollisionRect.Y, CollisionRect.Width, 1);\n }\n\n\nOr is it better to create the rectangle in my fields, and then just change the values of the already existing object in my draw method like this, even though the code is gonna be more \"messy\"\n\npublic void Draw(SpriteBatch spriteBatch)\n{\n topline.Height = 1;\n topline.Width = CollisionRect.Width;\n topline.X = CollisionRect.X;\n topline.Y = CollisionRect.Y;\n\n}"
] | [
"c#",
"instantiation",
"rectangles"
] |
[
"How to declare variable in EJS?",
"I want to display array results in my database on the frontend using EJS. \n\nSo I have the following code: \n\n var tagss = [\"<%tags%>\"] \n <% for(var i=0; i<tagss.length; i++) { %>\n\n <a href='<%= tagss[i] %>'> <%= tagss[i] %> </a>\n\n </a>\n\n <% } %> \n\n\nBut error message keeps telling me that tagss is undefined\n\nHere is the full message:\n\nfull message:\n\n\nReferenceError: C:\\xampp\\htdocs\\meme.africa\\views\\pages\\meme.ejs:171\n 169| \n\n 170| var tagss = [\"<%tags%>\"] \n\n >> 171| <% for(var i=0; i<tagss.length; i++) { %>\n\n 172| \n\n 173| <a href='<%= tagss[i] %>'> <%= tagss[i] %> </a>\n\n 174| \n\n\ntagss is not defined\n\n\nPlease, what am I doing wrong?"
] | [
"javascript",
"node.js",
"ejs"
] |
[
"Finding a stable placement of an irregular (non-convex) shape",
"Given an image of a 2-dimensional irregular (non-convex) shape, how would I able to compute all the ways in which it could lie stable on a flat surface? For example, if the shape is a perfect square rectangle, then it will surely have 4 ways in which it is stable. A circle on the other hand either has no stable orientation or every point is a stable orientation.\n\nEDIT: There's this nice little game called Splitter (Beware, addictive game ahead) that seems close to what I want. Noticed that you cut a piece of the wood out it would fall to the ground and lay in a stable manner.\n\nEDIT: In the end, the approach I took is to compute center of mass (of the shape) and compute the convex hull (using OpenCV), and then loop through every pair of vertices. If the center of mass falls on top of the line formed by the 2 vertices, it is deemed stable, else, no."
] | [
"algorithm",
"physics"
] |
[
"JavaCV - Running Examples",
"I'm a bit of an amateur developer and I'm currently messing around with JavaCV and Eclipse on my Mac.\n\nI'm trying to get the FaceRecorgnition to work but I don't really know how to install this into Eclipse properly.\n\nI've created a new Java Project, and I've imported the 'JavaCPP', 'JavaCV-Mac', and 'JavaCV' libraries.\n\nI then created a package and called it 'mvn', then created a class and C/P the 'FaceRecorgnition' java into that class and then try and run it. I then get this error:\n\nOct 24, 2012 10:17:22 PM mvn.FaceRecognition learn\nINFO: ===========================================\nOct 24, 2012 10:17:22 PM mvn.FaceRecognition learn\nINFO: Loading the training images in data/all10.txt\nException in thread \"main\" java.lang.RuntimeException: java.io.FileNotFoundException: data/all10.txt (No such file or directory)\n at mvn.FaceRecognition.loadFaceImgArray(FaceRecognition.java:317)\n at mvn.FaceRecognition.learn(FaceRecognition.java:97)\n at mvn.FaceRecognition.main(FaceRecognition.java:789)\nCaused by: java.io.FileNotFoundException: data/all10.txt (No such file or directory)\n at java.io.FileInputStream.open(Native Method)\n at java.io.FileInputStream.<init>(FileInputStream.java:120)\n at java.io.FileInputStream.<init>(FileInputStream.java:79)\n at java.io.FileReader.<init>(FileReader.java:41)\n at mvn.FaceRecognition.loadFaceImgArray(FaceRecognition.java:244)\n ... 2 more\n\n\nI don't fully understand imports and SDKs fully yet, so be easy.\n\nThanks."
] | [
"eclipse",
"macos",
"javacv"
] |
[
"ios most efficient way to get average value while also filtering out some objects",
"I'm trying to get the average value of an attribute in a child entity while also trying to only include a select set of records.\n\nI have two entities in my Core Data model: Invoice and InvoiceDetail.\n\nInvoice:<br>\n invoiceNum - attribute<br>\n invoiceDate - attribute<br>\n invoiceDetails - one-to-many relationship to InvoiceDetail\n\nInvoiceDetail:<br>\n itemAmount - attribute<br>\n itemType - attribute<br>\n invoice - one-to-one relationship to Invoice<br>\n\n\nIf I wanted to just get the average value of itemAmount for an entire invoice, I would use the following (invoice is an NSManagedObject):\n\nfloat avgAmount = [[invoice valueForKeyPath:@\"[email protected]\"] floatValue];\n\n\nHowever, I'm trying to only get the average for objects where itemType = 1. I can loop through the invoiceDetail items and do this manually, but I know that this will cause a performance issue. I'm not sure what is the best way to go about doing this.\n\nThanks for your help."
] | [
"ios",
"core-data",
"aggregate-functions"
] |
[
"How to reformat row values to column fields in R",
"I have row values that end with a -# (# ranging from 4 - 8). I have a corresponding column that has values associated to each -# row. \n\nI would like to use dplyr to transpose my df so the -3 rows turn into column fields and the number of corresponding values from other variables (columns) be added to each column given it's 'title' (-4, -5, etc.)\n\nI used dplyr package to move my rows to column headers but cannot seem to get the right output. \n\nhead(MFP)\n PART_RMV_DT RMV_MFR_PART_NO RMV_LRU_TSO_TM RMV_LRU_TSR_TM LRU\n1 2017-06-25 828300-5 MFP\n9 2016-01-11 828300-5 17500 17500 MFP\n17 2015-12-27 828300-5 16698 12193 MFP\n19 2018-11-30 828300-5 40738 17494 MFP\n21 2016-09-19 828300-5 25107 13528 MFP\n23 2016-11-17 828300-5 35281 35281 MFP\n\nt <- as.data.frame.matrix(xtabs(RMV_LRU_TSO_TM~RMV_MFR_PART_NO, MFP_df))\n\nError in Summary.factor(c(4268L, 472L, 3342L, 17L, 1L, 1L, 2834L, 5421L, : \n ‘sum’ not meaningful for factors\n\n\nIf I have 4 different groups of values in my column based on -#, I would like to move those values into columns and pull the associated values from other columns below each one of those -# columns."
] | [
"r",
"dplyr",
"reformatting"
] |
[
"Boost log - cleanup & shutdown",
"I have an initialization function which sets up boost log via add_common_attributes(), register_simple_formatter_factory(), register_sink_factory() and init_from_stream() (all are functions within namespace ::boost::log)\n\nI want to be able to tear down the types I've registered later. It appears easy enough to remove the sinks and unregister attributes using the logging core. But there does not appear to be a way to tear down the registered formatters nor the registered sink factories. There also does not appear to be a way to cleanly tear down the logging core.\n\nAm I missing something? Is there an example of doing this?\n\nI'm originally using boost 1.55 however I've also looked through 1.57 and 1.58 to no avail.\n\nUltimately what I need to be able to do is create effectively a wrapper library which can be loaded from multiple applications to provide consistent logging without code duplication to set up. I need the ability to set up and tear down boost::log as part of unit testing the features and different configurations."
] | [
"c++",
"logging",
"boost"
] |
[
"Getting relative paths in BASH",
"I already searched for this, but I guess there was no great demand on working with paths.\nSo I'm trying two write a bash script to convert my music collection using tta and cue files.\nMy directory structure is as following: /Volumes/External/Music/Just/Some/Dirs/Album.tta for the tta files and /Volumes/External/Cuesheets/Just/Some/Dirs/Album.cue for cue sheets.\n\nMy current approach is setting /Volumes/External as \"root_dir\" and get the relative path of the album.tta file to $ROOT_DIR/Music (in this case this would be Just/Some/Dirs/Album.tta), then add this result to $ROOT_DIR/Cuesheets and change the suffix from .tta to .cue.\n\nMy current problem is, that dirname returns paths as they are, which means /Volumes/External/Music/Just/Some/Dirs does not get converted to ./Just/Some/Dirs/ when my current folder is $ROOT_DIR/Music and the absolute path was given.\n\nAdd://Here is the script if anybody has similar problems:\n\n#!/bin/bash\nROOT_DIR=/Volumes/External\nBASE=\"$1\"\n\nif [ ! -f \"$BASE\" ]\nthen\n echo \"Not a file\"\n exit 1\nfi\n\nif [ -n \"$2\" ]\nthen\n OUTPUT_DIR=\"$HOME/tmp\"\nelse\n OUTPUT_DIR=\"$2\"\nfi\nmkfdir -p \"$OUTPUT_DIR\" || exit 1\n\nBASE=${BASE#\"$ROOT_DIR/Music/\"}\nBASE=${BASE%.*}\n\nTTA_FILE=\"$ROOT_DIR/Music/$BASE.tta\"\nCUE_FILE=\"$ROOT_DIR/Cuesheets/$BASE.cue\"\nshntool split -f \"${CUE_FILE}\" -o aiff -t \"%n %t\" -d \"${OUTPUT_DIR}\" \"${TTA_FILE}\"\nexit 0"
] | [
"bash",
"path"
] |
[
"Deploy Single Page Application to Azure Cloud Service",
"I am currently creating a dashboard for a complex backend that should be hosted on an Azure Cloud Service due to performance reasons. Unlike our older projects we want to implement our dashboard as single page application based on vue.js, but after doing some initial research I am aware of difficulties when it comes to deployment.\n\nThe idea is to have a frontend project and an ASP.NET Web Api that offers the respective data for the dashboard. Both projects should run inside the cloud service.\n\nWhat would be the best approach to deploy single page applications to a cloud service? Since we prefer Visual Studio Code over Visual Studio for frontend-related tasks, it would be great if we won't depend on specific features VS offers."
] | [
"asp.net",
".net",
"azure"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.