texts
sequence
tags
sequence
[ "RoR SendGrid error in configuration, will not allow deploy to Heroku; Ch 10 Hartl", "I've done this bit of configuration for SendGrid exactly to the tutorial, searched a lot for answers, still getting this error when attempting to push to heroku:\n\nNameError: undefined local variable or method `auto' for #<SampleApp::Application:0x007f5c8bdaef78>\n\n\nThe line throwing up the error:\n\n:enable_starttls_auto => true\n\n\nFull code from config/environments.rb:\n\n config.action_mailer.raise_delivery_errors = true\n config.action_mailer.delivery_method = :smtp\n host = 'gentle-sands-4285.herokuapp.com'\n config.action_mailer.default_url_options = { host: host }\n ActionMailer::Base.smtp_settings = {\n :address => 'smtp.sendgrid.net',\n :port => '587',\n :authentication => :plain,\n :user_name => ENV['SENDGRID_USERNAME'],\n :password => ENV['SENDGRID_PASSWORD'],\n :domain => 'heroku.com',\n :enable_starttls_auto => true\n }\n\n\nReally appreciate any help, and hopefully will be helpful to others learning through the tutorial." ]
[ "ruby-on-rails", "heroku", "railstutorial.org", "sendgrid" ]
[ "Xamarin forms listview databinding to object", "Is it possible to bind to an object rather than the properties in a list view. For example:\n\npublic ObservableCollection<Employee> employees = new ObservableCollection<Employee>(); \n public EmployeeListPage()\n { \n employees.Add(new Employee { DisplayName = \"Rob Finnerty\" });\n employees.Add(new Employee { DisplayName = \"Bill Wrestler\" });\n employees.Add(new Employee { DisplayName = \"Dr. Geri-Beth Hooper\" });\n employees.Add(new Employee { DisplayName = \"Dr. Keith Joyce-Purdy\" });\n employees.Add(new Employee { DisplayName = \"Sheri Spruce\" });\n employees.Add(new Employee { DisplayName = \"Burt Indybrick\" }); \n }\n\n <ListView ItemSource=\"{Binding employees}\" x:Name=\"emView\">\n <ListView.ItemTemplate>\n <DataTemplate>\n <ViewCell>\n <b:CustomView Employee=\"{Binding .}\"/>\n </ViewCell> \n </DataTemplate> \n </ListView.ItemTemplate>\n </ListView>`" ]
[ "c#", "xamarin.forms" ]
[ "featuretools: how is DirectFeature calculated?", "I've read docs a lot and tried to understand how it works, but still got trouble in understanding it.\n\nNow, I'm struggling with one of the tests in repo:\n\nfrom featuretools.primitives import Count, Max, Min, Percentile, Sum, Mean\n\nes.add_last_time_indexes()\n\ncount_log = ft.Feature(base=es['log']['value'], parent_entity=es['sessions'], primitive=Sum,)\nagg_feat2 = ft.Feature(count_log, parent_entity=es['customers'], primitive=Sum)\ndfeat = DirectFeature(agg_feat2, es['sessions'])\n\ncutoff_time = pd.DataFrame({\n 'id': [0, 0],\n 'time': ['2011-04-09 10:30:00', '2011-04-09 10:40:00'],\n}).astype({'time': 'datetime64[ns]'})\n\nactual = ft.calculate_feature_matrix(\n features=[count_log, agg_feat2, dfeat],\n entityset=es,\n cutoff_time=cutoff_time,\n cutoff_time_in_index=True,\n training_window='10 minutes',\n)\n\nIn [5]: actual\nOut[5]:\n SUM(log.value) SUM(sessions.SUM(log.value)) customers.SUM(sessions.SUM(log.value))\nid time\n0 2011-04-09 10:30:00 0.0 0.0 0.0\n 2011-04-09 10:40:00 50.0 56.0 56.0\n\n\nWhat I really want to know is, how SUM(sessions.SUM(log.value)) and customers.SUM(sessions.SUM(log.value)) are different. I tried to change the cutoff time or other values but both have the same values all the time. I already know how SUM(sessions.SUM(log.value)) is calculated in hands but not for customers.SUM(sessions.SUM(log.value)). Could you explain it with" ]
[ "featuretools" ]
[ "How do I integrate Mercurial into Coda?", "I tried using the plugin from app Changes, but it doesn't work, it says \"No SCM found\".\n\nDoes anyone have a way to integrate Mercurial into Coda or know how to solve this problem?" ]
[ "macos", "version-control", "mercurial", "coda" ]
[ "Ubuntu 16.04 Spyder 3.2.4 shortcut ctrl + 1 not working", "I have a strange problem with my installation of Spyder 3.2.4 on Ubuntu 16.04.\nThe \"toggle comment\" command in the editor works when invoked from the menu, but does not with its corresponding shortcut \n\n\n Ctrl + 1 \n\n\nI tried to change the shortcut, tried to uninstall Anaconda and reinstall it, but the shortcut still does not work.\n\nP.S. Other shortcuts with Ctrl do no work either." ]
[ "anaconda", "keyboard-shortcuts", "ubuntu-16.04", "spyder" ]
[ "Scraping the data from list of href link?", "I am trying to scrap a list of href link from a webpage, and then trying to scrap the value out of it. I am now facing the problem which the code only can handle up to 5 links. If the links more than 5, it will show runtime error on random line.\n\nI am extracting the href link from these webpage:http://www.bursamalaysia.com/market/listed-companies/company-announcements/#/?category=SH&sub_category=all&alphabetical=All&date_from=28/09/2018\n\nOption Explicit\nSub ScrapLink()\n Dim IE As New InternetExplorer, html As HTMLDocument\n\n Application.ScreenUpdating = False\n\n With IE\n\n IE.Visible = False\n IE.navigate Cells(1, 1).Value\n\n While .Busy Or .readyState < 4: DoEvents: Wend\n Application.Wait Now + TimeSerial(0, 0, 3)\n Application.StatusBar = \"Trying to go to website?\"\n DoEvents\n\n Dim links As Object, i As Long\n Set links = .document.querySelectorAll(\"#bm_ajax_container [href^='/market/listed-companies/company-announcements/']\")\n For i = 1 To links.Length\n With ThisWorkbook.Worksheets(\"Sheet1\")\n .Cells(i + 1, 1) = links.item(i - 1)\n End With\n Next i\n .Quit\n End With\nEnd Sub\n\nPublic Sub GetInfo()\n Dim IE As New InternetExplorer, headers(), u As Long, resultCollection As Collection\n headers = Array(\"URL\", \"Name\", \"No\", \"Date of change\", \"# Securities\", \"Type of Transaction\", \"Nature of Interest\")\n Set resultCollection = New Collection\n Dim links()\n links = Application.Transpose(ThisWorkbook.Worksheets(\"Sheet1\").Range(\"A2:A100\"))\n\n With IE\n .Visible = True\n\n For u = LBound(links) To UBound(links)\n If InStr(links(u), \"http\") > 0 Then\n .navigate links(u)\n\n While .Busy Or .readyState < 4: DoEvents: Wend\n Application.Wait Now + TimeSerial(0, 0, 2)\n Dim data As Object, title As Object\n\n With .document.getElementById(\"bm_ann_detail_iframe\").contentDocument\n Set title = .querySelector(\".formContentData\")\n Set data = .querySelectorAll(\".ven_table tr\")\n End With\n\n Dim results(), numberOfRows As Long, i As Long, currentRow As Object, td As Object, c As Long, r As Long\n\n numberOfRows = Round(data.Length / 4, 0)\n ReDim results(1 To numberOfRows, 1 To 7)\n\n For i = 0 To numberOfRows - 1\n r = i + 1\n results(r, 1) = links(u): results(r, 2) = title.innerText\n Set currentRow = data.item(i * 4 + 1)\n c = 3\n For Each td In currentRow.getElementsByTagName(\"td\")\n results(r, c) = Replace$(td.innerText, \"document.write(rownum++);\", vbNullString)\n c = c + 1\n Next td\n Next i\n resultCollection.Add results\n Set data = Nothing: Set title = Nothing\n End If\n Next u\n .Quit\n End With\n Dim ws As Worksheet, item As Long\n If Not resultCollection.Count > 0 Then Exit Sub\n\n If Not Evaluate(\"ISREF('Results'!A1)\") Then '<==Credit to @Rory for this test\n Set ws = Worksheets.Add\n ws.NAME = \"Results\"\n Else\n Set ws = ThisWorkbook.Worksheets(\"Results\")\n ws.Cells.Clear\n End If\n\n Dim outputRow As Long: outputRow = 2\n With ws\n .Cells(1, 1).Resize(1, UBound(headers) + 1) = headers\n For item = 1 To resultCollection.Count\n Dim arr()\n arr = resultCollection(item)\n For i = LBound(arr, 1) To UBound(arr, 1)\n .Cells(outputRow, 1).Resize(1, 7) = Application.WorksheetFunction.Index(arr, i, 0)\n outputRow = outputRow + 1\n Next\n Next\n End With\nEnd Sub" ]
[ "html", "excel", "vba", "web-scraping", "href" ]
[ "Geolocation in JavaScript not returning the position", "I am running the following code on my localhost and also on https://early-position.surge.sh/ but it does get the position even though I allow it.\n\n\nif(!navigator.geolocation) {\n console.log('Geolocation is not supported by your browser')\n} else {\n navigator.geolocation.getCurrentPosition(function(position) {\n console.log(position)\n }, function() {\n\n })\n}\n\nAnyone familiar with this issue?" ]
[ "javascript" ]
[ "state undefined in file tree reducer", "I want to just return an array of objects from my reducer, but useSelect() returns undefined\nreducer/directories/index.js:\nexport * from './reportDir'\n\nreducer/directories/reportDir.js:\nconst reportDir = [\n{\n type: 'cat',\n name: 'گزارش ها',\n childrens: [\n {\n type: 'folder',\n name: 'گزارش های اپراتور',\n childrens: [\n {type: 'file', name: 'گزارش شنود', route: '/listen', id: 1}\n ]\n },\n {\n type: 'folder',\n name: 'گزارش مالی',\n childrens: [\n {type: 'file', name: 'مالی', id: 2}\n ]\n }\n ]\n}\n ]\n\n const reportDirReducer = (state = reportDir) => {\n return state\n }\n\n export default reportDirReducer\n\nreducer/index.js:\nimport { combineReducers } from 'redux'\nimport newTabReducer from './newTabReducer' \nimport fileReducer from './fileReducer'\nimport tableReducer from './tableReducer'\nimport { authentication } from './authenticationReducer';\nimport { alert } from './alertReducer';\nimport { listen } from './reportOpReducer';\nimport { reportDirReducer } from './directories';\n\nexport default combineReducers({\n newTabReducer, fileReducer, authentication, \n tableReducer, alert, listen, reportDirReducer\n})\n\nthis is a simple directory path I have created for my react app and I don't know why am I getting undefined from reportDirReducer?" ]
[ "javascript", "reactjs", "redux", "redux-reducers" ]
[ "Search partial filenames in C++ using boost filesystem", "the question is simple , I want to find a file path inside a directory but I have only part of the filename, so here is a functions for this task\nvoid getfiles(const fs::path& root, const string& ext, vector<fs::path>& ret)\n{\n if(!fs::exists(root) || !fs::is_directory(root)) return;\n\n fs::recursive_directory_iterator it(root);\n fs::recursive_directory_iterator endit;\n while(it != endit)\n {\n if(fs::is_regular_file(*it)&&it->path().extension()==ext) ret.push_back(it->path());//\n ++it;\n\n }\n\n}\n\nbool find_file(const filesystem::path& dir_path, const filesystem::path file_name, filesystem::path& path_found) {\n const fs::recursive_directory_iterator end;\n const auto it = find_if(fs::recursive_directory_iterator(dir_path), end,\n [file_name](fs::path e) {\n\n\n cerr<<boost::algorithm::icontains(e.filename().native() ,file_name.native())<<endl;\n return boost::algorithm::icontains(e.filename().native() ,file_name.native());//\n});\n\n if (it == end) {\n return false;\n } else {\n path_found = it->path();\n return true;\n }\n}\n\n\nint main (int argc, char* argv[]) \n{\n vector<fs::path> inputClass ;\n fs::path textFiles,datasetPath,imgpath;\n textFiles=argv[1];\n datasetPath=argv[2];\n\n getfiles(textFiles,".txt",inputClass);\n \n for (int i=0;i<inputClass.size();i++)\n \n {\n ifstream lblFile(inputClass[i].string().c_str());\n string line;\n fs::path classname=inputClass[i].parent_path()/inputClass[i].stem().string();\n cerr<<classname.stem()<<endl;\n while (getline(lblFile,line))\n {\n \n bool find=find_file(datasetPath,line,imgpath);\n if (find)\n {\n \n while(!fs::exists(classname))\n fs::create_directories (classname);\n fs::copy(imgpath,classname/imgpath.filename());\n cerr<<"Found\\n";\n }\n else\n cerr<<"Not Found \\n";\n \n \n }\n lblFile.close();\n }\n \n \n}\n\nConsole out:\n"490"\nvfv343434.jpeg||E9408000EC0\n0\nfsdfdsfdfsf.jpeg||E9408000EC0\n0\n1200E9408000EC0.jpeg||E9408000EC0\n0\nNot Found \n\nbut when I set the search string manually it works fine ! I tried other methods for searching string like std::find but all the methods fail to find the substring, it seems there is problem with input string (line) I printed all the chars but no especial characters or anything.\nif I set the search string manually it works as desired\nstring search="E9408000EC0";\n cerr<<e.filename().native()<<"||"<<search<<endl;\n cerr<<boost::algorithm::icontains(e.filename().native() ,search)<<endl;\n\n \n\nthe results for above change is like\n"490"\nvfv343434.jpeg||E9408000EC0\n0\nfsdfdsfdfsf.jpeg||E9408000EC0\n0\n1200E9408000EC0.jpeg||E9408000EC0\n1\nFound" ]
[ "c++", "search", "boost", "boost-filesystem" ]
[ "dynamically loading a dll that uses the applications methods", "I want to change and test my dll function build for an application without constantly closing and starting the application itself, which takes a lot of time. Hence I build a calling dll for the application to load, and another testing dll (which i load dynamically), where I can change my testing function in real time, without closing the application.\nThe application loads automatically the calling dll, wherein I can dynamically load my testing dll and call an empty function succesfully :\ncalling dll:\ntypedef void(__stdcall *test_func)(void);\nHINSTANCE hdl = LoadLibraryA("C:\\\\testingfunction.dll");\ntest_func func = (test_func) GetProcAddress(hdl, "?testingfunc@@YAXXZ");\nfunc();\n\nIn the testing function dll I have:\ntestingfunction.h\n#define DLL_API _declspec(dllexport)\nDLL_API void __stdcall testingfunc();\n\ntestingfunction.cpp\nDLL_API void __stdcall testingfunc()\n{\n double a = 3 * 4.2;\n //PlugIn::gResultOut << " ...I am alive... " << std::endl;\n\nreturn;\n}\n\nSo if the printing line is commented out, the function works in the application, meaning it does not crash. But when I uncomment the printing line, the application crashes. It seems I cannot use the methods and functions of the application itself.\nHow would I fix this? Do I need to use __declspec(dllimport), and if so, how?\nthanks!" ]
[ "c++", "dynamic", "dll", "visual-studio-2015" ]
[ "StopUpdatingLocation method not working for iOS5", "I am working on map application,\n\nI am try to use [locationManager stopUpdatingLocation]; method to stop the Location services.\n\nIt seems that it works fine in iOS4.3 but in iOS5, it's not working.\n\nPlease any one suggest me How to stop location services in iOS5?" ]
[ "iphone", "objective-c", "cocoa-touch", "ios5", "ios4" ]
[ "Yii2 force JSON response regardless of content header", "I'm trying to make Yii2 API that only returns JSON, so in the configuration I've setup the response component like this:\n\n'response' => [\n 'format' => yii\\web\\Response::FORMAT_JSON,\n 'charset' => 'UTF-8',\n]\n\n\nHowever Yii2's yii\\filter\\ContentNagotiator still checks the client headers and if the client requests application\\xml, it would serialize the response as XML. This however is unwanted behaviour for this API.\n\nIs there a way to force only JSON response?" ]
[ "json", "rest", "yii2", "yii2-advanced-app" ]
[ "How to change the way Oracle XE Application Express displays the NULL value?", "I'm using Oracle 10g XE edition via Application Express and NULLs are displayed using - character. I found from the parameter listing that: \n\n+-------+-------+------------+--------------------------------------------+\n| Name | Value | Is Default | Description |\n+-------+-------+------------+--------------------------------------------+\n| event | - | TRUE | debug event control - default null string |\n+-------+-------+------------+--------------------------------------------+\n\n\nIs there a way to change this value so that NULLs are displayed NULL instead of -?" ]
[ "oracle", "oracle-apex" ]
[ "Google People API detect merged contacts with syncToken - previousResourceNames not included", "I am using the people API to allow users to create entities in my system from their google contacts, via the people API, and am storing the resourceName (i.e 'people/c7760106965272617307') to keep track of the google contact the entity was created from.\n\nI want to be able periodically update the entities to match what is in google. i.e. if the contact updates the phone number the entity gets the updated phone number. So am a calling the list API passing the sync token to get the contacts that have changed since the last call. This works for updates, edits and deletes but I can't find a way to detect when two contacts have been merged in google contacts.\n\nThe docs state:\nhttps://developers.google.com/people/api/rest/v1/people#Person.PersonMetadata\n\n\n previousResourceNames[] Any former resource names this person has had.\n Populated only for connections.list requests that include a sync\n token.\n\n\nSo if I:\n - Call the list API requesting a sync token\n - Create Contact A and Contact B\n - Call the list API passing the sync token, then I get just the two created contacts and a new sync token:\n\n{\n \"resourceName\": \"people/c1465347538402693914\",\n \"etag\": \"%EgcBAj0JPjcuGgQBAgUHIgxab0lZTFBvUU43bz0=\",\n \"metadata\": {\n \"sources\": [\n {\n \"type\": \"CONTACT\",\n \"id\": \"1455f5d28afc531a\",\n \"etag\": \"#ZoIYLPoQN7o=\",\n \"updateTime\": \"2020-02-26T15:35:34.021Z\"\n }\n ],\n \"objectType\": \"PERSON\"\n },\n \"names\": [\n {\n \"metadata\": {\n \"primary\": true,\n \"source\": {\n \"type\": \"CONTACT\",\n \"id\": \"1455f5d28afc531a\"\n }\n },\n \"displayName\": \"Contact A\",\n \"familyName\": \"A\",\n \"givenName\": \"Contact\",\n \"displayNameLastFirst\": \"A, Contact\"\n }\n ]\n },\n {\n \"resourceName\": \"people/c4555919836853785218\",\n \"etag\": \"%EgcBAj0JPjcuGgQBAgUHIgx2WmJHUUtjNTcxQT0=\",\n \"metadata\": {\n \"sources\": [\n {\n \"type\": \"CONTACT\",\n \"id\": \"3f39e0f40cd35282\",\n \"etag\": \"#vZbGQKc571A=\",\n \"updateTime\": \"2020-02-26T15:35:44.056Z\"\n }\n ],\n \"objectType\": \"PERSON\"\n },\n \"names\": [\n {\n \"metadata\": {\n \"primary\": true,\n \"source\": {\n \"type\": \"CONTACT\",\n \"id\": \"3f39e0f40cd35282\"\n }\n },\n \"displayName\": \"Contact B\",\n \"familyName\": \"B\",\n \"givenName\": \"Contact\",\n \"displayNameLastFirst\": \"B, Contact\"\n }\n }\n\n\nIf I then merge the two contacts, and then call the API passing the new sync token i get:\n\n{\n \"resourceName\": \"people/c4555919836853785218\",\n \"etag\": \"%EgcBAj0JPjcuGgQBAgUHIgxqNlFVYnIwaU9vVT0=\",\n \"metadata\": {\n \"sources\": [\n {\n \"type\": \"CONTACT\",\n \"id\": \"3f39e0f40cd35282\"\n }\n ],\n \"deleted\": true,\n \"objectType\": \"PERSON\"\n }\n }\n\n\nSo TDLR; I can find out one of the contacts were deleted, but not that it was merged into another contact.\n\nIt seems like the previousResourceNames[] field would do exactly what I want, but I can't seem to make it return in the data, either on the try the API function on the docs:\n\nhttps://developers.google.com/people/api/rest/v1/people.connections/list\n\nor using the below nodjs code:\n\nconst service = google.people({version: 'v1', auth: authClient});\nconst result = await service.people.connections.list({\n resourceName: 'people/me',\n personFields: 'names,emailAddresses,phoneNumbers,metadata',\n //requestSyncToken: true\n syncToken: \"insert token here\"\n});\nconsole.info(\"Google Returned\", JSON.stringify(result.data, null, 4));\n\n\nI wonder if i need to grant extra scopes, or something else in the requested person fields.\n\nScopes Requested:\n\n'https://www.googleapis.com/auth/contacts',\n'https://www.googleapis.com/auth/userinfo.email',\n'https://www.googleapis.com/auth/userinfo.profile'" ]
[ "google-people" ]
[ "Using idb instead of localStorage", "I'm following the Progressive Web App lab from Google and it says that it's using localStorage for simplicity but that we should change it to idb.\n\nBasically, we want to store a list of cities to display their weather information. \n\nI tried using plain idb following the info here but I think I'm too new to this and I couldn't get any of this. Am I supposed to do: \n\nconst dbPromise = idb.open('keyval-store', 1, upgradeDB => {\n upgradeDB.createObjectStore('keyval');\n});\n\n\nand would keyval be the name of my variable where I would use keyval.get() or keyval.set() to get and store values?\n\nI decided to move on to the simpler idbKeyval, I'm doing: \n\napp.saveSelectedCities = function() {\n var selectedCities = JSON.stringify(app.selectedCities);\n idbKeyval.set(selectedCities);\n};\n\n\ninstead of the localStorage example: \n\napp.saveSelectedCities = function() {\n var selectedCities = JSON.stringify(app.selectedCities);\n localStorage.selectedCities = selectedCities;\n};\n\n\nand\n\napp.selectedCities = idbKeyval.keys().then(keys => console.log(keys)).catch(err => console.log('It failed!', err));\n\n\ninstead of the localStorage example: \n\napp.selectedCities = localStorage.selectedCities;\n\n\nBut my app is not loading any data, and in the developer tools console, I get: \n\napp.js:314 Uncaught ReferenceError: idbKeyval is not defined(…)\n\n\nI'm sure I'm missing something trivial but these are my first steps with javascript and the likes, so please, any help with any of the points touched here would be greatly appreciated!" ]
[ "javascript", "indexeddb", "progressive-web-apps" ]
[ "How to check if a number is a np.float64 or np.float32 or np.float16?", "Other than using a set of or statements\n\nisinstance( x, np.float64 ) or isinstance( x, np.float32 ) or isinstance( np.float16 )\n\nIs there a cleaner way to check of a variable is a floating type?" ]
[ "python", "numpy" ]
[ "Android sqliteException near \"CREATE\": syntax error", "I'm developing a database for my app and when I try to add a new user into the database I get this error \n\n\n android.database.sqlite.SQLiteException: near \"CREATE\": syntax error while\n\n\nI've looked at other questions and seen that the spacing and quote positioning is very important. But looking at other working examples mine's seems to be correct? \n\nMy class below\n\n private static final String TABLE_NAME = \"FITNESSMATETABLE\";\n private static final String DATABASE_NAME = \"fitnessmatedatabase\";\n\n private static final String USERID = \"_id\";\n private static final String NAME = \"Name\";\n private static final String PASSWORD = \"Password\";\n\n //Database Version\n private static final int DATABASE_VERSION = 18;\n\n //The database strings themselves\nprivate static final String CREATE_TABLE = \"CREATE TABLE \" + TABLE_NAME\n + \" (\" + USERID + \" INTEGER PRIMARY KEY AUTOINCREMENT, \" + NAME\n + \" TEXT, \" + PASSWORD + \" TEXT);\";\n\n\nLooking at the error I believe it's telling me that the quotations around \"CREATE\" are wrong. Can anyone see anything out of the ordinary?\n\nThanks in advance" ]
[ "android", "database", "sqlite", "syntax" ]
[ "how to insert values from list/menu into mysql", "i want to insert the grades into the mysql database. my list/menu as follow\n\n <select name=\"grade\" size=\"1\" id=\"select\">\n <option value=\"\" selected=\"selected\">--- Select ---</option>\n <option value=\"\">A</option>\n <option value=\"A-\">A-</option>\n <option value=\"B+\">B+</option>\n <option value=\"B\">B</option>\n <option value=\"B-\">B-</option>\n </select>\n\n\ni used this code but grades didn't insert in the database and error message appeared\n\n <?php\n$grade = mysql_real_escape_string($_POST['grade']);\n\n$sql3 = \"INSERT (enrollment_id, stud_id, code, grade, date_enrolled) VALUES ('','','','$_POST[grade]','')\";\n$result = mysql_query($sql3);\n\nif(mysql_query($sql3))\n{\n echo 'User information saved successfully.';\n}else\n{\n echo 'Error: We encountered an error while inserting the new record.';\n}\nmysql_close($con_mark_entry);\n?>" ]
[ "php", "mysql" ]
[ "search in notepad++ with wildcard", "this is my doccument:\n\n [HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Interface\\{66899421-F497-4503-8C9D-ADAE290F2F27}\\ProxyStubClsid32]\n @=\"{E6D78900-BB40-4039-9C54-593A242B65DA}\"\nDas= 66999930-6E32-4506-A362-733C16E4DBF9\n\n\nhow can i search all the value like : ........-....-....-....-............ (GUID) , not in the key name.\nwith this example, how can i get :\n\nE6D78900-BB40-4039-9C54-593A242B65DA\n66999930-6E32-4506-A362-733C16E4DBF9\n\n\nThanks so much for help." ]
[ "notepad++", "wildcard" ]
[ "Why does my code create NA's when splitting data in R", "I am trying to split a training set into two sets: training set and validation set. It does split it, but for some reason it deletes 32 lines in the validation set and puts NA's there. There were no NA's in the original dataset. \n\nThis is the code:\n\nset.seed(123)\nsample <- sample.int(n = nrow(traindata), size = floor(.2*nrow(traindata)), replace = F)\ntraindata <- traindata[-sample, ] #creating training set\nvalidatiedata <- traindata[sample, ] #creating validation set\n\nprint(traindata)\nhead(traindata)\ntail(traindata)\n\nprint(validatiedata)\nhead(validatiedata)\ntail(validatiedata)\n\n\nI have tried using different code to split the data:\n\nlibrary(caTools)\nset.seed(123)\nsplit = sample.split(traindata, SplitRatio = 0.8)\n\n# Create training and testing sets\ntrain = subset(traindata, split == TRUE)\ntest = subset(traindata, split == FALSE)\n\ndim(train); dim(test)\n\nhead(traindata)\ntail(traindata)\n\nhead(validatiedata)\ntail(validatiedata)\n\n\nThis second code is no good either. It splits the data wrong and also creates the NA's in the validation set.\n\nAny suggestions?" ]
[ "r", "testing", "set", "na", "code-splitting" ]
[ "NSTextView wont update unless I click on it, and it wont focus. Any ideas?", "I dont have time right this second to put some sample code, (Ill edit my question tomorrow and add some) but basically what happens is that I have a Window. It works fine usually, but if I use\n\n [myWindow setStyleMask:NSBorderlessWindowMask]\n\n\nto make it borderless, the NSTextView it contains will stop gaining focus even when you click on it: the ring will never appear, the cursor wont change and the scroll bar will remain gray.\n\nSomething else that happens when I make it borderless is that it wont update! I basically have this\n\n [lyricsView setString:someString];\n\n\nto update the string inside it. The Console marks me no errors, but the string wont appear in the Text View unless I click on it.\n\nAll of this stops happening if I remove the line setting the styleMask to Borderless. Any ideas? Suggestions? Comments? Cheers?\n\nThank You!\nKevin" ]
[ "objective-c", "cocoa", "xcode", "nswindow", "nstextview" ]
[ "Angular2 does not inject template CSS when refreshing the page", "I have an app which uses the selector portfolio-app and has 2 stylesheets - '../app/styles/templateMobile.css', '../app/styles/templateOther.css'\n\nNow when I open my app from the default URL (localhost:3000 ATM), the stylesheets get applied properly. But when I go to a different route, and press refresh (F5), the template styles are not applied to the page. The same thing happens when I start on a different route.\n\nThere are no error messages in the console.\n\nI tested this in firefox, chrome and safari, incognito mode and with clearing the browser cache. I also tested on a LG G2, iPhone, iPad and various android emulators (Nexus 9, Nexus 10, Galaxy Nexus). All the time the result is the same.\n\napp.component:\n\nimport { Component } from 'angular2/core';\nimport {ViewEncapsulation} from 'angular2/core';\nimport { ROUTER_PROVIDERS, ROUTER_DIRECTIVES, RouteConfig } from 'angular2/router';\n\nimport { LandingComponent } from './landing.component';\nimport { PortfolioComponent } from './portfolio.component';\nimport { PagesService } from './pages.service';\n\n@Component({\n selector: 'portfolio-app',\n templateUrl: '/app/views/template.html',\n styleUrls: ['../app/styles/templateMobile.css', '../app/styles/templateOther.css'],\n encapsulation: ViewEncapsulation.None,\n directives: [ROUTER_DIRECTIVES],\n providers: [ROUTER_PROVIDERS, PagesService]\n})\n\n@RouteConfig([\n { path: '/landing', name: 'Landing', component: LandingComponent, useAsDefault: true },\n { path: '/portfolio', name: 'Portfolio', component: PortfolioComponent }\n])\n\nexport class AppComponent {\n landing = true;\n portfolio = false;\n\n changeMiniNavLanding = function () {\n this.landing = true;\n this.portfolio = false;\n }\n\n changeMiniNavPortfolio = function () {\n this.landing = false;\n this.portfolio = true;\n }\n}\n\n\nmain.ts :\n\nimport {bootstrap} from 'angular2/platform/browser';\nimport {AppComponent} from './app.component';\n\nbootstrap(AppComponent);\n\n\nIf you need additional information, please ask, or browse trough the gitHub repository. (all relevant files are in the app folder).\n\nThanks for the help." ]
[ "css", "typescript", "angular" ]
[ "Convert HH:MM:S to seconds int", "I have two columns with the format YYYY-MM-DD HH:MM:SS\nWhen I do the difference between these two columns, my result has a format of the form HH:MM:SS\n\nI would like to convert this result into seconds. How can I make it?\n\nExample:\n\n2019-06-15 19:27:33.045000 | 2019-06-15 19:27:22.298000 | 00:00:10.747" ]
[ "sql", "amazon-redshift", "datetime-conversion" ]
[ "How to create an instance of LearningSwitch class of pox L2_learning component?", "I'm developing L2_learning module of pox for my controller.The skeleton of my code is:\n\nclass LearningSwitch (object):\n def __init__ (self, connection, transparent):\n self.connection = connection\n self.transparent = transparent\n connection.addListeners(self)\n\n .\n .\n .\n def flowtable_request (self):\n for connection in core.openflow._connections.values():\n connection.send(of.ofp_stats_request(body=of.ofp_flow_stats_request()))\n log.info(\"Sent %i flow/port stats request(s)\",len(core.openflow._connections))\n\n\n\n def _handle_flowstats_received(self,event):\n .\n .\n .\n def _handle_PacketIn (self, event):\n .\n .\n .\nclass l2_learning (object):\n\n def __init__ (self, transparent):\n core.openflow.addListeners(self)\n self.transparent = transparent\n\n def _handle_ConnectionUp (self, event):\n log.debug(\"Connection %s\" % (event.connection,))\n LearningSwitch(event.connection, self.transparent)\n\n\ndef launch (transparent=False, hold_down=_flood_delay):\n \"\"\"\n Starts an L2 learning switch.\n \"\"\"\n try:\n global _flood_delay\n _flood_delay = int(str(hold_down), 10)\n assert _flood_delay >= 0\n except:\n raise RuntimeError(\"Expected hold-down to be a number\")\n\n core.registerNew(l2_learning, str_to_bool(transparent))\n\n\nI call the \"flowtable_request (self)\" function,somewhere in the code.I know that inorder that the \" _handle_flowstats_received(self,event)\" function works properly, i should add these 2 lines to the end of my code:\n\nc=LearningSwitch(?,?)\ncore.openflow.addListenerByName(\"FlowStatsReceived\", c._handle_flowstats_received)\n\n\nbut i don't know how to create an instance of the LearningSwitch class! what values i should pass to the \"connection\" and \"transparent\" arguments?\n\nAny help would be appreciated." ]
[ "python", "sdn", "pox" ]
[ "POJO for JSON array without keys [Long, Double]", "I have this JSON:\n\n{\n \"entries\": [\n [\n 1545230391429, // long\n 3799.9872120695404 // double\n ],\n [\n 1545230685249,\n 3796.6928339346546\n ],\n [\n 1545231000586,\n 3793.6487491594485\n ],\n ...\n ]\n}\n\n\nThis POJO can handle them as Strings, but then I need to manually convert them to proper types... aaaand it's risky:\n\n@SerializedName(\"entries\")\n@Expose\nprivate List<List<String>> entries;\n\n\nI tried with more robust way, but it's not working properly:\n\npublic class Entry {\n public Long timestamp;\n public Double value;\n}\n\n@SerializedName(\"entries\")\n@Expose\nprivate List<Entry> entries;\n\n\nI get \n\n\n com.google.gson.JsonSyntaxException: java.lang.IllegalStateException:\n Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 13 path\n $.entries[0]\n\n\nI think the problem is that Entry should be a List, but I can't make a list with two different types.\n\nHow to proceed?" ]
[ "java", "android", "gson", "pojo" ]
[ "If a constructor throws exception, then does it make sense to have a global object of that class?", "I am asking this question for general coding guidelines:\n\nclass A {\n A() { ... throw 0; }\n};\nA obj; // <---global\n\nint main()\n{\n}\n\n\nIf obj throws exception in above code then, it will eventually terminate the code before main() gets called. So my question is, what guideline I should take for such scenario ? Is it ok to declare global objects for such classes or not ? Should I always refrain myself from doing so, or is it a good tendency to catch the error in the beginning itself ?" ]
[ "c++", "exception", "global-variables", "coding-style" ]
[ "Trying to implement a r script within power bi to update a SQL Server database", "I'm trying to implement a r script within power bi to update a SQL Server database. I keep running into this problem... anyone know how I can resolve the error?\n\nlibrary(RODBC)\noutputframe=data.frame(dataset)\nDBHANDLE<-odbcDriverConnect('driver={SQL Server};server=____;database=___;trusted_connection=true')\n\nTBLExist=\"sbs.Iterations\" %in% sqlTables(DBHANDLE)$TABLE_NAME\nif (!TBLExist)\nsqlSave(DBHANDLE, data.frame(dataset), tablename = \"sbs.Iterations\",rownames=FALSE, append = FALSE)\n\n\n\n DataSource.Error: ADO.NET: R script error. During startup - Warning\n message: In\n setJsonDatabasePath(system.file(\"extdata/capabilities.json\", :\n bytecode version mismatch; using eval Error in type.convert(data[[i]],\n as.is = as.is[i], dec = dec, numerals = numerals, : invalid input\n '[Adhoc] [C2R]:When user clicks on 🙂(Provide feedback) from Main\n UI, User is not able to see submit button.' in 'utf8towcs' Calls:\n read.csv -> read.table -> type.convert Execution halted Details:\n DataSourceKind=R DataSourcePath=R Message=R script error. During\n startup - Warning message: In\n setJsonDatabasePath(system.file(\"extdata/capabilities.json\", :\n bytecode version mismatch; using eval Error in type.convert(data[[i]],\n as.is = as.is[i], dec = dec, numerals = numerals, : invalid input\n '[Adhoc] [C2R]:When user clicks on 🙂(Provide feedback) from Main\n UI, User is not able to see submit button.' in 'utf8towcs' Calls:\n read.csv -> read.table -> type.convert Execution halted\n ErrorCode=-2147467259\n ExceptionType=Microsoft.PowerBI.Scripting.R.Exceptions.RScriptRuntimeException" ]
[ "sql", "r", "powerbi" ]
[ "PHP image upload Android/iOS images are in landscape", "I wrote a script to upload images with AJAX and PHP.\nThe script works well but there is the following problem:\nIf I upload an image from an Android device that was shot in portrait it is uploaded in landscape.\n\nIs there a way to fix this?\nThe problem is that I cant rotate all images because uploaded images from desktops are uploaded right." ]
[ "php", "android", "ios", "image", "upload" ]
[ "Convert List to Dictionary (a map of key and the filtered list as value)", "class Animal\n {\n public FoodTypes Food { get;set;} \n public string Name { get; set; }\n }\n enum FoodTypes\n {\n Herbivorous,\n Carnivorous\n }\n\n class Util\n {\n public static Dictionary<FoodTypes,List<Animal>> GetAnimalListBasedOnFoodType(List<Animal> animals)\n {\n Dictionary<FoodTypes, List<Animal>> map = new Dictionary<FoodTypes, List<Animal>>();\n var foodTypes = animals.Select(o => o.Food).Distinct();\n foreach(var foodType in foodTypes)\n {\n if (!map.ContainsKey(foodType))\n map.Add(foodType, null);\n map[foodType] = animals.Where(o => o.Food == foodType).ToList();\n }\n return map;\n }\n }\n\n\nThe above code is to get the idea of what I am trying to achieve. Now, the question is \nIs it possible to achieve the functionality of GetAnimalListBasedOnFoodType in a single lambda expression?" ]
[ "c#", "c#-4.0", "lambda" ]
[ "How to upload app to the App Store with OneSignal plugin? ERROR ITMS-90362 \"MinimumOSVersion\" invalid", "I am having some issues related to the OneSignal plugin on IOS. In Xcode after archiving the app, when I try to upload the app to the AppStore I get this error:\n\niTunes Store Operation Failed\nERROR ITMS-90362: "Invalid Info.plist value. The value for the key\n'MinimumOSVersion' in bundle\nfsa.app/PlugIns/OneSignalNotificationServiceExtension.appex is\ninvalid. This extension requires a version of iOS higher than the\nvalue specified for the MinimumOSVersion key in Info.plist."\n\nI've tried to change the value manually in the Info.plist file related to the OneSignalNotificationServiceExtension, but I still got this error. In Unity I've set the minimum iOS version to 9.0. Any ideas how to solve this problem?\nAdditional information, I've used these tutorial to setup the project:\nUnity SDK Setup\nGenerate an iOS Push Certificate\nVersion:\nXcode 9.0\nUnity 5.6.1f1\nOneSignal 2.4.0\nThank you!" ]
[ "ios", "xcode", "unity5", "onesignal" ]
[ "BPF in python to sniff packets for multiple TCP ports", "I got code from http://allanrbo.blogspot.in/2011/12/raw-sockets-with-bpf-in-python.html. It works fine, but I want to sniff the traffic on multiple TCP ports like port 9000, 80, 22...\n\nSo I have modified the filter_list like blow\n\nfilters_list = [ \n # Must have dst port 67. Load (BPF_LD) a half word value (BPF_H) in \n # ethernet frame at absolute byte offset 36 (BPF_ABS). If value is equal to \n # 67 then do not jump, else jump 5 statements. \n bpf_stmt(BPF_LD | BPF_H | BPF_ABS, 36), \n bpf_jump(BPF_JMP | BPF_JEQ | BPF_K, 9000, 0, 5), <===== Here I added another port\n bpf_jump(BPF_JMP | BPF_JEQ | BPF_K, 80, 0, 5),\n\n\n # Must be UDP (check protocol field at byte offset 23) \n bpf_stmt(BPF_LD | BPF_B | BPF_ABS, 23), \n bpf_jump(BPF_JMP | BPF_JEQ | BPF_K, 0x06, 0, 3), #<==Changed for TCP \"0x06\"\n\n # Must be IPv4 (check ethertype field at byte offset 12) \n bpf_stmt(BPF_LD | BPF_H | BPF_ABS, 12), \n bpf_jump(BPF_JMP | BPF_JEQ | BPF_K, 0x0800, 0, 1), \n\n bpf_stmt(BPF_RET | BPF_K, 0x0fffffff), # pass \n bpf_stmt(BPF_RET | BPF_K, 0), # reject ]\n\n\nThe thing is, sometimes it is working sometimes it is not, like getting traffic only on 9000 but not 80, sometimes getting traffic on 80. I didnt understood the code completely. Any help?" ]
[ "python", "sockets", "tcp", "bpf" ]
[ "Game Center Multiplayer using GKMatch but seems can't be connected", "Hi I'm a new bie in Game Center for iOS. I'm trying to add the multiplayer feature using matches to my game and following the documentation.\n\nSo far I reached a point where 2 of my clients can successfully get a match, i.e. the matchmakerViewController:didFindMatch callback is called and a GKMatch object is delivered.\n\nHowever after that I seems to be stuck there forever, because according to the documentation, I'll have to wait until all the players (2 in my case) are actually connected before starting my game. But it seems the match:player:didChangeState callback is never called to indicate a successful connection. Well, I'm sure my clients are all in the same wifi network ( or is it a must?) Could any one enlighten me on this case? Do I have to do any extra things to make the clients to connect? Thanks a lot for the help!" ]
[ "iphone", "objective-c", "game-center" ]
[ "Find the translation between two origins based on the camera positions", "I have determined the camera position based on two origins in the field of view of the camera. Let's say origin 1 is located at (140,200) and origin 2 is located at (70,180).\nFollowing are the camera positions with respect to origin 1 and origin 2.\nX1,Y1,Z1,X2,Y2,Z2 = 0.8361721744324895,-0.5131803297263005,1.3708440418732257,0.09985411281689659,0.3329507542440152,1.342809058827907\n\nwhereas the (X1, Y1, Z1) are the camera position with respect to the origin 1 while (X2, Y2, Z2) is the camera position with respect to the origin 2.\nI have used the following code to compute the translation between both origins.\ndist = math.sqrt((X1-X2) ** 2 + (Y1-Y2) **2 + (Z1-Z2)**2)\n\nHowever, the value is a scalar and not a vector (XYZ) value of the translation between the origins based on their respective camera positions. How can I get the XYZ distances?" ]
[ "python", "opencv", "camera", "opencv-solvepnp" ]
[ "Send HTML mail using Android intent", "I have generated an HTML code(complete with <html><body></body></html> tags) as a String. Now I want to send this HTML code as HTML to mail. My code is as below.\n\nIntent intent = new Intent(Intent.ACTION_SEND);\nintent.setType(\"text/html\");\nintent.putExtra(Intent.EXTRA_EMAIL, new String[]{\"[email protected]\"});\nintent.putExtra(Intent.EXTRA_SUBJECT, \"I would like to buy the following\");\nintent.putExtra(Intent.EXTRA_TEXT, purchaseOrder());\nstartActivity(Intent.createChooser(intent, \"sending mail\"));\n\n\nWhere the purchaseOrder() is the method which passes me the string having full HTML code. But though the GMail client opens on my Nexus1 but it has the String with all HTML tags and not the actual HTML view. I tried the following but got error. The GMail crashed.\n\nintent.putExtra(Intent.EXTRA_STREAM, purchaseOrder());" ]
[ "html", "android", "email", "android-intent" ]
[ "Get a live notification when a customer is on a certain page", "I have been searching for a solution to this problem for a while and surprised it doesn't exist. I have a low traffic site but a high conversion/acquisition cost per customer.\n\nSo when a customer hits a certain page on my website, I want to be notified via SMS. So I can instigate a live chat and get them converting.\n\nI have tried an option with Google Analytics, but that seems to have a delay. The live chat platforms do not seem to have this feature.\n\nHow could this type of action be achieved?" ]
[ "google-analytics", "zapier", "livechat" ]
[ "Match triggerAction() with Dynamic dialogAction button", "So, I'm trying to move a button click to a triggerAction() instead of the beginDialogAction() that I have implemented right now but I can't seem to find the right regex pattern to match and route this action button click:\n\nUniversalBot(\"*\") routing \"action?loadreference-pt=FT2018/52\" from \"emulator\"\n\nBear in mind that the last part is dynamic so it would be always like:\n\n\"action?loadreference-pt=[INVOICE_NUMBER]\"\n\nRight now, this works just fine but I would prefer with triggerAction() to override customPrompts():\n\nbot.triggerAction('loadreference-pt', '/loadreference-pt'); \n\nI've tried with a regexp like:\n\n.triggerAction({ matches: /action?loadreference.pt=\\w+/ });\n\nBut it's not working.\nCould someone help me out?\n\nThank you!" ]
[ "node.js", "botframework", "bots", "chatbot" ]
[ "Track download / upload transfers (size)", "I have a WCF Service (C#) that has about 10 methods 5 for getting data (.NET Dataset) and 5 for updating data (.Net Dataset).\n\nExample of methods:\n\n// getting data from Method \npublic DataSet GetEmployeeContractInfo(Guid uid)\n {\n\n DataSet ds = null;\n Database db = InfoTacto.Framework.WebServices.Common.GetDatabase();\n\n using (DbCommand cmd1 = db.GetStoredProcCommand(\"sp_employee_contractinfo_get\"))\n {\n\n db.AddInParameter(cmd1, \"employeeuid\", DbType.Guid, uid);\n ds = db.ExecuteDataSet(cmd1);\n }\n\n if (ds.Tables.Count > 0)\n {\n ds.Tables[0].TableName = \"contract_info\";\n }\n return ds;\n\n }\n\n/// <summary>\n /// \n /// </summary>\n /// <param name=\"ds\"></param>\n /// <returns></returns>\n public bool UpdateEmployeeContractInfo(DataSet ds)\n {\n bool returnVal = true;\n\n Database db = Common.GetDatabase();\n DbConnection conn = db.CreateConnection();\n conn.Open();\n DbTransaction trans = conn.BeginTransaction();\n\n try\n {\n if (ds != null && (\n (ds.Tables.Contains(\"contract_info\") && ds.Tables[\"contract_info\"].Rows.Count > 0)\n )\n )\n {\n foreach (DataRow dr in ds.Tables[\"contract_info\"].Rows)\n {\n if (dr.RowState == DataRowState.Modified || dr.RowState == DataRowState.Added)\n {\n using (DbCommand cmd1 = db.GetStoredProcCommand(\"sp_employee_contractinfo_change\"))\n {\n\n db.AddInParameter(cmd1, \"employeeuid\", DbType.Guid, dr[\"employeeuid\"]);\n\n//... all other parameters\n\n db.ExecuteNonQuery(cmd1,trans);\n }\n }\n\n }\n\n }\n trans.Commit();\n }\n catch\n {\n trans.Rollback();\n returnVal = false;\n }\n finally\n {\n // Cleanup\n conn.Close();\n }\n\n\n return returnVal;\n }\n\n\n20 of my users will be using WIFI via celular modem because they are in a place that traditional WIFI is not accessible, so I need to track how much bandwidth is comusing my WCF Service for getting data and for uploading data by method, that way if I have that information I can really know if they consume more bandwidth that the one tracked by the WCF Service then they are looking at videos, etc. and human resources can take actions.\n\nAny clue? I was thinking on checking the size of each dataset object before sending the dataset to the client and then store that value into a database table and also doing the same when receiving a dataset from the client." ]
[ "c#", "wcf" ]
[ "How to unhide hidden column in Phabricator workboard?", "I hid a column in a Phabricator workboard by clicking on the arrow on the top right of it and selected \"Hide Column\". Now I would like to unhide it but I don't see any way to do so." ]
[ "phabricator" ]
[ "How can I define an entity such as nbsp in an asp.net application", "I have an asp.net application that renders and works correctly in all browsers. However when checking with the validator at http://validator.w3.org/ I get the following error:\n\nreference to undeclared general entity nbsp\n\n\nThe Error is also keeping me from being able to use loadstorm to test the application. Loadstorm gives me this error:\n\nEntity 'nbsp' not defined\n\n\nchanging each \"nbsp\" to \"#160\" is not an option because they are coming from a ckeditor that users enter content into\n\nI have also tried doing something like the following on the page, but it doesn't work either.\n\n<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp \" \"> ]>\n\n\nshould I be trying to declare it somewhere else or be doing something entirely different all together?" ]
[ "asp.net", "xhtml", "html-entities" ]
[ "Logstash Grok Pattern for Rails 4?", "Anyone have a Logstash pattern for Ruby on Rails 4 multiline logs? \n\nI only have a pattern for Rails 3, which has a much different log structure:\n\nRUUID \\h{32}\n# rails controller with action\nRCONTROLLER (?<controller>[^#]+)#(?<action>\\w+)\n# this will often be the only line:\nRAILS4HEAD (?m)Started %{WORD:verb} \"%{URIPATHPARAM:request}\" for % {IPORHOST:clientip} at (?<timestamp>%{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{HOUR}:%{MINUTE}$\n# for some a strange reason, params are stripped of {} - not sure that's a good idea.\nRPROCESSING \\W*Processing by %{RCONTROLLER} as (?<format>\\S+)(?:\\W*Parameters: {%{DATA:params}}\\W*)?\nRAILS4FOOT Completed %{NUMBER:response}%{DATA} in %{NUMBER:totalms}ms %{GREEDYDATA}\nRAILS4PROFILE (?:\\(Views: %{NUMBER:viewms}ms \\| ActiveRecord: %{NUMBER:activerecordms}ms|\\(ActiveRecord: %{NUMBER:activerecordms}ms)?\n# putting it all together\nRAILS4 %{RAILS4HEAD}(?:%{RPROCESSING})?(?<context>(?:%{DATA}\\n)*)(?:%{RAILS4FOOT})?\n\n\nRails 4 logs are now in the format, which includes a timestamp and what looks like is an ID (#).\n\nI, [2016-01-26T23:21:44.581108 #27447] INFO -- : Started GET \"/login\" for XXX.XXX.XXX.XXX at 2016-01-26 23:21:44 -0800" ]
[ "ruby-on-rails", "logstash-grok" ]
[ "running a js function via onmousedown for newly added ajax", "i'm using JQuery ajax to load new content into the page, on the server side I load a new div:\n\n<div id=\"newFuncDiv\" onmousedown=\"javascript:newFunc(\"VAR\");\">Click me</div>\n\n\nIn previous cases i used a function as follows:\n\nfunction newFunc(){$(\"#newFuncDiv\").click(function(){alert(\"something\");});}\n\n\nBut in this case onclick of this div I need to pass a variable, which I extract from the db on server side, how can i achieve this, as even when I add the newFunc(); with the ajax response it doesn't work, \n\nEDIT:\n\nby the way, forgot to say that i'm looping the response from server so the variable i need to pass is gonna be unique for each div." ]
[ "php", "jquery", "ajax" ]
[ "select inside case statement in where clause tsql", "I have written a case condition inside where clause which is working fine without any sub queries, but it is not working with sub queries\n\nfor example\n\ndeclare @isadmin varchar(5) = 'M'\n\nselect * from Aging_calc_all a where a.AccountNumber in \n(case @isadmin when 'M' then 1 else 0 end)\n\n\nwhich is working fine.\n\nHowever this does not seem to work - \n\nselect * from Aging_calc_all a where a.AccountNumber in \n(case @isadmin when 'M' then (select AccountNumber from ACE_AccsLevelMaster where AssignedUser=7) else 0 end)\n\n\nAny suggestions or this is a t-sql bug in 2008." ]
[ "sql", "sql-server", "tsql" ]
[ "Excel VBA : How to Compare specific String", "I had came up with some problem that i not sure on how to compare string.\n\nExample \n\nDim DateStart as String\nDim CompareDate as String\nDateStart = \"01-05-15\"\n\n\nIn CompareDate i type in a value 02-05-15, how can i compare the 01-05 with 02-05?\n\nI do not want to use Dim DateStart as Date.\n\nAnd also how can i compare Column instead of Row?\nThe current code i using for comparing row is :\n\niRow = ws.Cells.Find(what:=\"*\", After:=ws.Range(\"a1\"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1" ]
[ "vba", "excel" ]
[ "Using og:image set to a php script doesn't show up in facebook feed", "I have been working on a website for a friend and trying to integrate it with facebook. He is a semi-professional photographer and does photo shoots for weddings and such. As part of this, I had to integrate a bit of a security system which uses a script to get images instead of directly accessing them through a link. The script takes a photograph id and the size requested (full size or thumbnail), checks the database to see if it is publicly accessible, and reads the image to the browser (using header() to change the mime type). However, when I use 'Like' buttons on the page with og:image set to this photo retrieving script, facebook doesn't display an image. I am guessing this has something to do with the 'safe_image.php' script that facebook uses to load images on pages. Does anyone know a way to work around this?\n\nHere are my og tags for the page I am trying to make show up in the feed just in case I did something wrong:\n\n<meta property=\"og:title\" content=\"Wedding Samples\"/>\n<meta property=\"og:type\" content=\"article\"/>\n<meta property=\"og:image\" content=\"http://www.thevandykecollection.com/index.php?f=viewphoto&id=289&thumbnail\"/>\n<meta property=\"og:url\" content=\"http://www.thevandykecollection.com/index.php?f=portfolio&id=23\"/>\n<meta property=\"og:site_name\" content=\"The Van Dyke Collection\"/>\n<meta property=\"fb:admins\" content=\"510746110,500416148\"/>" ]
[ "php", "image", "facebook-like", "facebook-opengraph" ]
[ "Visual Studio Web Form Application Loading Error", "I have recently attempted to begin learning C# and ASP.NET. I have installed Microsoft Visual Studio 2012 and tried to follow along with a few tutorials on creating a Web Form Application. Unfortunately, when I create a new web form application project, the Visual Studio screen and Solution explorer do not load as other Youtube tutorials and my books indicate they should.\n\n\nWhen I \"Save All\", I am not getting the Form1.cs, Program.cs, or Form1.Designer.cs files to be created.\nAlso, I do not get the Form1.CS window appearing so I can drag objects from the toolbox into the form. Instead I just get a default.aspx tab with code.\n\n\nI have posted a quick video illustrating this on YouTube to describe this in greater detail. Am I doing something wrong, or could it be that my Visual Studio is not working properly? I had Visual Studio 2010 installed before this, but tried to uninstall it and install 2012.\n\nhttp://www.youtube.com/watch?v=xHXkcCnmHnk\n\nThank you." ]
[ "c#", "asp.net", "visual-studio-2012" ]
[ "How to run command prompts from a pascal program?", "I need to open a file (music files specifically) using the default program for that file type from a pascal program. So far I think that the best way to do that would be to use the command line to run the command:\n\nopen C:/Users/defaultuser0/Music/filename.wav\n\n\nbut I'm not sure how to tell cmd to do something from within pascal." ]
[ "cmd", "pascal" ]
[ "MFC Workspace Bar: \"Failed to create empty document\"", "I am attempting to create a dockable workspace bar much like the on in VS. I am using the BCGCBPro library and the function I am calling is essentially a control bar derived class. In my CMainFrame::OnCreate function I am calling my create function responsable for creating a dockable workspace.\n\nWhen I run the following, I get an assertion error:\n\nif (!m_wndWorkSpace.Create (_T(\"Workspace\"), this, CSize (200,200),\n TRUE, ID_VIEW_WORKSPACE,\n WS_CHILD | WS_VISIBLE | CBRS_LEFT))\n{\n TRACE0(\"Failed to create workspace bar\\n\");\n return -1; // fail to create\n}\n\n\nThe assertion error complains that my CObject* pOb pointer is null.\n\nNow when i remove the WS_CHILD style, I get the infamous \"Failed to create empty document\":\n\nif (!m_wndWorkSpace.Create (_T(\"Workspace\"), this, CSize (200,200),\n TRUE, ID_VIEW_WORKSPACE,\n WS_VISIBLE | CBRS_LEFT))\n{\n TRACE0(\"Failed to create workspace bar\\n\");\n return -1; // fail to create\n}\n\n\nI've done a bunch of research, yet have no concrete ideas. I've tried some alternatives I've found on the internet yet nothing seems to be working. Any help will be appreciated!!\n\nThanks in advance" ]
[ "c++", "mfc" ]
[ "Excluding a file while merging in Mercurial", "I use Mercurial with TortoiseHg. I have two branches (A and B) with two files (toto.cs and titi.cs).\n\nIs there a way, when I want to merge B with A, to exclude titi.cs from merging, and only merge toto.cs? If it's possible, how can I do that?" ]
[ "mercurial", "merge", "tortoisehg" ]
[ "How can I remotely update in app text on xamarian.ios and xamarian.android", "What is the best way to update a text box in an app remotely. I want to add a text box that will be updated daily and was wondering what is the best way to do it on xamarian.ios and xamarian.android. Would something like firebase work well for that or is there a better way to do this if I want to update it daily with different text.\n\nThis is not necessary, but is there a way to set up text updates for each day at one time and then as the date changes the text does as well so that way I can set up the whole week or something like that at once.\n\nI appreciate any help with this, if you guys know a way to do this or have a guide I can follow I would greatly appreciate it. Thank you!" ]
[ "c#", "xamarin.android", "xamarin.ios" ]
[ "Fibonacci numbers using matlab", "I need to write a code using matlab to compute the first 10 Fibonacci numbers.\n\nThe equation for calculating the Fibonacci numbers is \n\nf(n) = f(n-1) + f(n-2) \nknowing that \nf(0) = 1 and f(1) = 1\n\nThe simple code that I wrote is\n\nf(0) = 1;\nf(1) = 1;\n\nfor i = 2 : 10\n f(i) = f(i-1) + f(i-2);\n str = [num2str(f(i))];\n disp(str)\nend\n\n\nThis code is giving me error message in line 1:\n\n\n Attempted to access f(0); index must be a positive integer or logical.\n\n\nOn the other hand, when i modify the code to\n\nf(1) = 1;\nf(2) = 2;\n\nfor i = 3 : 10\n f(i) = f(i-1) + f(i-2);\n str = [num2str(f(i))];\n disp(str)\nend \n\n\nthis is working fine.\n\nBut I need it to start and display the numbers from f(0).\n\nCan you please tell me what is wrong with my code?" ]
[ "matlab" ]
[ "How does Bootstrap work with Ruby on Rails?", "I'm unfamiliar with how Bootstrap is implemented on a web app built on Ruby on Rails. I've been asked to create the front-end ,HTML/CSS for new pages. I strictly have been working with small, static sites so I don't know the way to go about this. I've seen that the CSS files only include the specific code that your page requires?\n\nDoes that mean that I will have to copy each component's Boostrap CSS to a separate CSS file for my page?" ]
[ "ruby-on-rails", "twitter-bootstrap", "structure" ]
[ "Naming a database table with the current date through PHP", "I'm looking to run a mysql_query() that allows me to create a new table within a database and name it according to the current date and time. \n\nExample: Create a table named 2012-01-09-03-00-00, or something along those lines.\n\nI know that this is not an optimal way of doing things, but ultimately I'm going to take the data on this table and dump it into a bigger database. \n\nI've tried the code:\n\n<?php\n$date = date('YmdHis', time()-(3600*5));\n$exportSQL = \"CREATE TABLE $date(\nFirstName varchar(15)\n)\";\nmysql_select_db($database);\nmysql_query($exportSQL) or die (mysql_error());\necho \"Table created!\";\n?>\n\n\nBut this has been to no good. Please Help and thanks in advance.\n\nEDIT: THIS HAS BEEN SOLVED. THE CODE WORKING SHOULD LOOK LIKE THIS:\n\n<?php\n$date = date('YmdHis', time()-(3600*5));\n$exportSQL = \"CREATE TABLE `$date`(\nFirstName varchar(15)\n)\";\nmysql_select_db($database);\nmysql_query($exportSQL) or die (mysql_error());\necho \"Table created!\";\n?>" ]
[ "php", "mysql", "sql" ]
[ "Android | Update sqlite from mysql or update app with newer sqlite db?", "Still newish to Android.\nI need some advise, Should I \n 1. have a local sqlite DB, and have the app check for new records uptop in a mysql DB\nOR\n 2. Publish my app with a full sqlite DB. When ever I insert new records to the full sql lite DB then publish updates?\n\nI've been scouring the internet for some guidance. Since I am still newer to Android I wonder the difficulty in making #1 work (since I'll have to gen the php code as well)." ]
[ "android", "mysql", "sqlite" ]
[ "WPF Binding question", "I'm beginning with WPF and binding, but there are some strange behavior that I don't understand.\n\nExemple 1 :\nA very simple WPF form, with only one combobox (name = C) and the following code in the constructor :\n\n public Window1()\n {\n InitializeComponent();\n\n BindingClass ToBind = new BindingClass();\n ToBind.MyCollection = new List<string>() { \"1\", \"2\", \"3\" };\n\n this.DataContext = ToBind;\n\n //c is the name of a combobox with the following code : \n //<ComboBox Name=\"c\" SelectedIndex=\"0\" ItemsSource=\"{Binding Path=MyCollection}\" />\n MessageBox.Show(this.c.SelectedItem.ToString());\n }\n\n\nCan you explain me why this will crash because of this.c.SelectedItem being NULL.\n\nSo I though ... no problem it's because it's in the constructor, let's put the code in the Loaded form event :\n\n public Window1()\n {\n InitializeComponent();\n }\n\n private void Window_Loaded(object sender, RoutedEventArgs e)\n {\n BindingClass ToBind = new BindingClass();\n ToBind.MyCollection = new List<string>() { \"1\", \"2\", \"3\" };\n this.DataContext = ToBind;\n MessageBox.Show(this.c.SelectedItem.ToString());\n }\n\n\nSame problem this.c.SelectedItem is null...\n\nRemark : If I remove the Messagebox thing, then the binding work fine, I have the value in the combobox. It's like if \"some\" time was needed after the datacontext is set. But how to know when the binding will be done ?\n\nTx you for your help." ]
[ "c#", "wpf", "data-binding", "binding" ]
[ "How push into array without creating numbered indexes in a multidimensional array in PHP?", "I want to use array_push() to add to an array, but it always adds a [0] => Array level. How can I prevent that, or take that out afterwards?\n\nFor example, I'm trying to push into the '[addOns] => Array' with this:\n\n$addOnid='gcl1';\n$addOnid_arr=array('inheritedFromId' => $addOnid);\narray_push($result['addOns'], $addOnid_arr);\n\n\nThe array_push is resulting in this:\n\nArray\n(\n [addOns] => Array\n (\n [inheritedFromId] => gcl2\n )\n [0] => Array\n (\n [inheritedFromId] => gcl1\n )\n\n)\n\n\nAnd want to make it:\n\nArray\n(\n [addOns] => Array\n (\n [inheritedFromId] => gcl2\n )\n (\n [inheritedFromId] => gcl1\n )\n)\n\n\n...basically just getting rid of all the [0] => Array, moving all the subarrays up a level.\n\nMaybe I haven't been using the right queries, but I haven't been able to find out how to do this." ]
[ "multidimensional-array", "array-push" ]
[ "How do I get a certain value from a row in vaadin?", "This is the problem, I have a vaadin table that represent people information (for example) and when someone clicks on a row I want to extract the cellphone number.\n\nHere is part of the code of the listener:\n\ntable_2.addListener(new ItemClickEvent.ItemClickListener() {\n\n @Override\n public void itemClick(ItemClickEvent event) { // TODOAuto-generated // method stub\n String resultado = (table_2.getItem((Object)event.getItemId()))\n + \"\";\n resultado = resultado.substring(resultado.indexOf(\"phone\"),\n resultado.indexOf(\"|weight\"));\n label_3.setValue(resultado);\n }\n });\n\n\nIt worked one time but now it doesn't. The code returns a Null, so when I try to parse the object to string it crash." ]
[ "java", "get", "row", "vaadin" ]
[ "Products Model testing Using Rspec and capybara", "Product.rb \n\n class Product < ApplicationRecord\n validates :name, presence: true, uniqueness: true\n\nend\n\n\nProduct_spec.rb \n\nrequire 'rails_helper'\nrequire 'capybara/rspec'\n\nRSpec.feature \"Create Product\", :type => :feature do\n\nscenario \"User creates a duplicate product\" do\n visit \"/products/new\"\n\n fill_in \"Name\", :with => \"My Widget\"\n click_button \"Create\"\n #expect(page).to have_content(\"Name has already been taken\")\n #expect(flash[:notice]).to have_content(\"Name has already been taken\")\n\n expect(flash[:alert]).to match(/Name has already been taken/)\n end\n\n scenario \"User creates a invalid product\" do\n visit \"/products/new\"\n\n fill_in \"Name\", :with => \"\"\n click_button \"Create\"\n\n expect(flash[:alert]).to have_text(\"Name can't be blank.\")\n end\n\n end\n\n\nError Displayed : \n\n\nHow do I catch the error messages that are raised in Flash ? I tried everything like to have_content , to contain etc" ]
[ "ruby-on-rails", "testing", "rspec", "capybara" ]
[ "ToolTip style on TextBoxStyle {WPF}", "I try apply tooltip style on textboxstyle In user control. Style I have in:\n\n<UserControl.Resources>\n\n <!--Style definition-->\n\n</UserControl.Resources>\n\n\nToolTipStyle:\n\n<Style x:Key=\"ToolTipStyle\" TargetType=\"{x:Type ToolTip}\">\n <Setter Property=\"Width\" Value=\"200\"/>\n <Setter Property=\"Height\" Value=\"100\"/> \n</Style>\n\n\nTextBoxStyle:\n\n <Style x:Key=\"textBoxStyle\" TargetType=\"{x:Type TextBox}\">\n <Setter Property=\"Width\" Value=\"200\"/>\n <Setter Property=\"Height\" Value=\"25\"/>\n <Setter Property=\"FontSize\" Value=\"13\"/>\n <Setter Property=\"VerticalAlignment\" Value=\"Center\"/>\n\n <!--Apply toolip style-->\n <Setter Property=\"ToolTip.Style\" Value=\"{StaticResource ToolTipStyle}\"/>\n\n\n <Style.Triggers>\n <Trigger Property=\"Validation.HasError\" Value=\"true\">\n <Setter Property=\"ToolTip\"\n Value=\"{Binding RelativeSource={RelativeSource Self}, \n Path =(Validation.Errors)[0].ErrorContent}\"/>\n </Trigger>\n </Style.Triggers>\n </Style>\n\n\nTextBoxStyle apply on textbox constrol:\n\n <TextBox Name=\"tbNick\" \n Text=\"{Binding Nick, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}\"\n Style=\"{StaticResource textBoxStyle}\"/>\n\n\nI get this compile error:\n\n\n {\"Style object is not allowed to affect the Style property of the\n object to which it applies.\"}\n\n\nStackTrace:\n\n\n at System.Windows.Markup.XamlReader.RewrapException(Exception e,\n IXamlLineInfo lineInfo, Uri baseUri) at\n System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader,\n IXamlObjectWriterFactory writerFactory, Boolean\n skipJournaledProperties, Object rootObject, XamlObjectWriterSettings\n settings, Uri baseUri) at\n System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader,\n Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel\n accessLevel, Uri baseUri) at\n System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext\n parserContext, Object parent, Boolean closeStream) at\n System.Windows.Application.LoadComponent(Object component, Uri\n resourceLocator) at Spirit.Views.ShellView.InitializeComponent() in\n c:\\Users\\Jan\\Documents\\Visual Studio\n 2010\\Projects\\C#\\Pokec__Messenger\\Spirit_MEF\\Views\\ShellView.xaml:line\n 1 at Spirit.Views.ShellView..ctor() in\n C:\\Users\\Jan\\Documents\\Visual Studio\n 2010\\Projects\\C#\\Pokec__Messenger\\Spirit_MEF\\Views\\ShellView.xaml.cs:line\n 9\n\n\nApply tooltip style on textbox style is not allowed in WPF? What I do wrong? \n\nAlso in WPF I use caliburn.micro and MEF, but I think it doesn’t caused this error." ]
[ "wpf", "styles" ]
[ "Is this MSP an instance of the TSP?", "In his book, The Algorithm Design Manual, Steven S. Skiena poses the following problem:\n            \n\nNow consider the following scheduling problem. Imagine you are a highly-indemand actor, who has been presented with offers to star in n different movie projects under development. Each offer comes specified with the first and last day of filming. To take the job, you must commit to being available throughout this entire period. Thus you cannot simultaneously accept two jobs whose intervals overlap.\nFor an artist such as yourself, the criteria for job acceptance is clear: you want to make as much money as possible. Because each of these films pays the same fee per film, this implies you seek the largest possible set of jobs (intervals) such that no two of them conflict with each other.\nFor example, consider the available projects in Figure 1.5 [above]. We can star in at most four films, namely “Discrete” Mathematics, Programming Challenges, Calculated Bets, and one of either Halting State or Steiner’s Tree.\nYou (or your agent) must solve the following algorithmic scheduling problem:\nProblem: Movie Scheduling Problem\nInput: A set I of n intervals on the line.\nOutput: What is the largest subset of mutually non-overlapping intervals which can be selected from I?\n\nI wonder, is this an instance of the TSP (perhaps a simplified one)?" ]
[ "algorithm", "traveling-salesman" ]
[ "Errors in Mixed Effects Model Code: \"(p <- ncol(X)) == ncol(Y) is not TRUE\" and \"variable lengths differ\"", "I'm pretty new to R coding and am trying to run a mixed effects model for the first time. My model is aiming to investigate the effects of populations trends of one species on population trends of another species over time (year being included as a fixed effect) with state being a random effect (since the data is reported by state, but I'm only looking at continental effects).\nHere's a snippet of the set-up of my data (table called IGP):\n species state Count_yr population_value\n1 A AL 1970 0.1615\n2 B AL 1970 0.1981\n3 C AL 1970 0.2162\n4 A KY 1971 0.2096\n5 B KY 1971 0.2118\n6 C KY 1971 0.2784\n\nI subsetted the data to keep all three species separate (1 subset for A, 1 subset for B, 1 subset for C) as follows:\nA &lt;- subset(IGP, IGP$species==&quot;A&quot;)\nB &lt;- subset(IGP, IGP$species==&quot;B&quot;)\nC &lt;- subset(IGP, IGP$species==&quot;C&quot;)\n\nEverything worked fine for a linear model focused only on one species:\nAlm &lt;- lm(A$population_value ~ A$Count_yr+A$state)\n\nBut things get hairy when doing the mixed effects model with all 3 species\nincorporated:\nlmer&lt;-lmer(A$population_value ~ B$Count_yr*B$population_value + \n C$Count_yr*C$population_value + (1|state)\n\nFirst, I was getting a &quot;variable lengths differ&quot; error, so I went in and manually added NAs in for years and/or states that did not have data values for one of the species. I checked to make sure all years had the same number of data points and all states had the same number of data points, so I don't think there was an issue there after that.\nOnce I added the NA's, however, I started getting the error &quot;(p &lt;- ncol(X)) == ncol(Y) is not TRUE&quot;, which seems to be due to having NA values in factor columns. Going off of recommendations on other posts, I used na.omit to fix the issue, but then I got the &quot;variable lengths differ&quot; error again (seems like an endless cycle that I don't know how to fix yet).\nIf anyone could guide me as to how I should proceed, I would be super grateful! I'm not very knowledgeable about statistics or coding, so please let me know if there's any other information I could add to the post to make things clearer. Thanks in advance!" ]
[ "r", "error-handling", "lme4" ]
[ "Creating instance in Application class", "I am developing an Android Application, in which I am using Network libraries Retroift with GSON,Otto and Realm. So am creating instance in application class( extends Application). It makes my app launching time very slow. Is there any alternate solution to solve this out.\n\n public class MyApp extends Application{\n\n private MyApp appInstance;\n private MainThreadBus bus;\n private RealmConfiguration myAppRealmConfig;\n private GSON gson;\n private HttpLoggingInterceptor logging;\n\n\n @Override\n public void onCreate() {\n super.onCreate();\n\n //Application instance\n appInstance = this;\n gson = new GsonBuilder()\n .setDateFormat(ApiConstants.API_DATE_FORMAT).setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)\n .serializeNulls()\n .create();\n mAppRealmConfig = RealmConfigurationFactory.createMyAppRealmConfiguration(this, secretKey);\n appConfig = new AppConfig(); logging = new HttpLoggingInterceptor();\n logging.setLevel(HttpLoggingInterceptor.Level.BODY);\n bus = new MainThreadBus();\n\n }\n\n public Gson getGson() {\n return gson;\n }\n\n public AppConfig getAppConfig() {\n return appConfig;\n }\n\n}" ]
[ "android", "singleton", "android-application-class" ]
[ "lock logged in user in oracle by java", "i have one java web application in jsp and servlet and db as oracle 10g EE. In login if one user has been logged in then how can i prevent same user from logging again unless sign out? \n\nNote: I am not telling that if a logged in user will click on login page then immediately he would be forwarded to his home page.\n\nI am asking is how can i prevent that logged in user to login again if he is already logged in. Suppose user A is already logged in into the db(sign out not done), then user B tries to login in to db with the user id and password of user A, then simply user B will be prevented from login. How do i implement that?" ]
[ "java", "oracle", "jsp", "servlets", "login" ]
[ "Creating new collections vs array properties", "Coming from a MySQL background, I've been questioning the some of the design patterns when working with Mongo. One question I keep asking myself is when should I create a new collection vs creating a property of an array type? My current situation goes as follows:\n\n\nI have a collection of Users who all have at least 1 Inbox\nEach inbox has 0 or more messages\nEach message can have 0 or comments\n\n\nMy current structure looks like this:\n\n{\nusername:\"danramosd\",\ninboxes:[\n {\n name:\"inbox1\",\n messages:[\n {\n message:\"this is my message\"\n comments:[\n {\n comment:\"this is a great message\"\n }\n ]\n }\n ]\n\n }\n]\n}\n\n\nFor simplicity I only listed 1 inbox, 1 message and 1 comment. Realistically though there could be many more. \n\nAn approach I believe that would work better is to use 4 collections:\n\n\nUsers - stores just the username\nInboxes - name of the inbox, along with the UID of User it belongs to\nMessages - content of the message, along with the UID of inbox it belongs to\nComments - content of the comment, along with the UID of the message it belongs to.\n\n\nSo which one would be the better approach?" ]
[ "mongodb" ]
[ "How to Format Code in Dynamically Created .cs File", "I have dynamically created a new .cs file using the following method:\n\n// Create the new file. \nusing (FileStream newFile = File.Create(path))\n {\n //Get info for the file\n Byte[] info = new UTF8Encoding(true).GetBytes(\"contents\");\n\n // Add information to the file.\n newFile.Write(info, 0, info.Length);\n System.Windows.Forms.Form.ActiveForm.Close();\n }\n\n\nThis works great and all my info is being displayed how I want, except the code is not formatted properly. All the text is aligned to the left and there is no indention. Is there a way to fix this, or perhaps another method I can use to create the cs file that would result in a properly formatted .cs file?" ]
[ "c#", ".net", "visual-studio-2012" ]
[ "PayPal android sdk Sandbox Integration", "I want to integrate paypal in my android application,and i used paypal sdk2\nfor testing I used Paypal environment as Sandbox,but in the PaymentActivity page the sandbox button seems to be disabled\n\nHere is my code for paypal configuration\n\n PaypalConfiguration config = new PayPalConfiguration();\n config.environment(PayPalConfiguration.ENVIRONMENT_SANDBOX).clientId(\"myclientId\");\n\n\nOn clicking on the Buy button i called the below function\n\nprivate void buyFromPayPal() {\n PayPalPayment payPalPayment=new PayPalPayment(new BigDecimal(1.75),\"USD\",\"Bike\",PayPalPayment.PAYMENT_INTENT_SALE);\n Intent intent = new Intent(this, PaymentActivity.class);\n // send the same configuration for restart resiliency\n intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);\n\n intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payPalPayment);\n\n startActivityForResult(intent, 0);\n}\n\n\nAnd i am getting a out put screen like this" ]
[ "android", "paypal", "paypal-sandbox" ]
[ "Mongo (doesnt run through browser)", "MongoDB is not giving off any error when trying to run through the browser, \ngives a 500 internal server error.\n\nThings I have tried:\n\n\nchecking php modules to make sure its running, and it is.\nchecked to see if it ran internal from within the server command line\n\"php myfile.php\" and it works\n\n\nServer has a domain name using an SSL, so its https:\n\nI have tried catching the error but that also does no good tried couple of ways with no luck.\n\nFinally caught an error which makes no sense since the new Mongo driver is loaded, as it works when I run the file directly from console as apose to browser\n\n'MongoDB\\Driver\\Manager' not found in httpdocs/vendor/mongodb/mongodb/src/Client.php on line 87" ]
[ "php", "mongodb", "ssl", "https" ]
[ "WebView and Advanced View is Not loading partiucalr URL", "I try to load one particular URL on the Android web view and it is keep on throwing error as i attached in the screenshot 1: \n\nCode here \n\n mWebView = (WebView) view.findViewById(R.id.webview);\n mWebView.setWebChromeClient(new WebChromeClient());\n WebSettings settings = mWebView.getSettings();\n CookieManager.getInstance().setAcceptCookie(true);\n\n settings.setBuiltInZoomControls(true);\n settings.setLoadsImagesAutomatically(true);\n settings.setSupportZoom(true);\n settings.setDomStorageEnabled(true);\n settings.setUserAgentString(AppConstant.USER_AGENT);\n\n mWebView.getSettings().getJavaScriptEnabled();\n mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);\n mWebView.getSettings().setAppCacheEnabled(true);\n mWebView.setWebViewClient(new MyBrowser());\n mWebView.setInitialScale(30);\n mWebView.getSettings().setUseWideViewPort(true);\n mWebView.setScrollbarFadingEnabled(false);\n\n if (mFindPricesURL.contains(\".pdf\")) {\n try {\n mWebView.loadUrl(\"http://drive.google.com/viewerng/viewer?embedded=true&amp;url=\" + mFindPricesURL);\n } catch (Exception e) {\n launchDocumentViewer(mFindPricesURL);\n }\n } else if (mFindPricesURL.contains(\".xls\") || mFindPricesURL.contains(\".ppt\")\n || mFindPricesURL.contains(\".doc\")) {\n launchDocumentViewer(\"https://m.goodrx.com/search\");\n } else {\n mWebView.loadUrl(mFindPricesURL);\n }\n\n\nAlso i did\n\n private class MyBrowser extends WebViewClient {\n\n @Override\n public void onPageFinished(WebView view, String url) {\n super.onPageFinished(view, url);\n ProgressBarUtil.dismissProgressDialog();\n view.loadUrl(\"javascript:document.getElementById('imPage').style.display='none';\");\n }\n\n }\n\n\n\n\nas mention in the code i have enabled the cookie and Java script in Webview i dono what additionally that we have to do on this" ]
[ "android", "webview" ]
[ "Parallel tar with split for large folders", "I am have really huge folder I would like to gzip and split them for archive:\n\n#!/bin/bash\ndir=$1\nname=$2\nsize=32000m\ntar -czf /dev/stdout ${dir} | split -a 5 -d -b $size - ${name}\n\n\nAre there way to speed up this with gnu parallel?\nthanks." ]
[ "bash", "parallel-processing", "split", "gnu", "tar" ]
[ "what's difference between nodejs with browser about event-loop in below code?", "async function async1() {\n console.log(\"a\");\n await async2(); \n console.log(\"b\");\n}\nasync function async2() {\n console.log( 'c');\n}\nconsole.log(\"d\");\nsetTimeout(function () {\n console.log(\"e\");\n},0);\nasync1();\nnew Promise(function (resolve) {\n console.log(\"f\");\n resolve();\n}).then(function () {\n console.log(\"g\");\n});\nconsole.log('h');\n\n\nnodejs runtime output: d a c f h b g e\n\nGoogle Browser runtime output: d a c f h g b e\n\nwhy output different result?" ]
[ "node.js" ]
[ "ITK in Python: SimpleITK or not?", "I have started to work with ITK for a week thanks to SimpleITK in Python. Even though, currently, I am satisfied with SimpleITK, I have noticed that some features such as the Powell optimization scheme or the OnePlusEvolutionary one are not available in SimpleITK. It seems to be the same with landmark-based registration methods.\n\nSo, I was wondering if there is a way to retrieve all the features available in ITK (in C++) in SimpleITK or if it is necessary to perform my own wrapping?\n\nIf not I will later learn C++ to do so!\n\nThanks!" ]
[ "python", "c++", "image-processing", "itk" ]
[ "Storing lots of attachments in single CouchDB document", "tl;dr : Should I store directories in CouchDB as a list of attachments, or a single tar\n\nI've been using CouchDB to store project documents. I just create documents via Futon and upload them directly from there. I've also written a script to bulk-upload directories. I am using it like a basic content repository. I replicate it, so other people on my team have a copy of the repository.\n\nI noticed that saving directories as a series of files seems to have a lot of storage overhead, so instead I upload a .tar.gz file containing the directory. This does significantly reduce the size of the document but now any change to the directory requires replicating the entire tarball.\n\nI am looking for thoughts or perspective on the matter." ]
[ "couchdb", "archive", "tar", "attachment" ]
[ "Comparison between empty interfaces in Golang", "According to the specification: \n\n\n Interface values are comparable. Two interface values are equal if\n they have identical dynamic types and equal dynamic values or if both\n have value nil.\n\n\nvar err error \nvar reader io.Reader \n\n\nAs far as understand, err and reader have different dynamic types (error and io.Reader) and therefore are not comparable. \n\nfmt.Println(err == reader) \n\n\nwill cause a compile error:\n\n\n invalid operation: err == reader (mismatched types error and io.Reader)\n\n\nIf it is true, why Println command outputs the same results for both variables? Why both are nil?\n\nfmt.Printf(\"reader: %T\", reader) // nil\nfmt.Printf(\"error: %T\", err) // nil\n\n\nEDIT reflect.TypeOf(err)or reflect.TypeOf(reader) will also output nil. I do not understand why the output is the same if the types are different." ]
[ "go", "interface", "comparison" ]
[ "NSAttributedString issues in Swift", "I'm getting issues with NSAtrributedString no matter which path I take and can't seem to figure out what the issue is.\n\nWith the code below I get: Cannot invoke 'init' with an argument list of type '(string: StringLiteralConvertible, attributes: $T6)'\n\nlet cancelButtonTitle = NSAttributedString(string: \"CANCEL\", attributes: [NSFontAttributeName: buttonFont, NSForegroundColorAttributeName: UIColor.whiteColor()])\n\n\nAny ideas where the issue lies? I've tried in xcode 6.1 and 6.2." ]
[ "ios", "iphone", "swift", "xcode6", "nsattributedstring" ]
[ "Use code in a file as content of a SAS macro variable", "I have a series of files, each containing SQL code.\nI'd like to use SAS to run passthrough queries using that SQL.\nSince those files are changing often I just want an automated way to keep SAS synched up with these files.\nI'm thinking that if I could import the SQL file and put it into a macro variable, then I could just use the macro within my SAS passthrough and everything would be in synch.\nBut I wouldn't know how to read the external SQL in anything other than a SAS dataset, which wouldn't make a lot of sense to start with...\nExample:\nsqlcode.sql\n\nselect *\nfrom table1\n\n\nIn SAS:\n\n/*Somehow read sqlcode.sql into a macro variable sassql*/\n\nproc sql;\nconnect to netezza (SERVER=MYSERVER DATABASE=MYDBS);\n\nexecute (\n&amp;sassql.\n\n) by netezza;\n\n;\nquit;" ]
[ "file", "import", "sas" ]
[ "TypeError: cannot unpack non-iterable bool object", "When I run the code it redirects and showing \n\nTypeError at /accounts/register cannot unpack non-iterable bool object\n\n\nThe problem is when I put the below condition in my code\n\nUser.objects.filter(username==username).exists():\n\nUser.objects.filter(email=email).exists():\n\n\n\nPlease help\n\nfrom django.shortcuts import render, redirect\nfrom django.contrib.auth.models import User, auth\n\n\n\n# Create your views here.\n\ndef register(request):\n\n if request.method == 'POST':\n last_name = request.POST['Last_name']\n first_name = request.POST['first_name']\n username = request.POST['username']\n email = request.POST['email']\n password1 = request.POST['password1']\n password2 = request.POST['password2']\n\n if password1==password2:\n if User.objects.filter(username==username).exists():\n print(\"username taken\")\n elif User.objects.filter(email=email).exists():\n print('email exists')\n else:\n user = User.objects.create_user(username=username,password=password1,email=email,first_name=first_name,last_name=last_name)\n user.save()\n print('User Created')\n else:\n print('password doesnt match')\n\n return redirect('/')\n\n\n else:\n return render(request,'accounts/register.html')\n\n\n\nError\n\nTypeError: cannot unpack non-iterable bool object\n\n[16/Jul/2019 17:51:22] \"POST /accounts/register HTTP/1.1\" 500 98878\n\n\n\nEnvironment:\n\nRequest Method: POST\nRequest URL: http://127.0.0.1:8000/accounts/register\n\n\nTraceback:\n\nFile \"C:\\Users\\MaqboolThoufeeqT\\Envs\\djangotest\\lib\\site-packages\\django\\core\\handlers\\exception.py\" in inner\n 34. response = get_response(request)\n\nFile \"C:\\Users\\MaqboolThoufeeqT\\Envs\\djangotest\\lib\\site-packages\\django\\core\\handlers\\base.py\" in _get_response\n 115. response = self.process_exception_by_middleware(e, request)\n\nFile \"C:\\Users\\MaqboolThoufeeqT\\Envs\\djangotest\\lib\\site-packages\\django\\core\\handlers\\base.py\" in _get_response\n 113. response = wrapped_callback(request, *callback_args, **callback_kwargs)\n\nFile \"C:\\Users\\MaqboolThoufeeqT\\Desktop\\DjangoWork\\travello\\accounts\\views.py\" in register\n 19. if User.objects.filter(username==username).exists('True'):\n\nFile \"C:\\Users\\MaqboolThoufeeqT\\Envs\\djangotest\\lib\\site-packages\\django\\db\\models\\manager.py\" in manager_method\n 82. return getattr(self.get_queryset(), name)(*args, **kwargs)\n\nFile \"C:\\Users\\MaqboolThoufeeqT\\Envs\\djangotest\\lib\\site-packages\\django\\db\\models\\query.py\" in filter\n 892. return self._filter_or_exclude(False, *args, **kwargs)\n\nFile \"C:\\Users\\MaqboolThoufeeqT\\Envs\\djangotest\\lib\\site-packages\\django\\db\\models\\query.py\" in _filter_or_exclude\n 910. clone.query.add_q(Q(*args, **kwargs))\n\nFile \"C:\\Users\\MaqboolThoufeeqT\\Envs\\djangotest\\lib\\site-packages\\django\\db\\models\\sql\\query.py\" in add_q\n 1290. clause, _ = self._add_q(q_object, self.used_aliases)\n\nFile \"C:\\Users\\MaqboolThoufeeqT\\Envs\\djangotest\\lib\\site-packages\\django\\db\\models\\sql\\query.py\" in _add_q\n 1318. split_subq=split_subq, simple_col=simple_col,\n\nFile \"C:\\Users\\MaqboolThoufeeqT\\Envs\\djangotest\\lib\\site-packages\\django\\db\\models\\sql\\query.py\" in build_filter\n 1187. arg, value = filter_expr\n\nException Type: TypeError at /accounts/register\nException Value: cannot unpack non-iterable bool object" ]
[ "python", "django", "python-3.x", "django-views", "python-requests" ]
[ "Is there an issue with making a custom polling method for Selenium automation?", "First of all, here's the C# code (even though the question is language-independent):\n\npublic static void PollClick(IWebElement element, int timeout = defaultTimeout, int pollingInterval = defaultPollingInterval)\n {\n var stopwatch = new Stopwatch();\n stopwatch.Start();\n\n while (stopwatch.Elapsed &lt; TimeSpan.FromSeconds(timeout))\n {\n try\n {\n element.Click();\n break;\n }\n catch (Exception)\n {\n System.Threading.Thread.Sleep(pollingInterval);\n }\n }\n }\n\n\nThis one is for clicking an element, but I could easily replace the click command with something else (visibility check, send text, etc). I'm setting up automation for IE, Edge, Firefox, and Chrome. I've come across a few situations where a certain web driver has a bug or the web page misbehaves for a browser (an element remains obscured, a crash with no stack trace, and other strange issues). This method has been used sparingly (once or twice) as I already have made use of the existing waits available for Selenium and have even created wrapper functions around those waits (including one that waits until an exception is no longer being thrown). Is it a bad idea to have this method handy? It did pass code review but I'm just curious as to what else I could do for anomalous situations." ]
[ "c#", "selenium", "selenium-webdriver", "automation" ]
[ "Flexbox, how to keep a minimum of 2 cols at 400px?", "https://codepen.io/leon-yum/pen/XYpgzj?editors=1100\n\nI'm trying to make sure that on mobile (400px and below) that my flexbox grid sticks to 2 cols / boxes. However whatever I do, either it snaps to 1 column, or each row stays at 3 cols or 4 cols respectively.\n\nExpected at 400px width:\n\n\n\nResults:\n\n\n\nHTML\n\n&lt;div class=\"flex-grid-thirds\"&gt;\n &lt;div class=\"col\"&gt;This little piggy went to market.&lt;/div&gt;\n &lt;div class=\"col\"&gt;This little piggy stayed home.&lt;/div&gt;\n &lt;div class=\"col\"&gt;This little piggy had roast beef.&lt;/div&gt;\n&lt;/div&gt;\n\n&lt;div class=\"flex-grid-four\"&gt;\n &lt;div class=\"col\"&gt;This little piggy went to market.&lt;/div&gt;\n &lt;div class=\"col\"&gt;This little piggy stayed home.&lt;/div&gt;\n &lt;div class=\"col\"&gt;This little piggy had roast beef.&lt;/div&gt;\n &lt;div class=\"col\"&gt;This little piggy had roast beef.&lt;/div&gt;\n&lt;/div&gt;\n\n\nCSS\n\n.flex-grid-thirds,\n.flex-grid-four {\n display: flex;\n justify-content: space-between;\n margin-bottom: 20px;\n}\n\n.flex-grid-thirds .col {\n width: 32%;\n}\n\n.flex-grid-four .col {\n width: 24%;\n}\n\n@media (max-width: 400px) {\n .flex-grid-thirds,\n .flex-grid-four {\n .col {\n width: 40%;\n }\n }\n}\n\n* {\n box-sizing: border-box;\n}\nbody {\n padding: 20px;\n}\n.flex-grid { \n margin: 0 0 20px 0;\n}\n.col {\n background: salmon;\n padding: 20px;\n}" ]
[ "html", "css", "flexbox", "flexboxgrid" ]
[ "How to remove magento breadcrumbs via the admin-panel?", "I want to remove the breadcrumbs from magento pages, especially from the product detail and product listing pages.\n\nCan this be done without changing any code? Only inside the admin-panel?" ]
[ "php", "magento" ]
[ "Any prediction method for this?", "This is my dataset.\nenter image description here\nI was trying to create a prediction for Global_Sales and Types (doesn't matter they at x or y). I tried several model, they all come out error and cannot be run.\nThis is the analysis I did. By using this code.\nggplot(vgsa, aes(x = Types, y = Global_Sales)) +\n geom_line(color = 'blue', size = 5) + \n labs(y = &quot;Global_Sales&quot;, title = &quot;Global_Sales of Video Games&quot;)\n\nenter image description here\nAny suggest prediction model?" ]
[ "r", "prediction" ]
[ "PHP - Reading from XML using simplexml_load_file returning no values", "I'm currently using 'simplexml_load_file' to read from an XML file. I'm looking to read multiple values and store them in some parameters, which I later use in an SQL insert statement.\n\nI can confirm no errors are being returned. Also I have printed these values outs before performing my SQl statement to ensure something wasn't going wrong there, and the echo prints out nothing. I imagine may syntax may be incorrect with regards to grabbing the values, but I'm unsure. Below is my PHP:\n\n$xml = simplexml_load_file(\"{$path}/{$email_safe}/{$datafile}.xml\");\n\n// Retreive data details for specified activity\n$totalTime = $xml-&gt;TrainingCenterDatabase-&gt;Activities-&gt;Activity-&gt;Lap-&gt;TotalTimeSeconds;\n$distance = $xml-&gt;TrainingCenterDatabase-&gt;Activities-&gt;Activity-&gt;Lap-&gt;DistanceMeters;\n$maxSpeed = $xml-&gt;TrainingCenterDatabase-&gt;Activities-&gt;Activity-&gt;Lap-&gt;MaximumSpeed;\n$calories = $xml-&gt;TrainingCenterDatabase-&gt;Activities-&gt;Activity-&gt;Lap-&gt;Calories;\n$intensity = $xml-&gt;TrainingCenterDatabase-&gt;Activities-&gt;Activity-&gt;Lap-&gt;Intensity;\n$trigMethod = $xml-&gt;TrainingCenterDatabase-&gt;Activities-&gt;Activity-&gt;Lap-&gt;TriggerMethod;\n\n// Store activity details into the 'detail' table\n$sqlDetail = \"INSERT INTO detail (detailID,TotalTime,distance,maxSpeed,calories,intensity,trigMethod) VALUES (\\\"$datafile\\\",\\\"$totalTime\\\",\\\"$distance\\\",\\\"$maxSpeed\\\",\\\"$calories\\\",\\\"$intensity\\\",\\\"$trigMethod\\\")\";\n$runDetail = mysql_query($sqlDetail) or die(\"unable to complete INSERT action:$sql:\".mysql_error());\n\n\nAnd here is a snippet of the XML file which I'm attempting to read from:\n\n&lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?&gt;\n&lt;TrainingCenterDatabase xmlns=\"http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.garmin.com/xmlschemas/ActivityExtension/v2 http://www.garmin.com/xmlschemas/ActivityExtensionv2.xsd http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd\"&gt;\n\n &lt;Activities&gt;\n &lt;Activity Sport=\"Running\"&gt;\n &lt;Id&gt;2014-02-17T20:23:52Z&lt;/Id&gt;\n &lt;Lap StartTime=\"2014-02-17T20:23:52Z\"&gt;\n &lt;TotalTimeSeconds&gt;1585.4799805&lt;/TotalTimeSeconds&gt;\n &lt;DistanceMeters&gt;113.5199966&lt;/DistanceMeters&gt;\n &lt;MaximumSpeed&gt;1.3720000&lt;/MaximumSpeed&gt;\n &lt;Calories&gt;3&lt;/Calories&gt;\n &lt;Intensity&gt;Active&lt;/Intensity&gt;\n &lt;TriggerMethod&gt;Manual&lt;/TriggerMethod&gt;\n\n\nIf anyone is able to point out my errors here, It would be much appreciated. Thanks." ]
[ "php", "sql", "xml" ]
[ "Making shell scripts robust against location they're called from", "What is the best way to write a shell script that will access files relative to it such that it doesn't matter where I call it from? \"Easy\" means the easiest/recommended way that will work across different systems/shells.\n\nExample\n\nSay I have a folder ~/MyProject with subfolders scripts/ and files/. In scripts/, I have a shell script foo.sh that wants to access files in files/:\n\nif [ -f \"../files/somefile.ext\" ]; then\n echo \"File found\"\nelse\n echo \"File not found\"\nfi\n\n\nIt'll work fine If I do cd ~/MyProject/scripts &amp;&amp; ./foo.sh, but it will fail with cd ~/MyProject &amp;&amp; scripts/foo.sh." ]
[ "linux", "bash", "shell", "zsh", "ksh" ]
[ "Nginx Redirects Subfolders", "I have on my server installation of WordPress in public directory:\n\nvar/www/example/ - main installation of WordPress\n\n\nIn that directory I have also subdirectory WORDPRESS which has many subfolders like\n\nvar/www/example/WORDPRESS/1\nvar/www/example/WORDPRESS/2\netc.\n\n\nEvery this subfolders 1,2 have installed WordPress Blog. Everythings works ok when I use standard permalinks for wordpress for example:\n\nhttp://www.example.net/WORDPRESS/1/?p=1\n\n\nBut when I try to change it to somethink like:\n\nhttp://www.example.net/WORDPRESS/2015/09/27/title-of-post\n\n\nNginx redirect to:\n\nhttp://www.example.net/2015/09/27/title-of-post/ \n\n\nMy nginx configuration:\n\nserver {\n listen 80;\n server_name example.net *.example.net;\n rewrite ^/(.*)$ http://www.example.net/$1 permanent;\n}\nserver {\n listen 80;\n server_name www.example.net;\n root /var/www/example/;\n index index.php index.html index.htm;\n client_max_body_size 128M;\n\n location / {\n root /var/www/example/;\n index index.php index.html index.htm;\n try_files $uri $uri/ /index\n}\n\n\nHow can I make subfolders work? Nginx just skips WORDPRESS subdirectory in link." ]
[ "nginx" ]
[ "Padrino and RSpec don't work with Sequel?", "Recently, I've started diving into Ruby MVCs, in order to find the best, fastest, most minimal framework to build my app. Being unsatisfied with Rails, I decided to try out Padrino. I'm also trying out Outside-in TDD for a full app for the first time, so being able to write tests for all components is critical. Unfortunately, I cannot get past making models in Padrino, so I'm wondering if it's just a cause of beta software, or just error on my part.\n\nI start off by creating my project with Cucumber and RSpec for testing and Sequel for my ORM.\n\n$ padrino g project test -d sequel -t cucumber -c sass -b\n\n\nNext, I create some model and migration:\n\n$ padrino g model user\n\n# ./db/migrate/001_create_users.rb\nSequel.migration do\n change do\n create_table :users do\n primary_key :id\n String :name\n String :password\n end\n end\nend\n\n\nNext, of course, comes the spec. For sake of example, just something simple:\n\n# ./spec/models/user_spec.rb\nrequire 'spec_helper'\n\ndescribe User do\n it 'can be created' do\n user = User.create\n end\nend\n\n\nNow, migrate and run the spec:\n\n$ padrino rake sq:migrate:up\n$ rspec spec\n\nF\n\nFailures:\n\n 1) User can be created\n Failure/Error: user = User.create\n Sequel::DatabaseError:\n SQLite3::SQLException: no such table: users\n # ./spec/models/user_spec.rb:5:in `block (2 levels) in &lt;top (required)&gt;'\n\nFinished in 0.00169 seconds\n1 example, 1 failure\n\nFailed examples:\n\nrspec ./spec/models/user_spec.rb:4 # User can be created\n\n\nThis is very confusing. It was at this point that I thought going into the Padrino console would help me solve this strange issue. I was wrong.\n\n$ padrino c\n&gt; User.create\n =&gt; #&lt;User @values={:id=&gt;1, :name=&gt;nil, :password=&gt;nil}&gt;\n&gt; User.all\n =&gt; [#&lt;User @values={:id=&gt;1, :name=&gt;nil, :password=&gt;nil}&gt;]\n\n\nFair enough results, but then I try it with the test environment:\n\n$ padrino c -e test\n&gt; User.create\n Sequel::DatabaseError: SQLite3::SQLException: no such table: users\n\n\nI know that in RoR, to get integrated models to run, you have to do something like rake db:test:prepare, but doing padrino rake -T doesn't seem to reveal any equivalent (tested with Sequel, DataMapper, and ActiveRecord; none seem to have the db:test:prepare). So, my question is: how do I get integrated database tests running within Padrino?" ]
[ "ruby", "model-view-controller", "rspec", "sequel", "padrino" ]
[ "Issue with custom icon font rendering differently in different browsers", "Having issues with a custom icon font. It renders differently between Safari and Chrome. It appears to be between 1-2 pixels lower in Safari. Can I somehow have it render the same in both browsers?\n\nCreated the icon font by exporting 16 x 16 px SVG from Sketch and then imported them into IcoMoon and put the optimize metrics to 16 automatic.\n\n Grid on IcoMoon\n\n Chrome OS X\n\n Safari OS X\n\nLive example: http://jsfiddle.net/QQ7mV/\n\nHTML:\n\n&lt;a href=\"\" class=\"button increase\"&gt;&amp;#x2b;&lt;/a&gt;\n\n\nCSS:\n\n* {\n box-sizing: border-box;\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n -o-box-sizing: border-box;\n -ms-box-sizing: border-box;\n}\n@font-face {\n font-family: \"icons\";\n src: url(\"http://cl.ly/Qo0T/icons.ttf\") format(\"truetype\");\n font-weight: normal;\n font-style: normal;\n}\na {\n display: block;\n text-decoration: none;\n outline: none;\n}\n.button {\n width: 115px;\n height: 37px;\n color: #333333;\n font-size: 14px;\n font-weight: bold;\n text-align: center;\n line-height: 35px;\n margin: 0 auto 20px auto;\n background-color: #edeef0;\n background-repeat: no-repeat;\n border-radius: 4px;\n -webkit-border-radius: 4px;\n -moz-border-radius: 4px;\n -o-border-radius: 4px;\n -ms-border-radius: 4px;\n transition-property: background-color, opacity;\n -webkit-transition-property: background-color, opacity;\n -moz-transition-property: background-color, opacity;\n -o-transition-property: background-color, opacity;\n -ms-transition-property: background-color, opacity;\n transition-duration: 0.2s;\n -webkit-transition-duration: 0.2s;\n -moz-transition-duration: 0.2s;\n -o-transition-duration: 0.2s;\n -ms-transition-duration: 0.2s;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -o-user-select: none;\n -ms-user-select: none;\n -webkit-user-drag: none;\n}\n.button.increase, .button.decrease {\n display: inline-block;\n vertical-align: top;\n width: 23px;\n height: 23px;\n font-family: \"icons\";\n font-size: 8px;\n font-weight: normal;\n line-height: 1;\n padding: 8px 0 0 0;\n -webkit-font-smoothing: antialiased;\n}\n.button.increase {\n margin: 13px 5px 0 11px;\n}\n.button.decrease {\n margin: 13px 0 0 0;\n}" ]
[ "css", "icon-fonts" ]
[ "how can i add a timeout function to javascript?", "$('.btn').click(function() {\r\n $(this).toggleClass('spinner');\r\n});\r\n\r\n\r\n\n\nand i want to add a timeout function to it i added it like this but it does not work, any ideas why?\n\n\r\n\r\n$('.btn').click(function() {\r\n $(this).toggleClass('spinner');\r\n setTimeout(function() {\r\n $this.button('reset');\r\n }, 8000);\r\n\r\n});" ]
[ "javascript", "jquery" ]
[ "Cloudformation Custom Resource Orchestration/precedence?", "I have a Cloudformation Custom Resource, that I want to use the outputs from, and call another Custom Resource.\n\nI tried exporting the Outputs, and tinkered with using DependsOn, hoping it would set some order of precedence.\n\nIs this Possible:\n\nAWSTemplateFormatVersion: 2010-09-09\nTransform: AWS::Serverless-2016-10-31\nDescription: Run Lambda1, then run Lambda2 w/ outpu from Lambda1\nOutputs:\n lambda1Output:\n Value:\n Fn::GetAtt:\n - lambda1\n - test\n Export:\n Name: lambda1Outputs\nResources:\n lambda1:\n Type: Custom::test\n Properties:\n ServiceToken: arn:aws:lambda:us-east-1:761861444952:function:runOnce\n lambda2:\n Type: Custom::test2\n DependsOn: lambda1\n Properties:\n ServiceToken: arn:aws:lambda:us-east-1:761861444952:function:runOnce\n myParameter: !ImportValue lambda1Outputs" ]
[ "amazon-web-services", "amazon-cloudformation", "orchestration" ]
[ "How to check the cycles in Prolog?", "I have the Prolog predicates:\n\ngen(c1, c2). \ngen(c2, c1).\ngen(c2, c3).\ngen(c3, c1).\n\n\nI want to write a rule to check that there are no cycles in the gen/2 predicates. How should I write this rule?" ]
[ "prolog" ]
[ "Calling multiple stored procedures from stored procedure - sql while loop", "I often hear that while loops are as bad as cursors, which I did not believe to be true. Is it better from a performance standpoint to call multiple stored procedures from C#, or allow a stored procedure to parse XML data and call procedures in a looping fashion? Is there a better way to call an unknown number of stored procedures in SQL than looping? \n\nLet me explain\n\nI have to design and implement a vendor messaging system. There is a third party company sending along XML messages to the recipient that originated from the sender. My company might be the sender or the recipient at any given time. \n\nI have come up with a design that uses a SQL while loop to run stored procedures, but I'm worried that it might not perform well when faced with a large number of loops. \n\nThe basic idea is:\nSender --> third party (message system) --> receiver\n\nMy problem may occur when my company is the receiver: \n\n\nSender sends message to third party company \nThird party company sends message to my company\nWCF Service receives request from third party company\nA stored procedure is called, passing the xml of the message received to be parsed\nThis stored procedure parses xml and finds messages in the XML\nWhile loop goes through each message and calls a stored procedure to update information, passing the ID of the instance of the message. \n\n\nThe message XML is something like this:\n\n&lt;envelope&gt;\n &lt;to&gt;&lt;/to&gt;\n &lt;from&gt;&lt;/from&gt;\n ...\n &lt;messages&gt;\n &lt;message&gt;\n &lt;id&gt;&lt;/id&gt;\n ...\n &lt;params&gt;\n &lt;param&gt;\n &lt;Name&gt;&lt;/Name&gt;\n &lt;Value&gt;&lt;/Value&gt;\n &lt;param&gt;\n ...\n &lt;/params&gt;\n &lt;/message&gt;\n ...\n &lt;/messages&gt;\n&lt;/envelope&gt;\n\n\nI can receive or send one or more messages in each transmission of XML. There could potentially be multiple messages received at once. A requirement of the third party company which handles sending and receiving the XML is that we always respond with Success or Fail. We have a 60 second timeout window to respond. Due to these limitations, I am naturally afraid that I won't be able to do all the processing I need to do in the time limit, causing a timeout. \n\nSo if I find message 1, 2 and 3 in one transmission, I would have to run stored procedure 1, 2 and 3. I have a temp table filled with message ID and stored procedure to run. \n\nSo the While loop would be basically (didn't check validity of this part, just free-handed it as I don't have the SP handy)\n\nWhile select count(*) from #temptable &gt; 0\nbegin\n select top 1 @idMessage = idMessage, @spToRun = spToRun from #temptable\n exec @spToRun @idMessage\n\n delete from #temptable where idMessage = @idMessage\n select @idMessage = null, @spToRun = null\nend\n\n\nI'm afraid to put this into production and then find out it runs far, far too slowly. Does anyone have advice?" ]
[ "c#", "xml", "wcf", "stored-procedures", "sql-server-2012" ]
[ "Leave System Balance on a HR application Laravel", "I'll just head on to the question directly, I'm currently trying to build an HR(Human Resources) Application on Laravel and at the Leave System where a user can take a specific type of Leave(Vacation and such), I would like to create a Balance system where the user selects a date from and date to and that number in between them gets deducted from the main balance that a user has and that would be the number 20 which I added to my user table on a field called leave_balance(the number is set by default as 20 when a user is created).\nNow except deducting the number I would also like to add a function somehow that adds a specific number to the leave_balance every day ex 0.05 I am suspecting I can do this with carbon but I have not the slightest idea how since im relatively new to Laravel\nSo this is the Leave Table(it is not connected by a foreign key with the user's table):\n\nid\nuser_id\nfrom\nto\ntype\ndescription\nstatus\nmessage\n\nThe user_id is only there to store the id of the authenticated user who creates a leave it is not related by a foreign key\nThis is what I was thinking of adding in the LeaveController:\n// checks for table if employee leave is at 0\n$employee = DB::table('leaves')-&gt;where('id', $id)-&gt;where('leave', 0)-&gt;get()-&gt;all();\n$employeeObj = DB::table('leaves')-&gt;where('id', $id)-&gt;get()-&gt;all();\n\n// init for needed condition\n$leaveBool = false;\nif(sizeof($employee) &lt; 1) {\n $leaveBool = true;\n}\n\n// leave is not at 0\nif(!$leaveBool) {\n DB::table('leaves')-&gt;update([\n 'id' =&gt; $id,\n 'leave' =&gt; $employeeObj['leaves'] - 1,\n ]);\n}\n\nI would like to fix this code so that I can add this in the Leave Controller(also if it's possible to explain to me where exactly I should put such a code in the controller) by fix I mean to not just removed -1 but the number between &quot;from&quot; and &quot;to&quot;\nI'm not sure if these are helpful but I will post them too just to make it easier to see,\nThis is the Leave Model:\nclass Leave extends Model\n{\n use Notifiable;\n\n protected $guarded=[];\n \n public function user(){\n return $this-&gt;belongsTo(User::class,'user_id','id'); \n }\n}\n\nThis is the view of the Leave\n&lt;div class=&quot;card-body&quot;&gt;\n &lt;form method=&quot;POST&quot; action=&quot;{{route('leaves.store')}}&quot;&gt;\n @csrf\n\n &lt;div class=&quot;form-group&quot;&gt;\n &lt;label&gt;From Date&lt;/label&gt;\n &lt;div class=&quot;col-md-6&quot;&gt;\n &lt;input class=&quot;datepicker&quot; type=&quot;text&quot; class=&quot;form-control @error('from') is-invalid @enderror&quot; name=&quot;from&quot; required=&quot;&quot;&gt;\n\n @error('from')\n &lt;span class=&quot;invalid-feedback&quot; role=&quot;alert&quot;&gt;\n &lt;strong&gt;{{ $message }}&lt;/strong&gt;\n &lt;/span&gt;\n @enderror\n &lt;/div&gt;\n &lt;/div&gt;\n\n &lt;div class=&quot;form-group&quot;&gt;\n &lt;label&gt;To Date&lt;/label&gt;\n &lt;div class=&quot;col-md-6&quot;&gt;\n &lt;input class=&quot;datepicker1&quot; type=&quot;text&quot; class=&quot;form-control @error('to') is-invalid @enderror&quot; name=&quot;to&quot; required=&quot;&quot;&gt;\n\n\nI used datepicker for the date, this would be a visualization of what I'm trying to achieve\n\nAlso by any means, if you have a better code or idea on how I can do this do share it your way it may probably be heaps better" ]
[ "mysql", "laravel", "laravel-5", "eloquent" ]
[ "in scripting bridge how can i send shortcut with 2 modifiers?", "I was trying to replicate \"take a screenshot shortcut\" (cmd+shift+3) via cocoa and scripting bridge\n\nSystemEventsApplication * sysEvent = [SBApplication applicationWithBundleIdentifier:@\"com.apple.systemevents\"];\n[sysEvent keyCode:20 using:SystemEventsEMdsCommandDown];\n\n\nbut i can't send more than one SystemEventsEMds to the method.\nIn applescript is as easy as\n\nkey code 20 using {command down, shift down}" ]
[ "objective-c", "cocoa", "scripting-bridge" ]
[ "Bootstrap Modal flashes/disappears instantly - ASP.NET gridview RowCommand", "Good morning everybody. I seem to be stuck between a rock and a hard place and fear I may be missing something incredibly simple. I am currently developing a webforms application using an ASP.NET GridView control. \n\nI have a bootstrap modal that is intended to display gridview row details through an ASP button on each row. I understand there are other posts on this topic but my issue seems to be a little different. \n\nThe button I use to toggle the bootstrap modal is in an asp control:\n\n&lt;asp:TemplateField HeaderText=\"Approval Information\"&gt;\n &lt;ItemTemplate &gt;\n &lt;asp:Button Text=\"Stats\" runat=\"server\" CommandName=\"ApprovalModal\" type=\"button\" class=\"btn btn-info\" OnClientClick=\"return false\" data-toggle=\"modal\" data-target=\"#myModal\"/&gt;\n &lt;/ItemTemplate&gt;\n&lt;/asp:TemplateField&gt;\n\n\nThis button can currently toggle my modal just fine. The problem is, I want to subscribe to the RowCommand event in GridView so I can change the text of the ASP Literal control in the modal to display Row stats for each individual row when clicked:\n\n protected void gvwApprovals_RowCommand(object sender, GridViewCommandEventArgs e)\n {\n if (e.CommandName == \"ApprovalModal\")\n {\n approvalModalText.Text = \"Some Unique Row Stats\";\n approvalModalText.Visible = true;\n }\n }\n\n\nThe only way I can subscribe to this event and have it fire is if I take out OnClientClick=\"return false\"\n\nHowever, if I take that out of the ASP button, I subscribe to the event, but then the bootstrap modal now just flashes and disappears. \n\nHere is my modal:\n\n&lt;!-- Modal --&gt;\n&lt;div class=\"modal fade\" id=\"myModal\" role=\"dialog\"&gt;\n &lt;div class=\"modal-dialog\"&gt;\n &lt;!-- Modal content--&gt;\n &lt;div class=\"modal-content\"&gt;\n &lt;div class=\"modal-header\" style=\"display: block;\"&gt;\n &lt;button type=\"button\" class=\"close\" data-dismiss=\"modal\"&gt;&amp;times;&lt;/button&gt;\n &lt;h4 class=\"modal-title\"&gt;Approval Information - Relevant Statistics&lt;/h4&gt;\n &lt;/div&gt;\n &lt;div class=\"modal-body\" &gt;\n &lt;asp:Literal ID=\"approvalModalText\" runat=\"server\" Text='placeholder' Visible=\"false\" /&gt;\n &lt;/div&gt;\n &lt;div class=\"modal-footer\"&gt;\n &lt;button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\"&gt;Close&lt;/button&gt;\n &lt;/div&gt;\n &lt;/div&gt;\n &lt;/div&gt;\n&lt;/div&gt;\n\n\nWhat am I missing here? Available to clarify any further questions. Fairly new to ASP controls in general, so I'm not sure if there's something super simple I might just be totally unaware of. \n\nEDIT: \n\nOf course there is a post that happens to fire the RowCommand which reloads the page and the modal disappears. Thanks to Alex for pointing it out to me in the comments (I knew it was something dumb and simple). Must use RegisterStartupScript in Row Command handler to show the modal rather than just doing a straight toggle. jQuery here I come." ]
[ "c#", "asp.net", "gridview", "webforms", "modal-dialog" ]
[ "Meteor.js connects to, but does not publish to, remote mongo server?", "So I'm connecting a develop mode instance of meteor to a remote mongo via the recommended method of including MONGO_URL::@: in order to have persistent collections for saving user state that will allow a user to come back later by loading what they had input into the app. I can see several connections from the meteor server on the mongo server.\n\nHowever, when running the app, no collections appear on the mongo server. Both \"Show Collections\" and db.getCollections() return nothing. \n\nIf I kill the app process and run meteor again without the remote connection, the collections appear just fine in the mongo instance that meteor starts.\n\nIs there something special I need to do in the code with meteor to properly push collections to the remote instance? (i.e. turn off auto publish)" ]
[ "node.js", "mongodb", "meteor" ]
[ "EAV within entity framework 4 and ddd", "Some tables in my database is designed using EAV concept. \nThen I use entities which are auto generated and represent \"static\" tables (not \"EAV\" tables) by ORM Entity Framework as DDD objects.\n\n\nHow can I use my \"EAV\" entities in object model (not in relational like in database) using Entity Framework?\n\n\nFor example,\nin the database I have static table Report and EAV tables which help me store ReportProperty for Report.\nIn domain model I want have Report like that: \n\nReport\n{\n ICollection&lt;ReportProperty&gt; ReportProperties{get;set;}\n}\n\n\nI can use Report entity which is generated by Entity Framework and in partial section\nrealise some logic in getter for retrieving data from my EAV tables to fill Collection ReportProperies. Then it begs the next question.\n\n\nWhat can I do if I decide use NHibernate instead Entity Framework, because i can`t use my partial section which i already realize using Entity Framework?\n\n\nIf I will be use DDD objects, which i can use for Entity Framework or NHibernate, it will be hardly for me, because I will need call mapping procedures in each procedures in my DAO." ]
[ "entity-framework-4", "domain-driven-design", "entity-attribute-value" ]
[ "How to successfully download the old version of lsmeans package", "I'd like to download version 2.26-3 of lsmeans package.\n\nAn error occurs when I try to download an old version of the lsmeans package. \nI've tried two options for downloading the old versions of lsmeans.\n\nOption 1) \n\npath&lt;- \"http://cran.r-project.org/src/contrib/Archive/lsmeans/lsmeans_2.26-3.tar.gz\"\ninstall.packages(path, repos=NULL, type=\"source\")\n\n\nOption 2)\n\nlibrary(devtools)\n install_version(\"lsmeans\", version = \"2.26-3\", dependencies=FALSE, repos = \"http://cran.rstudio.com/\")\n\n\nWhen I attempt either option, I am prompted to:\n\n\n \"These packages have more recent versions available. which would you\n like to update.\"\n\n\nIt then it lists a number of packages. I have attempted to choose both options \"all\" and \"none\" \n\nThe main error code I keep getting is this:\n\n\n Error: (converted from warning) unable to access index for repository\n http://glmmadmb.r-forge.r-project.org/repos/bin/windows/contrib/3.5:\n \n cannot open URL\n 'http://glmmadmb.r-forge.r-project.org/repos/bin/windows/contrib/3.5/PACKAGES'\n\n\nwhy does it direct me to this glmmadmb.r address which no longer exists. Any suggestions?" ]
[ "r", "rstudio", "cran", "lsmeans", "emmeans" ]
[ "How are binary floating points (IEEE 754) converted to decimal (i.e. to string)?", "It's possibly a very stupid question, but I've been searching for a whole day and I couldn't get an answer... \n\nLet's say I have a double-precision floating point literal: 5.21. Calling Double.toString( 5.21 ) in Java yields the string \"5.21\".\n\nNow, let's say we have Java, but without toString and valueOf, nor can I format it with String.format or just by concatenation. How would I be able to convert my number to a string, assuming that I only have the binary representation?\n\nMore specifically, how do Double.toString and dtoa exactly work: how can I write my own toString/dtoa function (assuming we're dealing with IEEE 754 double-precision floating points)?" ]
[ "floating-point", "precision", "tostring", "ieee-754" ]
[ "How can I launch the on-screen keyboard from my application on Vista and Windows 7", "I have a problem, I have an application which has a toolbar icon to launch the system onscreen keyboard. This all works fine with the exception of Windows Vista and Windows 7 beta. The UAC appears to be getting in the way and preventing the osk.exe from running.\n\nI have read that because it is used on the logon screen it will not prompt the user for authentication. If I turn the UAC off it works, however this is not an option as the customer wants it to run out of the box.\n\nIs there anything I can do to get around this?" ]
[ "c++", "qt", "visual-c++", "keyboard", "uac" ]
[ "ERROR in ./src/app/svg.component.ts Module not found: Error: Can't resolve './svg.component.svg'", "There is a live example from the official doc thats not working:\nhttps://angular.io/generated/live-examples/template-syntax/stackblitz.html\n\nThe live example error says:\nImport error, can't find file: ./svg.component.svg\n\nIf I download the example and npm install it, I got the error:\n\nERROR in ./src/app/svg.component.ts\nModule not found: Error: Can't resolve './svg.component.svg' in 'C:\\Users\\Elias\\Desktop\\New folder\\src\\app'\n\n\nThe svg.component.ts has this portion of code:\n\nimport { Component } from '@angular/core';\n@Component({\n selector: 'app-svg',\n templateUrl: './svg.component.svg',\n\n\nIt seems that the component is asking for an .svg file. I don't know how to get it." ]
[ "angular" ]
[ "Extracting tweets from a location based on profile in tweepy", "I'm developing a piece of code whereby I want to track a key word using the Twitter streaming API.\n\nObviously, when I track the key word I get global results. I'm aware you cant stream both key words and locations simulatiously due to the API parameter requirements.\n\nInstead I plan on only saving the streamed tweets which list their profile location as being in a certain city (London in this case).\n\nCurrently I'm trying the following\n\ndef on_status(self,status):\n try:\n locations=status.user.location\n if locations == ['London']:\n #Save to database\n else:\n pass\n\n\nHowever, this isn't saving any tweets which contain the profile location as London" ]
[ "python", "python-2.7", "twitter", "tweepy", "twitter-streaming-api" ]
[ "Load the main js-files while user login and we dont need them right now?", "I have a web application with a lot of graphic interfaces (charts, grids etc.). For that we have different solutions (Telerik, Syncfusiuon etc.) and got the best of every group of frameworks.\n\nIn total we have Javascript files of around 4 to 5MB and we can't reduce their size at the moment.\n\nI have a login page in which we don't need any of the frameworks.\nIs it possible to use the time while the user logs himself in and download the Javascript files into the browser cache using an async methodology in the background?" ]
[ "javascript" ]
[ "Creating dynamic folder with imacro", "I have a list of URLs for which I am taking screenshots with their respective domain names,now I want these screenshots to be stored in the folders with their respective domain names, which I want to be created dynamically, so is there any way to create a folder using imacro at runtime.\nFollowing is the piece of code which I am using \n\nvar iterations = prompt(\"Please enter total count of URLs\");\nvar file1 = prompt(\"Please enter file name of URLs\");\nfile1 = file1.concat(\".csv\");\nvar macro2 = \"\";\n\nmacro2 += \"CODE:\" + \"\\n\";\nmacro2 += \"VERSION BUILD=8920312 RECORDER=FX\" + \"\\n\";\nmacro2 += \"SET !ERRORIGNORE YES\" + \"\\n\";\nmacro2 +=\"WAIT SECONDS=2\" + \"\\n\";\nmacro2 +=\"SET !DATASOURCE {{f1}}\" + \"\\n\";\nmacro2 +=\"SET !DATASOURCE_LINE {{i}}\" + \"\\n\";\n\nmacro2 +=\"SAVEAS TYPE=PNG FOLDER=C:\\Users\\omkar.somji\\Documents\\iMacros\\Downloads\\{{!COL1}} FILE={{!COL1}}\" + \"\\n\";\n\nfor(var i=1; i&lt;=iterations ; i++){\n\niimSet('i', i );\niimSet('f1', file1 );\niimPlay(macro2);\n\n}\n\n\nThanking you in advance." ]
[ "javascript", "imacros" ]