texts
sequence | tags
sequence |
---|---|
[
"Single endpoint post array with multiple type of dictionary",
"I am creating the RESTful endpoints for supporting frontend payload.\nMy payload is an order of build your own dish and ready-made single dish\n\nProblem:\nIn single POST of frontend. He wants to put everything to the single time. That's mean in the given list will contains 2 types of dictionary\none for build your own and one for ready-made single dish\n\nIMO:\nHe can POST 2 times for each type of payload. By this method the endpoint will do one thing and I prefer that way.\n\nHe has only 1 reason to POST everything to single endpoint\n\nQuestion:\nWhat is your best practice for this sort of problem?\n\nBuild Your Own Payload:\nIn short I call it BYO.\n1. base_bowl will dictates the size and price of the item\n1. base_bowl will also determine the number of fishes, toppings, sauces. \nBecause base_bowl size S, M, or L has different quota. \n\nFor example \n\nSize S can has fishes 1 scoop size S, and toppings 2 scoops size S.\n\nSize M can has fishes 2 scoops size M, and toppings 3 scoops size M. Then if the customer would like to add more than quota he must add it in the extra_fishes, extra_toppings\nBase on Price id since quantity is determine by number of member in the list.\n\n {\n \"base_bowl\": salad.id, # require=True, Price id\n \"fishes\": [salmon.id, tuna.id],\n \"extra_fishes\": [tofu.id],\n \"toppings\": [tamago.id, mango.id],\n \"extra_toppings\": [rambutan.id],\n \"premium_toppings\": [ikura.id],\n \"sauces\": [shoyu.id, spicy_kimchi.id],\n \"extra_sauces\": [],\n \"sprinkles\": [sesame.id, fried_shalots.id],\n \"dish_order\": 1, # require=True\n \"note\": {\n 'msg': 'eat here',\n },\n }\n\n\nAnd backend will validate the input and INSERT them to Order and OrderItem\n\nReady-Made Dish:\nThis is very straight forward because it has no implicit logic like BYO. It just add OrderItem to Order\n\nUse Menu id, size, and qty to determine price. Because customer is free to choose\n\n{\n 'order_items': [\n {\n 'menu_id': has_poink_menu.id,\n 'size': Price.MenuSize.XL, # 27, 37, 47, 52\n 'qty': 2, # amount = 52 * 2\n },\n {\n 'menu_id': no_poink_menu.id,\n 'size': Price.MenuSize.L, # 20, 30, 40, 45\n 'qty': 1 # amount = 40 * 1\n }\n ]\n}"
] | [
"django",
"django-rest-framework"
] |
[
"Is there any way to prevent getaddrinfo from revealing the true IP address of a hostname?",
"Let's say there is a program that opens up the HOSTS file to make sure that it isn't being rerouted somewhere. (It wants to connect to www.example.com but it makes sure you don't have an entry in the HOSTS file for that).\n\nSo instead, you decide to add a DNS entry, so that www.example.com really points to 123.123.1.123. So that works.\n\nBut then the program gets smarter and calls getaddrinfo to determine if it's being rerouted to 123.123.1.123. Is there any way to hide this information, or any alternate ways of changing the IP Address of a given hostname?\n\nIs there any way to make the normal IP of www.example.com point to 123.123.1.123?\n\nAll I can think of is maybe detours, but I'm wondering if there's a better way. Perhaps there is a way to protect the Windows HOSTS file from being read?\n\nOr is there a way to spoof packets so that it appears that they come from \"www.example.com\"? (Assume I have total control over the software sending / receiving the packets)"
] | [
"dns",
"hosts",
"getaddrinfo"
] |
[
"Update DIV content with different API parameters",
"I'm trying to update the contents of a div after the DOM has loaded.\n\nThe contents are being loaded from an API which loads different content based on what parameter values are passed.\n\nThe contents load fine to start with. But I have an option for a user to either just load the 'Sales' or 'Rentals' properties so I have an onClick function to update the parameters of the API.\n\nHere is my code\n\nvar url = \"http://api.zoopla.co.uk/api/v1/property_listings.js\";\nvar key = \"APIKEY\";\nvar branch = \"7103\";\nvar ajaxURL = url + \"?branch_id=\" + branch + \"&api_key=\" + key;\n\n$('#rentals a').click(function (evt) {\n var link = $(this).attr('href');\n ajaxURL += link;\n $(\"#main\").load('#main');\n evt.preventDefault();\n\n});\n\n$.ajax({\n type: 'GET',\n dataType: 'jsonp',\n jsonp: 'jsonp',\n url: ajaxURL,\n success: function (data) {\n $.each(data.listing, function (i, property) {\n $(\"#main\").append('<h3>' + property.displayable_address + '</h3><p>' + property.description + '<br /> <img src=\"' + property.image_url + '\" /> </p>')\n });\n },\n error: function () {\n alert(\"Sorry, I can't get the feed\");\n }\n}); // end GET\n\n\nIts this code here I can't get wo to work\n\n$('#rentals a').click(function (evt) {\n var link = $(this).attr('href');\n ajaxURL += link;\n $(\"#main\").load('#main');\n evt.preventDefault();\n});"
] | [
"javascript",
"jquery",
"html",
"jsonp"
] |
[
"Matlab - Can you combine 2 circular antenna arrays in one plot",
"I'm trying to do this using both Antenna Toolbox and Phased Array toolbox. But it's not allowing me to have multiple circular arrays. \n\nIs there any way to combine 2 circular Antenna arrays and plot the summation of their phase patterns?"
] | [
"matlab"
] |
[
"Objective-C vs. C speed",
"This is probably a naive question here but I'll ask it anyway.\n\nI'm working with Core Audio (C API) on iOS and am mixing C with Objective-C. My class has the .mm extension and everything is working so far.\n\nI've read in different places about Objective-C being slow (without much detail given - and I am not making any declaration that it is). I understand about not calling Objective-C from a Core Audio render callback, etc. and the reasons why.\n\nOn the other hand, I need to call in to the class that handles the Core Audio stuff from my GUI in order to make various adjustments at runtime. There would be some walking of arrays, mostly, shifting data around that is used by Core Audio. Would there be any benefit speed-wise from writing my functions in C and storing my variables in, say, vectors rather than NSMutableArrays?\n\nI've only been working with Objective-C/iOS for a few months so I don't have any perspective on this."
] | [
"objective-c",
"c",
"ios"
] |
[
"Having trouble running node js script with Axe accessibility tool on Windows 7.",
"I am running this script that i found from https://www.npmjs.com/package/axe-reports to create human-readable reports for the Axe accessibility tool. I am running the example: \n\nvar AxeBuilder = require('axe-webdriverjs'),\n AxeReports = require('axe-reports'),\n webdriver = require('selenium-webdriver'),\n By = webdriver.By,\n until = webdriver.until;\n\nvar driver = new webdriver.Builder()\n .forBrowser('chrome') //or firefox or whichever driver you use\n .build();\n\nvar AXE_BUILDER = AxeBuilder(driver)\n .withTags(['wcag2a', 'wcag2aa']); // specify your test criteria (see aXe documentation for more info)\n\nAxeReports.createCsvReportHeaderRow();\ndriver.get('https://www.google.com');\ndriver.wait(until.titleIs('Google'), 1000)\n .then(function () {\n AXE_BUILDER.analyze(function (results) {\n AxeReports.createCsvReportRow(results);\n });\n });\ndriver.get('https://www.bing.com');\ndriver.wait(until.titleIs('Bing'), 1000)\n .then(function () {\n AXE_BUILDER.analyze(function (results) {\n AxeReports.createCsvReportRow(results);\n });\n });\ndriver.quit();\n\n\nThis is the error that i get: \n\nCommand prompt error message"
] | [
"node.js",
"bash",
"automated-tests",
"accessibility",
"uiaccessibility"
] |
[
"Send an AppointmentItem with HTML Body with Python win32com library",
"I'm trying to create an Appointment in Outlook 2007, with Python 3.\nI am able to create a calendar with plain text body, but not a body with HTML text. There is no 'CreateItem.HTMLBody' property \n\nimport win32com.client\n\noutlook = win32com.client.Dispatch(\"Outlook.Application\")\n\nApp = outlook.CreateItem(1) #olAppointmentItem\n\n\nApp.Subject = \"Meeting with CEO\"\n\n#App.Body = 'Hi Tim, <br><br>Kindly attend the meeting.' \nApp.HTMLBody = 'Hi Tim, <br><br>Kindly attend the meeting.'\nApp.Location = \"Meeting Room 10\"\nApp.Start = '2017-07-17 15:00'\nApp.Duration = 3\nrecipient='[email protected]'\n\nApp.MeetingStatus = 1\nApp.Recipients.Add(recipient)\n\nApp.Display()\n#App.Send()\n\n\nI have also tried using GetInspector.WordEditor, but that too just gives plain text.\n\nSelection = App.GetInspector.WordEditor.Windows(1).Selection\nSelection.TypeText ('Hi Tim, <br><br>Kindly attend the meeting.')\n\n\nHow can I go about this? Any tips?"
] | [
"python",
"python-3.x",
"win32com"
] |
[
"Validation using entity for a FormType inside a form",
"I have two entities: Company and Location. One company has one location (while one location may \"have\" multiple companies). Now when a user creates a company, I want him/her to able able, to create the location in the same form. So I use the following\n\n $builder\n ->add('name', TextType::class, ['label' => 'company.name'])\n ->add('size', IntegerType::class, ['label' => 'company.size'])\n ->add( $builder->create('location', FormType::class, [\n 'label' => 'company.location',\n 'by_reference' => true,\n 'data_class' => 'AppBundle\\Entity\\Location',\n ])\n ->add('street', TextType::class, [\n 'label' => 'location.street',\n ])\n ->add('number', TextType::class, [\n 'label' => 'location.number',\n ])\n\n\nThis works fine in creating the form. Now it comes to validation. I added @Assert annotations for both entities in their respective files. While company validation works, location does not get automatically validated.\n\nI managed to get validation by adding constraint properties to the new $builder->create('location') elements, but this means duplicated code (once in Entity and at least once in every form that needs location).\n\nHow can I solve it so the form gets validated by using the entity's annotation?"
] | [
"php",
"validation",
"symfony-forms",
"symfony"
] |
[
"Button syncronized with thread android",
"How create a button which pause the thread which is inside the loop and another button which \nresumes.\n\nRunnable myRun = new Runnable(){\n\n\npublic void run(){\n\n for(int j =0 ;j<=words.length;j++){\n\n synchronized(this){\n try {\n\n wait(sleepTime);\n\n bt.setOnClickListener(new View.OnClickListener() {\n public void onClick(View arg0) {\n\n try {\n wait();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }});\n bt2.setOnClickListener(new View.OnClickListener() {\n public void onClick(View arg0) {\n notify();\n\n }\n });\n } catch (InterruptedException e) {\n e.printStackTrace();\n\n } }\n runOnUiThread(new Runnable(){\n public void run(){\n try {\n et.setText(words[i]);\n i++;\n } catch (Exception e) {\n e.printStackTrace();\n }\n }});\n }}};\n\n\ndoing some stuff say words.lenght=1000 times\nthen suppose user want to take break in between\nclick pause button with id = bt this button pauses thread until and user \nclicks resume with id= bt1"
] | [
"android",
"multithreading",
"button",
"onresume",
"onpause"
] |
[
"Strict Standards: Non-static method lang::utf8decode() should not be called statically in",
"I have this line \n\n$newLang[$key] = (key_exists($key2, $_LANG)) ? \n lang::utf8decode($_LANG[$key2], 'UTF-8') : '';\n\n\nIn more than one place, it seems it is creating an error for every place it is present.\n Do you know why this is happening and how to solve it?\n\nexample: \n\nforeach($matches[1] as $key)\n{\n $key2 = $template.'_'.md5($key);\n $newLang[$key] = (key_exists($key2, $_LANG)) ? lang::utf8decode($_LANG[$key2], 'UTF-8') : '';\n}\n$files[$template] = $newLang;\n$count += sizeof($newLang);"
] | [
"php",
"utf-8",
"utf",
"utf8-decode"
] |
[
"Victory Chart background rounded corners",
"Here is design of a chart I'm trying to style (see rounded corners of background and cells)\n\nFor now something I've archived is following\n\nSee editable code here https://codesandbox.io/s/chart-9ln2e\nCould someone point me with technique or direction of how to round corners?\nThanks."
] | [
"javascript",
"victory-charts"
] |
[
"Find application installation path from UpgradeCode",
"I'm faced with little \"inconvenience\" using Visual Studio 2010 setup and deployment projects. Let's say I have 2 applications: App1 and App2. Both applications have separate MSi installation packages and can be installed to different locations. App1 need to know where App2 is installed. Previously I was provide App1 with \"ProductCode\" value of installation package of App2. This way App1 could find installation path of App2 looking for appropriate value in \"ProductCode\" key in the HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall.\n\nNow I was updated the version of App2 installation package and Visual Studio urged me to change the ProductCode. It was changed and now App1 can't successfully use previous ProductCode to find installation path of App2. Of corse I can give new ProductCode to the App1 but I will be forced to do this each time when App2 version updated. Also old version of App1 will be unable to find new version of App2 because new ProductCode will be unknown for it.\n\nSo I need more \"persistent\" method to find App2 installation path. I think of UpgradeCode value of Visual Studio setup and deployment project which is never changes unless developer will change it himself for some reason. But I couldn't find any trails of UpgradeCode in the registry.\n\nIs anyone know where UpgradeCodes are saved? Or probably the way to find actual ProductCode when we know UpgradeCode exist? Maybe someone have a better method of finding installation paths of applications?\nThanks in advance."
] | [
"visual-studio-2010",
"windows-installer",
"setup-project"
] |
[
"\"RuntimeError: dictionary keys changed during iteration\" when attempting to call add_attachment for Jira issue object, but dictionaries aren't used?",
"I am attempting to just add a csv file to my issues as a test, but I keep receiving the error:\n\nRuntimeError: dictionary keys changed during iteration\n\n\nHere is the code (I've removed the parameters for server, username and password):\n\nfrom jira import JIRA\n\noptions = {\"server\": \"serverlinkgoeshere\"}\njira = JIRA(options, basic_auth=('username', 'password'))\nissuesList = jira.search_issues(jql_str='', startAt=0, maxResults=100)\nfor issue in issuesList:\n with open(\"./csv/Adobe.csv\",'rb') as f:\n jira.add_attachment(issue=issue, attachment=f)\n f.close()\n\n\nI'm at a loss, I'm not changing any dictionary keys in my code. Here is the full error message:\n\nTraceback (most recent call last):\n File \"C:/Users/USER/PycharmProjects/extractor/main/jiraCSVDupdate.py\", line 8, in <module>\n jira.add_attachment(issue=issue, attachment=f)\n File \"C:\\Users\\USER\\AppData\\Roaming\\Python\\Python38\\site-packages\\jira\\client.py\", line 126, in wrapper\n result = func(*arg_list, **kwargs)\n File \"C:\\Users\\USER\\AppData\\Roaming\\Python\\Python38\\site-packages\\jira\\client.py\", line 787, in add_attachment\n url, data=m, headers=CaseInsensitiveDict({'content-type': m.content_type, 'X-Atlassian-Token': 'nocheck'}), retry_data=file_stream)\n File \"C:\\Users\\USER\\AppData\\Roaming\\Python\\Python38\\site-packages\\jira\\utils\\__init__.py\", line 41, in __init__\n for key, value in super(CaseInsensitiveDict, self).items():\nRuntimeError: dictionary keys changed during iteration\n\n\nReferences:\nJira add_attachment example:\nhttps://jira.readthedocs.io/en/master/examples.html#attachments\n\nadd_attachment source code:\nhttps://jira.readthedocs.io/en/master/_modules/jira/client.html#JIRA.add_attachment"
] | [
"python-3.x",
"jira",
"python-jira"
] |
[
"How to access component method in React from a WebSocket callback",
"I have a problem with Javascript and React. I want to change a components state based on push messages from a WebSocket.\n\nMy problem is that I do not know how to call the the function handlePushMessage from the WebSocket callback. Here is the code:\n\nconst MainPage = React.createClass({\n ...\n componentDidMount: function() { \n var connection = new WebSocket('ws://localhost:12345');\n connection.onmessage = function (e) {\n var jsonData = JSON.parse(e.data);\n handlePushMessage(jsonData);\n };\n },\n\n handlePushMessage: function(data) {\n ...\n }\n}\n\n\nI have tried different syntaxes for specifying that function and I tried accessing the function via this. However nothing has helped. Any ideas?"
] | [
"javascript",
"reactjs"
] |
[
"how to print output simultaneously in Python",
"print \"Trying to connect VM \"\ntry:\n ssh=paramiko.SSHClient()\n ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())\n ssh.connect('hostname',username='abc',password='1234')\n print (\"Connected \\n\")\n command1='cd '+ PATH + \" ; ls -ltr %s/abc.bin | awk '{print $9}' | cut -d '/' -f 8 | xargs grid -h \" + MACHINE_TYPE + \" -f \"\n stdin, stdout, stderr = ssh.exec_command(command1)\n for line in stdout:\n print line\n except paramiko.AuthenticationException:\n print (\"failed to connect \\n\")\n sys.exit(1)\n ssh.close()\n\n\nHere stdout is a huge output where it will be printing continuously around 600 lines.Until ssh.exec_command(command1) this completes i won't be able to print stdout. I am looking for simultaneous output on console too...Any help would be great!"
] | [
"python"
] |
[
"Where is the Ftp option to publish Console Application in Visual Studio",
"I created a C# Console Application and now I want to publish it to a ftp server. However, when I got to the Publish screen, the only targets I see are, \"Azure Webjobs\" and \"Folder\".\n\nWhere is the other option that should read, \"Ftp, IIs, etc\"?\n\nscreenshot of publish page"
] | [
"c#",
"visual-studio",
"deployment",
"console-application"
] |
[
"Delete particular word from string",
"I'm extracting twitter user's profile image through JSON. For this my code is:\n\n$x->profile_image_url\n\n\nthat returns the url of the profile image. The format of the url may be \"..xyz_normal.jpg\" or \"..xyz_normal.png\" or \"..xyz_normal.jpeg\" or \"..xyz_normal.gif\" etc.\n\nNow I want to delete the \"_normal\" part from every url that I receive. How can I achieve this in php? I'm tired of trying it. Please help."
] | [
"php",
"string"
] |
[
"Extracting user playcount from Last.fm API using JSON",
"In a nutshell, I'd like to display the Last.fm user playcount figure on my site (see 'playcount' on http://www.last.fm/api/show/user.getInfo). I've tried the following, but confess I have no idea if I'm on the right lines here.\n\n$(document).ready(function() {\n$.getJSON(\"http://ws.audioscrobbler.com/2.0/?method=user.getinfo&user=XXX&api_key=XXX&limit=5&format=json&callback=?\", function(data) {\n var html = '';\n $.each(data.user.playcount, function(i, item) {\n html += \"<p>\" + item.playcount + \"</p>\";\n });\n $('#count').append(html);\n});\n});"
] | [
"javascript",
"json",
"api",
"last.fm"
] |
[
"Auditing and model lifecycle management for instances and their associations?",
"I am trying to write an application to track legal case requests. The main model is Case, which has_many Subjects, Keywords, Notes, and Evidences (which, in turn, has_many CustodyLogs). Since the application is legal-related, there are some requirements that are out of the ordinary:\n\n\nCRUD operations must be logged, including what the operation was, who the actor was, and when the operation occurred\nThere needs to be some way to validate the data (i.e. recording MD5 checksums of records)\nSome data should be write-once (i.e. the app can create an audit log entry, but that log cannot be edited or deleted from within the application thereafter)\nChanges to associated objects probably should be logged throughout the nesting. For example, adding a CustodyLog to a piece of Evidence should have a log for itself, a log for it's Evidence, and a log for the parent Case. This is to ensure that the last update timestamp for the Case accurately reflects the real last update, and not just the last time that the Case model data itself changed.\n\n\nI've got bits of this working, but I'm running into a problem. Authentication is being handled by an external web single-sign-on service, so the only visibility to the ID of the logged in user is in a request variable. If I put audit logging in the model, through a callback, for example, I can be fairly sure that all data modifications are logged, but the model has no visibility to the request variables, so I can't log the user ID. This also ensures that changes to the state machine (currently using state_machine plugin) get logged.\n\nIf, on the other hand, I put the audit logging in the application controller, I lose the ability to be sure that all CRUD operations are logged (code in the Case model calling Subject.create, for example, wouldn't be logged). I also think that I'd lose state changes.\n\nIs there a way to be sure that all CRUD operations are logged throughout the association tree such that the user ID of the logged in user is recorded?"
] | [
"ruby-on-rails",
"logging",
"associations",
"nested-forms",
"auditing"
] |
[
"how to split this kind of column in a dataframe?",
"I have data frame same like below:\n Name Rating Review Price\n1 The park NaN NaN 5040\n2 The Westin Good 7.6 NaN 6045\n3 Courtyard NaN NaN 4850\n4 Radisson Excellent 9.8 NaN 7050\n5 Banjara Average 6.7 NaN 5820\n6 Mindspace NaN NaN 8000\n\nMy required output is like this:\n Name Review Rating Price\n1 The park NaN NaN 5040\n2 The Westin Good 7.6 6045\n3 Courtyard NaN NaN 4850\n4 Radisson Excellent 9.8 7050\n5 Banjara Average 6.7 5820\n6 Mindspace NaN NaN 8000\n\nI use this split function:\ndf[["review","ratings"]] = df["rating"].str.split(expand=True)\n\nBut I got 'Columns must be same length as key' this type error.\nHow to split this type of data can anyone help me?"
] | [
"pandas",
"dataframe"
] |
[
"How to pass XMl String visualforce page to apex class",
"I developed a String XML type and i just want to pass these XML String to Apex class and i want to iterate the values and i need to display .please share some example"
] | [
"xml",
"salesforce",
"apex-code",
"visualforce"
] |
[
"Making X-axis labels in R more granular",
"I'm producing a graph and R and would like the x axis to be more granular. \n\n Tenure Type Visits Members Percent\n1 0 Basic 122446 283975 0.4311858\n2 0 Premium 21190 44392 0.4773383\n3 1 Basic 92233 283975 0.3247927\n4 1 Premium 17909 44392 0.4034285\n5 2 Basic 42516 283975 0.1497174\n6 2 Premium 9613 44392 0.2165480\n\n\n plot(Visit_Curve$Tenure, Visit_Curve$Percent, type = \"n\", main = \"Visit Curve\")\n lines(Visit_Curve$Tenure[Visit_Curve$Type == \"Basic\"], Visit_Curve$Percent[Visit_Curve$Type == \"Basic\"], col = \"red\")\n lines(Visit_Curve$Tenure[Visit_Curve$Type == \"Premium\"], Visit_Curve$Percent[Visit_Curve$Type == \"Premium\"], col = \"blue\")\n\n\nThe code above produces a chart that has the x-axis broken down by factors of 50. Is there a way to easily customize the scale in base R plotting? Perhaps have a tick every 10 or 5?\n\nThanks,\nBen"
] | [
"r",
"axis-labels",
"graphing"
] |
[
"Laravel 4 - pagination filter reults",
"Does anybody know why I have an error when I'm using the Laravel pagination after filter results in a View?\n\nIt works perfectly in my simple view, but when I filter data using the form I've created for... the same pagination doesn't work!\n\nMY CODE:\n\nController:\n\npublic function filtro()\n{\n $keyword = Input::get('keyword');\n $asignatura = Input::get('asignatura_id');\n $nivel = Input::get('nivel_id');\n\n $actividades = Actividad::where('actividad', 'LIKE', '%'.$keyword.'%');\n\n if($asignatura){\n $actividades->where('asignatura_id', $asignatura); \n }\n if($nivel){\n $actividades->where('nivel_id', $nivel);\n }\n\n $actividads = $actividades->orderBy('created_at', 'DES')\n ->paginate(10);\n\n\n\n $id_user = Sentry::getUser()->id;\n $fichas = Ficha::where('user_id', $id_user)->orderBy('created_at', 'DESC')->get();\n $asignatura_clave = Asignatura::where('id', $asignatura)->first();\n $asignatura_id = Asignatura::orderBy('nombre', 'asc')->lists('nombre','id');\n $nivel_id = Nivel::orderBy('edad', 'asc')->lists('edad','id');\n $nivel_clave = Nivel::where('id', $nivel)->first();\n\n $user = User::find($id_user);\n // Devuelve todas las actividades que estan relacionadas con alguna ficha.\n $actividadEnFicha = Actividad::has('fichas')\n ->get();\n\n //$asignaturas = Asignatura::all();\n // return var_dump($actividadEnFicha);\n return View::make('actividads.index')\n ->with('fichas', $fichas)\n ->with('user', $user)\n ->with('palabra_clave', $keyword)\n ->with('keyword', $keyword)\n ->with('nivel_id', $nivel_id)\n ->with('nivel_clave', $nivel_clave)\n ->with('asignatura_clave', $asignatura_clave)\n ->with('asignatura_id', $asignatura_id)\n ->with('actividadEnFicha', $actividadEnFicha)\n ->with('actividads', $actividads);//->with('asignaturas', $asignaturas);\n}\n\n\nThe pagination code in my View:\n\n{{ $actividads->links(); }}\n\n\nMESSAGE ERROR:\n\nSymfony \\ Component \\ HttpKernel \\ Exception \\ MethodNotAllowedHttpException\n\n* @param array $others\n* @return void\n*\n* @throws \\Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException\n*/\nprotected function methodNotAllowed(array $others)\n{\nthrow new MethodNotAllowedHttpException($others);\n}\n\n\nEDIT:\n\nI've created these two routes \nRoute::post('filtro', array('as' => 'filtro', 'uses' => 'ActividadController@filtro')); and Route::get('filtro', array('as' => 'filtro', 'uses' => 'ActividadController@filtro')); , and pagination works. \n\nThe problem now is when I change to another page (using pagination) my filters are forgotten and it paginates all my activities angain... :S Any idea why? This is the first time I try it, and probably I'm doing it in a wrong way.\n\nAny idea what's happening? \n\nThanks!"
] | [
"filter",
"laravel-4",
"pagination"
] |
[
"Is it possible to parse these dates",
"Is it possible to parse dates like these in Java :\n\nSunday February 09th, 2014 or Sunday February 21st, 2014. \n\nI search a way with SimpleDateFormat. Thanks"
] | [
"java",
"date"
] |
[
"Won't let me call an event from outside the class",
"In my class I have:\n\npublic event WrDatabase.LoadStatus loadStatus;\n\n\nI can call it fine inside a method in the class. But from outside when I have:\n\nif (datasource.loadStatus != null)\n datasource.loadStatus.Invoke(WrDatabase.TYPE.SFORCE_COLLECTION, SObjectName);\n\n\nI get:\n\n\nif statement: The event can only appear on the left hand side of += or -=\nInvoke statement: I get that Invoke() is not a method on that class.\n\n\nDo I need to push this into the class for some reason?"
] | [
".net",
"events",
"delegates"
] |
[
"Ternary default on boxed boolean with unset key for NSDictionary",
"So I've tested this, but just wanting to make sure it wasn't some random undefined behavior. I want to use the shorthand ternary on a dictionary but I want it to return a default value when it is not set. Here is the test I wrote:\n\nNSMutableDictionary *test = [NSMutableDictionary new];\ntest[@\"test_1\"] = @NO;\ntest[@\"test_2\"] = @YES;\n\nBOOL test1 = [test[@\"test_1\"] boolValue] ?: NO;\nBOOL test2 = [test[@\"test_2\"] boolValue] ?: NO;\nBOOL test3 = [test[@\"test_3\"] boolValue] ?: NO;\n\nLogDebug(@\"test1 = %@\", (test1 ? @\"YES\" : @\"NO\"));\nLogDebug(@\"test2 = %@\", (test2 ? @\"YES\" : @\"NO\"));\nLogDebug(@\"test3 = %@\", (test3 ? @\"YES\" : @\"NO\"));\n\n\nNow I got the correct value for test3, but I'm wondering whether thats just a random fluke of undefined behavior. I'm wondering this because when I checked for that value in the debugger by typing this in the console:\n\npo [test[@\"test_3\"] boolValue]\n\n\nI got:\n\nerror: no known method '-boolValue'; cast the message send to the method's return type\nerror: 1 errors parsing expression\n\n\nAre the results of test3 reliable?"
] | [
"objective-c"
] |
[
"What is wrong with my Regex?",
"I'm using javascript to test for the ending of a file that is selected to be uploaded to the server.\n\nThe regex is this:\n\n(jpg|jpeg|png|gif|bmp)$\n\nAnd it works fine as long as the file extensions are in lower case, but when I do this\n\n/(jpg|jpeg|png|gif|bmp)$/i\n\nI doesn't match anything.\n\nCan someone tell me why? What am I doing that is wrong?"
] | [
"javascript",
"regex"
] |
[
"How to animate shadow with gradient?",
"I have a chart like below:\n\n\n\nI have a problem with animation and shadows.\ni draw a gradient with animation but from the beginning i have the shadow and mask layer which i don't want, i want the shadow animating with the gradient.\nthe current chart with animation is like below.\n\n\ni dont want the user see the shadow and mask layer from the beginning.\n\nhere is my code:\n\nimport Foundation\nimport UIKit\n\n@IBDesignable class CircularProgressView: UIView {\n\n@IBInspectable var containerCircleColor: UIColor = UIColor.lightGray\n@IBInspectable var gradientStartColor: UIColor = UIColor.green\n@IBInspectable var gradientEndColor: UIColor = UIColor.yellow\n@IBInspectable var arcWidth: CGFloat = 20\n\n\noverride init(frame: CGRect) {\n super.init(frame: frame)\n circularProgressView_init()\n}\n\nrequired init?(coder aDecoder: NSCoder) {\n super.init(coder: aDecoder)\n circularProgressView_init()\n}\n\n\nfileprivate func circularProgressView_init() {\n\n let viewHeight = NSLayoutConstraint(item: self, attribute: .height, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 1, constant: 0)\n self.addConstraint(viewHeight)\n\n}\n\noverride func prepareForInterfaceBuilder() {\n circularProgressView_init()\n}\n\noverride func draw(_ rect: CGRect) {\n let width = self.bounds.width\n let center = CGPoint(x: self.bounds.midX, y: self.bounds.midY)\n let radius: CGFloat = (width - (arcWidth * 2.5)) / 2\n let progressStartAngle: CGFloat = 3 * CGFloat.pi / 2\n let progressEndAngle: CGFloat = CGFloat.pi / 2\n\n //fill circular\n let circlePath = UIBezierPath(arcCenter: center,\n radius: radius,\n startAngle: 0,\n endAngle: 360,\n clockwise: true)\n circlePath.lineWidth = arcWidth\n containerCircleColor.setStroke()\n circlePath.stroke()\n\n\n //MARK: ProgressPath\n let progressPath = UIBezierPath(arcCenter: center,\n radius: radius,\n startAngle: progressStartAngle,\n endAngle: progressEndAngle,\n clockwise: true)\n progressPath.lineWidth = arcWidth\n progressPath.lineCapStyle = .round\n\n //MARK: Gradient\n let gradientLayer = CAGradientLayer()\n gradientLayer.colors = [gradientStartColor.cgColor , gradientEndColor.cgColor]\n gradientLayer.startPoint = CGPoint(x: 0, y: 0)\n gradientLayer.endPoint = CGPoint(x:1, y:1)\n gradientLayer.frame = self.bounds\n\n //MARK: Animation\n let anim = CABasicAnimation(keyPath: \"strokeEnd\")\n anim.duration = 2\n anim.fillMode = kCAFillModeForwards\n anim.fromValue = 0\n anim.toValue = 1\n\n //MARK: Mask Layer\n let maskLayer = CAShapeLayer()\n maskLayer.path = progressPath.cgPath\n maskLayer.fillColor = UIColor.clear.cgColor\n maskLayer.strokeColor = UIColor.black.cgColor\n maskLayer.lineWidth = arcWidth\n maskLayer.lineCap = kCALineCapRound\n\n gradientLayer.mask = maskLayer\n\n self.layer.insertSublayer(gradientLayer, at: 0)\n\n let context = UIGraphicsGetCurrentContext()\n let shadow = UIColor.lightGray\n let shadowOffset = CGSize(width: 3.1, height: 3.1)\n let shadowBlurRadius: CGFloat = 5\n context!.saveGState()\n context!.setShadow(offset: shadowOffset, blur: shadowBlurRadius, color: (shadow as UIColor).cgColor)\n progressPath.stroke()\n context?.restoreGState()\n\n maskLayer.add(anim, forKey: nil)\n gradientLayer.add(anim, forKey: nil)\n\n }\n}\n\n\nIs it possible at all?\nIf it is not, how can i at least hide the shadow and mask and show it after animation ends?"
] | [
"swift",
"animation",
"gradient",
"shadow"
] |
[
"How to use the method to show localstream in videoview in WEBRTC latest framework ? - for webrtc framework(iOS)",
"After updating the webrtc framework for the latest one , I am not getting how to show local stream to user cause methodology is changed which has no sample on repository's \"iOS\" folder.\n\nin old code...\n\n RTCVideoCapturer *capturer = [RTCVideoCapturer capturerWithDeviceName:cameraID];\n RTCMediaConstraints *mediaConstraints = [self defaultMediaStreamConstraints];\n RTCVideoSource *videoSource = [_factory videoSourceWithCapturer:capturer constraints:mediaConstraints];\n localVideoTrack = [_factory videoTrackWithID:@\"ARDAMSv0\" source:videoSource];\n\n\nThe RTCVideoCapturer object and RTCVideoSource object was linked here to each other.\n\nBut in new code...\n\n RTCVideoSource *source = [_factory videoSource];\n RTCCameraVideoCapturer *capturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:source];\n [_delegate appClient:self didCreateLocalCapturer:capturer];\n localVideoTrack = [_factory videoTrackWithSource:source\n trackId:kARDVideoTrackId];\n\n\nThere is no connection to each other.\nSo, the delegate method does what ,\n[_delegate appClient:self didCreateLocalCapturer:capturer];\nI am not getting it. [Help Required!]"
] | [
"ios",
"objective-c",
"webrtc",
"video-capture",
"apprtc"
] |
[
"Angular - Populating Form from Firebase Results In Duplicates",
"I'm populating a form based on a query. In this case, there should be two entries, but I'm getting a duplicate:\n\n get childrenForm() {\n return this.recordForm.get('children') as FormArray;\n }\n\n // Get all students associated with the current record.\n const query = this.afs.collection('students', ref => ref.where('recordId', '==', this.currentRecordId));\n this.subscriptions.push(\n query.valueChanges()\n .subscribe(students => {\n console.log(`MD: RecordFormPage -> populateForm -> students`, students);\n students.forEach((child: any) => {\n const timestamp = child.dob.seconds;\n const date = new Date(timestamp * 1000);\n const childData = this.fb.group({\n fname: child.fname,\n lname: child.lname,\n dob: date,\n grade: child.grade,\n gender: child.gender,\n race: child.race,\n id: child.id\n });\n this.childrenForm.push(childData);\n });\n })\n );\n\n\nNote duplicate Delvin Carrington entry:\n\n\nYou'll notice in the console that valueChanges() emits the first entry in the data base, then emits the first entry + second entry, thus producing three results:\n\n\nSo I believe that If there is an appropriate way to wait until valueChanges() has all the data, then only at that point, emit and/or push the data to this.chidrenForm - that should fix it. Knowing that a subscription to valueChanges() will not fire its onComplete method. Thank you in advance."
] | [
"angular",
"rxjs",
"google-cloud-firestore"
] |
[
"can't debug hanging $.post in firefox extension",
"I'm developing this extension https://builder.addons.mozilla.org/addon/1022928/latest/\n\nThe code central to this question is in Data/panel.js\n\nAnd it's working pretty well, except that whenever I hit \"Gem\" to post a jquery call, it just hangs at the loading icon, I don't get any feedback in the console as to why the call is not going through and being processed as it should. \n\nSo how do I debug that with the new firefox add-on sdk builder beta. I've tried writing to console.log(), and I've read that it's supposed to work for others, but I really can't see any of my log messages, just errors that are synchronous in code, and hence not ajax errors.\n\nReturning to my question: How do I debug a hanging ajax call in my firefox extension's panel?"
] | [
"javascript",
"jquery",
"firefox-addon",
"firefox-addon-sdk"
] |
[
"how get a file path by uri which authority is \"com.android.externalstorage.documents\"",
"I want to get a file path through open a file choose by startActivityForResult which intent is Intent.ACTION_GET_CONTENT and setType(* / *), but when I choose open form the \"Nexus 5X\" item the return uri is \"com.android.externalstorage.documents\", how to handle this type uri.\nThere are some codes.\n\nIntent intent = new Intent(Intent.ACTION_GET_CONTENT);\nintent.addCategory(Intent.CATEGORY_OPENABLE);\nintent.putExtra(Intent.ACTION_DEVICE_STORAGE_OK, true);\nintent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);\nintent.setType(\"*/*\");\nstartActivityForResult(intent, FILE_ADD_ACTION_REQUEST_CODE);\n\n\nscreenshot"
] | [
"android"
] |
[
"Wordpress child theme style.css not working",
"I have created a file structure in the same format as my parent theme. My parent theme is called Alpine and within Alpine there is a functions.php and style.css file. There do not appear to be any additional style.css files.\n\nI have created a directory called Alpine-child and within that I have created a functions.php and style.css file.\n\nI can't work out why any changes I make to the child style.css are not implemented but they are when I make the same changes in parent style.css\n\nThis is my child style.css:\n\n\r\n\r\n/*\r\n Theme Name: Alpine Child\r\n Theme URI: http://www.creative-ispiration.com/wp/alpine/\r\n Description: My first child theme, based on Alpine\r\n Author: MilkshakeThemes\r\n Author URI: http://themeforest.net/user/milkshakethemes\r\n Template: Alpine\r\n Version: 1.0.0\r\n Tags: one-column, two-columns, right-sidebar, fluid-layout, custom-menu, editor-style, featured-images, post-formats, rtl$\r\n Text Domain: alpine-child\r\n*/\r\n\r\n\r\n\n\nThis is my child functions.php file:\n\n\r\n\r\n<?php\r\nadd_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );\r\nfunction my_theme_enqueue_styles() {\r\n wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );\r\n}\r\n?>"
] | [
"php",
"wordpress"
] |
[
"How do I format a number with a leading zero?",
"My time is updating in realtime with the following function:\n\n\r\n\r\n var nIntervId;\r\n\r\n function updateTime() {\r\n nIntervId = setInterval(flashTime, 1000*2);\r\n }\r\n\r\n function flashTime() {\r\n var now = new Date();\r\n var h = now.getHours();\r\n var m = now.getMinutes();\r\n var s = now.getSeconds();\r\n var time = h + ':' + m;\r\n $('.time').html(time);\r\n }\r\n\r\n $(function() {\r\n updateTime();\r\n });\r\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>\r\n\r\n <span class=\"time\" style=\"margin-left:20px\"></span>\r\n\r\n\r\n\n\nProblem ist, that it is displaying 11:9 instead if 11:09"
] | [
"javascript",
"jquery"
] |
[
"How to integrate react-perfect-scrollbar with react-select",
"I want to apply style to scrollbar, scrollbar style works perfectly in chrome using css. but does not work in Firefox and Iexplore.\n\n\nHence I opted to perfect-scroll-bar, But scrollbar does not move as expected if we navigate options using arrow keys, scroll position does not change.\n\nBelow is the demo link:\n\nhttps://codesandbox.io/s/18pvjy0olj\n\nThanks in advance!"
] | [
"reactjs",
"material-ui",
"react-select",
"perfect-scrollbar"
] |
[
"project of file storage system in asp.net how to implement correctly?",
"on upload.aspx page i have \n conn1.ConnectionString = \"Data Source=.\\ip-of-remote-database-server;AttachDbFilename=signup.mdf;Integrated Security=True;User Instance=True\";\n\nand all the queries are also on same page ,only database on another machine..\n\nso is this the correct way of implementing ?? or i have to create all queries on another machine and call them by application??"
] | [
"asp.net",
"database-design"
] |
[
"Swift function async",
"func passcodeViewController(_ passcodeViewController: TOPasscodeViewController, isCorrectCode code: String) -> Bool {\n\n let userDefault = UserDefaults.standard\n let tokenPinCode = userDefault.string(forKey: \"tokenPinCode\")\n let mailData = self.emailField.text\n let dataStruct = mailData!+\"|\"+tokenPinCode!\n print(\"1\")\n self.checkToken(code: dataStruct) { (response) in\n if(response[0] == \"OK\"){\n print(\"2\")\n self.alertPasswordChange(text: \"Podaj nowe hasło\", code: dataStruct)\n }else{\n self.standardAlert(title: \"Znaleziono błędy\", message: \"Podany kod jest błedny\", ok: \"Rozumiem\")\n self.werifyButton.isEnabled = true\n }\n }\n print(\"3\")\n return false\n }\n\n\nFunction returns: Print -> 1 -> 3 -> 2\n\nHow to get the effect to work out: Print -> 1 -> 2 -> 3"
] | [
"ios",
"swift",
"xcode",
"alamofire"
] |
[
"URL linter not working from cURL",
"I need to update the pages from my website to all have the same og:image. I could use the Object Debugger website, but it would take me hours to do it manually so I built a Bash script to do the job.\n\nProblem is, even when I try manually from the Terminal I'm getting nowhere. It simply won't scrape the updated metas. The og:image (or really any other og:meta-tag) remains the same, like I never entered the cURL command. As a precision, it does work when I try from the Debugger website.\n\nAs indicated in the Open Graph documentation:\n\ncurl https://developers.facebook.com/tools/lint/?url={YOUR_URL}&format=json\n\n\nIs there any way I can fix that?\nThanks!"
] | [
"facebook",
"curl",
"graph"
] |
[
"Label tag asp-for is not displaying",
"I have this ViewModel class\n\npublic class ThirdPartyTransfer\n{\n public int Id { get; set; }\n [Display(Name = \"Transfer Amount\")]\n public decimal TransferAmount { get; set; }\n\n}\n\n\nand in my C# Razor Pages, ThirdPartyTransfer.cshtml\n\n <div class=\"form-group\">\n <label asp-for=\"ThirdPartyTransfer.TransferAmount\" />\n <input asp-for=\"ThirdPartyTransfer.TransferAmount\" class=\"form-control\" />\n <span asp-validation-for=\"ThirdPartyTransfer.TransferAmount\" class=\"text-danger\"></span>\n</div>\n\n\nand what is being rendered out is below\n\n <div class=\"form-group\">\n <label for=\"ThirdPartyTransfer_TransferAmount\" />\n <input class=\"form-control\" type=\"text\" data-val=\"true\" data-val-number=\"The field Transfer Amount must be a number.\" data-val-required=\"The Transfer Amount field is required.\" id=\"ThirdPartyTransfer_TransferAmount\" name=\"ThirdPartyTransfer.TransferAmount\" value=\"\" />\n <span class=\"text-danger field-validation-valid\" data-valmsg-for=\"ThirdPartyTransfer.TransferAmount\" data-valmsg-replace=\"true\"></span>\n</div>\n\n\nI wonder why I could see the textbox but not the label."
] | [
"asp.net-core",
"razor-pages"
] |
[
"Rails Memcache Store and expires_in problems",
"[25] pry(main)> Rails.cache.fetch(\"my_key\", :expires_in => 1.year) do\n[25] pry(main)* (Time.now.to_date).to_s\n[25] pry(main)* end\n=> \"2013-11-01\"\n[28] pry(main)> Rails.cache.fetch(\"my_key\")\n=> nil\n\n\nI cant understand the above behavior. The cache does not have this key before this, or rather it is nil. \n\nThis works fine if I remove the expires_in option.\n\nThis is in the production version of my app which uses memcached\n\n # Use a different cache store in production\n config.cache_store = :mem_cache_store, <DNS NAME>\n\n\nThis also works on my local which I expect is the filesystem based caching.\n\nEdit: ah, 1.year is too long perhaps.. It works with 1.day. Is this a bug or is this documented somewhere?\n\nEdit: It appears that 1.month is the max in a duration form. But this still cant be accepted behavior\nMemcache maximum key expiration time"
] | [
"ruby-on-rails",
"caching",
"ruby-on-rails-3.2",
"memcached"
] |
[
"Cannot establish connection with RMI Registry on a remote server",
"Currently I'm trying to start a java server using RMI on a remote machine. Server seem to start, but I can't invoke its methods on a client.\nOn a client I get an exception which looks like this:\n\nException in thread \"main\" java.rmi.ConnectException: Connection refused to host: 10.0.0.6; nested exception is: \n java.net.ConnectException: Operation timed out (Connection timed out)\n\n\nThis is my RMI Server constructor:\n\n private RmiServer(String address, int port) throws RemoteException, SQLException, MalformedURLException {\n System.out.println(\"This address = \" + address + \", Port = \" + port);\n Registry registry;\n try {\n registry = LocateRegistry.createRegistry(PORT);\n } catch (RemoteException e)\n {\n registry = LocateRegistry.getRegistry(PORT);\n }\n System.setProperty(\"java.rmi.server.hostname\", address);\n try {\n registry.bind(REGISTRY_NAME, this);\n Naming.bind(address, this);\n }\n catch (AlreadyBoundException e)\n {\n registry.rebind(REGISTRY_NAME, this);\n Naming.rebind(address, this);\n }\n ...\n }\n\n\nAnd this is my client code:\n\n static public void main(String[] args) throws IOException {\n try {\n Registry registry = LocateRegistry.getRegistry(SERVER_ADDRESS, SERVER_PORT);\n rmiServer = (ReceiveMessageInterface) registry.lookup(REGISTRY_NAME);\n } catch (RemoteException | NotBoundException e) {\n System.err.println(e.getMessage());\n isServerOK = false;\n }\n Scanner reader = new Scanner(new InputStreamReader(System.in));\n boolean isAuthenticated = false;\n int pin;\n String cardNumber;\n SessionInfo session = null;\n if (isServerOK) {\n while (true) {\n if (!isAuthenticated) {\n System.out.println(\"Welcome Customer to HDFC Bank ATM : \\nPlease enter your card number: \");\n cardNumber = reader.next();\n System.out.println(\"Please enter your PIN: \");\n pin = reader.nextInt();\n String cardHolderName = rmiServer.verifyPIN(cardNumber, pin);\n ...\n }\n ...\n }\n ...\n }\n ...\n }\n\n\nI start server with this string:\n\njava -cp flyway-core-6.0.8.jar:mssql-jdbc-7.4.1.jre8.jar:mysql-connector-java-8.0.18.jar:. -Djava.security.policy=java.security.AllPermission kmalfa.RmiServer\n\n\nMy server runs on linux virtual machine. I use Microsoft Azure service. I turned off firewall on my client and on virtual machine. I allowed all incoming connections in Azure settings for testing purposes and it doesn't help.\nWhat could be the problem?"
] | [
"java",
"azure",
"client-server",
"rmi",
"firewall"
] |
[
"QT 5.3 Location of Configure Command",
"I am trying to compile QT statically.\nHowever I am unable to run the configure command as I get the following.\n'configure' is not recognized as an internal or external program.\n\nI assume this is because I am looking in the wrong location for it.\nI have tried using the windows command prompt and the one included with QT.\n\nI've tried following the instructions in this post with no luck.\n\nWhere can I found QT 5.3.0 command prompt"
] | [
"c++",
"qt"
] |
[
"ne_chunk without pos_tag in NLTK",
"I'm trying to chunk a sentence using ne_chunk and pos_tag in nltk.\n\nfrom nltk import tag\nfrom nltk.tag import pos_tag\nfrom nltk.tree import Tree\nfrom nltk.chunk import ne_chunk\n\nsentence = \"Michael and John is reading a booklet in a library of Jakarta\"\ntagged_sent = pos_tag(sentence.split())\n\nprint_chunk = [chunk for chunk in ne_chunk(tagged_sent) if isinstance(chunk, Tree)]\n\nprint print_chunk\n\n\nand this is the result:\n\n[Tree('GPE', [('Michael', 'NNP')]), Tree('PERSON', [('John', 'NNP')]), Tree('GPE', [('Jakarta', 'NNP')])]\n\n\nmy question, is it possible not to include pos_tag (like NNP above) and only include Tree 'GPE','PERSON'?\nand what 'GPE' means?\n\nThanks in advance"
] | [
"python",
"tree",
"tags",
"nltk",
"chunking"
] |
[
"Button Doesn't Show Correct Color - Android Studio",
"In my Android Studio application, I have a button for which I set a drawable as the background. The drawable rounds the corners and changes the color of the button.\nHowever, when I look at the resulting design of the activity, the color I want doesn't show up. Instead, the button assumes colorPrimary (orange, #ED3616). The same occurs when I run the application.\nNote: the other attributes of the drawable file translate perfectly to the button (i.e. the rounded corners). The problem is only with the color.\nI have tried using a MaterialButton, and setting the color with android:backgroundTint. Then, the color does show up as I want to, but the design looks odd (there is a different colored rectangle inside of the button(Picture of MaterialButton if you'd like to see it)\nHow can I make the regular button have the color I desire?\nButton:\n<Button\n android:background="@drawable/round2"\n android:id="@+id/signIn"\n android:layout_width="256dp"\n android:layout_height="66dp"\n android:text="@string/logIn"\n android:textColor="#FFFFFF"\n android:textSize="25sp"\n app:layout_constraintBottom_toBottomOf="parent"\n app:layout_constraintEnd_toEndOf="parent"\n app:layout_constraintHorizontal_bias="0.496"\n app:layout_constraintStart_toStartOf="parent"\n app:layout_constraintTop_toTopOf="parent"\n app:layout_constraintVertical_bias="0.878" />\n\nDrawable: round2.xml:\n <?xml version="1.0" encoding="utf-8"?>\n<shape xmlns:android="http://schemas.android.com/apk/res/android"\n android:shape="rectangle">\n <solid\n android:color="#B30C44"\n android:paddingLeft="6dp"\n android:paddingTop="6dp" />\n <corners\n android:bottomRightRadius="20dp"\n android:bottomLeftRadius="20dp"\n android:topLeftRadius="20dp"\n android:topRightRadius="20dp"/>\n <padding\n android:bottom="6dp"\n android:left="6dp"\n android:right="6dp"\n android:top="6dp" />\n</shape>\n\nWhat shows up:\nWhat the Button looks like"
] | [
"android",
"button",
"android-button",
"material-components-android",
"materialbutton"
] |
[
"Extract unique characters from a string with keeping whitespace between strings",
"How do I extract unique letter occurrences in a string, including all spaces?\n\nThe problem with my code is that it only returns the first occurrence of the space:\n\nfunction unique_char(str1) {\n var str = str1;\n var uniql = \"\";\n for (var x = 0; x < str.length; x++) {\n\n if (uniql.indexOf(str.charAt(x)) == -1) {\n uniql += str[x];\n\n }\n }\n return uniql;\n}\nconsole.log(unique_char(\"the fox news newspaper\"));\n\n\n\n\nthis prints to console:\n\n\n the foxnwspar\n\n\nbut my desired output is:\n\n\n the fox nws par\n\n\nAny help will be appreciated.\n\nThanks"
] | [
"javascript",
"arrays",
"string",
"whitespace"
] |
[
"javascript regex obtained from a variable giving error on test: \"is not a function\"",
"in plain javascript: I am getting error when i run the below:\n\nvar arg_regex = 'myregex:/^[:a-z0-9\\s!\\\\\\/]+$/i';\n\nregex_patt = arg_regex.replace(/^myregex:/,'');\n\nif(regex_patt.test(stringtocheck)){\n//good\n} else {\n//bad\n}\n\n\nerror:\n\nregex_patt.test is not a function\n\n\npl help. not able to figure why it would fail."
] | [
"javascript",
"regex",
"testing"
] |
[
"Multiple Ajax HTTP GET Requests with Different Input Variables using jQuery",
"I want to make asychronous get requests and to take different results based on the input that I provide to each one. Here is my code:\n\nparam=1;\n$.get('http://localhost/my_page_1.php', param, function(data) {\n alert(\"id = \"+param);\n $('.resul 5.t').html(data);\n});\n\nparam=2;\n$.get('http://localhost/my_page_2.php', param, function(data) {\n alert(\"id = \"+param);\n $('.result').html(data);\n});\n\n\nThe result for both requests is:\n \"id = 2\"\nI want the results to be:\n \"id = 1\" for the 1st request, and\n \"id = 2\" for the second one..\n\nI want to do this for many requests in one\nHTML file and integrate the results into the\nHTML as soon as they are ready.\n\nCan anyone help me to solve this problem?"
] | [
"jquery",
"ajax",
"get",
"http-request"
] |
[
"Disable user from accessing page VIA address bar",
"Afternoon,\n\nI am currently fixing a few things on my application and have come across a problem that is quite serious and never thought of before.\n\nIn my application a user has to log in and when their details have been entered it goes to the database and checks if they are there, if they are not an error message appears, if they are they will be logged in.\n\nIf the user goes to the address bar and changes the login page:\n\n\"/Account/nLogin.aspx\"\n\n\nTo the page after the login button:\n\n\"PolicySearch.aspx\"\n\n\nThe user will be directed to that page. Is there a way i can disable the user moving from page to page using the address bar?"
] | [
"asp.net",
"vb.net",
"url"
] |
[
"XLib: How do I return to windowed mode once I make it full screen?",
"I was able to make my app go full screen, but I can't make it go back to the windowed mode with borders visible. I tried to call XDeleteProperty to clear out the settings for full screen but it doesn't seem to work."
] | [
"c",
"x11",
"xlib"
] |
[
"Extract image filename with extension - JS",
"i see many options on the internet, but it is not what I want. \nI want to get the image name, but with extension with JS.\nEven if the path to the image file and image is something like:\n\n\n folder/folder1/fol.der/my.image.jpg\n\n\nThe result must be:\n\n\n my.image.jpg"
] | [
"javascript",
"jquery",
"html",
"image"
] |
[
"Why doesn't simple test pass using AutoFixture Freeze, SemanticComparison Likeness and CreateProxy?",
"I'm trying to understand how to use the CreateProxy() feature of Likeness<T>() using two instances of a simple class.\n\npublic class Band\n{\n public string Strings { get; set; }\n public string Brass { get; set; }\n}\n\n\nWith the following test, I use a Fixture to Create<T> a Band instance with values for the two string properties.\n\n[Fact]\npublic void Equality_Behaves_As_Expected()\n{\n // arrange\n var fixture = new Fixture();\n fixture.Customize(new AutoMoqCustomization());\n\n var original = fixture.Create<Band>();\n // Brass something like --> \"Brass65756b89-d9f3-42f8-88fc-ab6de5ae65cd\"\n // Strings something like --> \"Strings7439fa1b-014d-4544-8428-baea66858940\"\n\n // act\n var dupe = new Band {Brass = original.Brass, \n Strings = original.Strings};\n // Brass same as original's like --> \"Brass65756b89-d9f3-42f8-88fc-ab6de5ae65cd\"\n // Strings same as original's like --> \"Strings7439fa1b-014d-4544-8428-baea66858940\"\n\n\nI've tried many different assertions, but the crux of the matter seems to be that the CreateProxy method is not populating the properties of Band, so that even when I try to compare two instances of Band with the same property values, the instance from the CreateProxy method always has null values. \n\n // assert\n var likeness = dupe.AsSource().OfLikeness<Band>()\n .Without(x => x.Brass).CreateProxy();\n // Brass & String properties are null using dupe as source of likeness (!)\n\n //var likeness = original.AsSource().OfLikeness<Band>()\n // .Without(x => x.Brass).CreateProxy();\n // Brass & String properties are null using original as source of likeness (!)\n\n //Assert.True(likeness.Equals(original)); // Fails\n //Assert.True(original.Equals(likeness)); // Fails\n\n // below are using FluentAssertions assembly\n //likeness.Should().Be(original); // Fails (null properties)\n //original.Should().Be(likeness); // Fails (null properties)\n //likeness.ShouldBeEquivalentTo(original); // Fails (null properties)\n //original.ShouldBeEquivalentTo(likeness); // Fails (null properties)\n}\n\n\nI've gotta be doing something wrong, but I've read everything I can find on the Ploeh blog and SO, and can't find an example suitably simple enough to compare to what I'm doing. Any ideas?"
] | [
"autofixture",
"semantic-comparison"
] |
[
"Keras fit_generator with multiple tensor input",
"I have a Keras model with 4 tensor input and one array output. It works properly using model.fit method\n\nmodel.fit([inputUM, inputMU, inputUU, inputMM],outputY , validation_data=([inputTestUM, inputTestMU, inputTestUU, inputTestMM],outputTest), batch_size=None, epochs=3, steps_per_epoch=200,validation_steps=200, callbacks=[checkpointer])\n\n\nNow I change model.fit to model.fit_generator as\n\nbatchSize = 10\nsamples = int(outputY.shape[0]) #number of all samples\nstepsPerEpoch = int(samples/batchSize)\nmodel.fit_generator(dataGenerator(inputUM, inputMU, inputUU, inputMM, outputY, batchSize),\n steps_per_epoch=stepsPerEpoch,\n epochs=2,\n verbose=1,\n callbacks=[checkpointer],\n validation_data=dataGenerator(inputTestUM, inputTestMU, inputTestUU, inputTestMM, outputTest, batchSize),\n validation_steps=stepsPerEpoch))\n\n\nIn the dataGenerator each tensor is sliced as following\n\ndef dataGenerator(inputUM, inputMU, inputUU, inputMM, outputY, batchSize): \n samples = int(outputY.shape[0]) #number of all samples\n batchNumber = int(samples/batchSize) #number of batches\n counter=0\n\n while True:\n if counter > batchNumber: #restart counter at the end of each epoch\n counter = 0\n inUM = tf.slice(inputUM,[counter*batchSize,0,0],[batchSize,60,1]) \n inMU = tf.slice(inputMU,[counter*batchSize,0,0],[batchSize,60,1]) \n inUU = tf.slice(inputUU,[counter*batchSize,0,0],[batchSize,60,1]) \n inMM = tf.slice(inputMM,[counter*batchSize,0,0],[batchSize,60,1]) \n outY = outputY[counter*batchSize:(counter+1)*batchSize]\n\n counter += 1\n yield ([inUM, inMU, inUU, inMM], outY)\n\n\nHowever I get this error:\n\nFile \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\spyder\\utils\\site\\sitecustomize.py\", line 705, in runfile\nexecfile(filename, namespace)\nFile \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\spyder\\utils\\site\\sitecustomize.py\", line 102, in execfile\nexec(compile(f.read(), filename, 'exec'), namespace)\nFile \"mycode.py\", line 529, in <module>\nmain(data)\nFile \"mycode.py\", line 236, in main\ninitial_epoch=0)\nFile \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\legacy\\interfaces.py\", line 91, in wrapper\nreturn func(*args, **kwargs)\nFile \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\engine\\training.py\", line 1418, in fit_generator\ninitial_epoch=initial_epoch)\nFile \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\engine\\training_generator.py\", line 223, in fit_generator\ncallbacks.on_batch_end(batch_index, batch_logs)\nFile \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\callbacks.py\", line 115, in on_batch_end\ncallback.on_batch_end(batch, logs)\nFile \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\callbacks.py\", line 238, in on_batch_end\nself.totals[k] = v * batch_size\nFile \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\framework\\tensor_shape.py\", line 410, in __rmul__\nreturn self * other\nTypeError: unsupported operand type(s) for *: 'Dimension' and 'float'\n\n\nI know it needs some integer variable, however it gets other type data. I can't understand which parameter type is wrong. I cast all1 variables like stepsPerEpoch and samples, to integer. Also it seems the generator works properly, in debug mode it returns [<tf.Tensor 'Slice_48:0' shape=(100, 60, 1) dtype=float32>, <tf.Tensor 'Slice_49:0' shape=(100, 60, 1) dtype=float32>, <tf.Tensor 'Slice_50:0' shape=(100, 60, 1) dtype=float32>, <tf.Tensor 'Slice_51:0' shape=(100, 60, 1) dtype=float32>] as input and array([4., 5., 4., ..., 4., 4., 5.]) as output."
] | [
"python",
"tensorflow",
"keras"
] |
[
"Why I can't escape the question mark (C#)?",
"I need to count how many times each words occurs in a text read from file . The problem is that I must escape some of the common symbols and I'm doing it. All of them are removing successfully except the question mark \"?\" and I still can't realize why is that happening. I'm referring the code. Thanks again.\n\nnamespace DictionariesHashTablesAndSets\n{\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nclass WordsOccurencesInText\n{\n static void Main()\n {\n StreamReader reader = new StreamReader(\"../../text.txt\");\n string textFromFile = reader.ReadToEnd();\n\n string[] words = SplitWords(textFromFile);\n\n for (int index = 0; index <= words.Length - 1; index++)\n {\n words[index] = words[index].ToLower();\n }\n\n IDictionary<string, int> dict = new Dictionary<string, int>();\n\n foreach (var word in words)\n {\n int count = 1;\n if (dict.ContainsKey(word))\n {\n count = dict[word] + 1;\n }\n\n dict[word] = count;\n }\n\n Console.WriteLine(textFromFile);\n\n foreach (var word in dict)\n {\n Console.WriteLine(\"{0} -> {1} times\", word.Key, word.Value);\n }\n\n }\n\n private static string[] SplitWords(string textFromFile)\n {\n char[] separators = new char[] { '.', ',', ' ', '?', '!', ';', '-' };\n string[] words = textFromFile.Split(separators, StringSplitOptions.RemoveEmptyEntries);\n\n return words;\n }\n}\n}\n\n\nAnd the output:\n\njust -> 1 times\nsome -> 1 times\nrandom -> 3 times\ntext -> 11 times\nover -> 1 times\nhere -> 1 times\nand -> 1 times\nmore -> 1 times\nthis -> 3 times\nis -> 2 times\nthe -> 2 times\n? -> 1 times\n\n\nSample of the text file:\n\n\n just Some random text over Here, TEXT, text, and more random - random text Text? This is the TEXT. Text, text, text THIS TEXT! Is this the text?"
] | [
"c#"
] |
[
"How to programatically scroll a TextMergeViewer?",
"My SWT window (Eclipse plugin) has a TextMergeViewer in it, in order to compare two files. However, I can't find a way to programmatically make it scroll up or scroll down.\n\nIf you ever used the Java compare tool in Eclipse, there is a few buttons allowing you to jump to the next/previous difference. This is what I would like to do for my viewer. How could I make it by myself ? \n\nThanks for reading."
] | [
"java",
"eclipse",
"eclipse-plugin",
"scrollviewer"
] |
[
"Post file content using CURL",
"How can I \"correctly\" upload the content of a file with cURL?\n\nThere are a lot of explanations and questions here where tmp files are send by curl with a @prefix on the file or using the curlFile api. In My use case I don't want to create a tmp file, and just post the content of file_get_contents('php://input') as body of the post request. The server does not accept multipart form requests.\n\nThe Following snipped will work in PHP7:\n\n$body = file_get_contents('php://input');\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $body);\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\n\n\nIt feels ugly to set the content type to json, no matter what the actual content of the stream may holds. But it seems to work. Sadly I need to support a really old version of PHP and feel like running out of options. \n\nMy question is:\nIs the above example correct, even for PHP 7 or can it be made better?\nAdditionally: Is there any improvement or option that can be used to make this work with PHP 5.3.10? In this old version the post body always seems to be empty."
] | [
"php",
"curl"
] |
[
"Mongodb aggregate with cond and query value",
"I'm new to mongodb. I need to know how it is possible to query item for set to the value with aggregate\nData\n[\n {\n "_id" : "11111",\n "parent_id" : "99",\n "name" : "AAAA"\n },\n {\n "_id" : "11112",\n "parent_id" : "99",\n "name" : "BBBB"\n },\n {\n "_id" : "11113",\n "parent_id" : "100",\n "name" : "CCCC"\n },\n {\n "_id" : "11114",\n "parent_id" : "99",\n "name" : "DDDD"\n }\n]\n\nmongoshell\nAssume $check is false\ndb.getCollection('test').aggregate(\n [\n {\n "$group": {\n "_id": "$id",\n //...,\n "item": {\n "$last": {\n "$cond": [\n {"$eq": ["$check", true]},\n "YES",\n * * ANSWER **,\n }\n ]\n }\n },\n }\n ]\n)\n\nSo i need the result for item is all the name contain with same parent_id as string of array\nExpect result\n[\n {\n "_id" : "11111",\n "parent_id" : "99",\n "name" : "AAAA",\n "item" : ["AAAA","BBBB","DDDD"]\n },\n\n {\n "_id" : "11112",\n "parent_id" : "99",\n "name" : "BBBB",\n "item" : ["AAAA","BBBB","DDDD"]\n },\n\n {\n "_id" : "11113",\n "parent_id" : "100",\n "name" : "CCCC",\n "item" : ["CCCC"]\n },\n\n {\n "_id" : "11114",\n "parent_id" : "99",\n "name" : "DDDD",\n "item" : ["AAAA","BBBB","DDDD"]\n }\n]"
] | [
"mongodb",
"mongodb-query"
] |
[
"Collapsible / Sliding \"Tray\" (Div)",
"Slide right to left?\n\nhttp://www.learningjquery.com/2009/02/slide-elements-in-different-directions\n\nI've been jumping between the above trying to get my \"tray\" to work to no avail. Part of the problem is I don't want one of the divs to disappear completely. I want to have a \"tray\", a long rectangle that, when clicked, will slide out the div containing the names. Right now I have it set up in reverse, but I can't figure out how to get the div that expands to default to hidden (*I also don't understand why they are different colors, but have the same CSS).\n\nhttp://jsfiddle.net/r6yWP/\n\nHTML:\n\n<div class =\"collapsedTray\">\n<div class=\"expandTray\">\n Joey Joe Joe Jr.</br>\n Tommy Thompson Thomas III</br>\n Stephen Stephenson </br>\n Cool Mo Dee Tomahawk Fire Marshall Bill</br>\n</div>\n\n\n\n\nCSS:\n\n .collapsedTray {\n width:10px;\n height: 500px;\n background:grey;\n opacity:0.5;\n position: absolute;\n left:0;\n}\n\n.expandTray {\n white-space: nowrap;\n height: 500px;\n background:grey;\n opacity:0.5;\n position: absolute;\n left:0;\n padding:8px;\n}\n\n\nJ:\n\n $('.collapsedTray').click(function(){\n var $lefty = $('.expandTray');\n $lefty.animate({\n left: parseInt($lefty.css('left'),10) == 0 ?\n -$lefty.outerWidth() :\n 0\n});\n });"
] | [
"jquery",
"html",
"slide",
"collapse",
"tray"
] |
[
"Sidekiq on production server gives error on runing",
"We are using Amazon AWS Ubuntu machine for our server.\nRails 4.2.7 and Ruby 2.3\n\nI have installed redis with these instructions (Redis)\n\nand installed sidekiq with Sidekiq\n\nI started redis, then starting sidekiq with just bundle exec sidekiq it give me error as running the jobs\n\nFATAL: password authentication failed for user \"ubuntu\"\n\n\nNot sure why this error. Any suggestions ?"
] | [
"ruby",
"redis",
"sidekiq",
"ruby-on-rails-4.2"
] |
[
"start assync php command line script from another php process",
"the question really says it all.\nI have a script that processes loads of data and may run for a few hours. To avoid time limit exceptions and locking the user to that specific process execution I need to start that script from console. The question is, how can i start a php console script from another php instance and leave it running assynchonously?\n\nThe assync part is not that important if there is no nice way to do it via php I can just use ajax to launch the starter script.\n\nUsing PHP 5.5, but this must be runnable using PHP 5.4"
] | [
"php",
"ajax",
"console",
"console-application"
] |
[
"onkeypress not working, please advise",
"The below code seems to be not working in IE. In chrome it only works after the page has been refreshed a few times. Any idea whats wrong? Thanks.\n\nSCAN SHIPMENT:\n<input type='text' name='scan_shipment' maxlength=\"30\" id='scan_shipment'\nmaxlength=\"20\" size='30' onkeypress=\"handleKeyPress(event,this.form)\"/></td>\n\n\n\nfunction handleKeyPress(e,form){\n alert(\"test\"); \n var key=e.keyCode || e.which;\n if (key==13){\n\n var age = document.getElementById('scan_shipment').value;\n\n age = age.substring(1, age.length);\n var appropiateTr = document.getElementById(age);\n\n if(appropiateTr==null) {\n var $messageDiv = $('#message'); // get the reference of the div\n $messageDiv.show().html('<H1>Barcode not found in this Manifest</H1>');\n // show and set the message\n setTimeout(function(){ $messageDiv.hide().html('');}, 3000); // 3\n seconds later, hide\n\n var audioElement = document.createElement('audio');\n audioElement.setAttribute('src', 'error-beep.mp3');\n audioElement.setAttribute('autoplay', 'autoplay');\n audioElement.play();\n\n $('#scan_shipment').val(\"\");\n return;\n } \n\n ajaxFunction();\n\n }\n }"
] | [
"javascript",
"jquery",
"onkeypress"
] |
[
"Is there a way to run wcf3.5 rest api in an integrated app pool",
"Is there possibly another way to run my WCF 3.5 Rest API in an IIS integrated app pool?\n\nHere's the message in the event viewer:\n\n\n A request mapped to aspnet_isapi.dll was made within an application\n pool running in Integrated .NET mode. Aspnet_isapi.dll can only be\n used when running in Classic .NET mode. Please either specify\n preCondition=\"ISAPImode\" on the handler mapping to make it run only in\n application pools running in Classic .NET mode, or move the\n application to another application pool running in Classic .NET mode\n in order to use this handler mapping.\n\n\nAnd here's the handler entry in my web.config under system.webServer > handlers:\n\n<add name=\"svc-ISAPI-2.0_64\" path=\"*.svc\" verb=\"*\" modules=\"IsapiModule\" scriptProcessor=\"C:\\Windows\\Microsoft.NET\\Framework64\\v2.0.50727\\aspnet_isapi.dll\" resourceType=\"Unspecified\" preCondition=\"\" />"
] | [
"asp.net",
"wcf"
] |
[
"Rmarkdown Latex Align a figure and a kbl table (output PDF)",
"I have the following Rmarkdown Trial:\n---\ntitle: "Test kableExtra"\ndate: "3/20/2021"\noutput: pdf_document\nclassoption: landscape\n---\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE)\nlibrary(tidyverse)\nlibrary(kableExtra)\n\n```\n\n# R Markdown\n\n```{r echo=FALSE}\nlibrary(knitr)\nlibrary(xtable)\n\ndt <- mtcars[1:5, 1:6]\n\nt1 <- kbl(dt, booktabs = T)\nt2 <- kbl(dt, booktabs = T)\n\nt3 <- ggplot(dt,aes(x=mpg,y=cyl)) +\n geom_point()\n\npng(file="plot1.png",width=200,height=200)\nprint(t3)\ndev.off() # close the png file\n\n```\nSome Text\n\n\\begin{table}[!h]\n \\begin{minipage}{.5\\linewidth}\n \\centering\n```{r echo=FALSE}\nt1\n```\n\\end{minipage}%\n \\begin{minipage}{.5\\linewidth}\n \\centering\n \\includegraphics[width=\\textwidth]{plot1.png}\n \\end{minipage}\n\\end{table}\n\noutput\nAnd when you knit it it works ok, but I would like the graph and the table to be aligned on top.\nAnybody an idea?\nIf you have a better idea to put a ggplot next to a kbl table I'm all ears!\nThanks,\nMichael"
] | [
"ggplot2",
"latex",
"r-markdown"
] |
[
"MYSQL Query in Database View",
"SELECT `aversio`.`module`.`module` AS `module`\n\nFROM \n `projectmodule`\n JOIN `module` ON `aversio`.`projectmodule`.`moduleID` = `aversio`.`module`.`moduleID`\n\n JOIN `project` ON `aversio`.`project`.`projectID` = `aversio`.`projectmodule`.`projectID`\n\n\nWHERE `aversio`.`module`.`actief` = _utf8'1'\n AND `aversio`.`projectmodule`.`verwijderd` = _utf8'0'\n AND `aversio`.`projectmodule`.`verwijderd` = _utf8'0'\n\n\n\n MYSQL Error : There is no 'aversio'@'%' registered\n\n\nWhat this error mean"
] | [
"mysql",
"database",
"view"
] |
[
"why is my test skipped on jest",
"I have this test using jest, but the second method is getting skipped, why?\n\nconst stringToTest = JSON.stringify({\"filename\":\"9F6148567F8.jpg\",\"id\":\"ss9:blob-ref:29e4b813a\",\"diskp\":\"gotchi\",\"mikoId\":\"e3f813a\",\"content\":\"gotchi, 18/08/13 at 11:57 AM\"});\n\n\ndescribe('regex for uri', () => {\n\nit('should match expected URI', () => {\n expect(matchUriRE.test(stringToTest)).toBe(true);\n});\n\n//below method skipped why?\nit('should not be bull or undefined'), () => {\n expect(matchUriRE.test(stringToTest)).not.toBeNull;\n expect(matchUriRE.test(stringToTest)).not.toBe(null);\n expect(matchUriRE.test(stringToTest)).not.toBeUndefined();\n};\n}) \n\n\nwith result:\n\nTest Suites: 1 passed, 1 total\nTests: 1 skipped, 1 passed, 2 total"
] | [
"javascript",
"jestjs"
] |
[
"How to do sorting of TreeMap with key as well value also",
"Is it possible for treemap??, actually treemap itself sort on the keys but I want to sort keys as well as values also. \n\nTreeMap <Double, List<String>> treemap = new TreeMap <Double, List<String>>(); \n\n\nExample \n\n Keys : 1.84, 2.35, 5.89, 0.21 \n values: {Burger, 02058795247}, {Pizza, 02087958742}, {Rolls, 020547896874}, {Sandwich, 02058967412} \n\n\nResult should be \n\nkeys : 0.21 \nValues: {Sandwich, 02058967412} \nkeys : 0.21, 1.84 \nValues: {Sandwich, 02058967412}, {Burger, 02058795247} \nkeys : 0.21, 1.84, 2.35 \nValues: {Sandwich, 02058967412}, {Burger, 02058795247}, {Pizza, 02087958742} \nkeys : 0.21, 1.84, 2.35, 5.89 \nValues: {Sandwich, 02058967412}, {Burger, 02058795247}, {Pizza, 02087958742}, {Rolls, 020547896874}\n\n\nBut I got result like \n\n keys : 0.21 \n values: {Burger, 02058795247} \n Key: 0.21, 1.84 \n Value : {Burger, 02058795247, Pizza, 02087958742} \n keys : 0.21, 1.84, 2.35 \n Value: {Burger, 02058795247, Pizza, 02087958742, Rolls, 020547896874}\n keys : 0.21, 1.84, 2.35, 5.89 \n Value :{Burger, 02058795247, Pizza, 02087958742, Rolls, 020547896874, Sandwich, 02058967412}"
] | [
"android",
"sorting",
"arraylist",
"treemap"
] |
[
"Pause gif animation with Image widget flutter",
"Is a way to control gif animation with using Image widget? Now I am using flutter_gifImage package, but I want know is the way pause gif animation without any packages?"
] | [
"image",
"flutter",
"gif"
] |
[
"G++ Multi-platform memory leak detection tool",
"Does anyone know where I can find a memory memory leak detection tool for C++ which can be either run in a command line or as an Eclipse plug-in in Windows and Linux. I would like it to be easy to use. Preferably one that doesn't overwrite new(), delete(), malloc() or free(). Something like GDB if its gonna be in the command line, but I don't remember that being used for detecting memory leaks. If there is a unit testing framework which does this automatically, that would be great.\n\nThis question is similar to other questions (such as Memory leak detection under Windows for GNU C/C++ ) however I feel it is different because those ask for windows specific solutions or have solutions which I would rather avoid. I feel I am looking for something a bit more specific here. Suggestions don't have to fulfill all requirements, but as many as possible would be nice.\n\nThanks.\n\nEDIT: Since this has come up, by \"overwrite\" I mean anything which requires me to #include a library or which otherwise changes how C++ compiles my code, if it does this at run time so that running the code in a different environment won't affect anything that would be great. Also, unfortunately, I don't have a Mac, so any suggestions for that are unhelpful, but thank you for trying. My desktop runs Windows (I have Linux installed but my dual monitors don't work with it) and I'd rather not run Linux in a VM, although that is certainly an option. My laptop runs Linux, so I can use that tool on there, although I would definitely prefer sticking to my desktop as the screen space is excellent for keeping all of the design documentation and requirements in view without having to move too much around on the desktop.\n\nNOTE: While I may try answers, I won't mark one as accepted until I have tried the suggestion and it is satisfactory.\n\nEDIT2: I'm not worried about the cross-platform compatibility of my code, it's a command line application using just the C++ libraries."
] | [
"c++",
"eclipse",
"memory-management",
"memory-leaks"
] |
[
"Fixing div navigation from hiding upon scroll",
"I have this sample HTML5 page which have a navigation and a content area pasted on JSFiddle.\n\nThe problem is that <div id=\"nav\"> isn't fixed when I scroll vertically. How can I make the navigation to be fixed on the top of the browser even with scrolled vertically?"
] | [
"css",
"html"
] |
[
"Bug in the circle menu",
"menu itself: http://codepen.io/anon/pen/zxXvoG\n\n<!-- language: lang-js -->\n$(document).ready(function() {\n $('a').hover(function() {\n $(\"ul li\").eq($(this).index()).trigger(\"mouseover\");\n }, function() {\n $(\"ul li\").eq($(this).index()).trigger(\"mouseout\");\n });\n $('li').hover(function() {\n $('a').eq($(this).index()).css('background-color', '#333333');\n $(this).css('background-color', '#333333');\n }, function() {\n $('a').eq($(this).index()).css('background-color', '#666666');\n $(this).css('background-color', '#666666');\n });\n});\n$( \"a\" )\n .on( \"mouseenter\", function() {\n $( this ).css({\n \"color\": \"#00CAF2\"\n });\n })\n .on( \"mouseleave\", function() {\n var styles = {\n \"color\":\"\"\n };\n $( this ).css( styles );\n });\n\n\nThe problem: when you hover a link, block selected normally, but when you move cursor from menu item title to its block, somewhy block \"ssssssss8\"(first block in 'ul' list) selects too."
] | [
"javascript",
"jquery",
"html",
"css"
] |
[
"is it possible to drag and drop html elemnts in dreamviwer cs6",
"I am developing a phonegap application using dreamviewr cs6. I use dreamviewr after a long time. In a previous version, I can rember that there was a html bar so that I could drag and drop html contents and design a site. but In dream viewer cs6 I couldnt find such a facility. Is there any special configuration to get html list to drag and drop?"
] | [
"html",
"cordova",
"dreamweaver"
] |
[
"Creating a Constraint as a Trigger in phpMyAdmin",
"So I've seen plenty of trigger examples in phpMyAdmin, but the syntax isn't making sense to me... I'm way oversimplifying it.\n\nI want to create a constraint on phpMyAdmin. I have two tables, one is Funds, and one is Fund_Shares_Purchased. In Funds, there is an attribute \"total_available\", which is the total number of shares that can be purchased. In Fund_Shares_Purchased, there is an attribute \"quantity\", which is how many shares somebody has bought. The two tables are related on the \"Fund_Name\" attribute.\n\nI tried the following...\n\nCREATE TRIGGER limitFundShares\nBEFORE INSERT ON Fund_Shares_Purchased\nBEGIN\n IF (Fund.total_shares < NEW.quantity)\n THEN\n RAISERROR(\"You can't buy that many shares of the fund!\")\n END IF;\nEND;\n\n\nAny help or guidance would be much appreciated!"
] | [
"mysql",
"triggers",
"phpmyadmin"
] |
[
"Why can a full property in C# be overridden with only a getter but it can still be set?",
"I came across a behavior that surprises me. Given the following two classes:\n\nclass Parent\n{\n public virtual bool Property { get; set; }\n}\n\nclass Child : Parent\n{\n public override bool Property { get => base.Property; }\n}\n\n\nI can write code like this:\n\nChild child = new Child();\nchild.Property = true; // this is allowed\n\n\nThe IDE makes it confusing, too, because, while it allows the assignment, it also indicates that the overridden property is read-only:\n\n\n\nFurthermore, this override is only allowed when I'm using the base class' getter:\n\n\n\nWhat is going on here?"
] | [
"c#",
"visual-studio",
"visual-studio-2017",
"c#-7.3"
] |
[
"statvfs() returns a filesystem ID of 0 for tmpfs; is f_fsid trustworthy?",
"I'm writing a sanity-check C routine that runs through a list of certain paths and checks whether the free space in each of them is above a certain threshold. In order to not make unnecessary checks if many of these paths are in the same filesystem, I had the idea of checking the f_fsid member of the statvfs structure filled by statvfs(). It does work, but when I check /tmp I see the f_fsid value it returned is zero. This is Ubuntu 20.04, in which /tmp is mounted as tmpfs.\nNow I'm starting to worry yet another funky filesystem type might not return a usable f_fsid and my logic will make me skip a check I should make. Is there a more trustworthy way for a C program to check whether two paths are in the same filesystem? Or should I stop worrying since it works OK for real-storage type fs's as it is?"
] | [
"c",
"filesystems",
"system-calls"
] |
[
".net core MVC - specifying a layout view in a controller",
"Is there not way to specify a layout view in a controller directly? Thereby keeping my views clean of C# code.\nI tried this, but no luck. Some advice says I need a model. But what if I have no model to pass?\nreturn View("AboutMe", "~/Views/Shared/_Layout2.cshtml");"
] | [
"c#",
".net-core",
"asp.net-core-mvc"
] |
[
"LWJGL cannot find class error when using \"java \" command",
"I successfully compiled my source using this command:\n\njavac -classpath \"..\\lwjgl-2.7.1\\jar\\lwjgl.jar\" Game.java\n\n\nHowever, when I try to run it using:\n\njava -classpath \"..\\lwjgl-2.7.1\\jar\\lwjgl.jar\" Game\n\n\n, it gives me an error:\n\nError: Could not find or load main class Game\n\n\nWhat have I done wrong!? :(\n\nI am certain that there are no syntactical errors and class labeling anomalies.\n\nEDIT: I've also tried running the program using this command, but still nothing. T.T\n\njava -cp \"..\\lwjgl-2.7.1\\jar\\lwjgl.jar\" -Djava.library.path=\"..\\lwjgl-2.7.1\\native\\windows\" Game"
] | [
"java",
"lwjgl"
] |
[
"Delete last character of string (if exists)",
"I have a string containing some text, the last character might (might) be a slash, which I don't want. How do I remove that, if it exists?\n\nIs this the \"correct\" way?\n\nif(substr($str, -1) == \"/\") $str = rtrim($str, '/');"
] | [
"php"
] |
[
"Flutter - Using Custom Hex colours",
"How can you add colours from Hex values in Flutter? For instance, I am trying the following:\n\nWidget build(BuildContext context) {\n return Row(\n children: <Widget>[\n Expanded(\n child: Container(\n padding: EdgeInsets.only(left: 20.0),\n height: 100.0,\n decoration: BoxDecoration(\n color: Color.hex(\"#183451\"),\n ),\n child: Row(\n mainAxisAlignment: MainAxisAlignment.start,\n children: <Widget>[\n Image.asset('assets/main_image.png'),\n // More widgets here\n ],\n ),\n ),\n ),\n ],\n );\n}\n\n\nBut get the following error:\n\n\n Error: The argument type 'color::Color' can't be assigned to the\n parameter type 'dart.ui::Color\n\n\nThis is using the \"color\" package:\nhttps://pub.dartlang.org/packages/color\n\nIf I use a MaterialColor it will work as anticipated:\n\ncolor: Colors.blue\n\n\nI guess I would need to create a MaterialColor, however these take an integer value and swatch. Would the Hex Value need to be converted from a string to an int? I guess looking for some code examples how to acheive this, if possible :)\n\nThanks in advance"
] | [
"dart",
"flutter"
] |
[
"AVPlayerViewController scrub bar jumps between second intervals",
"I've implemented a standard Swift video player:-\n\n let path = NSBundle.mainBundle().pathForResource(assetName, ofType: \"m4v\")\n let url = NSURL.fileURLWithPath(path!)\n player = AVPlayer(URL: url)\n playerViewController.player = player\n\n\nUsing the standard build-it controller bar at the bottom of the video. I've noticed that during playback, the built-in scrub/progress bar (the sliding control that shows the time elapsed in the video) jumps at second intervals.\n\nIs there any way to quantise this control position to frame intervals? Or make it so that it moves continuously, rather than updating and jumping position every second."
] | [
"ios",
"swift",
"avplayerviewcontroller"
] |
[
"new to Batch script, what exactly this for loop do",
"I have a bactch script which I am trying to understand, as I am new to batch programming and have to customize this code. but I can't understand what the subroutines check_utf8_bom,create_utf8bom_free_file,remove_utf8 are actually doing. Can someone please help\n\n set /p bom=<.\\bom \n for /f \"delims=\" %%G in (.\\file-list.txt) do (\n call:check_utf8_bom %bom% !SOURCE_FOLDER!\n )\n\n :check_utf8_bom\n rem ;; Checks If There Is The UTF-8 Bom At The Beginning Of The File\n set /p firstLine=<%2\\tmp\n\n if \"%firstLine:~0,3%\"==\"%~1\" call:create_utf8bom_free_file %2\n goto:eof \n\n:create_utf8bom_free_file\n rem ;; Remove UTF-8 BOM From \"tmp\" File o Avoid Problems During Interpretation\n type %1\\tmp>%1\\tmp.bom\n\n for /f \"delims=\" %%G in (%1\\tmp.bom) do (\n if defined i echo.%%G>>%1\\tmp\n if not defined i (\n call:remove_utf8_bom \"%%G\" %1\n set i=1\n )\n )\n del %1\\tmp.bom\n goto:eof\n\n:remove_utf8_bom\n rem ;; Called From create_utf8bom_free_file Function Create The File Without The BOM In The First line\n set fl=%~1\n echo %fl:~3,-1%%fl:~-1%>\"%2\\tmp\"\n goto:eof \n\n\ncan somebody please help me to understand it?"
] | [
"windows",
"batch-file"
] |
[
"Setting Eclipse STS to use Java 8 to compile java code of my project",
"I'm very surprised how hard is it to operate Eclipse - almost everything I try to do ends with SE question.\n\nI have a new project which consists of about two files and some external libraries. This project can by compiled manually by a command line script:\n\nrem List all java files in jar/ directory to text file\ndir /s /B jar\\*.java > sources.txt\nrem make javac compile those files and put the .class files in bin directory\njavac -cp %PZCLASSPATH% -d bin @sources.txt\n\n\nI use java 8 JDK for compiling the project. I am not even dreaming of Eclipse ever building the same way (or building properly at all), but at least I'd like to make it use Java 8 for code validation, as to avoid errors for code incompatible with old java versions:\n\n\n\nI looked into project properties and tried to find something to set-up:\n\n\n\nAs you can see, Java 8 is kinda missing in that menu. In NetBeans, I remember just changing the JDK to desired version. Probably better approach than hardcoded menu.\n\nAlso the menu doesn't even seem to have much effect, as I see The import java.util.Arrays cannot be resolved error for import java.util.Arrays; command:\n\n\n\nSo it's not using even the Java 7 now. Note that other projects work fine in the IDE, but this one has been handcrafted so is problematic.\n\nIs there another way of configuring it?"
] | [
"eclipse",
"sts-springsourcetoolsuite"
] |
[
"Flutter: Android: Dart isolates: app stops responding after 1 minute",
"Edited: Default Counter App instead of Flashlight App\nIn a default flutter counter app i have added shake package for incrementing counter by shaking phone, things works well when app is running in front (in active state) but pressing home button (or letting counter app run in background) stops this shake feature after one minute, it works only for one minute but it doesn't respond to phone shake after one minute, acording to Miguel Ruivo's comment i tried to implement isolate but i was unable to do that if someone can show me how to implement isolate in following code i will be very thanks full to him, please edite this code for solving problem,\nThank you\nCode is here:\n\r\n\r\nimport 'package:flutter/material.dart';\nimport 'package:shake/shake.dart';\n\nvoid main() => runApp(MyApp());\n\nclass MyApp extends StatefulWidget {\n @override\n _MyAppState createState() => _MyAppState();\n}\n\nclass _MyAppState extends State<MyApp> {\n int _counter = 0;\n ShakeDetector detector;\n\n @override\n void initState() {\n detector = ShakeDetector.autoStart(onPhoneShake: () {\n setState(() {\n _counter++;\n });\n });\n super.initState();\n }\n\n @override\n Widget build(BuildContext context) {\n return MaterialApp(\n home: Scaffold(\n body: Center(child: Text('$_counter')),\n ),\n );\n }\n}"
] | [
"android",
"flutter",
"background-process",
"shake",
"dart-isolates"
] |
[
"Calling a video thru an ajax call",
"I am trying to load a flash video when the page is scrolled to a particular position thru ajax/jquery. Everything works and I get the expected data as below:\n\n\n\n<div id=\"rr-brightcove\" class=\"module vids rrmodule\"><h3>Video</h3>\n\n <div class=\"module-body\">\n\n <script src=\"http://admin.brightcove.com/js/BrightcoveExperiences.js\" type=\"text/javascript\"></script>\n\n <object id=\"myaolExperience\" class=\"BrightcoveExperience\">\n\n <param name=\"bgcolor\" value=\"#FFFFFF\" />\n\n <param name=\"width\" value=\"318\" />\n\n <param name=\"height\" value=\"295\" />\n\n <param name=\"playerID\" value=106573607001 />\n\n <param name=\"publisherID\" value=1612833736/>\n\n <param name=\"isVid\" value=\"true\" />\n\n <param name=\"isUI\" value=\"true\" />\n\n <param name=\"autoStart\" value=\"false\" />\n\n <param name=\"@videoList\" value=648729340001 />\n\n <param name=\"wmode\" value=\"transparent\">\n\n </object>\n\n </code>\n\n</div>\n\n</div>\n\n\n\nHowever the problem is, when I append the response to a div on my page the script tag just disappers (stripped) and I can't play the video. It seems to only append the below without the script tag:\n\n\n<div id=\"rr-brightcove\" class=\"module vids rrmodule\"><h3>Video</h3>\n\n <div class=\"module-body\">\n\n <object id=\"myaolExperience\" class=\"BrightcoveExperience\">\n\n <param name=\"bgcolor\" value=\"#FFFFFF\" />\n\n <param name=\"width\" value=\"318\" />\n\n <param name=\"height\" value=\"295\" />\n\n <param name=\"playerID\" value=106573607001 />\n\n <param name=\"publisherID\" value=1612833736/>\n\n <param name=\"isVid\" value=\"true\" />\n\n <param name=\"isUI\" value=\"true\" />\n\n <param name=\"autoStart\" value=\"false\" />\n\n <param name=\"@videoList\" value=648729340001 />\n\n <param name=\"wmode\" value=\"transparent\">\n\n </object>\n\n </code>\n\n</div>\n\n</div>\n\n\nCan someone please help me with this?\n\nThanks,\nL"
] | [
"jquery"
] |
[
"Silverlight call from aspx no longer working",
"I'm fixing up some old code that uses silverlight along with arcgis. The silverlight portion broke over time. The code that's originally used is:\n\n<asp:Silverlight ID=\"xamlMain\" runat=\"server\" Source=\"ClientBin/ControlPoints.xap\" MinimumVersion=\"3.0.40624.0\" Width=\"100%\" Height=\"100%\" />\n\n\nand the way it was called \n\nfunction RefreshControlPointLayer() {\n var slControl = document.getElementById(\"xamlMain\");\n slControl.Content.RefreshControlPointsLayer();\n }\n\n\nI would get \"slControl.Control is undefined.\" After looking up the silverlight call (I have no prior experience or knowledge of silverlight) I found that the way it's being called is old, so I changed it to the new object way.\n\n<object type=\"application/x-silverlight-2\" data=\"data:application/x-silverlight,\" width=\"100%\" height=\"100%\">\n <param name=\"source\" value=\"ClientBin/ControlPoints.xap\" />\n <param name=\"id\" value=\"xamlMain\" />\n <param name=\"runat\" value=\"server\" />\n <param name=\"onError\" value=\"onSiliverError\" />\n <param name=\"background\" value=\"white\" />\n <param name=\"minRuntimeVersion\" value=\"3.0.40624.0\" />\n <param name=\"autoUpgrade\" value=\"true\" />\n <a href=\"http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60310.0\" style=\"text-decoration:none\">\n <img src=\"http://go.microsoft.com/fwlink/?LinkId=161376\" alt=\"Get Microsoft Silverlight\" style=\"border-style:none\"/>\n </a>\n </object><iframe id=\"_sl_historyFrame\" style='visibility: hidden; height: 0px; width: 0px; border: 0px'></iframe>\n\n\nand I call it by just calling the function \"RefreshControlPointsLayer().\" In chrome's inspector console I'm able to see this code\n\nfunction refreshControlPointsLayer() { \n window.opener.RefreshControlPointLayer();\n return false;\n}\n\n\nbut in firebug all I can is\n\n<td align=\"center\">\n<span id=\"ctl00_Main_gv_import_ctl21_ImportStatus\" disabled=\"disabled\" style=\"color:Red;\"></span>\n</td><td>10X</td><td>5570.47000</td><td>1244.33900</td><td>473.69900</td><td>BRK-10X bk 25596 pg ?? </td><td>&nbsp;</td>\n</tr>\n\n\nThe function refreshControlPointsLayer() doesn't even show up in firebug. But both tell me \"window.opener.refreshControlPointsLayer is not a function.\" I've opened the xap file but all it contained was dll's. \n\nAm I calling the silverlight object wrong? Has anyone ever had anything similar happen to them? Would any one off the top of there head know how I should properly call a xap file from an aspx page so I can use it's functions? thank you for any help."
] | [
"asp.net",
"silverlight"
] |
[
"I can't work out how to make validation work on an MVC Ajax modal box",
"I am using JQM to produce AJAX modal boxes.\n\nI have a normal page, and on that page, I have a link that launches the Ajax model box.\n\nThe Ajax modal launches fine, and it simply has a textbox and a button.\n\nThe model behind it has Required on that textbox, but, I can't figure out how to implement validation on it.\n\nCurrently, if there is text in the box, everything works fine and the box gets hidden. If there isn't any text in the box, I currently just return null from the controller and the box still gets hidden.\n\nThe final Ajax page with the form has the following code:\n\n@using (Ajax.BeginForm(new AjaxOptions {\n UpdateTargetId = \"TheBigList\",\n InsertionMode = InsertionMode.Replace,\n OnSuccess = \"HideModal\",\n HttpMethod = \"post\",\n OnFailure = \"AjaxError\",\n\n}))\n{\n @Html.TextBox(\"text\")\n\n <input type=\"submit\" value=\"OK\" />\n\n}<br />\n<br />\n\n\nI hope this is straight forward and I will happily provide other code, but as it doesn't work, I am not sure how relevant it is! HideModal is just as it says, and I know OnFailure deals with connection rather than validation (I have thought about returning an error code to cheat!), but, I have tried many combinations that I have read on this site wihtout much luck.\n\nThe closest I though was by implementing $.validator.unobtrusive.parse(\"#form0\"); , However, I can't work out where/how to add this.\n\nThis has been driving me mad for the past week! Please help!!!!"
] | [
"c#",
"ajax",
"asp.net-mvc-3",
"validation"
] |
[
"Android Market developer groups",
"I'm trying here to find a way to give access to other people to my market publisher account so that another person can push updates or modify things when he wants, but without giving away my password, I know that on AppStore you can do that, but can you do it on Android Market?\nThanks a lot."
] | [
"android",
"google-play"
] |
[
"How to connect orientdb with nativescript",
"i'm using nativescript but can't connect database is orientdb. i try npm install orientjs https://github.com/orientechnologies/orientjs but don't success. Please help me"
] | [
"nativescript"
] |
[
"BadRequestObjectResult(Errors.AddErrorsToModelState(result, ModelState)) is not working",
"I am using a code from \"https://fullstackmark.com/post/13/jwt-authentication-with-aspnet-core-2-web-api-angular-5-net-core-identity-and-facebook-login\" but I can't get past the AccountsController since I get this error: \"The name 'Errors' does not exist in the current context\"\n\nThis is my code:\n\nusing System.Threading.Tasks;\nusing AutoMapper;\nusing Microsoft.AspNetCore.Identity;\nusing Microsoft.AspNetCore.Mvc;\nusing webapi.DataContext;\nusing webapi.Models;\nusing webapi.ViewModels;\n\nnamespace webapi.Controllers\n{\n [Route(\"api/controller\")]\n [ApiController]\n public class AccountsController : ControllerBase\n {\n private readonly UserManager<AppUser> _userManager;\n private readonly IMapper _maper;\n private readonly ApplicationDbContext _appDbContext;\n public AccountsController(UserManager<AppUser> userManager, IMapper maper, ApplicationDbContext appDbContext)\n {\n _appDbContext = appDbContext;\n _maper = maper;\n _userManager = userManager;\n\n }\n\n [HttpPost]\n public async Task<IActionResult> Post(RegistrationViewModel model) \n {\n if(!ModelState.IsValid){\n return BadRequest(ModelState);\n }\n\n var userIdentity = _maper.Map<AppUser>(model);\n\n var result = await _userManager.CreateAsync(userIdentity, model.Password);\n\n if (!result.Succeeded) return new BadRequestObjectResult(Errors.AddErrorsToModelState(result, ModelState));\n\n await _appDbContext.Customers.AddAsync(new Customer { IdentityId = userIdentity.Id, Location = model.Location });\n await _appDbContext.SaveChangesAsync();\n\n return new OkObjectResult(\"Account created\");\n }\n }\n}\n\n\nI get the error on this line: \n\n\n if (!result.Succeeded) return new BadRequestObjectResult(Errors.AddErrorsToModelState(result, ModelState));\n\n\n\n\nCan you please show me how to this right? Than you."
] | [
"c#",
"asp.net-core"
] |
[
"Does Get-Help tell you the type returned by a cmdlet?",
"Is there a way to get the return type for a PowerShell cmdlet from the Get-Help command? I prefer to get this information without actually invoking the command and use GetType() on it. Seems like the object return type should be in the documentation somewhere?\n\nExample: I type Get-Help Get-Content. Where in the documentation does it tell me it returns a String Object? or String[] object? \n\nIs there some flag I need to provide to Get-Help to get this information?"
] | [
"powershell"
] |
[
"Multiple arguments for a PHP function",
"Follow up from this:\nApply a specific class/id to current page on menu (PHP)\n\nHere's the code I'm using:\n\n <div id=\"bottoni\" style=\"float:right;margin-top:30px;margin-right:30px\">\n\n <?php\n // funzione per ottenere la class 'current' per la pagina che si sta visitando\n function get_current($name) {\n if (strpos($_SERVER['REQUEST_URI'], $name) !== false)\n echo 'id=\"current\"';\n }\n ?>\n\n <a <?php get_current('biografia') ?> href=\"<?php echo esc_url( home_url( '/' ) ); ?>biografia/\"><img style=\"width:120px;margin-right:25px\" src=\"http://robertocavosi.com/beta/wp-content/themes/robertocavosi/images/bottone_robertocavosi.jpg\"></a>\n <a <?php get_current('attore') ?> <?php get_current('regista') ?> <?php get_current('autore') ?> <?php get_current('riconoscimenti') ?> <?php get_current('pubblicazioni') ?> <?php get_current('insegnamento') ?> id=\"tooltipclick\"><img style=\"width:120px;margin-right:25px;cursor:pointer\" src=\"http://robertocavosi.com/beta/wp-content/themes/robertocavosi/images/bottone_curriculum.jpg\"></a>\n <a <?php get_current('gallery') ?> href=\"<?php echo esc_url( home_url( '/' ) ); ?>gallery/\"><img style=\"width:120px;margin-right:25px;border:0\" src=\"http://robertocavosi.com/beta/wp-content/themes/robertocavosi/images/bottone_gallery.jpg\"></a>\n <a <?php get_current('itinera') ?> href=\"<?php echo esc_url( home_url( '/' ) ); ?>itinera/\"><img style=\"width:120px;margin-right:25px;border:0\" src=\"http://robertocavosi.com/beta/wp-content/themes/robertocavosi/images/bottone_itinera.jpg\"></a>\n <a <?php get_current('contatti') ?> href=\"<?php echo esc_url( home_url( '/' ) ); ?>contatti/\"><img style=\"width:120px;border:0\" src=\"http://robertocavosi.com/beta/wp-content/themes/robertocavosi/images/bottone_contatti.jpg\"></a>\n </div>\n\n\nI'd like to specify in one \"call\" all these:\n\n <?php get_current('attore') ?> <?php get_current('regista') ?> <?php get_current('autore') ?> <?php get_current('riconoscimenti') ?> <?php get_current('pubblicazioni') ?> <?php get_current('insegnamento') ?>\n\n\nI tried with:\n\n <?php get_current('attore', 'regista', 'autore', 'riconoscimenti', 'pubblicazioni', 'insegnamento') ?>\n\n\nBut it doesn't work..."
] | [
"php",
"conditional"
] |
[
"simple process rollback question",
"while revising for an exam, i came across this simple question asking about rollbacks in processes. i understand how rollbacks occur, but i need some validation on my answer.\nThe question:\n\n\n\n\nmy confusion results from the fact that there is interprocess communication between the processes. does that change anything in terms of where to rollback? my answer would be R13, R23, R32 and R43. any help is greatly appreciated! thanks!"
] | [
"java",
"multithreading",
"process",
"parallel-processing",
"rollback"
] |
[
"Pandas: Why does DataFrame.drop(labels) return a DataFrame with removed label name",
"When I drop some variables from a DataFrame, dataframe return as I expect except the when index.name is removed. Why would this be?\n\nExample:\n\ntest = pd.DataFrame([[1,2,3],[3,4,5],[5,6,7]], index=['a','b','c'], columns=['d','e','f'])\ntest\n\nOut[20]:\nsecond d e f\nfirst \na 1 2 3\nb 3 4 5\nc 5 6 7\n#test.index.name = first\n#test.columns.name=second\nIn [27]:\n\ntest.drop(['b'])\n\nOut[27]:\nsecond d e f\na 1 2 3\nc 5 6 7\n\n\nAfter 'b' is dropped the returned dataframe (index.name) is no longer 'first' but None.\n\nQ1. Is it because the .drop() method returns a dataframe that has a\n new index object which by default would have no name?\nQ2. Is there anyway to preserve the index.name during drop operations as the newindex is still correctly named - it is just a subset of the\n original index\n\nExpected Output would be: \n\n Out[20]:\n second d e f\n first \n a 1 2 3\n c 5 6 7"
] | [
"python",
"pandas"
] |
[
"Can a page loaded in an iframe find out the url of its parent?",
"Possible Duplicate:\n get parent.location.url - iframe - from child to parent \n\n\n\n\nIs it possible for a page that's been loaded inside of another page in an tag to find out more about its parent than just the fact one exists?\n\nI know that JS can check if the current page is the top window. If it isn't, chances are it's being loaded in an iframe. But can it find out more? For instance, can it execute some code to find the URL of the top frame?"
] | [
"javascript",
"iframe",
"browser"
] |
[
"Merge data from excel files",
"I have about 70,000 excel files each of size about 300kb. The first column is date and time and rest columns are all doubles. \n\nHow do I merge them into 1 single csv file or bring them all together into one sheet of an excel work book. I was thinking about using Matlab but it runs out of memory."
] | [
"excel",
"matlab",
"command-line"
] |
[
"Actor Gateway for Kaa Server - Java based",
"I am using KAA iOT server to connect my hardware with cloud. I have implemeted MQTT protocol in hardware and need to implement Actor Gateway or some other solution to enable communication between hardware and cloud. I am unable to find any guide on how to implement actor gateway. Any help please."
] | [
"java",
"kaa"
] |
[
"MATLAB Plot - Legend entry for multiple data rows - getcolumn",
"Consider the following example:\n\nx = magic(3);\nfigure(1); clf(1);\nplot( x, '-r', 'DisplayName', 'Magic' );\nlegend( 'show' );\n\n\nThe resulting legend entries in MATLAB R2014a are\ngetcolumn(Magic,1)\ngetcolumn(Magic,2)\ngetcolumn(Magic,3)\n\nThe problem stems from function [leg,labelhandles,outH,outM] = legend(varargin) in legend.m (Copyright 1984-2012 The MathWorks, Inc.), line 628:\nstr{k} = get(ch(k),'DisplayName');\nMore specifically, the function get\n\n\nprepends getcolumn( and\nappends , <Column Number>).\n\n\nIs there an easy way to display exactly one legend entry (or multiple, but without the pre- and appended strings) for multiple data rows named after DisplayName, which have the same visual properties? \n\nAn alternative would of course be to programatically create multiple (or one) legend entries through plot handles (see below), but I would like to keep things short and simple.\n\nOne entry:\n\nx = magic(3);\nfigure(1); clf(1);\nh = plot( x, '-r' );\nlegend( h(1), 'Magic' );\n\n\nMultiple entries:\n\nx = magic(3);\nfigure(1); clf(1);\nh = plot( x, '-r' );\nstrL = cell( 1, numel(h) );\nfor k = 1:numel(h)\n strL{k} = sprintf( 'Magic %d', k );\nend\nlegend( h, strL );\n\n\n\n\nIn MATLAB R2014b, the problem with getcolumn(Name,Row) does not appear anymore for the first code example."
] | [
"matlab",
"matlab-figure",
"legend"
] |
[
"Get Path of Gallery Image Xamarin?",
"I am trying to get the path of Gallery Image. I am getting the path of the image which is stored in internal storage but not of the external storage. I have also enabled the read-write storage and camera access permissions which has been granted. \nHere is my code\n\n void ChoosePhoto()\n {\n try\n {\n var imageIntent = new Intent();\n imageIntent.SetType(\"image/*\");\n imageIntent.SetAction(Intent.ActionGetContent);\n StartActivityForResult(Intent.CreateChooser(imageIntent, \"Select photo\"), 0);\n }\n catch (Exception ex)\n {\n throw ex;\n }\n } \n\nprotected override void OnActivityResult(int requestCode, Result resultCode, Intent data)\n {\n base.OnActivityResult(requestCode, resultCode, data);\n\n if (requestCode == CAMERA_CAPTURE)\n {\n // camera operation\n }\n else\n {\n Console.WriteLine(\"choose pic from Gallery\");\n var uri = data.Data;\n var path = getRealPathFromURI(uri); //path returns null when i select image from external storage;\n }\n }\n private String getRealPathFromURI(Uri contentURI)\n {\n string[] proj = { MediaStore.Images.ImageColumns.Data };\n String result;\n var cursor = ContentResolver.Query(contentURI, proj, null, null, null);\n if (cursor == null)\n result = contentURI.Path;\n else\n {\n int idx= cursor.GetColumnIndex(MediaStore.Images.ImageColumns.Data);\n cursor.MoveToFirst();\n result = cursor.GetString(idx);\n cursor.Close();\n }\n return result;\n }"
] | [
"android",
"xamarin",
"xamarin.android",
"android-permissions",
"android-gallery"
] |
[
"ConstraintLayout alignment with offset",
"I am using a ConstraintLayout with two views inside. An ImageView that varies in size depending on the image loaded and a View which acts as a custom made dropshadow for the Image. What I've been doing so far is adding 8dp padding to the ImageView and then aligning all of the edges of the View to the ImageViews, thereby making the View stick out 8dp underneath the ImageView. \n\nNow for several reasons I don't want to keep the padding on the ImageView but I still want to achieve the same effect. So basically I would like to align the Left of the View to 8dp left of the Left of the ImageView (and the same for every other edge, right, top, bottom).\n\nIs there any way to achieve this?\n\nThanks in advance!"
] | [
"android",
"margin",
"padding",
"offset",
"android-constraintlayout"
] |
[
"Does Jekyll support backticks code blocks now?",
"When I read the official documentation, it only mentioned the {% highlight python %} syntax:\nhttps://jekyllrb.com/docs/templates/\n\nHowever I prefer to use the backticks code block to highlight codes in markdowns:\n\n```python\n code goes here\n```\n\n\nI googled around and found a few requests but I'm not sure if the backticks work right now. If it works, how can I enable it? As I experimented with my own jekyll github page and it still only works with {% highlight python %}.\n\n\n\nIt seems that the kramdown is only on Jekyll 3.X. Unfortunately, the theme that I'm using is on 2.X.\n\nhttps://cecilialee.github.io/\n\nHow can I work on it? Would I be able to update my theme to Jekyll 3.X without breaking anything? Or how can I add the function to my current Jekyll site?"
] | [
"jekyll",
"github-pages"
] |
[
"Carry user info from one razor page to another using cookies",
"Currently, I have a form which asks for the primary key and when the user submits it redirects it to another page. I want to display the record on another page. I have tried creating a cookie but it isnt working. When I print the string that should have been stored in cookie it shows nothing."
] | [
"c#",
"cookies",
"razor-pages"
] |
[
"Select all columns from table which is a result of joining two tables",
"I'm wondering if it's possible to select all columns belonging to one table from result table which is a join of two tables:\n\nCREATE TABLE TABLE_AB \nAS (SELECT TABLE_A.*,TABLE_B.* FROM TABLE_A NATURAL JOIN TABLE_B);\n\n\nAnd I'd like to SELECT TABLE_A FROM TABLE_AB;\n\nIs this possible in Oracle?"
] | [
"sql",
"oracle"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.