texts
list | tags
list |
---|---|
[
"Apache mod_security and chat server",
"My website is hosted on a virtual server that runs Apache and Plesk. I would like to integrate a chat from livezilla.de on my website. The chat server runs on my server as well.\n\nTo secure my system, I have activated plesk_modsecurity. However, that particular module bans the IP address of each user of the chat because the chat pings the server quite frequently.\n\nIs it possible to (a) allow requests from the chat to the chat server and vice versa with no restriction while (b) any other requests are still handled by the module with the appropriate restrictions?\n\nOr would you recommend another solution?\n\nThe following list shows some of the errors raised by the modsecurity rules.\n\nMessage: Rule 7f7e7ac18c30 [id \"340159\"][file \"/etc/apache2/modsecurity.d/rules/tortix/modsec/50_plesk_basic_asl_rules.conf\"][line \"114\"] - Execution error - PCRE limits exceeded (-8): (null).\nMessage: Rule 7f7e7abb2c60 [id \"340157\"][file \"/etc/apache2/modsecurity.d/rules/tortix/modsec/50_plesk_basic_asl_rules.conf\"][line \"135\"] - Execution error - PCRE limits exceeded (-8): (null).\nApache-Error: [file \"apache2_util.c\"] [line 273] [level 3] [client XX.XXX.XX.XXX] ModSecurity: Rule 7f7e7ac18c30 [id \"340159\"][file \"/etc/apache2/modsecurity.d/rules/tortix/modsec/50_plesk_basic_asl_rules.conf\"][line \"114\"] - Execution error - PCRE limits exceeded (-8): (null). [hostname \"mydomain.tld\"] [uri \"/livezilla/server.php\"] [unique_id \"WzIClVXWzdsAABSrkdgAAAAE\"]\nApache-Error: [file \"apache2_util.c\"] [line 273] [level 3] [client XX.XXX.XX.XXX] ModSecurity: Rule 7f7e7abb2c60 [id \"340157\"][file \"/etc/apache2/modsecurity.d/rules/tortix/modsec/50_plesk_basic_asl_rules.conf\"][line \"135\"] - Execution error - PCRE limits exceeded (-8): (null). [hostname \"mydomain.tld\"] [uri \"/livezilla/server.php\"] [unique_id \"WzIClVXWzdsAABSrkdgAAAAE\"]\nApache-Handler: proxy:unix:///var/www/vhosts/system/mydomain.tld/php-fpm.sock|fcgi://127.0.0.1:9000\nStopwatch: 1530004117657831 96698593 (- - -)\nStopwatch2: 1530004117657831 96698593; combined=96528507, p1=2, p2=96528499, p3=2, p4=1, p5=3, sr=0, sw=0, l=0, gc=0\nProducer: ModSecurity for Apache/2.9.2 (http://www.modsecurity.org/); 201806211447.\nServer: Apache\nEngine-Mode: \"ENABLED\""
] | [
"apache",
"plesk",
"mod-security"
] |
[
"How to pass the values from the template as an argument to the function in views?",
"I want the input entered by user in the template to pass it as arguments to the function which is imported to views.py ..this is the part of that template.\n\n<form action=\"#\" method=\"post\">\n {% csrf_token %}\n Ratings: <input type=\"number\" name=\"rate\" step=\"0.1\" min=\"1\" max=\"5\"><br>\n <input type=\"submit\" value=\"Submit\" name=\"mybtn\">\n</form> \n\n\nThis is the function I have used to import the function and pass the values as arguments.\n\ndef request_page(request):\nusers_id = request.user.id + 671\nif (request.POST.get('mybtn')):\n updater.rate_movie(672, 6251, float(request.POST['rate']))"
] | [
"python",
"django",
"django-forms",
"django-templates",
"django-views"
] |
[
"I want to create a menu that shows 1. Client details, 2.Property details and 3. Exit",
"I want to create a menu that shows:\n\nClient details\nProperty details\nExit\n\n#include <stdio.h>\n#include <conio.h>\n \nvoid main() {\n char L,F,H;\n float CID,Aoc,Pte,Cost_per_sqft;\n int dicnt,age,ch;\n \n printf("Enter the Client ID\\n");\n scanf("%f", &CID);\n printf("Enter the age of client\\n");\n scanf("%f", &Aoc);\n\n if (age >=60) {\n printf("The client is eligible for a discount\\n");\n } else if (age<60) {\n printf("The client is not eligible for a discount\\n");\n } { \n printf("Select Porperty type\\nF=Flat\\nL=Land\\nH=House\\n");\n scanf("%f", &Pte);\n }\n\n printf("Please select the menu option\\n");\n printf("1.Client ID\\n");\n printf("2.Property details\\n");\n printf("3.Exit\\n");\n scanf("%d", &ch);\n\n switch(ch) {\n case 1:\n printf("Client ID %f", CID);\n printf("Age of client %f", Aoc);\n } \n}\n\n\nIt's not letting me enter the option to open a menu, also the age else is doesn't work because age => 60 is also showing not eligible for discount. The switch case doesn't work either."
] | [
"c"
] |
[
"jQuery custom plugin element counter",
"I am creating jQuery plugin which counts how many elements there are in the DOM.\n\nThis is what I have done so far.\n\njQuery Plugin\n\n$.fn.count = function(i) {\n return this.each(function() {\n ++i;\n return i;\n });\n}\n\n\nHTML\n\n<!DOCTYPE html>\n<html lang=\"en\">\n<body>\n <p>Sample text.</p> \n <p>Sample text.</p>\n <p>Sample text.</p> \n</body>\n</html>\n\n\nRunning the plugin\n\nconsole.log($(\"p\").count());\n\n\nError\n\n\n\nExpected Output\n\n3\n\n\nWhat am I missing in the plugin? Thanks in advance :)"
] | [
"jquery",
"jquery-plugins"
] |
[
"How to show data in gridview asynchronously in asp.net?",
"My code is properly work in desktop application show data asncrounsly\nin data gridview but when I use same code in web form it throws\nexception GridView1 was null. at\nGridView1.DataSource = table;.While\ndebugging data is completely working just want to put that data into\ngridview.What changes should i made to acheive my task.\n\n public partial class _Default : System.Web.UI.Page\n {\n public class NameAndScore\n {\n public string Name { get; set; }\n public string Score { get; set; }\n }\n public _Default()\n {\n\n InitTable();\n }\n DataTable table;\n HtmlWeb web = new HtmlWeb();\n\n private async Task<List<NameAndScore>> GameRankingsFromPage(int pagenum)\n {\n string url = \"https://www.ebay.com/sch/i.html?_nkw=xbox+one&_in_kw=1&_ex_kw=&_sacat=0&LH_Complete=1&_udlo=&_udhi=&_ftrt=901&_ftrv=1&_sabdlo=&_sabdhi=&_samilow=&_samihi=&_sadis=15&_stpos=&_sargn=-1%26saslc%3D1&_salic=1&_sop=12&_dmd=1&_ipg=50&_fosrp=1\";\n // string url = \"https://www.gamerankings.com/browse.html\";\n\n if (pagenum != 0)\n url = \"https://www.ebay.com/sch/i.html?_sacat=0&LH_Complete=1&_udlo=&_udhi=&_ftrt=901&_ftrv=1&_sabdlo=&_sabdhi=&_samilow=&_samihi=&_sadis=15&_stpos=&_sop=12&_dmd=1&_fosrp=1&_nkw=xbox+one&_pgn=\" + pagenum.ToString() + \"&_skc=50&rt=nc\";\n\n var doc = await Task.Factory.StartNew(() => web.Load(url));\n\n var namenodes = doc.DocumentNode.SelectNodes(\"//*[contains(@id,'item')]/h3/a\");\n var scorenodes = doc.DocumentNode.SelectNodes(\"//*[contains(@id,'item')]/ul[1]/li[1]/span\");\n var names = namenodes.Select(node => node.InnerText.Trim('\\r', '\\n', '\\t'));\n var scores = scorenodes.Select(node => node.InnerText.Trim('\\r', '\\n', '\\t'));\n\n\n if (namenodes == null || scorenodes == null)\n return new List<NameAndScore>();\n\n return names.Zip(scores, (name, score) => new NameAndScore() { Name = name.ToString(), Score = score.ToString() }).ToList();\n }\n protected async void Page_Load(object sender, EventArgs e)\n {\n int pageNume = 0;\n int id = 0;\n var rankings = await GameRankingsFromPage(0);\n while (rankings.Count > 0)\n {\n foreach (var ranking in rankings)\n table.Rows.Add(id++, ranking.Name, ranking.Score);\n GridView1.DataSource = table;\n GridView1.DataBind();\n pageNume++;\n rankings = await GameRankingsFromPage(pageNume);\n }\n\n }\n private void InitTable()\n {\n table = new DataTable(\"Xbox Prices\");\n table.Columns.Add(\"ID\", typeof(string));\n table.Columns.Add(\"Name\", typeof(string));\n table.Columns.Add(\"Score\", typeof(string));\n GridView1.DataSource = table;\n GridView1.DataBind();\n\n }\n }"
] | [
"c#",
"asp.net",
"asynchronous",
"async-await"
] |
[
"Instance not storing in my arrayList",
"I've created a method addImage in class ImageManager that creates an instance of Picture class and adds it to an ArrayList. When you add in image through the run class by using imageManager.addImage(\"title,image,\"Arizona\",\"a;ldkjsf;kasjdf\");\nit works just fine.\n\nBut when you add an image from the Parser class the images ArrayList in the ImageManager class loses the images created from the Parser class between calling the addImage method and the getImages method but doesn't lose the instance created through the MainViewController class. Why is it doing this and how do I fix it?\n\npublic class Run {\n public static void main(String[] args){\n Parser parser = new Parser();\n ImageManager imageManager = new ImageManager();\n imageManager.addImage(\"title\", \"location\",\"description\");\n parser.parsePictureData();\n imageManager.getImages();\n }\n}\n\npublic class Parser {\n\nImageManager imageManager = new ImageManager();\nDocument document;\n\npublic void parsePictureData() {\n try{\n readXMLFile();\n readImageFromDocument();\n }catch(IOException e){\n e.printStackTrace();\n } catch (ParserConfigurationException e) {\n e.printStackTrace();\n } catch (SAXException e) {\n e.printStackTrace();\n }\n}\n\nprivate void readXMLFile() throws IOException, SAXException, ParserConfigurationException {\n File file = new File(System.getProperty(\"user.dir\")+\"/src/\"+\"test.xml\");\n DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n DocumentBuilder builder = factory.newDocumentBuilder();\n document = builder.parse(file);\n}\n\nprivate void readImageFromDocument() {\n NodeList pictureNodes = document.getElementsByTagName(\"picture\");\n for(int i = 0; i<pictureNodes.getLength();i++){\n Node pictureNode = pictureNodes.item(i);\n if(pictureNode.getNodeType()==Node.ELEMENT_NODE){\n Element pictureElement = (Element) pictureNode;\n String location =pictureElement.getAttribute(\"location\");\n String imagePath = pictureElement.getElementsByTagName(\"path\").item(0).getTextContent();\n String title = pictureElement.getElementsByTagName(\"title\").item(0).getTextContent();\n String description = pictureElement.getElementsByTagName(\"description\").item(0).getTextContent();\n\n imageManager.addImage(title,location,description);\n }\n }\n}\n\n}\n\npublic class ImageManager {\n\nArrayList<Pictures> images = new ArrayList<>();\n\npublic void addImage(String title, String location, String description){\n Pictures newImage = new Pictures(title, location, description);\n images.add(newImage);\n System.out.println(\"1\"+images);\n}\n\npublic ArrayList<Pictures> getImages(){\n System.out.println(\"2\"+images);\n return images;\n}\n\n}\n\npublic class Pictures{\n\nprivate String title;\nprivate String location;\nprivate String description;\n\n\npublic Pictures(String title, String location, String description){\n this.title = title;\n this.location = location;\n this.description = description;\n}\n}"
] | [
"java"
] |
[
"FileNotFoundException ResourceManage::GetString C++/CLI",
"I have a MFC DLL with CLR enabled and using .Net v4.0 in VS2010 SP1. I have added a new managed resource file called ReportStrings.resx to the root of the project. I am using the code below to access the resources. No matter what I put in the ResourceManger constructor. I am getting a FileNotFoundException when rmResources->GetString(sKey) is called. The exception says \"Could not find file 'Report.resources'.\" I searched my application for any references to Report.resources and did not find any. Any help would be gretaly appreciated.\n\nThanks,\nJosh\n\npublic ref class ResourceGetter\n{\n static ResourceManager^ rmResources = gcnew ResourceManager(\"Report.ReportStrings\", Assembly::GetExecutingAssembly());\n\n public:\n static String^ GetResource(String^ sKey)\n {\n String^ sReturn = nullptr;\n String^ sTheme = String::Empty;\n\n try\n {\n sReturn = rmResources->GetString(sKey);\n }\n catch (Exception^ ex)\n {\n ex;\n }\n\n return (sReturn == nullptr) ? \"[\" + sKey + \" not found]\" : sReturn;\n }\n};"
] | [
".net-4.0",
"mfc",
"resources",
"c++-cli",
"managed"
] |
[
"Why getBoundingBox doesn't work on Windows?",
"the goal is to replace native Google Charts labels with icons. Doing:\ngoogle.visualization.events.addListener(chart, 'ready', function () {\n\n const chartLayout = chart.getChartLayoutInterface(),\n chartBounds = chartLayout.getChartAreaBoundingBox();\n\n for (let i = 0; i < chartData.getNumberOfRows(); i++) {\n\n console.log(chartLayout)\n\n const axisLabelBounds = chartLayout.getBoundingBox(`vAxis#0#label#${i}`),\n thumb = container.appendChild(document.createElement('img'));\n\n console.log(axisLabelBounds)\n\n thumb.src = chartData.getProperty(i, 0, 'icon');\n thumb.style.position = 'absolute';\n thumb.style.width = '16px';\n thumb.style.height = '16px';\n thumb.style.zIndex = '1';\n thumb.style.top = axisLabelBounds.top - 8 + 'px';\n thumb.style.left = axisLabelBounds.left - 25 + 'px';\n\n }\n});\n\nchart.draw(chartData, getBarChartOptions({\n title: null\n})) \n\nIt works great on macOS and Linux:\n{left: 36.75, top: 111.890625, width: 0.25, height: 277.21875}\nBut not on Windows:\n{left: 0, top: 0, width: 0, height: 0}\nSame browser, the latest Chrome. Any ideas?\nThanks a lot!"
] | [
"javascript",
"windows",
"google-chrome",
"svg",
"google-visualization"
] |
[
"Is it a bad practice to pass sqlalchemy query as an argument to a function?",
"Is it a bad practice to pass sqlalchemy query as an argument to a function? In my program i am pre processing some data by executing some queries and storing the results in the form of dictionary. In order to reduce the size of the dictionary i can pass the main query, create it into a sub query and filter out the pre processing queries so that the dictionary size is reduced. Is it advisable to do so?\n\nEDIT: The reason i want to do this is because i want to reduce the number of queries to psql. Suppsose, i want to store the data in a dictionary in Table2 in the following sample code:\n\ndef func1(filters_1, filters_2):\n q=apply_filter(session.query(Table1.id),filters_1)\n q=apply_filter(q,filters_2)\n result_dict = func2(q)\n # Use the values in dictionary.\n\n\ndef func2(q):\n result_dict=dict()\n q=q.subquery()\n q_func2 = session.query(Table2).filter(Table2.device_id==q.c.id)\n for i in q_func2.all()\n result_dict[i.name] =i.data\n return result_dict"
] | [
"python",
"sqlalchemy",
"flask-sqlalchemy"
] |
[
"Java 8/Javascript (Nashorn) long interoperatiblity",
"The following Javascript code executed in Java 8 (Nashorn) does not behave as expected :\n\nif( a != b )\n{\n do_sth();\n}\n\n\na and b are long values coming from Java object (e.g., 1023948, 1023949). For example, when a = 1023949 and b = 1023949, a != b is true. \n\nNote that the following code works fine:\n\nif( (a+0) != (b+0) )\n{\n do_sth();\n}\n\n\nI know about long precision issue (as Javascript numbers are 64 doubles) but I was expecting that \"small\" long values should work.\n\nAny input is appreciated. Thx."
] | [
"javascript",
"java",
"nashorn"
] |
[
"SwiftUI's ForEach crashes when array's element is removed",
"I try to lay out my UI elements in rows - two elements in a row, for that I use two ForEach, one for rows and one for elements in a row. Each UI element has @Binding so I pass a structure from my model's array. I should be able to add or remove the elements dynamically and everything works except one thing - when I remove the only element from a row my app crashes with error Fatal error: Index out of range: file Swift/ContiguousArrayBuffer.swift, line 444. I have read several topics on SO but I haven't found an answer.\nThis is how my code looks like:\nstruct PickerElement: Hashable {\n let id: Int\n let title: String\n let value: Int\n}\n\nstruct CellModel: Hashable {\n var element: PickerElement?\n var error: String?\n}\n\nstruct PickerButton: View {\n @Binding var value: CellModel?\n @Binding var error: String?\n\n (...)\n}\n\nclass MyModel: ObservableObject {\n\n @Published var counter = 0\n @Published var cellModels = [CellModel]()\n\n private var cancellables = Set<AnyCancellable>()\n\n $counter.sink { value in\n let diff = value - self.cellModels.count\n \n if diff > 0 {\n self.cellModels.append(contentsOf:\n Array(repeating: CellModel(), count: diff)\n )\n } else if diff < 0 {\n self.cellModels = Array(\n self.cellModels.prefix(value)\n )\n }\n }.store(in: &cancellables)\n\n}\n\nstruct MyView: View {\n @ObservedObject var model: MyModel\n \n var body: some View {\n VStack(spacing: 8) {\n layOutElements()\n }\n }\n\n @ViewBuilder\n func layOutElements() -> some View {\n let elementsCount = model.cellModels.count\n \n if elementsCount > 0 {\n VStack {\n HStack {\n Spacer()\n Text("Some title").font(.caption)\n Spacer()\n }.padding()\n\n // count number of rows\n let rowsCount = Int(ceil(Double(elementsCount) / 2.0))\n\n // lay out rows\n ForEach(0 ..< rowsCount, id: \\.self) { rowIndex in\n layOutRow(rowIndex: rowIndex,\n elementsCount: elementsCount,\n rowsCount: rowsCount)\n }\n }\n }\n }\n\n@ViewBuilder\nprivate func layOutRow(rowIndex: Int, elementsCount: Int, rowsCount: Int) -> some View {\n HStack(alignment: .top, spacing: 8) {\n let firstCellInRowIndex = rowIndex * 2\n let lastCellInRowIndex = min(elementsCount - 1, firstCellInRowIndex + 1)\n\n ForEach(firstCellInRowIndex ... lastCellInRowIndex, id: \\.self) { elementIndex in\n PickerButton(value: $model.cellModels[elementIndex].element, // <--- *1\n error: $model.cellModels[elementIndex].error) // <--- *2\n }\n\n // *1 , *2 - if I changed the lines and pass dummy bindings (not array's elements) there, the code would work without any glitches\n\n if rowIndex == rowsCount - 1 && !elementsCount.isMultiple(of: 2) {\n Spacer()\n .frame(minWidth: 0, maxWidth: .infinity)\n }\n }\n}\n\nIf I change a value of @Published var counter = 0 everything works properly, views are added and removed, but while decrementing if SwiftUI tries to remove the last remaining element from a row the app crashes. As I have commented in the code above, if I don't bind PickerButton to the structures from my model's array, the app doesn't crash. How to fix this issue? (I need to use indexes because I have to count rows and cells in a row)"
] | [
"swift",
"swiftui"
] |
[
"Change the width of the indicator in UITextView",
"I'm facing a strange request by my client.\n\nHe want's the indicator inside the UITextField to be thiner. Can i change the indicator width? is this thing even possible?\n\nThanks,"
] | [
"ios",
"objective-c",
"uitextfield",
"indicator"
] |
[
"JQuery: content loading doesn't wait for animation to be finished",
"$(\"#clickme\").click(\n function(){\n $(this).slideToggle(1000);\n $(this).load(\"MYTEXT.txt\");\n $(this).slideToggle(1000);\n } \n )\n\n\nI want the new content of my HTML element to be displayed ONLY after the first animations is finished. What happens in this code is, it first slides up, and slides down with new content, but the new content is shown before the slide up effect is done!\n\nHow can I fix this?"
] | [
"jquery",
"load",
"slidetoggle"
] |
[
"Is possible get a table from another server(Mysql) in my table(Sql)?",
"I have 2 connections in my project and I need get a table from database dbservermysql in my table in dbserversql. Are 2 databases from 2 differents server. This is possible with Cakephp 3.8?\n\nI tried:\n\n$result = $this->VacancyControl->find('search', ['search' => $filter])\n ->select(['user' => 'b.NAME'])\n ->join([\n 'b' => [\n 'table' => 'BUser',\n 'type' => 'LEFT',\n 'conditions' => 'b.ID = VacancyControl.user_id',\n ]);\n\n\nVacancyControl come from the database dbserversql and BUser come from dbservermysql.\nWhen I call in postman get->http://localhost/api/BUser I got my response normally. \nBut when I call get->http://localhost/api/VacancyControl i got this error: Error: SQLSTATE[42S02]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Invalid object name 'BUser&#039\n\nMy connections:\n\n...\n'dbservermysql ' => [\n 'className' => 'Cake\\Database\\Connection',\n 'driver' => 'Cake\\Database\\Driver\\Mysql',\n 'host' => '...',\n 'username' => '...',\n 'password' => '....',\n 'database' => 'dbservermysql ',\n 'persistent' => false,\n 'encoding' => 'utf8',\n ],\n 'dbserversql ' => [\n 'className' => 'Cake\\Database\\Connection',\n 'driver' => 'Cake\\Database\\Driver\\Sqlserver',\n 'persistent' => false,\n 'host' => '...',\n 'username' => '....',\n 'password' => '....',\n 'database' => 'dbserversql ',\n 'timezone' => 'UTC',\n 'flags' => [],\n 'cacheMetadata' => true,\n 'quoteIdentifiers' => false,\n 'log' => false,\n 'url' => env('DATABASE_TEST_URL', null)\n ],\n...\n\n\nIs possible get BUser in VacancyControl? If yes, how can I do this?"
] | [
"mysql",
"sql",
"cakephp-3.x"
] |
[
"how to use OCaml's Cohttp library to make a HTTPS request",
"How can I use the Cohttp library to GET a URL over HTTPS?\n\nHere is the code I'm trying to use:\n\nopen Lwt\nopen Cohttp\nopen Cohttp_lwt_unix\n\nlet url = \"https://google.com\"\n\nlet do_request =\n Client.get (Uri.of_string url) >>= fun (resp, body) ->\n body |> Cohttp_lwt.Body.to_string\n\nlet run () =\n let body = Lwt_main.run do_request in\n print_endline (\"Received body\\n\" ^ body)\n\n\nWhen I run this, I get the following error:\n\nFatal error: exception (Failure \"Ssl not available\")\n\n\nHow can I enable SSL when using Cohttp?\n\nAlso, as a bonus question, how should I have been able to figure this out without resorting to asking here? Is there some sort of Cohttp documentation I have missed?\n\n\n\n@antron asked the question below, \"Do you have the ssl library installed?\"\n\nI do have the ssl library installed:\n\n$ opam list ssl\n# Available packages for 4.05.0:\nssl 0.5.3 Bindings for OpenSSL\n\n\nHowever, I'm not sure if this is relevant, but my cohttp package doesn't show a depends on ssl:\n\n$ opam info --field depends cohttp\nbase-bytes & jbuilder >= 1.0+beta10 & re & uri >= 1.9.0 & fieldslib & sexplib & ppx_fields_conv >= v0.9.0 & ppx_sexp_conv >= v0.9.0 & stringext & base64 >= 2.0.0 & magic-mime & fmt & logs & jsonm\n\n\n\n\nI'm running on Arch Linux with OCaml version 4.05.0, installed through opam switch.\n\nJust in case, here is the jbuild file I'm using:\n\n(jbuild_version 1)\n\n(executables\n((names (main))\n (libraries (cohttp cohttp-lwt-unix core lwt))))\n\n(install\n((section bin)\n (files ((main.exe as my_example_prog)))))\n\n\nI am running jbuilder like the following. I get no errors when compiling:\n\n$ jbuilder build @install\n\n\nI am running the my_example_prog executable like the following:\n\n$ _build/install/default/bin/my_example_prog\nFatal error: exception (Failure \"Ssl not available\")\n\n\nYou can find the full OCaml project I'm using here."
] | [
"ssl",
"https",
"ocaml",
"ocaml-dune"
] |
[
"Ruby on Rails: Data gather from blogsites",
"This is a very broad question, so please bear with me.\n\nI wanted to create an app that gets data from another website, specifically medium.com. However, I don't think medium has an API.\n\nSpecifically, what I wanted to achieve is to search the medium.com of articles that has 500 or more likes, or perhaps one that has 50 or more responses (comments). I wanted to do it with ruby on \nHow do you think I can do that? Please if you know how, point me in the right direction. Thank you in advance :)"
] | [
"ruby-on-rails",
"ruby"
] |
[
"How to create sub account in Oracle SQL",
"after logging in with the account system\nI created an oracle account in this way\n\nCREATE USER ExampleAdmin IDENTIFIED by oracle \nDEFAULT TABLESPACE USERS TEMPORARY \n\nTABLESPACE TEMP QUOTA 24M ON USERS PROFILE DEFAULT;\nGRANT ALL PRIVILEGES TO ExampleAdmin;\n\n\nand after logging in with the new account, I created the structure of my database with the related tables, views, triggers, procedures and etc.\n\nnow i'm trying to create a sub account that has the possibility to access only some created tables and i tried like this:\n\nCREATE ROLE Bar;\nGRANT CONNECT, CREATE SESSION TO Bar;\nGRANT SELECT ON TableExample1 TO Bar;\nGRANT SELECT, INSERT, UPDATE ON TableExample2 TO Bar;\nCREATE USER BAR1 IDENTIFIED BY bar;\nGRANT Bar TO BAR1;\n\n\nand it gave me no error in the compilation.\nBut when I try a select from table TableExample1, it tells me that the table does not exist.\nWhere am I wrong?\nThanks"
] | [
"sql",
"oracle",
"roles",
"privileges"
] |
[
"Python executable file created by Pyinstaller shows import error in another computer",
"I have created a python exe file using pyinstaller. It works fine in my mac, though it creates multiple warning in warn-.txt file in build directory. When I try to run the exe file in another mac it shows me ModuleNotFoundError: No module named 'pyimod03_importers'. In my warn-.txt file, this modules is also missing. I have tried to add the module in .spec file. But nothing has changed. It will be appreciated if someone can help me with this problem. Thanks in advance.\nHere is my .spec file:\nblock_cipher = None\n\n\na = Analysis(['cli.py'],\n pathex=['/Users/*******/Documents/testPipeline'],\n binaries=[],\n datas=[],\n hiddenimports=['pyimod03_importers','numpy.random.randn'],\n hookspath=['pyimod03_importers'],\n runtime_hooks=[],\n excludes=[],\n win_no_prefer_redirects=False,\n win_private_assemblies=False,\n cipher=block_cipher,\n noarchive=False)\npyz = PYZ(a.pure, a.zipped_data,\n cipher=block_cipher)\nexe = EXE(pyz,\n a.scripts,\n a.binaries,\n a.zipfiles,\n a.datas,\n [],\n name='cli',\n debug=False,\n bootloader_ignore_signals=False,\n strip=False,\n upx=True,\n upx_exclude=[],\n runtime_tmpdir=None,\n console=True )\n\nThis is the error I have got during running the exe in another pc."
] | [
"python",
"pyinstaller",
"executable"
] |
[
"How to troubleshoot empty /var/log/secure /var/log/messages etc log on linux",
"Today(2016-12-14), i login my vps and cat /var/log/secure /var/log/messages, but all these log files are empty except *-20161211. I don't know what happen. How to fix it? I need help, thanks!\n\nHere is my screenshot.\n\n\nWhen i cat /var/log/fail2ban-20161211 it shows, but secure log was end up by 2016-12-08\n\n\nHere is my config\n\n\nrsyslog is also running."
] | [
"linux",
"centos7",
"syslog",
"rsyslog"
] |
[
"Force Android Studio to show light bulb",
"Say I type the following field \n\nfield = \"I am field\";\n\n\nIn Eclipse as soon as I place the mouse on field it shows me a list of options from which I can select create local variable field. \n\nIn Android Studio, the lightbulb is a headache for me. Sometimes it appears quickly, sometimes it takes forever to appear. \n\n\n\nIs there a way to force it to appear?"
] | [
"android",
"android-studio",
"code-completion"
] |
[
"Not in union [\"null\",\"int\"] Avro Format org.apache.avro.UnresolvedUnionException",
"I have a java program which writes data from Oracle db in avro format. I am getting this exception on a date column while writing \n\norg.apache.avro.file.DataFileWriter$AppendWriteException: org.apache.avro.UnresolvedUnionException: Not in union [\"null\",\"int\"]: 2020-04-01\n\nI am using avro 1.9.2 version. Below is the schema :\n\n{\n \"type\": \"record\",\n \"name\": \"some\",\n \"doc\": \"SOME\",\n \"namespace\": \"some.avro\",\n \"fields\": [\n {\n \"name\": \"SOME_DATE\",\n \"type\": [\n \"null\",\n \"int\"\n ],\n \"logicalType\": \"date\",\n \"default\": null\n }\n..\n\n ]\n}\n\n\nWhen I use below schema with string it works fine.\n\n{\"name\":\"SOME_DATE\",\"type\": [\"null\",\"string\"]}"
] | [
"java",
"oracle",
"avro",
"spark-avro",
"jackson-dataformat-avro"
] |
[
"Export data as a csv attachment",
"Hi all I want to export all the data from a custom object as CSV and send it as an email attachment using APEX.\nIs this possible?"
] | [
"salesforce",
"apex-code",
"visualforce",
"apex"
] |
[
"AngularJS Cannot find a differ supporting object '[object Object]' of type 'object' and Parse Query",
"So when I try to take my data from my parse query and put it in my array I end up with this error Cannot find a differ supporting object '[object Object]' of type 'object'. My Code for the Html and ts file are below. And my model file is also below. Is there a better way to display this data in the list?\n\nHtml:\n\n<ion-header>\n\n<ion-navbar>\n<ion-title button-right>Trade</ion-title>\n <ion-buttons end>\n <button ion-button icon-only (click)=\"addTrade()\">\n <ion-icon name=\"add\"></ion-icon>\n </button>\n</ion-buttons>\n</ion-navbar>\n\n</ion-header>\n<ion-content>\n<ion-searchbar (ionInput)=\"getItems($event)\"></ion-searchbar>\n <ion-list [virtualScroll]=\"items\"> \n <ion-item *virtualItem=\"let item\">\n {{ item.offering }} {{item.needs}} \n </ion-item>\n</ion-list>\n</ion-content>\n\n\nand my ts file\n\nimport { Component } from '@angular/core';\nimport { NavController, NavParams, AlertController } from 'ionic-angular';\nimport { Items} from \"../../trade-model\";\nvar Parse = require('parse');\n\n/*\nGenerated class for the Trade page.\n\nSee http://ionicframework.com/docs/v2/components/#navigation for more info on\nIonic pages and navigation.\n*/\n@Component({\nselector: 'page-trade',\ntemplateUrl: 'trade.html'\n })\nexport class TradePage {\nsearchQuery: string = ''\nitems: Items ={\noffering: [],\nneeds: []\n\n}\n\n\nconstructor(public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController) {\n\nParse.initialize('blankedout','unused', \"blankedout\");\nParse.serverURL = 'blankedout';\n\n\n}\nionViewWillEnter(){\nthis.initializeItems()\n}\n\nionViewWillLeave(){\n\n}\ninitializeItems() {\nvar this_ref = this\nvar Trade = Parse.Object.extend(\"Trade\")\nvar query = new Parse.Query(Trade);\nquery.find({\n success: function(trades) {\n for (var i = 0; i < trades.length; i++) {\n this_ref.items.offering = trades[i].get(\"offer\")\n this_ref.items.needs = trades[i].get(\"wants\")\n }\n }\n});\n}\n}\n\n\nThis is the template/interface\n\nexport interface Items{\noffering: string[];\nneeds: string[]; \n}"
] | [
"angularjs",
"parse-platform",
"ionic2"
] |
[
"How to access cross region resources in Cloudformation",
"I have a static website stack that I deploy to us-east-1. I only need the s3 bucket to be deployed in the eu-west-1 region, so to achieve this I used Stack Sets like this;\n StackSet:\n Type: AWS::CloudFormation::StackSet\n Properties:\n Description: Multiple S3 buckets in multiple regions\n PermissionModel: SELF_MANAGED\n \n StackInstancesGroup:\n - DeploymentTargets:\n Accounts:\n - !Ref "AWS::AccountId"\n Regions: \n - eu-west-1\n \n StackSetName: !Sub "AppBucketStack"\n TemplateBody: |\n AWSTemplateFormatVersion: 2010-09-09\n Description: Create a S3 bucket\n Resources:\n WebsiteBucket:\n Type: AWS::S3::Bucket\n DeletionPolicy: Retain\n UpdateReplacePolicy: Retain\n Properties:\n BucketName: !Join\n - ''\n - - ameta-app-\n - !Ref 'AWS::Region'\n - '-'\n - !Ref 'AWS::AccountId'\n AccessControl: Private\n CorsConfiguration:\n CorsRules:\n - AllowedHeaders:\n - "*"\n AllowedMethods:\n - GET\n - POST\n - PUT\n AllowedOrigins:\n - "*"\n MaxAge: 3600\n WebsiteConfiguration:\n IndexDocument: index.html\n ErrorDocument: 404.html\n Tags:\n - Key: Company\n WebsiteBucketPolicy:\n Type: AWS::S3::BucketPolicy\n Properties:\n Bucket: !Ref 'WebsiteBucket'\n PolicyDocument:\n Version: '2012-10-17'\n Statement:\n - Action:\n - s3:GetObject\n Effect: Allow\n Resource: !Join\n - ''\n - - 'arn:aws:s3:::'\n - !Ref 'WebsiteBucket'\n - /*\n Principal:\n CanonicalUser: !GetAtt OriginAccessIdentity.S3CanonicalUserId\n\nHowever now I need to address the bucket's domain name(!GetAtt WebsiteBucket.DomainName) in cloudfront which is being deployed in us-east-1. It seems that I can't use the output of the StackSet since the resources are different regions.\nDo you guys have any suggestions?"
] | [
"amazon-web-services",
"amazon-s3",
"amazon-cloudformation",
"amazon-cloudfront"
] |
[
"'rescue in rbuf_fill': Timeout::Error (Timeout::Error)",
"Same script different error. This might be related more to my network instead of my code. The script is as follows:\n\n#!/usr/bin/env ruby -rubygems\n\nrequire File.join(File.dirname(__FILE__), 'authentication')\n\nrequire \"csv\" # faster_csv (ruby 1.9)\n\nlines = CSV.read(File.join(File.dirname(__FILE__), 'karaoke.csv')) # Exported an Excel file as CSV\n\nlines.slice!(0) # remove header line\n\ncollection = StorageRoom::Collection.find('collection ID')\nSong = collection.entry_class\n\nlines.each do |row|\n karaoke = Song.new(:artist => row[0], :song => row[1], :genre => row[2], :file => StorageRoom::File.new_with_filename(\"#{karaoke.artist}#{karaoke.song}.mov\"))\n\n if karaoke.save\n puts \"Song saved: #{karaoke.artist}, #{karaoke.song}, #{karaoke.genre}\"\n else\n puts \"Song could not be saved: #{karaoke.errors.join(', ')}\"\n end\nend\n\n\nAnd the error is:\n\n/usr/local/lib/ruby/1.9.1/net/protocol.rb:140:in `rescue in rbuf_fill': Timeout::Error (Timeout::Error)\nfrom /usr/local/lib/ruby/1.9.1/net/protocol.rb:134:in `rbuf_fill'\nfrom /usr/local/lib/ruby/1.9.1/net/protocol.rb:116:in `readuntil'\nfrom /usr/local/lib/ruby/1.9.1/net/protocol.rb:126:in `readline'\nfrom /usr/local/lib/ruby/1.9.1/net/http.rb:2219:in `read_status_line'\nfrom /usr/local/lib/ruby/1.9.1/net/http.rb:2208:in `read_new'\nfrom /usr/local/lib/ruby/1.9.1/net/http.rb:1191:in `transport_request'\nfrom /usr/local/lib/ruby/1.9.1/net/http.rb:1177:in `request'\nfrom /usr/local/lib/ruby/1.9.1/net/http.rb:1170:in `block in request'\nfrom /usr/local/lib/ruby/1.9.1/net/http.rb:627:in `start'\nfrom /usr/local/lib/ruby/1.9.1/net/http.rb:1168:in `request'\nfrom /usr/local/lib/ruby/gems/1.9.1/gems/httparty-0.8.1/lib/httparty/request.rb:73:in `perform'\nfrom /usr/local/lib/ruby/gems/1.9.1/gems/httparty-0.8.1/lib/httparty.rb:391:in `perform_request'\nfrom /usr/local/lib/ruby/gems/1.9.1/gems/httparty-0.8.1/lib/httparty.rb:359:in `post'\nfrom /home/hanleyhansen/Desktop/thriventures-storage_room_gem-f7015ed/lib/storage_room/model.rb:69:in `block (2 levels) in create'\nfrom /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:403:in `_run__3801264735883484179__create__2558870880708463764__callbacks'\nfrom /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'\nfrom /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_create_callbacks'\nfrom /home/hanleyhansen/Desktop/thriventures-storage_room_gem-f7015ed/lib/storage_room/model.rb:68:in `block in create'\nfrom /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:403:in `_run__3801264735883484179__save__2558870880708463764__callbacks'\nfrom /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'\nfrom /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'\nfrom /home/hanleyhansen/Desktop/thriventures-storage_room_gem-f7015ed/lib/storage_room/model.rb:67:in `create'\nfrom /home/hanleyhansen/Desktop/thriventures-storage_room_gem-f7015ed/lib/storage_room/model.rb:61:in `save'\nfrom import_csv.rb:17:in `block in <main>'\nfrom import_csv.rb:14:in `each'\nfrom import_csv.rb:14:in `<main>'\n\n\nI'm interested in learning why this error occurred as well as the solution. Thanks in advance!"
] | [
"ruby"
] |
[
"Webpack Lazy Loading with Typescript",
"I have a problem with lazy loading and webpack.\n\nThere is a video of Sean Larkin showing how easy it is with webpack 4 to create a lazy loaded bundle (Here). But when I try to do it with typescript I run into some problems.\n\nindex.ts\n\nexport const someThing = something => import(\"./lazy/lazy\");\n\n\nand\n\nlazy/lazy.ts\nexport default \"I am lazy\";\n\n\nwhen I run it without any webpack configuration and name the files to \".js\" I get a main chunk and a small chunk for the lazy loaded module.\n\nBut when I run it as \".ts\" files with a simple webpack configuration I get just the \"main.js\" file and no extra chunk.\n\nwebpack.config.js\nlet config = {\n resolve: {\n extensions: [\".ts\", \".js\"]\n },\n module: {\n rules: [\n { test: /\\.ts$/, use: [\"ts-loader\"], exclude: /node_modules/ },\n ]\n },\n}\n\nmodule.exports = config;\n\n\nand\n\ntsconfig.json\n{\n \"compilerOptions\": {\n \"module\": \"commonjs\",\n \"target\": \"es5\",\n \"noImplicitAny\": false,\n \"sourceMap\": true,\n \"lib\": [ \"es6\", \"dom\" ],\n \"removeComments\": true\n }\n}\n\n\nIs there something to configure I am mission? \nWhat exactly is the difference between the import of a \"js\" file to a \"ts\" file?"
] | [
"typescript",
"webpack",
"webpack-4"
] |
[
"Best practice to handle aws s3 presigned URL expiration date",
"I'm saving images to my s3 bucket, generate a presigned URL and save that as a field in my model schema. When my frontend retrieves the model objects from the backend it uses that URL to retrieve the images.\n\nThe max expiration date you can set with v4 is 7 days. So what is the best practice to handle the \"refreshing\" of those URLs?\n\nThings I thought about:\n\n\nHaving a cron job in my backend that checks every e.g. every 24 hours if I have any URLs going invalid within the next 24h and generate a new one in case.\nChecking it everytime I receive a GET request and re-generate if it's invalid\nNot checking at all on the backend, and just try to the hit the URL on the frontend and if I get a 403 to then request the re-generation from the backend. I don't like this idea that much though as I couldn't simply use \"/> but have to wrap it in some other logic."
] | [
"javascript",
"amazon-web-services",
"amazon-s3",
"pre-signed-url"
] |
[
"CSS Image within div will not change sizes",
"I have two divs on my page, and between the two div's I have an image. Let me further explain...\n\nDiv 1 - This is the page's container.\nDiv 2 - Holds a few lines of text\nImage - Just an ordinary jpeg image I want to format.\n\nDiv 2 takes up 40% of my page starting from the page's left border. It stretches very far down my page. So, this leaves around 60% of my page left to work with. I want for my image to be 200px wide, and 110px in height. For one reason or another, my image just appears on the bottom of my page in it's original (pre-format) width and height. I will show you the code that I am using.\n\n HTML: \n\n<div id=\"container\">\n\n <div id=\"div2\">\n <p> Hi SO, I hope someone can help me with this issue! </p>\n </div>\n\n <img id=\"image1\" src=\"test.jpg\" alt=\"\" />\n\n</div>\n\n\n CSS: \n\n#image1{\n width:200px;\n height:100px;\n position:relative;\n float:right;\n}\n\n\nTo recap, I want the image 'image1' to be aligned between the left edge of 'div2' and the page's right border. So, I want it centered between the two but NOT centered on my page of course."
] | [
"html",
"css",
"image"
] |
[
"Java. How to make Jtable specific cell not selectable?",
"OK since Im making room renting app and Jtable brings me confusion I need your help. When certain room is selected my Jtable should be updated to not let user select cell which contains day of taken room. So somehow I need to make certain cell non selectable by passing rowindex and columnindex. How do I do this?"
] | [
"java",
"swing",
"jtable"
] |
[
"Powershell stops working when using -ea with Add-PSSnapin",
"i just encountered this strange behaviour:\n\nThe following line causes powershell to stop working:\n\nAdd-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -Erroraction Silentlycontinue\n\n\nwhile the following works fine:\n\nAdd-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010\n\n\nThis is the problem signature found in the Eventviewer:\n\n\n P1: powershell.exe\n \n P2: 6.3.9600.17090\n \n P3: System.NullReferenceException\n \n P4: System.TypeInitializationException\n \n P5: unknown\n \n P6: oft.Exchange.Diagnostics.SystemTraceControl.Update\n \n P7: unknown\n\n\nDoes anyone have a clue why this happens? The system runs on Server 2012R2\n\nThanks in advance"
] | [
"powershell",
"powershell-4.0"
] |
[
"Translating Lightbend activator to sbt",
"I'm trying to work through the book Reactive Web Applications, but it seems that it's already a bit out of date in that lightbend activator has been EOL'd so I can't download it (or at least can't figure out how to and probably shouldn't even if I could). \n\nI'm faced with the problem of creating the new project, which in the book would be done via the command \n\nactivator new twitter-stream play-scala-2.4\n\n\nI tried what I though was the equivalent sbt command but got the following error. \n\nurban:playground dhosek$ sbt new playframework/play-scala-seed.g8\n[info] Set current project to playground (in build \nfile:/Users/dhosek/playground/)\n[error] Not a valid command: new (similar: set)\n[error] Not a valid project ID: new\n[error] Expected ':' (if selecting a configuration)\n[error] Not a valid key: new (similar: name, run, runner)\n[error] new\n[error] ^\n\n\nAny help?"
] | [
"sbt",
"typesafe-activator"
] |
[
"Webdriver typing very slow in IE11 and Windows 10",
"While executing testcases the characters are getting typed very slow.\nI am using Windows10 + Selenium 2.39 + IE 11 + IEDriverServer(64bit), tried replacing it with 32 bit also but to no avail.All security zones setting are checked and have tried all available resources online.Any solutions or shall i downgrade the OS to windows 7(as it was working fine on win7)."
] | [
"selenium",
"webdriver",
"iedriverserver"
] |
[
"Change query to sum or aggregate data",
"I have a SQL query that is working fine, but I now need to change it up to sum up the data and I'm not sure how to go about it -\n\nSELECT store, tintermodel, tinterserial, eventdetails, trunc(datetime), COUNT(*)\nFROM tinter_events\nWHERE tintermodel = 'FM 8000DE' \nAND (datetime >= to_timestamp('2017-05-01', 'YYYY-MM-DD') \nAND datetime < to_timestamp('2017-08-31', 'YYYY-MM-DD'))\nAND function = 'Set Colorant Level'\nAND eventdetails IN ('R3[128]', 'G2[128]', 'W1[345]', 'Y3[512]', 'N1[185]', \n'R4[128]', 'L1[128]', 'B1[550]', 'B1[512]', 'Y1[128]', 'R2[185]')\nGROUP BY store, tintermodel, tinterserial, eventdetails, trunc(datetime) \nHAVING COUNT(*) > 1\nORDER BY store, tinterserial, eventdetails, trunc(datetime);\n\n\nWhat this does is gives me a count of any date a specific model (by serial number) is filled (\"set colorant level\") more than once in a day. This gives me a display for each date this happens. \n\nBut now I need to sum it up by store for each colorant total (aka SUBSTR(eventdetails,1,2)). In other words, have a list of the stores on the left and a column for each colorant with just a total of number of days that each colorant was filled more than once. \n\nI'm not sure how to handle that since I've already got a count going to give me only occurrences where a colorant was filled more than once a day on a specific model/serial. Some sort of SUM/SUMIF perhaps? Or a sub-select?"
] | [
"sql",
"sum",
"having"
] |
[
"Maven is not showing the arguments for parameterized tests, what could be wrong?",
"The tests appear to be running fine (well some are failing, but they're running), but the log isn't showing me the parameters, why?\n@ExtendWith( SpringExtension.class )\n@ContextConfiguration(\n locations = {\n "classpath:spring/testContext.xml",\n "classpath:applicationContext-mock.xml"\n } )\n@Transactional\n@ActiveProfiles( Profiles.TEST )\n@Category( IntegrationTest.class )\npublic abstract class AbstractDalTestBase {\n\n @ParameterizedTest\n @ArgumentsSource(LetterSearchWithFilterAndPagingForHCPCSCodeArguments.class)\n public void letterSearchWithFilterAndPagingForHCPCSCode(String searchTerm, int expected) {\n List<?> results = findMatchingItemsWithFilterAndPaging(searchTerm, CatalogItemType.HCPCSCODE, 0, 0, null);\n int projection = loadTotalNumberOfItems(searchTerm, CatalogItemType.HCPCSCODE);\n assertThat(projection).as("projection eq results").isEqualTo(results.size());\n assertThat(projection).as("projection eq expected").isEqualTo(expected);\n assertThat(results.size()).as("results eq expected").isEqualTo(expected);\n }\n\nclass LetterSearchWithFilterAndPagingForHCPCSCodeArguments implements ArgumentsProvider {\n\n @Override\n public Stream<? extends Arguments> provideArguments(ExtensionContext extensionContext) {\n int count = 5643;\n return Stream.of(\n Arguments.of("A", count),\n Arguments.of("a"),\n Arguments.of("b", 2151)\n );\n }\n}\n\n[ThreadedStreamConsumer] ERROR org.apache.maven.plugin.surefire.SurefirePlugin - letterSearchWithFilterAndPagingForHCPCSCode{String, int}[1] Time elapsed: 2.496 s <<< FAILURE!\njava.lang.AssertionError: \n[projection eq results] \nExpecting:\n <5643>\nand actual:\n <5643>\nto refer to the same object\n\nI thought junit was supposed to log the values passed to the method, how can I make it do that?"
] | [
"java",
"maven",
"junit",
"junit5",
"maven-surefire-plugin"
] |
[
"How to use tasks, background threads or another method to solve a hanging issue in Windows Service",
"I was wondering the best way to get round this issue.\n\nI have created a Windows Service that connects to a mailbox, processes the emails, then cleans up after itself, waits a certain amount of time and repeats.\n\nprotected override void OnStart(string[] args)\n{\n this._mainTask = new Task(this.Poll, this._cancellationToken.Token, TaskCreationOptions.LongRunning);\n this._mainTask.Start();\n}\n\nprivate void Poll()\n{\n CancellationToken cancellation = this._cancellationToken.Token;\n TimeSpan interval = TimeSpan.Zero;\n\n while (!cancellation.WaitHandle.WaitOne(interval))\n {\n using (IImapClient emailClient = new S22ImapClient())\n {\n ImapClientSettings chatSettings = ...;\n\n emailClient.Connect(chatSettings); // CAN SOMETIMES HANG HERE\n\n // SOME WORK DONE HERE\n }\n\n interval = this._waitAfterSuccessInterval;\n\n // check the cancellation state.\n if (cancellation.IsCancellationRequested)\n {\n break;\n }\n }\n}\n\n\nNow I am using a 3rd party IMAP client \"S22.Imap\". When I create the email client object on occasion it will hang on creation as it is attempting to login. This in turn will hang my Windows Service indefinitely.\n\npublic class S22ImapClient : IImapClient\n{\n private ImapClient _client;\n\n public void Connect(ImapClientSettings imapClientSettings)\n {\n this._client = new ImapClient(\n imapClientSettings.Host,\n imapClientSettings.Port,\n imapClientSettings.EmailAddress,\n imapClientSettings.Password,\n AuthMethod.Login,\n true);\n }\n}\n\n\nHow would I change the \"S22ImapClient.Connect()\" call to, behind the covers, use some method to attempt to connect for a set amount of time, then abort if it has not been able to? \n\nThe solution to this will also be used for anything that I need to do with the mail client, for example \"GetMessage()\", \"DeleteMessage()\" etc"
] | [
"c#",
".net",
"multithreading",
"asynchronous",
"windows-services"
] |
[
"Overlapping cohorts comparison in dashboard",
"Making a dashboard that will compare 1 cohort to another. So that the performance of a group can be compared to the other but the selection of group will occur in the dashboard by the end user and could have shared items. My plan is to Union the data, add a column with cohort 1 or 2 for grouping and then have the item name or null in two filter columns so each cohort. Is there a better clearer way to do this? Building in power bi"
] | [
"powerbi"
] |
[
"Change font size in Vuetify based on viewport?",
"I have a title:\n\n<v-card-text style=\"font-size:5em\">\n Some Heading Here\n</v-card-text>\n\n\nI would like to set font size to 3em when the view is XS.\nRight now I duplicated it as follows:\n\n<v-card-text hidden-xs-only style=\"font-size:5em\">\n Some Heading Here\n</v-card-text>\n<v-card-text visible-xs-only style=\"font-size:3em\">\n Some Heading Here\n</v-card-text>\n\n\nHowever I would like to avoid this duplication and solve the issue with CSS alone, but without having to write my own @media queries in the local .vue file. Is that possible?\n\nAlternatively, I'm ok with using predefined classes instead of specifying font size directly or even different elements completely, e.g. something like <h3> when it's XS but <h2> on other viewports."
] | [
"css",
"vue.js",
"viewport",
"vuetify.js"
] |
[
"Trying to change Data in Database with DataTable in Visual Basic",
"i'm trying to use DataTables and a .mdb Database on Visual Basic 2010 for the following functions, but it doenst work:\n\nI have an existing .mdb-Database with a Table \"Daten\" and with named Columns in this Table.\nAnd i'd like to add a new row with new informations to the database.\nSo i'm connection to the Database with the following code:\n\nsql = \"SELECT * FROM Daten\"\n\n Dim connection As New OleDb.OleDbConnection\n\n Try\n connection.ConnectionString = \"Provider=Microsoft.Jet.OLEDB.4.0;\" & \"Data Source=\" & pfad_netzdb\n Catch e As Exception\n MessageBox.Show(e.Message)\n End Try\n Dim adapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(sql, connection)\n\n\nAfter that, i'm filling a DataTable with the given datas of the database: \n\nDim daten As New DataTable\n\n adapter.Fill(daten)\n\n\nAfter that, i'd like to add a Row to the DataTable and fill the Row with new Informations:\n\ndaten.Rows.Add()\ndaten.Rows(daten.Rows.Count - 1)(0) = \"kdjfk\"\ndaten.Rows(daten.Rows.Count - 1)(1) = \"dkjfk\"\ndaten.Rows(daten.Rows.Count - 1)(2) = \"kdjfkd\"\n\n\nAfter that, i'd like to send my changed DataTable with the new row and the new Informations in the row back to the database. I think here is the point where my code doesn't do what i'm expecting. I'm trying it like this, but it doenst work:\n\nadapter.Update(daten)\n\n\nCan anyone help my why this Code doesn't work?\nThanks for your help!"
] | [
"database",
"vb.net",
"datatable"
] |
[
"Qt Drag & Drop doesn't work fine with custom items",
"I'm building a GUI using PySide2 (Qt5) with a custom treeview widget (MyTreeView, inherited from QTreeView). The model is a QStandardItemModel object whereas the items are custom: MyStandardItem, inherited from QStandardItem.\nThe problem is: if I check the type of the moved item after a drag and drop action, it has become a QStandardItem but it should have been a MyStandardItem.\nI believe that the problem is the MimeType, and after a lot of research I found out that the solution could be creating a custom model and overriding MIME related functions.\nI tried to figure out how but I couldn't.\nSo, here are the questions:\n\nDo I have to create a custom model or is there a simple solution?\nIf I have to create a custom model, which functions should I override and how should I override those functions?\n\nFor what it's worth, here is MyStandardItem implementation:\nclass MyStandardItem(QStandardItem):\n def __init__(self, text, font, icon_path='', value='', num=0, check_state=None):\n super().__init__()\n self.setDragEnabled(True)\n self.setDropEnabled(True)\n self.setText(text)\n self.setData({'value': (value, num)})\n self.setToolTip(str(self.data()['value']))\n self.setFont(font)\n self.setIcon(QIcon(icon_path))\n self.toggled = check_state\n if check_state is not None:\n self.setCheckable(True)\n self.setCheckState(check_state)\n\n def setCheckState(self, checkState):\n super().setCheckState(checkState)\n if checkState == Qt.Unchecked:\n self.toggled = Qt.Unchecked\n else:\n self.toggled = Qt.Checked"
] | [
"python",
"drag-and-drop",
"pyside2",
"qtreeview",
"qstandarditemmodel"
] |
[
"Div style float:left with clear not working",
"I have 7 divs. I am trying to make a three row three column layout. Two of the divs are different sizes. I have everything the way I want it, it's just on the third row one div jumps up to row two, and it wont budge down to row three even with clear:right.I am trying my hardest to have the design Internet Explorer 11 ready before I give up and cut off all traffic to IE.\nThe way the layout is rendering\n\nThe way it should be rendering\n\n \n\n\r\n\r\n<style>\n\n[div_glimg]{ width:390px; height:390px} \n[glimg]{ float:left; background-size: cover; }\n[div_glvideo], [glvideoobject]{ width:780px; height:390px; float:left} \n</style>\n<div style=\"background-color: white ;float:left\" div_glimg>\n \n <div glim>\n <div glim1title glim1titlerez style=\" margin-top:0 !important;\">Life<a> in</a> </div>\n <div glmaincdiv></div> \n <div glimcontent>info.</div>\n </div>\n </div>\n \n\n<div style=\"background-color: hsla(359,36%,62%,1.00); \" div_glimg glimg> </div>\n<div style=\"background-color: hsla(213,35%,62%,1.00); \" div_glimg glimg> </div>\n\n<div style=\"background-color: hsla(51,35%,62%,1.00); clear:left\" glimgTall glimg> tall</div> \n<div style=\"background-color: hsla(199,35%,62%,1.00); clear:right\" div_glvideo> video </div> \n\n \n<div style=\"background-color: hsla(302,35%,62%,1.00); \" div_glimg glimg> box 1</div>\n<div style=\"background-color: hsla(302,35%,62%,1.00); \" div_glimg glimg> box 2</div>\r\n\r\n\r\n\n\n ```"
] | [
"html",
"css"
] |
[
"Reusing WPF layout XAML with Bindings?",
"I've been stuck on trying to reuse layout code for my WPF application.\n\nI'm trying to make an XML editor that lets you have multiple files open (via tabs).\n\nMy situation is as follows:\n\n<TabControl>\n <TabItem>\n // Layout XAML with various {Binding} sources (File 1)\n </TabItem>\n <TabItem>\n // Layout XAML with various {Binding} sources (File 2)\n </TabItem>\n <TabItem>\n // Layout XAML with various {Binding} sources (File 3)\n </TabItem>\n</TabControl>\n\n\nThis works; however, each of the three TabItems is a huge chunk of copy & pasted code, with only a few names changed to avoid duplicate names.\n\nI want to rewrite the code in such a way that something like this is possible:\n\n<TabControl>\n <TabItem>\n // Reference to Template\n </TabItem>\n <TabItem>\n // Reference to Template\n </TabItem>\n <TabItem>\n // Reference to Template\n </TabItem>\n</TabControl>\n\n\nAnd have a Template defined somewhere else.\n\nI tried using a DataTemplate for the template, and assigning it to each TabItem with ContentTemplate, but although the layout displayed properly, all of the {Bindings} were lost.\n\nI've googled extensively, but haven't been able to figure out how I should be approaching this.\n\nI would greatly appreciate any links to demos that would show how to achieve binding without copy & pasting code.\n\nI would also appreciate any tips for debugging failed bindings, other than trying things out until they work. (I'm comfortable debugging C# with the debugger, but not sure how to inspect XAML stuff)\n\nThanks in advance!"
] | [
"c#",
"wpf",
"xaml"
] |
[
"Getting header information using c#",
"I am trying to create an outlook add-in in C# which collects header information from new emails in the inbox. Googling it says to use the following code to get the header information for the email. \n\nmailitem.PropertyAccessor.GetProperty(\"http://schemas.microsoft.com/mapi/proptag/0x007D001F/\")\n\n\nHowever when I use this the error Object reference not set to an instance of an object. Click the schema address also says the resource is no longer there is there another way of getting this or do I need to use a different language?\n\nFor reference I have added the below.\n\nprivate void Quarantine()\n {\n\n Outlook.MAPIFolder inBox = (Outlook.MAPIFolder)this.Application.\n ActiveExplorer().Session.GetDefaultFolder\n (Outlook.OlDefaultFolders.olFolderInbox);\n Outlook.Items items = (Outlook.Items)inBox.Items;\n Outlook.MailItem MailItem = null;\n items.Restrict(\"[UnRead] = true\");\n var destFolder = inBox.Folders[\"test\"];\n string StrRegex = @\"(Final Score - [-][0-9] | Final Score - [2][0 - 1] | Final Score - [0 - 1][0-9])\";\n Regex Reg = new Regex(StrRegex);\n foreach (object email in items)\n {\n MailItem = email as Outlook.MailItem;\n String Header= MailItem.PropertyAccessor.GetProperty(\"http://schemas.microsoft.com/mapi/proptag/0x007D001F/\");\n if (!(Reg.IsMatch(Header)))\n {\n MailItem.Move(destFolder);\n }\n }\n\n }\n }"
] | [
"c#",
"vsto",
"outlook-addin"
] |
[
"assign variable 1 to variable 2 and variable 2 to variable 3 javascript",
"i've got an array, and i want to shuffle those according to a certain pattern \n(i'm trying to make a rubics cube in javascript).\nI want to assign value2 to value 1 and value 1 to value 3 and value 3 to value 2. I can do that within 4 lines of code, but is there a shorter way? \nlike:\n\ntemp = var3; //make temporary variable\n(var3 = var2) = var1;//put var2 in var3 and var3 in var1\nvar1 = temp;//put var3/temp in var1\n\n\ni know that it doesn't work this way, but do you guys know a way it does work?\nthat would be usefull when cycling 8 variables.\n\nthanks,\nTempestas Ludi."
] | [
"javascript",
"variables",
"optimization"
] |
[
"UnhandledException - How to know what control made the application crash",
"I have already delivered my app to customers but they are complaining that sometimes the app crashes, and they need to relaunch it.\n\nI told them to describe what they were doing and what option / window they were using when the app crashed, unfortunately none of them was able to say something. So I decided to make a Global UnhandledException function.\n\nI updated the app with below Global UnhandledException code and I'm receiving the error messages through email but my concern now is that I'm not going to be able to locate what control caused that error in order to fix the problem.\n\nSo far, the error message I receive from 4 clients is Index was outside the bounds of the array. and I'm able to fix that but I'm not sure what VB control causes the problem as the app has many ListBoxes on each Window, and different controls.\n\nI just want to know whether there's a way to locate via (e.Exception.[control name]) the exact control that raises the error.\n\nBelow is my Global UnhandledException code\n\nPrivate Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException\n Try\n errorMsg = e.Exception.Message 'Store the error message in order to be sent via email to Support/Fix Departement via email\n\n e.ExitApplication = False\n\n thread = New System.Threading.Thread(AddressOf sendGlobalExcept)\n thread.Start()\n Catch\n\n End Try\nEnd Sub"
] | [
".net",
"vb.net"
] |
[
"Render GeoTiff to on browser with leaflet",
"I have a big GeoTiff Image with following gdalinfo : \n\nDriver: GTiff/GeoTIFF \nFiles: ImageNew.tif\nSize is 8501, 8544\nCoordinate System is:\nPROJCS[\"WGS 84 / Pseudo-Mercator\",\n GEOGCS[\"WGS 84\",\n DATUM[\"WGS_1984\",\n SPHEROID[\"WGS 84\",6378137,298.257223563,\n AUTHORITY[\"EPSG\",\"7030\"]],\n AUTHORITY[\"EPSG\",\"6326\"]],\n PRIMEM[\"Greenwich\",0,\n AUTHORITY[\"EPSG\",\"8901\"]],\n UNIT[\"degree\",0.0174532925199433,\n AUTHORITY[\"EPSG\",\"9122\"]],\n AUTHORITY[\"EPSG\",\"4326\"]],\n PROJECTION[\"Mercator_1SP\"],\n PARAMETER[\"central_meridian\",0],\n PARAMETER[\"scale_factor\",1],\n PARAMETER[\"false_easting\",0],\n PARAMETER[\"false_northing\",0],\n UNIT[\"metre\",1,\n AUTHORITY[\"EPSG\",\"9001\"]],\n AXIS[\"X\",EAST],\n AXIS[\"Y\",NORTH],\n EXTENSION[\"PROJ4\",\"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs\"],\n AUTHORITY[\"EPSG\",\"3857\"]]\nOrigin = (8267060.670175411738455,3458242.195657447911799)\nPixel Size = (0.583831698389895,-0.583831698389895)\nMetadata:\n AREA_OR_POINT=Area\nImage Structure Metadata:\n INTERLEAVE=BAND\nCorner Coordinates:\nUpper Left ( 8267060.670, 3458242.196) ( 74d15'51.37\"E, 29d38'48.83\"N)\nLower Left ( 8267060.670, 3453253.938) ( 74d15'51.37\"E, 29d36'28.61\"N)\nUpper Right ( 8272023.823, 3458242.196) ( 74d18'31.88\"E, 29d38'48.83\"N)\nLower Right ( 8272023.823, 3453253.938) ( 74d18'31.88\"E, 29d36'28.61\"N)\nCenter ( 8269542.247, 3455748.067) ( 74d17'11.62\"E, 29d37'38.73\"N)\nBand 1 Block=8501x1 Type=Byte, ColorInterp=Palette\n\n\nWhat I wanted to do is render the image on browser and get actual lat long coordinates (As how google map points)\n\nI used following library to convert the image to tiles : \nhttps://github.com/commenthol/gdal2tiles-leaflet\n\nAnd https://github.com/commenthol/leaflet-rastercoords\n\nto render the mosaic on web browser. \n\nAll seems to work fine. But when I click it return wrong lat lng coordinates compared to actual google latlong and rendered image latlng.\n\nAm I going wrong somewhere ?"
] | [
"javascript",
"leaflet",
"gdal",
"rgdal",
"geotiff"
] |
[
"Can you give some advise about 3D simulation engine (choose best one but how?) in winforms 3d and wpf 3d?",
"Can you give some advise winforms 3d and wpf 3d?\nQuestion:\ni try to write a simulation program 3D in windows forms i have some knowledge about \nCsGL (OpenGl wrapper)\nDirectX \nOPenTk\n\nAlso \nSlimDx\nOgreDotNet\n\nWPF :\nBalder\n\ni have 2 question:\n1) do you give some advise about above engines to create some simulation. Or any other best engine or wrapper class\n\n2) Can i use Balder in Windows Forms?"
] | [
"c#",
".net",
"visual-studio",
"3d"
] |
[
"How to show a splash screen to kill the time while data is loaded?",
"When starting my app I at first have to read in some data, have to init some forms and so on.\nFor that time the user sees just grey getting-ready to show something forms.\n\nThis lasts for a few seconds...\n\nI thought of a Splash Screen that loads the data in a seperate Thread and also shows how long it will take. Or just a status bar?\n\nHow would you do something like this?\n\nI'm using C# .NET 3.5 + Winforms"
] | [
"c#",
"winforms",
"progress-bar",
"splash-screen",
"time-wait"
] |
[
"How do I pass custom state with the MSAL.Net library?",
"I want to add Azure AD authentication to an existing set of ASP.Net web applications. As part of the login/signin process, I want to keep track of information about the current user of my application that I will use after the signin is complete. I guess I could just rely on standard ASP.Net session state management, but this seems like an appropriate use for the OAuth2.0 state parameter if I can figure out how to use it.\n\nHow do I pass custom state information to the IdP (in this case Azure Active Directory) which will be returned to my application upon authentication/signin, using MSAL.Net from an ASP.Net application? There is information here (https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-pass-custom-state-authentication-request) about doing it with MSAL.js, but it doesn't seem directly transferable to MSAL.Net. There is also a prior question on SO (How to use oAuth State parameter on MSAL.NET) which seems to be effectively the same question, but the answer is not helpful, at least to me. \n\nthanks\n\nMartin"
] | [
"asp.net",
"azure-active-directory",
"msal"
] |
[
"Changing header title color in Full Calendar 2.3.2",
"This answer appears to be out of date as the stylesheet is now different:\n\nhow-to-change-the-font-color-of-jquery-full-calender-header-title \n\nHow do i do this for version 2.3.2 of FullCalendar?\n\nWith thanks."
] | [
"css",
"colors",
"header",
"fullcalendar",
"title"
] |
[
"Moving from Mercurial to Git and merging with custom changes",
"I am having a problem with moving from Mercurial to Git and merging the last version of nopCommerce with my changes.\n\nHere is what I did. I clonned the nopCommerce mercurial repository a long time ago (version 2.60 I think). Since then I made many changes to the platform and I merged them with newer versions of nopCommerce. The last merge I did was on version 3.10.\n\nNow I see that nopCommerce started using Git, so I converted my mercurial repository to Git (following this guide: http://arr.gr/blog/2011/10/bitbucket-converting-hg-repositories-to-git/). But now, when I pull the nopCommerce changes (up to version 3.50), I get the following: \"warning: no common commits\", and ALL the commits are downloaded (not just the new ones, from 3.10 to 3.50), although I already have the commits up to version 3.10 in my repository. Basically, the nopCommerce commits up to version 3.10 are duplicated. I think this happens, because they have different commit numbers (when I converted my mercurial repository to Git, the commits got different commit numbers, and I see that the new nopCommerce Git repository also has different commit numbers from the old Mercurial repository).\n\nThe problem is that, when I merge nopCommerce v3.50 with the changes I made, and try to resolve the conflicts, the BASE file is empty, because Git does not see that they have a common ancestor. The LOCAL file has the commits from my repository as ancestors and the REMOTE file has the commits from the new Git repository as ancestors.\n\nDo you have any idea of how to fix this problem?"
] | [
"git",
"merge",
"mercurial",
"nopcommerce"
] |
[
"How to redirect https links to http?",
"Recently I've moved my blog from wordpress.com to my personal hosting. For some reason all of my links indexed on Google results and also the ones that I have listed on Reddit forums shows this error:\n\nYour connection is not private\nAttackers might be trying to steal your information from rockiceland.com (for example, passwords, messages, or credit cards). NET::ERR_CERT_COMMON_NAME_INVALID\n\nI believe the main reason for that is https in front of the links. I haven't purchased SSL certificate, it is something that Wordpress.com included and should have been gone after the migration of the blog (i think?).\n\nIf I try to access internal links with http, it opens as normal.\n\nHave you an idea how could I fix it so all the https would redirect to http links?"
] | [
"wordpress",
"redirect"
] |
[
"TypeScript: refactor a part of JQuerified code to another file",
"I've a big.js file which starts with the following code:\n\njQuery(document).ready(function ($) {\n\n\nInside this huge call to function I've a piece of code which I would like to refactor and move to specific.ts\n\nI've tried both to write in the other file:\n\njQuery(document).ready(function($) {\n $(\"#link\").on(\"click\", function(e) {\n\n\nAnd directly the piece of code which I want to move:\n\n $(\"#link\").on(\"click\", function(e) {\n\n\nIn both cases I got errors like:\n\nCould not find symbol 'jQuery'."
] | [
"javascript",
"jquery"
] |
[
"How can I set equals function in objective of solver in R/Python?",
"I am exploring one of the business problem to convert into solver/optimize problem.I have objective to set sum of 3 different columns should be exact 0.\nAs far I know Maximize and Minimize function problems can be solved using different available libraries.\nSO looking forward to get help how can I set objective function equals to 0 and which package or libraries can be used?"
] | [
"python",
"r",
"solver"
] |
[
"Dictionary search results in key error in Python",
"I've looked up similar stackoverflow questions but none are quite like this. \nQuite simply, I have the following code that seeks to look up a dictionary for a username and corresponding password. If they match, then access granted and go to the loggedin function, else access denied.\n\nHaving set it up like below, it works perfectly when the credentials are correct, but on getting them wrong, results in a key error:\n\nCode\n\nusername=input(\"Enter username:\")\n password=input(\"Enter password:\")\n\n accessgranted=False\n while accessgranted==False:\n if userinfo_dict[username]==password:\n loggedin()\n accessgranted==True\n else:\n break\n print(\"Sorry, wrong credentials\")\n main()\n\n\nError\n\n if userinfo_dict[username]==password:\nKeyError: 'ee'\n\n\nThe file is simply:\n\nuser1,pass1\nuser2,pass2\n\n\nCould someone please\na) Correct and comment on the error\nb) Suggest alternative or more efficient ways of achieving the same thing"
] | [
"python",
"dictionary",
"key"
] |
[
"Is Eclipse Oxygen.2 Release (4.7.2) has some major bug as it shows error in throwing Exception using throws keyword",
"Today I just encountered a problem with Eclipse Oxygen that I felt to share it here so that anyone facing same issue can know about it as I searched in Internet but was not able to find anything about it anywhere. So I felt to share the problem that I encountered. \n\nI was learning Exception Handling in Java and was practising program of same. When I used throws keyword with method to indicate about Exception to its caller method I got an error saying No exception of type Exception can be thrown; an exception type must be a subclass of Throwable. However while using throws for indicating Throwable and RunTimeException, there was no any error. It confused me as why Throwable is not giving any error but Exception is. Anyhow I made my own conclusion from this, that we cant use throws to indicate Exception.\n\nI conveyed same thing to one of my Bro and he disagreed with me and we had debate about this, finally he told he will execute and show and I was sure that it will give error, but to my surprise when he executed same piece of code in which I got error, he didn't got any. It surprised me like how this can happen.\n\nThen I came to know there might be some problem with my Eclipse Version so I installed previous version of Eclipse and tried with same piece of code and voila there was no error.\n\nStill I am confused either its my mistake or is this any bug with Eclipse but how there can be bug with release version? So please correct me if I am wrong or something that I don't know.\n\nScreenshot:\n\nVersion: Oxygen.2 Release (4.7.2)\nBuild id: 20171218-0600\n\nVersion: Luna Service Release 2 (4.4.2)\nBuild id: 20150219-0600"
] | [
"java",
"eclipse",
"exception",
"eclipse-oxygen"
] |
[
"shortcut to define parameterless functions in clojure",
"I am searching for a shortcut to define parameterless functions in clojure:\n\n=> (def x (fn [] (println \"test\")))\n#'x\n=> (x)\ntest\nnil\n=> (def y (println \"test\"))\ntest\n#'y\n=> (y)\nNullPointerException core/eval2015 (form-init5842739937514010350.clj:1)\n\n\nI would really like to avoid typing the fn []. I know about the lambda notation #() but it requires at least one parameter. I would use them in a GUI binding to handle button click events where I don't care about the event itself, I just need to know the button was clicked."
] | [
"clojure"
] |
[
"Problem with large requests in WCF",
"I've seen this problem posted a million times, but none of the solutions have worked for me...So here I go:\n\nWhen calling a WCF service I get the following error:\n\n\n The formatter threw an exception while trying to deserialize the\n message: There was an error while trying to deserialize parameter\n http://BlanketImportService.ServiceContracts/2011/06:request. The\n InnerException message was 'There was an error deserializing the\n object of type BlanketImport.BlanketImportRequest. The maximum array\n length quota (16384) has been exceeded while reading XML data. This\n quota may be increased by changing the MaxArrayLength property on the\n XmlDictionaryReaderQuotas object used when creating the XML reader.\n Line 1, position 44440.'. Please see InnerException for more details.\n\n\nI have modified the readerQuotas on both the client server, AND applied the bindingConfiguration tag.\n\nHere's the server config:\n\n<bindings>\n <basicHttpBinding>\n <binding name=\"BilagImportBinding\" maxBufferSize=\"2147483647\"\n maxBufferPoolSize=\"2147483647\" maxReceivedMessageSize=\"2147483647\">\n <readerQuotas maxDepth=\"2147483647\" maxStringContentLength=\"2147483647\"\n maxArrayLength=\"2147483647\" maxBytesPerRead=\"2147483647\" maxNameTableCharCount=\"2147483647\" />\n </binding>\n </basicHttpBinding>\n</bindings>\n\n<services>\n <service name=\"BlanketImport\">\n <endpoint address=\"\" binding=\"basicHttpBinding\" bindingConfiguration=\"BilagImportBinding\" bindingNamespace=\"http://BlanketImportService.ServiceContracts/2011/06\" contract=\"BlanketImport.IBlanketImport\">\n </endpoint>\n </service>\n</services>\n\n\nAnd the client config:\n\n <bindings>\n <basicHttpBinding>\n <binding name=\"BilagImportBinding\" maxBufferSize=\"2147483647\"\n maxBufferPoolSize=\"2147483647\" maxReceivedMessageSize=\"2147483647\">\n <readerQuotas maxDepth=\"2147483647\" maxStringContentLength=\"2147483647\"\n maxArrayLength=\"2147483647\" maxBytesPerRead=\"2147483647\" maxNameTableCharCount=\"2147483647\" />\n </binding>\n </basicHttpBinding>\n </bindings>\n <client>\n <endpoint address=\"http://localhost/BlanketImport/BlanketService.svc\"\n binding=\"basicHttpBinding\" bindingConfiguration=\"BilagImportBinding\" contract=\"BlanketServiceReference.IBlanketService\"\n name=\"BasicHttpBinding_IBlanketService\" />\n </client>"
] | [
"wcf",
"binding",
"basichttpbinding"
] |
[
"Azure Service Bus and Javascript Implementation",
"I have a Azure Service Bus Topic and I want to receive the messages in realtime on a web page that uses pure Javascript. \n\nI tried this SDK (http://developers.de/blogs/damir_dobric/archive/2015/01/26/eventhubs-support-for-azure-servicebus-javascript-sdk.aspx) but when I speed up the sending message not worked well.\n\nI tried too REST API but not worked well too.\n\nExist any alternative? \n\nRegards"
] | [
"javascript",
"azure",
"azureservicebus",
"azure-servicebus-topics"
] |
[
"Android actionbar tab icon png dimensions",
"What should the dimensions of the actionbar tab icon be? (meaning, mostly, size in pixels and padding)"
] | [
"android",
"tabs",
"android-actionbar",
"android-icons"
] |
[
"what is the alternative method of VB6 PropertyChanged in dot net",
"I have migrated a vb6 control to vb.net which references FARPoint Spread and below is the VB6 code.\n\n Public Property Let RetainSelBlock(ByVal New_RetainSelBlock As Boolean)\n sprSpread.RetainSelBlock() = New_RetainSelBlock\n PropertyChanged \"RetainSelBlock\"\n End Property \n\n\nThe below code is the wizard generated VB.Net code from the above Vb6 code.\n\n Public Property RetainSelBlock() As Boolean\n Get\n RetainSelBlock = sprSpread.RetainSelBlock\n End Get\n Set(ByVal Value As Boolean)\n sprSpread.RetainSelBlock = Value\n RaiseEvent RetainSelBlockChange()\n End Set\nEnd Property\n\n Public Event RetainSelBlockChange()\n\n\nas you can see, VB6 PropertyChanged method got changed to RaiseEvent. Is this correct ?"
] | [
"vb.net",
"vb6-migration"
] |
[
"Unique fields in table Fluent Api / Code First",
"I have been looking for a way to make, for example a username unique in the database with Fluent API / Code First. Is this even possible via either of these routes?\n\nBecause I can't find any tutorial or example that shows how this is done."
] | [
"ef-code-first",
"entity-framework-5",
"unique-index"
] |
[
"Why doesn't the progress bar progress?",
"Following function is called to move the progress bar but I don't know why it doesn't move till other process just works on.\n\nprivate void startProgressBar() {\n signInProgressBar.setMinimum(0);\n signInProgressBar.setMaximum(10);\n Runnable r = new Runnable() {\n @Override\n public void run() {\n int p = 1;\n while(!loginCompleted) {\n signInProgressBar.setValue(p);\n //System.out.println(p);\n p++;\n try {Thread.sleep(5000);}catch(Exception exc) {}\n } \n }\n };\n new Thread(r,\"progress_bar_thread\").start();\n}\n\n\nSnippet that calls startProgressBar :\n\n startProgressBar(); // CALL\n String username = usernameTextField.getText();\n String password = new String(passwordField.getPassword());\n Openfire server = new Openfire();\n boolean isConnected = server.connect(username,password);\n if(isConnected) {\n // Stash the username and password\n User user = new User();\n user.setUsername(username);\n user.setPassword(password);\n\n // Stop the progress bar\n loginCompleted = true;\n\n // Display the next window\n UserGUI blab = new UserGUI();\n blab.setVisible(true);\n this.dispose(); // Dispose off the login window\n }\n\n\nWhat could be the problem ?"
] | [
"java"
] |
[
"eclipse refuses to run my android project after I edit widget xml",
"I change few things in widget xml.\n\nThen I build successfully. Then I try to run, but get an error:\n\nbtw, horizonalt widget is regular xml or lansdcap xaml?\n\n\n\nBut clean and re-build runs OK"
] | [
"java",
"android",
"xml",
"widget"
] |
[
"Using regex to restrict input in textbox",
"/^+{0,1}(?:\\d\\s?){11,13}$/ this regex allows + at first place only and numbers only...\n\n\non keypress I want user should only be able to type + at first and digits that what above regex validates But code always goes to if part..why regex not working in this scenario\n\nfunction ValidatePhone(phone) {\n var expr = /^\\+?(?:\\d\\s?){11,13}$/;\n return expr.test(phone);\n }\n\n\nvar countofPlus = 0;\n\n $(\"#phone\").on(\"keypress\", function (evt) {\n if (evt.key == \"+\")\n {\n countofPlus = countofPlus + 1;\n if (countofPlus > 1 || this.value.length >= 1) {\n return false;\n }\n else return true;\n }\n var charCode = (evt.which) ? evt.which : event.keyCode\n if (charCode > 31 && charCode != 43 && charCode != 32 && charCode != 40 && charCode != 41 && (charCode < 48 || charCode > 57))\n return false;\n return true;\n });\n$(\"#phone\").on(\"keyup\", function (evt) {\n debugger;\n if (evt.key == \"+\") {\n countofPlus--;\n return true;\n }\n\n });"
] | [
"javascript",
"jquery",
"regex",
"validation"
] |
[
"Why does git keep recreating a branch with a forced update?",
"Whenever I do a fetch I get a notice from Git saying it has received a forced update and it says a branch is new. It does this for every fetch. I am wondering why this happens, and how I can keep it from happening (meaning fix it). I tried rm .git/refs/remotes/MWNG, but that had no effect.\n\n$ git fetch MWNG\nFrom github.com:MWNG/multikanal.epi7.mysite\n + 022873b...ecaa5df Feature/2005-registrering-sunnhetsbonus -> MWNG/Feature/2005-registrering-sunnhetsbonus (forced update)\n * [new branch] feature/2005-registrering-sunnhetsbonus -> MWNG/feature/2005-registrering-sunnhetsbonus\n * [new branch] feature/azure-rest-api -> MWNG/feature/azure-rest-api\n\n$ git fetch MWNG\nFrom github.com:MWNG/multikanal.epi7.mysite\n + 022873b...ecaa5df Feature/2005-registrering-sunnhetsbonus -> MWNG/Feature/2005-registrering-sunnhetsbonus (forced update)\n * [new branch] feature/2005-registrering-sunnhetsbonus -> MWNG/feature/2005-registrering-sunnhetsbonus\n * [new branch] feature/azure-rest-api -> MWNG/feature/azure-rest-api\n\n\nAs you can see from the above output there are probably two distict, but related problems. One branch has a forced push update and the other not, while both are supposedly new branches every time."
] | [
"git",
"github"
] |
[
"Resize react-beautiful-dnd",
"Is it possible to adjust the height of the the droppable container? I tried inline styling \n\n<Droppable droppableId=\"list\" style={{ height: 200 }}>\n\nbut didn't yield expected results. My expectation is that the container that holds the draggable items can be adjust to a certain height x and the overflow of draggable items will be scrollable. I also tried wrapping <DragDropContext onDragEnd={this.onDragEnd}> with the following div tag:\n\n<div style={{ height: 200 }}>\n\nhttps://codesandbox.io/s/using-react-beautiful-dnd-with-hooks-qnez5"
] | [
"reactjs",
"react-beautiful-dnd"
] |
[
"Use inline data for mutiple individual plots in gnuplot",
"I'm trying to plot \"x;y1;y2\" data from an inline file:\n\nset xdata time\nset timefmt \"%Y-%m-%dT%H:%M:%S\"\nset format x \"%H:%M:%S\"\nset datafile separator \";\"\nset yrange [0:]\nplot '-' index 0 using 1:2 with linespoints t 'before', '-' index 0 using 1:3 with linespoints t 'after'\n2015-11-05T00:42:32;0.690000;0.690000\n2015-11-05T00:43:34;0.690000;0.690000\n2015-11-05T00:44:35;0.690000;0.690000\n2015-11-05T00:45:36;0.690000;0.690000\n2015-11-05T00:46:37;0.690000;0.690000\n2015-11-05T00:47:38;0.690000;0.690000\n2015-11-05T00:48:38;0.690000;0.690000\n2015-11-05T00:49:40;0.690000;0.690000\ne\n\n\ngnuplot - however - complains the second part of having no data. While repeating the data such as\n\nset xdata time\nset timefmt \"%Y-%m-%dT%H:%M:%S\"\nset format x \"%H:%M:%S\"\nset datafile separator \";\"\nset yrange [0:]\nplot '-' index 0 using 1:2 with linespoints t 'before', '-' index 0 using 1:3 with linespoints t 'after'\n2015-11-05T00:42:32;0.690000;0.690000\n2015-11-05T00:43:34;0.690000;0.690000\n2015-11-05T00:44:35;0.690000;0.690000\n2015-11-05T00:45:36;0.690000;0.690000\n2015-11-05T00:46:37;0.690000;0.690000\n2015-11-05T00:47:38;0.690000;0.690000\n2015-11-05T00:48:38;0.690000;0.690000\n2015-11-05T00:49:40;0.690000;0.690000\ne\n2015-11-05T00:42:32;0.690000;0.690000\n2015-11-05T00:43:34;0.690000;0.690000\n2015-11-05T00:44:35;0.690000;0.690000\n2015-11-05T00:45:36;0.690000;0.690000\n2015-11-05T00:46:37;0.690000;0.690000\n2015-11-05T00:47:38;0.690000;0.690000\n2015-11-05T00:48:38;0.690000;0.690000\n2015-11-05T00:49:40;0.690000;0.690000\ne\n\n\ndoes the job, I hoped, that index 0 had selected the right dataset.\nI also tried to leave out the second \"file\"name to use the last file again.\n\nIs there a better way of using the same inline data again without repeating?"
] | [
"gnuplot"
] |
[
"Reversing a string in C x86 error",
"I am trying to do a simple strrev on a string and I keep getting this error when I compile it on my mac \n\nUndefined symbols for architecture x86_64:\n\"_strrev\", referenced from:\n _main in cc1zSAum.o\nld: symbol(s) not found for architecture x86_64\ncollect2: ld returned 1 exit status\n\n\nMy code is:\n\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main(int argc, char *argv[]){\n char str[] = \"Hello world\";\n char * test;\n test = strrev(str);\n printf(\"%s\",test);\n return 0;\n}\n\n\nI tried playing around with the strrev line\nbut nothing is working\n\nAny help would be appreciated \nThanks"
] | [
"c",
"string",
"x86"
] |
[
"EXPO save photo in Pictures after taking it from Camera",
"EXPO React Native, running the app on Expo Go on my android mobile.\nI am trying to save photo taken by the Camera to Pictures folder on my Android device.\nIt just not happening. Can anyone help me figure out what is wrong?\ntakePicture = async () => {\n const { uri } = await this.camera.takePictureAsync();\n console.log(‘uri’, uri);\n const asset = await MediaLibrary.createAssetAsync(uri);\n console.log(‘asset’, asset.filename);\n MediaLibrary.createAlbumAsync(‘Pictures’, asset)\n .then(() => {\n Alert.alert(‘Album created!’)\n })\n .catch(error => {\n Alert.alert(‘An Error Occurred!’)\n });\n this.setState({ photoId: this.state.photoId + 1 });\n Vibration.vibrate(); \n}\n\nmy console return the uri after photo taken but asset.file is not returned it is like nothing is happening there. any help is appreciated.\nI dumped medialibrary for imagepicker and it worked with this code\n _takePhoto = async () => {\n const {\n status: cameraPerm\n } = await Permissions.askAsync(Permissions.CAMERA);\n\n const {\n status: cameraRollPerm\n } = await Permissions.askAsync(Permissions.CAMERA_ROLL);\n\n // only if user allows permission to camera AND camera roll\n if (cameraPerm === 'granted' && cameraRollPerm === 'granted') {\n let pickerResult = await ImagePicker.launchCameraAsync({\n mediaTypes: ImagePicker.MediaTypeOptions.Images,\n allowsEditing: false,\n aspect: [4, 3],\n quality: 0.2,\n });\n\n this._handleImagePicked(pickerResult);\n }\n };"
] | [
"android",
"react-native",
"camera",
"expo"
] |
[
"How to route from one page to another?",
"I was trying to route the page if my http response is successful to the new page i.e. landing page.\nI have written code for handling http request and its working fine and returning response, if my response is successfull or the login is successful i.e. true then i want to move to my next page i.e my component <Loading /> with some parameter if my response fails then it should be on the samepage \n\nBasically i was trying when i click on login button it should send a http request if the request return a response then it should switch over to another page else it should be on the same page\n\nconst Login = () => {\n\n const [userName , setUserName] = useState(\"\")\n const [userPassword , setUserPassword] = useState(\"\")\n\n\n const handleUsernameInput = (event) => {\n setUserName(event.target.value);\n console.log(\"username entered\")\n }\n\n const handlePasswordInput = (event) => {\n setUserPassword(event.target.value);\n console.log(\"password entered\")\n }\n\n const [httpData, apiMethod] = useHttpPOSTHandlerdotthen()\n\n const handleSubmit = () => {\n apiMethod({url: 'url' , data: { \"password\": userPassword, \"username\": userName }})\n setUserName(\"\")\n setUserPassword(\"\")\n nextPage();\n }\n\n const nextPage = () => {\n if (httpData) {\n return <Redirect to={{ pathname: '/landing', key: httpData.key}} />\n }\n else{\n return <Redirect to={{ pathname: '/' }} /> \n }\n }\n\n return (\n <div className = \"login-page\">\n <Form>\n <Form.Control size = \"sm\" \n type=\"text\" \n placeholder=\"Username\" \n value = {userName}\n onChange = {event => handleUsernameInput(event)} \n />\n <Form.Control size = \"sm\" \n type=\"password\" \n placeholder=\"Password\" \n value = {userPassword}\n onChange = {event => handlePasswordInput(event)} \n />\n <Button size = \"sm\" variant=\"success\" \n onClick = {handleSubmit}>Login</Button>\n </Form>\n </div>\n );\n};\n\nexport default Login;"
] | [
"reactjs",
"react-hooks"
] |
[
"Can I use a loop to quicky produce x amount of checkbuttons?",
"Is it possible to iterate the production of 3 checkbuttons in TkInter. For instance I seperatly create my 3 buttons below, but can I simplify this code by running a loop, if BtnLst is defined as so. \n\n BtnLst = [\"Power\", \"Temperature\", \"Sunlight\"]\n #####Loop here?\n\n\n...\n\n C1 = Checkbutton(frame, text = \"Power\",\\\n onvalue = 1, offvalue = 0, height=1, \\\n width = 10)\n C1.pack(side=LEFT)\n C2 = Checkbutton(frame, text = \"Temperature\",\\\n onvalue = 1, offvalue = 0, height=1, \\\n width = 10)\n C2.pack(side=LEFT,padx =5, ipadx=12)\n C3 = Checkbutton(frame, text = \"Sunlight\",\\\n onvalue = 1, offvalue = 0, height=1, \\\n width = 10)\n C3.pack(side=LEFT)\n\n\nIs this even possible in tkinter because I have defined all 3 buttons separately?"
] | [
"python",
"python-2.7",
"tkinter"
] |
[
"How to get selected table view cell row in segue?",
"I am developing an iOS app using Swift and I have a view controller that segues from a table view cell content view by selecting a cell row or selecting a button inside of that cell row's content view. The original view controller that contains the table view performs a segue on two different occasions: one segue when the cell row itself is selected (segues to an avplayerviewcontroller and plays a video depending on the cell row that was selected) and the second segue happens when you press a button that is inside of the content view of the table view cell. In the first segue, I am able to pass the the cell row that is selected with if let indexPath = self.tableview.indexPathForSelectedRow when I override the first segue. However when I try to pass the cell row that was selected when I try to override the second segue that happens when you press the button it doesn't work. Is this because the button inside of the table view cell doesn't know which row it was selected in? If so, how can I solve this problem, and if not what is a viable solution to solve such issue? Reminder: The \"playDrill\" segue is trigged when you select a cell row, the \"Tips\" segue is trigged when you selected a button inside of that same cell row's content view\n\nCode for first segue that happens when you select a cell row (this segue functions as desired):\n\nclass DrillsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {\n\n override func prepare(for segue: UIStoryboardSegue, sender: Any?) {\n\n if segue.identifier == \"playDrill\" {\n if let indexPath = self.tableView.indexPathForSelectedRow {\n if initialRow == 1 {\n drillVid = videoURL[indexPath.row]\n playerViewController = segue.destination as! PlayerController\n playerViewController.player = AVPlayer(playerItem: AVPlayerItem(url: drillVid))\n playerViewController.player?.play()\n print(indexPath) //prints correct value which is \"[0,6]\"\n }\n if initialRow == 3 {\n drillVid = videoUrl[indexPath.row]\n playerViewController = segue.destination as! PlayerController\n playerViewController.player = AVPlayer(playerItem: AVPlayerItem(url: drillVid))\n playerViewController.player?.play()\n }\n\n\nCode for second segue that triggers when you select a button inside of the cell's content view (I want this segue to have the value of indexPath as in the first segue, but when I try to use that code it doesn't return the correct value):\n\n override func prepare(for segue: UIStoryboardSegue, sender: Any?) {\n\n if segue.identifier == \"Tips\" {\n if let indexPath = self.tableview.indexPathForSelectedRow {\n if initialRow == 1 {\n print(indexPath) //the value printed is \"6\", I want \"[0,6]\" like the first code block\n let tipVC = segue.destination as! KeysController\n\n } \n }\n }\n}"
] | [
"ios",
"swift",
"overriding",
"segue",
"indexpath"
] |
[
"loadable levels with code in addition to assets in xamarin",
"I am a newbie to Xamarin, and I have searched SO and Google for this but I have not found the right query to get my answer. In flex, I can create a \"module\" and it can have assets, code, etc, and in that module I can implement a class based on an interface in the main app, and load it after the main app is loaded.\n\nIn a game that I have written I load my levels this way. It works great because the core app is totally independent and rarely requires updates.\n\nBasically imagine that the main app has an IGameEngine interface for any interaction with it, and each level that is loaded from the cloud and cached locally (like Angry Birds Seasons does with levels), will have an implementation of that IGameEngine which may or may not be the same or different from other levels, depending on the features needed in that level.\n\nI will be using xamarin because I am comfortable with C# and have a need to target all platforms, and thus need to minimize the code to do so. I will most likely also be using CocosSharp as it seems to be an active community.\n\nIn Xamarin can I do something similar? How? When I search for Xamarin \"modules\", I get a million results for how to include a module in the compiler, obviously I'm searching for the wrong keywords.\n\nSorry for a question that an experienced user could probably locate in 5 seconds on Google, but I don't know where to start. I appreciate any and all help from the community!"
] | [
"c#",
"android",
"ios",
"xamarin"
] |
[
"imagemagick is executed in /usr/bin but the new version is in /usr/local/bin - php exec path",
"It seems the problem I have is that imagemagick is being executed from /usr/bin in which an old version of imagemagick is installed on my server, I do not know how to make php exec() look in the right direction which is /usr/local/bin - that is the actual location of convert,\nif I try using the full path with exec /usr/local/bin/convert then it does not work, exits with 127\n\nI am on php 5.3.3 on cent os 6.3"
] | [
"php",
"linux",
"path",
"centos",
"exec"
] |
[
"Bulding Menu with asp.net using the Database",
"I have an table in database and I need create Menu in my project using this database. \n\nHow I create this with asp.net c#? I need transform this line \"N:\\A\\B\\C\" in menu style Tree View. But this menu should be dynamic, because in this table, the paths may have varying levels of folders! For each row in my table, one Main Menu, and for each subfolder, one MenuChild. \n\nEx: \"N:\\A\" is my Main Menu and expands to \"B\\\" that is my second level (submenu) and expands to \"C\\\" that is my third level in menu\n\nI Create the first level for this menu. This show the full path for each line in table.\n\nprivate DataTable GetMenuData()\n{\n string selectCommand = \"SELECT distinct folder_path FROM A\";\n string conString = ConfigurationManager.ConnectionStrings[\"A\"].ConnectionString;\n SqlDataAdapter dad = new SqlDataAdapter(selectCommand, conString);\n DataTable dtblCategories = new DataTable();\n dad.Fill(dtblCategories);\n return dtblCategories;\n}\n\nprivate void AddTopMenuItems(DataTable menuData)\n{\n DataView view = new DataView(menuData);\n foreach (DataRowView row in view)\n {\n MenuItem newMenuItem = new MenuItem(row[\"folder_path\"].ToString(), row[\"folder_path\"].ToString());\n Menu1.Items.Add(newMenuItem);\n }\n}\n\n\n<div id=\"WorkingZone\">\n <asp:Menu ID=\"Menu1\" Orientation=\"vertical\" StaticMenuItemStyleCssClass=\"menuItem\"\n DynamicMenuItemStyle-CssClass=\"menuItem\" runat=\"server\" />\n</div>"
] | [
"c#",
"javascript",
"asp.net",
".net",
"sql"
] |
[
"Clear and Refresh DataGridView on vb.net",
"Im trying to clear DataGridView and then refreshing to show the updated table. But it say 'Cannot clear the list'. Im not using a datasource for the DataGridView in Design view.\nI need the clear function because if I don't it keeps duplicating all the data inside of my DataGridView. 1st time I press is ok as its already empty but onwards gives me the message.\nPrivate Sub btnRefresh_Click(sender As Object, e As EventArgs) Handles btnRefresh.Click\n DataGridView1.Rows.Clear()\n Refreshdata()\nEnd Sub\n\nDim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\ahmed\\OneDrive\\Desktop\\ProjectDatabase2003.mdb")\nDim DS As DataSet = New DataSet\nDim DA As OleDbDataAdapter\nDim tables As DataTableCollection = DS.Tables\nDim source1 As New BindingSource()\n\nPrivate Sub Refreshdata()\n DA = New OleDbDataAdapter("Select * from Risk_Register", myConnection)\n DA.Fill(DS, "Risk_Register")\n Dim view1 As New DataView(tables(0))\n source1.DataSource = view1\n DataGridView1.DataSource = view1\n DataGridView1.Refresh()\n\nEnd Sub"
] | [
"database",
"vb.net",
"visual-studio",
"datagridview",
"oledbconnection"
] |
[
"Procedure to return first name when inputting last name",
"create or replace procedure p_inout\n(v_emp_lname in varchar2(25))\nas\nv_first_name varchar2(20);\nbegin\nselect first_name into v_first_name\nfrom employees\nwhere last_name=v_emp_lname;\ndbms_output.put_line(v_first_name);\nend;\n\n\nI am getting \nError(2,25): PLS-00103: Encountered the symbol \"(\" when expecting one of the following: := . ) , @ % default character The symbol \":=\" was substituted for \"(\" to continue."
] | [
"oracle",
"plsql",
"procedure"
] |
[
"Chrome/Firefox/Edge Extension - Google Analytics",
"We have an extension written in Typescript working on Chrome, Firefox and Edge which we are adding Google Analytics to. We have done this by creating a simple file to load the google analytics:\n\nimport { environment } from \"../environment\";\n\n(function (i, s, o, g, r, a, m) {\n i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {\n (i[r].q = i[r].q || []).push(arguments)\n }, i[r].l = 1 * new Date().getTime(); a = s.createElement(o),\n m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)\n})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');\n\nga('create', environment.googleAnalyticsTrackingCode, 'auto');\nga('set', 'checkProtocolTask', function () { }); // Removes failing protocol check. @see: http://stackoverflow.com/a/22152353/1958200\nga('require', 'displayfeatures');\n\n\nWe then use webpack to build this and reference the file in the popup.html we have. We have added a reference to the NPM package:\n\n\n \"@types/google.analytics\": \"^0.0.39\"\n\n\nFrom the popup js file we are then able to make a call to the ga function like so:\n\nga('send', 'pageview', url); \n\n\nWe have also modified the manifest to include:\n\n\n \"content_security_policy\": \"script-src 'self'\n https://www.google-analytics.com; object-src 'self'\"\n\n\nEverything works without issue in Chrome and we see the page views logged in Google Analaytics but in Firefox and Edge there are no requests to Google Analytics but there are no errors of any kind either, it hits the ga function but nothing happens.\n\nIs there anything else we would have to do in Firefox and Edge to make this work?\n\nThe structure of our application is that the content script creates an iframe on the page and loads the popup.html as the src of that iframe. Is there a restriction in Firefox/Edge but not on Chrome that would affect Google Analytics on an extension structured in this way?\n\nComparing the network requests, Chrome on the left, Firefox on the right:\n\n\n\nI have also modified so it logs a page view from the background. Again this is working fine in Chrome but does not work in Edge/Firefox but no errors."
] | [
"typescript",
"google-chrome-extension",
"google-analytics",
"firefox-addon-webextensions",
"microsoft-edge-extension"
] |
[
"How to write a zip file from a request body to a file on Node server?",
"I am trying to write a node server that can receive a zip file of PDFs and JSON. In order to utilize it on the server I need to write it to a file on the server where I can call other functions on the internal data. \n\nHowever with my current method, I can successfully write to a file in the server but when trying to open it in windows, I get an error \"The Compressed (zipped) Folder is invalid.\"\n\nI've tried directly piping the request to fs.createWriteStream with the same result as the code below\n\n app.route('/myRoute').post(rawParser, function (req, res, next) {\n\n let serverFileName = `${req.connection.remoteAddress.substring(7)}_${Date.now()}.zip`\n let writeStream = fs.createWriteStream(`${__dirname}/${serverFileName}`, 'binary');\n\n // console.log(req.rawBody);\n writeStream.write(req.rawBody);\n writeStream.end();\n writeStream.on('error', err => {\n logger.logger(err);\n\n res.status = 500;\n res.send(\"Server did not accept File\");\n });\n writeStream.on('finish', () => {\n logger.logger(`Writing to file: ${serverFileName}`);\n res.status = 201;\n res.send(\"Successfully Wrote file to server\");\n });\n});\n\n\nHere is my rawParser middleware\n\nconst rawParser = function (req, res, next) {\n req.rawBody = [];\n req.on('data', function (chunk) {\n req.rawBody.push(chunk);\n console.log(chunk)\n });\n req.on('end', function () {\n req.rawBody = Buffer.concat(req.rawBody);\n next();\n });\n}\n\n\nI'm fairly new to node and javascript coding. I am welcome to any tips including your solutions"
] | [
"javascript",
"node.js",
"request",
"zip",
"writetofile"
] |
[
"Powershell, Lobsystem Cannot convert value type system.string to type Microsoft.Sharepoint.BusinessData.Administration.Lobsystem",
"Im trying to run a powershell code to import an assembly by I cannot figure out what the problem is with this code, can someone please help:\n$url = "http://myurl/"\n#Reference the dll from GAC\n$assemblyPath = "C:\\Windows\\assembly\\GAC_MSIL\\DMS.Bcs.DmsDataService\\1.0.0.0__6bff74e780620382\\DMS.Bcs.DmsDataService.dll"\n$lobSystemFile = "DMS.Bcs.DmsDataService"\nWrite-Host "Adding assembly to LOBSystem" + $lobSystemFile\n$serviceContext = Get-SPServiceContext $url\nWrite-Host "Url is set to" + $serviceContext\n$lobSystem = Get-SPBusinessDataCatalogMetadataObject -ServiceContext $serviceContext -BdcObjectType LobSystem -Name $lobSystemFile\nWrite-Host "Lob File contents is" + $lobFile \nImport-SPBusinessDataCatalogDotNetAssembly -LobSystem $lobSystemFile -Path $assemblyPath\n\nError:\nImport-SPBusinessDataCatalogDotNetAssembly : Cannot bind parameter 'LobSystem'. Cannot convert the "DMS.Bcs.DmsDataService.dll" value of \ntype "System.String" to type "Microsoft.SharePoint.BusinessData.Administration.LobSystem".\nAt line:10 char:55\n+ Import-SPBusinessDataCatalogDotNetAssembly -LobSystem $lobSystemFile -Path $asse ...\n+ ~~~~~~~~~~~~~~\n + CategoryInfo : InvalidArgument: (:) [Import-SPBusine...gDotNetAssembly], ParameterBindingException\n + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.SharePoint.BusinessData.SharedService.SPImportSPBusinessDataCatalogDo \n tNetAssemblyCmdlet"
] | [
"powershell",
"sharepoint",
"bdc"
] |
[
"How to wrap a custom WKInterfaceImage for SwiftUI",
"SwiftUI does a good job of providing WKInterfaceObjectRepresentable However, Is there any way to create a custom view for WKInterfaceImage?\nHere is what I tried,\nimport WatchKit\nimport SwiftUI\nimport SpriteKit\n\nstruct WatchImage: WKInterfaceObjectRepresentable {\n typealias WKInterfaceObjectType = WKInterfaceImage\n\n func makeWKInterfaceObject(context: WKInterfaceObjectRepresentableContext<WatchImage>) -> WKInterfaceImage {\n return WKInterfaceImage()\n }\n\n func updateWKInterfaceObject(_ wkInterfaceObject: WKInterfaceImage, context: Context) {\n wkInterfaceObject.setImage(UIImage(named: "start"))\n }\n}\n\nBut code is not compiling and giving an error on line return WKInterfaceImage() and says init() is unavailable\nThis is probably because we can not create an object of WKInterfaceImage programmatically. We need to use it with storyboard.\nSo Is there any workaround for this?"
] | [
"ios",
"swift",
"swiftui",
"watchkit"
] |
[
"Downloading/playing static audio files on iPhone",
"I have an iPhone app that downloads multiple WAV files from the web, storing the resultant sound data on the phone for playback in the app. Sometimes this works fine, and sometimes I'm getting one of two problems with the sound:\n\n1) There are pieces of a downloaded sound file that play back as staticky, corrupted noise\n\n2) Sometimes the full download doesn't appear to happen, meaning the binary data isn't recognizable as a legit sound file and chokes my playback library (FMOD), causing a crash.\n\nI'm using an NSURLConnection to build up the data by appending data received from the connection, as described in Apple's docs. My question is this: how can I write my downloading code so as to ensure that all files get downloaded and that they get downloaded without the corruption/noise?\n\nFacts:\n\n\nThe downloads are happening from Amazon S3. \nThey are a maximum of around a half megabyte in size. \nThey are not corrupted on the server -- i.e. they play back fine in a browser even when screwed up on the phone.\n\n\nBelow is the code I use to download all undownloaded files on each app launch. Thanks in advance for any help!\n\n- (void)downloadOutstandingFileSounds{\n NSArray *theFiles = [File listOfDownloadableOpponentfiles];\n\n if ([theFiles count] > 0) {\n NSLog(@\"Updating %d new files...\", [theFiles count]);\n for (File *file in theFiles) {\n self.theFile = file; \n NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:file.publicUrl] \n cachePolicy:NSURLRequestUseProtocolCachePolicy\n timeoutInterval:60.0];\n NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];\n if (theConnection) {\n currentFileDataContainer = [[NSMutableData data] retain];\n }else {\n NSLog(@\"failed attempt to download resource at: %@\", file.publicUrl);\n }\n\n }\n [[NSNotificationCenter defaultCenter] postNotificationName:@\"OutstandingFileSoundsDownloaded\" object:self];\n }\n}\n\n- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{\n [currentFileDataContainer setLength:0];\n}\n\n- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{\n [connection release];\n [currentFileDataContainer release];\n\n NSLog(@\"Connection failed! Error - %@ %@\",\n [error localizedDescription],\n [[error userInfo] objectForKey:NSErrorFailingURLStringKey]);\n}\n\n- (void)connection:(NSURLConnection *)connection didReceiveData:(NSMutableData *)data{\n [currentFileDataContainer appendData:data];\n}\n\n- (void)connectionDidFinishLoading:(NSURLConnection *)connection{\n NSLog(@\"Success! Received %d bytes of file data\", [currentFileDataContainer length]);\n self.theFile.fileSoundData = currentFileDataContainer;\n [self.theFile save];\n NSLog(@\"Downloadable files count: %d\", [[File listOfDownloadableOpponentfiles] count]);\n self.theFile = nil;\n [File clearCache];\n}"
] | [
"iphone"
] |
[
"WildFly (JBoss) Integration with Eclipse",
"I am currently trying to integrate WildFly and Eclipse JEE Oxygen 3 with WildFly12.0. I am getting an error I don't understand nor can I find a fix. When in the new server I get the following on the last step: \"No valid JREs found for execution environment \"JavaSE-1.8\" \"\n\nThanks in advance!"
] | [
"java",
"eclipse",
"wildfly"
] |
[
"How to Ignore cases,space and blank lines when comparing text between two files",
"So I have written a script in which I compare between two files\n\nso my files are \nfile1:\n\nThis is line 1.\nThis is line 2.\nThis is line 3.\nThis is line 4.\nThis is line 5.\n\n\nfile 2:\n\nthis is line 1,aaa\nthis is line 2,bbb\nthis is line 3,ccc\n\n\nso what my code does is find if the sentence preceding(in file2) the comma exists in file and if it exists then replace it with the sentence that succeeds the comma.\n\nHere is my code\n\nawk -F'\"(,\")?' '\nNR==FNR { r[$2] = $3; next }\n{ for (n in r) gsub(n, r[n]) } 1' file2.csv file1.csv>output.csv\n\n\nso my output.csv should look like this:\n\naaa\nbbb\nccc\nThis is line 4.\nThis is line 5.\n\n\nThis code works fine as long as there is no mismatch between the cases in both files and in the spaces.\nso When comparing I want it to compare in a case insensitive manner and by trimming the spaces.\nFor eg:\n\nWhen comparing:\nfile1:\nthisisline1.\nthisisline2.\nthisisline3. etc\n\n\nand the output should be in the original format \n\nThis is line 1.\n\n\nWhat I am looking for is on the fly trimming and lowercase conversion\n\nedit: Making this question clearer regarding the trim part.\nI have written the code:\n\ncat file2.csv|tr -s ' '>file3.csv\n\n\nwhat this does is trim multiple spaces into one \nso \n\nThis is line 1.\n\n\nis the same as\n\nThis is line 1.\n\n\nBut the problem occurs if there exists a blank line with one or more spaces\neg:\n\nthis is line 1,aaa\nthis is line 2,bbb\n(blank line but with space)\nthis is line 3,ccc\nthis is line 4.\nthis is line 5. \n\n\nso when I use my awk command first and then the trim function this fails.\nso even with this file my output should be\n\naaa\nbbb\nccc\nThis is line 4.\nThis is line 5."
] | [
"awk",
"tr"
] |
[
"Adding Array like data in Zend Framework 2 Sessions",
"Im wondering how to achieve the following:\n\nI have this Session Container created by a factory:\n\n $container = new Container('Fans');\n $container->setExpirationSeconds('219867583');\n return $container;\n\n\nthen i'm creating an instance in my controller like this:\n\n$this->sessionService = $this->getServiceLocator()->get('SessionService');\n\n\nNow i want to add something to the Session:\n\nThis one works fine:\n\n$this->sessionService->team = 'TEST';\n\n\nBut what i want to achieve is the following\n\n$this->sessionService->team[0] = 'Team Name 0' // This doesn't work;\n$this->sessionService->team[1] = 'Team Name 1' // This doesn't work;\n\\Zend\\Debug\\Debug::dump($this->sessionService->team);\n\n\nThe Output looks like this:\n\n<pre>string(9) \"TEST\" </pre>\n\n\nI don't know if i misunderstood something or do something wrong.\n\nDoes anybody know how to do it right ?"
] | [
"zend-framework2"
] |
[
"Click on safari web page button using AppleScript",
"I'm trying to figure out how to click on the button in a webpage. For example click on the \"I'm Feeling Lucky\" button in google web page.\n\nThis is what I have tried:\n\ntell application \"Safari\"\n make new document with properties {URL:\"https://www.google.com/\"}\n\n do JavaScript \"eval(document.getElementById('I'm Feeling Lucky').parentNode.href.substring(11))\" in document 1\n\n delay 1\n\nend tell\n\n\nBut it doesn't work. Any of you knows how can I click on the button using applescript? \n\nI'll really appreciate your help"
] | [
"javascript",
"html",
"safari",
"applescript"
] |
[
"OAuthCard not returning token after signin activity",
"I'm creating a Teams bot. I have added signin activity to my Teams bot.\n\nWhen I'm trying to signin, it gives me a popup to signin and after completing signin the token is not returned. So \"WaitForToken\" is never called.\n\nI was able to sign in using same bot last week. Can anyone help me to understand about any recent changes in OAuthCard for bots?\n\nThe signin code is as follows:\n\nprivate async Task SendOAuthCardAsync(IDialogContext context, Activity activity)\n {\n var reply = await context.Activity.CreateOAuthReplyAsync(ApplicationSettings.ConnectionName,\n \"Please sign in to continue.\", \"Sign In\", true).ConfigureAwait(false);\n await context.PostAsync(reply);\n\n context.Wait(WaitForToken);\n }\n\n private async Task WaitForToken(IDialogContext context, IAwaitable<object> result)\n {\n var activity = await result as Activity;\n\n var tokenResponse = activity.ReadTokenResponseContent();\n var channelData = context.Activity.GetChannelData<TeamsChannelData>();\n if (tokenResponse != null)\n {\n // Use the token to do exciting things!\n await context.PostAsync($\"Your sign in is successful\");\n }\n else\n {\n string input = activity.Type == ActivityTypes.Message ? Microsoft.Bot.Connector.Teams.ActivityExtensions.GetTextWithoutMentions(activity)\n : ((dynamic)(activity.Value)).state.ToString();\n if (!string.IsNullOrEmpty(input))\n {\n tokenResponse = await context.GetUserTokenAsync(ApplicationSettings.ConnectionName, input.Trim());\n if (tokenResponse != null)\n {\n // Use the token to do exciting things!\n\n await context.PostAsync($\"Your sign in is successful\");\n return;\n }\n }\n await context.PostAsync($\"Hmm. Something went wrong.\");\n }\n }"
] | [
"botframework",
"microsoft-teams",
"adaptive-cards"
] |
[
"How to center a group of objects?",
"I started working with Three.js (newbie) and I can not figure out how to change center origin of a group of objects. In this example https://jsfiddle.net/spyf1j94/2/ you can see that the origin is set to the first object added to the group, the question is how can I set this origin point to the group center?\n\nvar three = THREE;\n\nvar scene = new three.Scene();\nvar camera = new three.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);\n\nvar renderer = new three.WebGLRenderer({ antialias: true });\nrenderer.setSize(window.innerWidth, window.innerHeight);\n\ndocument.body.appendChild(renderer.domElement);\ncamera.position.z = 30;\nvar cubeMatrix = new THREE.Object3D();\n\nvar nextHeight = 0;\nfor(var j = 0, x = 0, y = 0; j < 220; j++, x++) {\nvar z = Math.floor(Math.random() * 12) + 1;\n var geometry = new THREE.BoxGeometry(1, 1 , z);\n\n var material = new THREE.MeshBasicMaterial({vertexColors: THREE.VertexColors});\n\n var color = Math.random() * 0xFFFFFF;\n\n for(var i = 0; i < geometry.faces.length; i += 2) {\n geometry.faces[i].color.setHex(color);\n geometry.faces[i + 1].color.setHex(color);\n }\n var cube = new THREE.Mesh(geometry, material);\n cube.position.set(x,y,z/2);\n\n if (x === 10) {\n x = -1;\n y++;\n }\n\n //cube.position.y = y * 1;\n cubeMatrix.add(cube);\n\n}\n\nscene.add(cubeMatrix);\nscene.add(new THREE.AxisHelper());\n\n\nvar isDragging = false;\nvar previousMousePosition = {\n x: 0,\n y: 0\n};\n$(renderer.domElement).on('mousedown', function(e) {\n isDragging = true;\n})\n.on('mousemove', function(e) {\n //console.log(e);\n var deltaMove = {\n x: e.offsetX-previousMousePosition.x,\n y: e.offsetY-previousMousePosition.y\n };\n\n if(isDragging) {\n\n var deltaRotationQuaternion = new three.Quaternion()\n .setFromEuler(new three.Euler(\n (Math.PI / 180) * (deltaMove.y * 1),\n (Math.PI / 180) * (deltaMove.x * 1),\n 0,\n 'XYZ'\n ));\n\n cubeMatrix.quaternion.multiplyQuaternions(deltaRotationQuaternion, cubeMatrix.quaternion);\n }\n\n previousMousePosition = {\n x: e.offsetX,\n y: e.offsetY\n };\n});\n/* */\n\n$(document).on('mouseup', function(e) {\n isDragging = false;\n});\n\n\n\n// shim layer with setTimeout fallback\nwindow.requestAnimFrame = (function(){\n return window.requestAnimationFrame ||\n window.webkitRequestAnimationFrame ||\n window.mozRequestAnimationFrame ||\n function(callback) {\n window.setTimeout(callback, 1000 / 60);\n };\n})();\n\nfunction render() {\n renderer.render(scene, camera);\n requestAnimFrame(render);\n}\n\nrender();"
] | [
"javascript",
"three.js"
] |
[
"Maidenhead Grid Square Functions in SAS, PHP or JavaScript",
"Conceptually I understand what I need to do. But mathmatically I'm stumped. \nI would like to create two functions preferably in SAS but PHP or JavaScript would work too. The first to convert a latitude/longitude into the Maidenhead Grid Square, the second finds the latitude and longitude for the center of the Maidenhead Grid Square given the grid square name (i.e. EM29qe78pq). I would like both to work with all 10 characters but still be flexable enough to only need 6 and 8 of them.\nI've read and re-read the Wikipedia article https://en.wikipedia.org/wiki/Maidenhead_Locator_System but always come up with the wrong values. I've Googled quite literally more than 100 times looking for help, none I found does. I've come to the realization I just am not understanding the math part of this problem. And its simple math..I'm told.\nThis is the SAS macro I have converting grid square to lat/lon, but while close, its not correct. Would someone care to investigate this for me and perhaps give me the answer. \n\n%macro grid2latlong(grid);\n\nfield = 'ABCDEFGHIJKLMNOPQRSTUVWX';\n\narray sparts $ 1 var1-var10;\ndo i = 1 to length(&grid);\n sparts{i} = substr(&grid,i,1);\n lon1 = (find(field,var1)-1) * 20 - 180;\n lat1 = (find(field,var2)-1) * 10 - 90;\n\n lon2 = var3 * 2;\n lat2 = var4 * 1;\n\n lon3 = (find(field,var5)-1) * 5/60;\n lat3 = (find(field,var6)-1) * 2.5/60;\n\n lon4 = var7 * 0.0083333; \n lat4 = var8 * 0.0041666; \n\n lon5 = var9;\n lat5 = var10;\n\n lonx = sum(lon1,lon2,lon3,lon4); \n latx = sum(lat1,lat2,lat3,lat4); \nend;\n\ndrop i var1-var8 lon4 lat4 lon1-lon3 lat1-lat3;\n\n\n%mend;"
] | [
"javascript",
"php",
"sas",
"latitude-longitude"
] |
[
"How to prevent a HttpUnauthorizedResult(401) from redirecting to login controller on my Api endpoint",
"I have a web application which provides an API in addition to the actual website.\nI have forms authentication enabled in my application...\n\nNow my problem is in my API endpoints returning a HttpUnauthorizedResult redirects me to the login page....\n\nHow can I prevent the redirection from happening and just have a 401 status returned?"
] | [
"asp.net-mvc",
"forms-authentication"
] |
[
"Trying to read a row of csv file modifying it",
"I have two csv file master and modified\n\nmaster have three cell \n1.FileName\n2 File MD5 value\n3 #\n\nmodified\n1 File Name\n2 its md5 value\n\nI have two check if modified.csv file name exists in master then swap the two md5 value of each file and write it to master.csv.master.csv contains around 6435 rows so it should only modify a particular row\n\nthis is what i have written and its nowt working.\n\nString s1,s2;\nSimpleDateFormat sdf = new SimpleDateFormat(\"MM/dd/yyyy HH:mm:ss\");\nBufferedReader modified_reader=new BufferedReader(new FileReader(modified_file));\nBufferedReader master_reader=new BufferedReader(new FileReader(master_file));\nFileWriter fw=new FileWriter(master_file.getName());\nwhile((s1=modified_reader.readLine())!=null)\n{\n\nString[] modified_lines=s1.split(\",\");\nSystem.out.println(modified_lines[0]+\" \"+modified_lines[1]);\nwhile((s2=master_reader.readLine())!=null)\n{\nString[] master_lines=s2.split(\",\");\nSystem.out.println(master_lines[0]+\" \"+master_lines[1]+\" \"+master_lines[2]);\nif(modified_lines[0].equalsIgnoreCase(master_lines[0]))\n{\nmaster_lines[1]=modified_lines[1];\n master_lines[2]=sdf.format(modified_file.lastModified());\nfw.write(master_lines[0]);\nfw.write(',');\nfw.write(master_lines[1]);\nfw.write(',');\nfw.write(master_lines[2]+\"DOne\");\nfw.flush();\n//fw.close();\n\n}\n\n\n}\n\n\n}\n\n\nThe problem here is its not modying the master.csv file with the swapped value and i am trying to get the file last modified time and change it with #"
] | [
"java"
] |
[
"Optimization SQL Query For Analytics",
"I have implemented analytics system which is now performing very poorly. To explain it I need to explain table structure queries\n\nI have two innodb tables \n\nTable1: Contains records about hourly stats (stats_id, file_id, time)\nTable2: Contains over 8 million rows.\n\nTable 2 structure is\n\nfull_stats (\n stats_id Int\n file_id Int\n stats_week Int\n stats_month Int\n stats_year Int\n stats_time DATETIME\n\n\n)\n\nWhat I am trying to do is to calculate the total views from hourly_stats for a given period of time and grouping records by file_id and then I add/update records to full_stats table. On avg it takes 1-2 mins to process one row. I am trying to optimize the queries for better performance.\n\nHere is what I am doing\n\nThere are 60% chances that file_id already exists in full_stats for a given week, month and year and 40% chances are that it doesn't exist.\n\nso in the first query I try to update record using following the query\n\nUPDATE full_stats \n SET total_views=XXX \n WHERE stats_week=XX stats_month=X \n AND stats_year=YYYY\n\n\nafter that I check if affected rows is zero then I insert the record. Once insert or update is done then the record from hourly_stats is removed based on file_id and the given period of time.\n\nCan you give me any suggestion how to optimize queries and reduce the lock rate?"
] | [
"mysql"
] |
[
"How to convert the value of an enum from input to Enum?",
"I have the following enums with their value:\nHow can I convert the value of an enum to the enum? For example, from "Rocky" as input how can I set the enum of a class to ROCK?\nI tried using valueOf like this:\ngen gen1 = gen.valueOf("Rocky")\n\nHowever, it throws an IllegalArgumentException of 'No enum constant'.\nI have been really trying to figure this out even though I guess it's too easy but I'm a beginner. I had to instead take direct enum constant as input instead of the value of enum as input. But I want to know for knowledge on how I can convert the value of an enum to enum constant?"
] | [
"java",
"enums"
] |
[
"Interpreting a Self Organizing Map",
"I have been doing reading about Self Organizing Maps, and I understand the Algorithm(I think), however something still eludes me. \n\nHow do you interpret the trained network? \n\nHow would you then actually use it for say, a classification task(once you have done the clustering with your training data)?\n\nAll of the material I seem to find(printed and digital) focuses on the training of the Algorithm. I believe I may be missing something crucial.\n\nRegards"
] | [
"machine-learning",
"neural-network",
"som"
] |
[
"How do I delete duplicates in my array merging method?",
"I have a method that takes 2 attributes which are 2 arrays and merges them in the ascending order. All that's left for me is to figure out how to delete duplicates. Here's the code:\n\npublic static int[] mergeArrays(int[] a, int[] b){\n\n int[] c = new int[a.length+b.length];\n int aIt = 0;\n int bIt = 0;\n\n while(true) {\n\n\n if(aIt < a.length && bIt < b.length) {\n if(a[aIt] == b[bIt]){\n c[aIt+bIt] = a[aIt++];\n }\n else{\n c[aIt+bIt] = b[bIt++];\n }\n } else if(aIt < a.length) {\n c[aIt+bIt] = a[aIt++];\n } else if(bIt < b.length) {\n c[aIt+bIt] = b[bIt++];\n } else {\n break;\n }\n }\n return c;\n}\n\n\nAs you can imagine, this is an assignment, so I'm not supposed to use any external libraries, otherwise this would be a lot easier.\n\nI tried this method, but when I run this code in the console it seems to put it in some never-ending loop which consumes my CPU core entirely until I stop the process:\n\npublic static int[] mergeArrays(int[] a, int[] b){\n\n int[] c = new int[a.length+b.length];\n int aIt = 0;\n int bIt = 0;\n int lastVal = 0;\n while(true) {\n if(c[aIt+bIt] == lastVal){\n continue;\n }\n else{\n if(aIt < a.length && bIt < b.length) {\n if(a[aIt] == b[bIt]){\n c[aIt+bIt] = a[aIt++];\n lastVal = c[aIt+bIt];\n }\n else{\n c[aIt+bIt] = b[bIt++];\n lastVal = c[aIt+bIt];\n }\n } else if(aIt < a.length) {\n c[aIt+bIt] = a[aIt++];\n lastVal = c[aIt+bIt];\n } else if(bIt < b.length) {\n c[aIt+bIt] = b[bIt++];\n lastVal = c[aIt+bIt];\n } else {\n break;\n }\n }\n }\n return c;\n}\n\n\nIt seems as though the \"continue\" keyword is the problem. When I try break in its place, the code executes.\n\nEDIT:\n\nI've added a new array to the mergeArrays method:\n\npublic static int[] mergeArrays(int[] a, int[] b)\n{\n int a_size = a.length;\n int b_size = b.length;\n int[] c = new int[a_size + b_size];\n int[] d = null;\n int i = 0 , j = 0, x = -1;\n for(; i < a_size && j < b_size;)\n {\n if(a[i] <= b[j])\n {\n c[++x] = a[i];\n ++i;\n }\n else \n {\n if(c[x] != b[j])\n {\n c[++x] = b[j]; // avoid duplicates\n }\n ++j;\n }\n }\n --i; --j;\n while(++i < a_size)\n {\n c[++x] = a[i];\n }\n while(++j < b_size)\n {\n c[++x] = b[j];\n }\n d = new int[uniqueValues(c)]; \n\n for(int g=0; g<uniqueValues(c); g++){\n d[g] = c[g];\n }\n return d;\n}"
] | [
"java",
"arrays",
"sorting"
] |
[
"MFC Dialog Size Question",
"Good day.\n\nfrom my vc++ project. .rc file.\n\nIDD_My_DIALOG DIALOGEX 0, 0, 233, 273\nSTYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME\nEXSTYLE WS_EX_OVERLAPPEDWINDOW | WS_EX_STATICEDGE | WS_EX_APPWINDOW\nCAPTION \"AMEC FA Tool\"\nFONT 8, \"MS Shell Dlg\", 0, 0, 0x1Q\n\nHow to change config a fixed dialog which size to length = 233 and hight = 273 ?\n\nAny help will be appreciated.\n\nBR!\nnano"
] | [
"mfc",
"dialog"
] |
[
"Is there a method to get the end/beginning coordinates of a line shape in Office.js?",
"I am trying to place a textbox at the end/beginning points of some line shapes and can't seem to figure out how to get the coordinates of the line to place the textbox shape at. I tried using the connectBeginShape method but it doesn't seem to work with textboxes."
] | [
"javascript",
"excel",
"office-js"
] |
[
"How to use vuefront with opencart?",
"I'm installing Vuefront on Opencart.\nUsing latest versions.\nAnd I'm following documentation in this URL. https://vuefront.com/guide/setup.html\nOpenCart version: 3.0.3.6\nCMS connect app: d_vuefront_compiled_oc3.0.3.2.v2.0.0.ocmod.zip\nBut I have some errors.\nPlease check this image\n[GraphQL error]: Message: Cannot query field "url" on type "Post"., Location: [object Object], Path: undefined\n[GraphQL error]: Message: Cannot query field "url" on type "Page"., Location: [object Object], Path: undefined\n[GraphQL error]: Message: Cannot query field "url" on type "Product"., Location: [object Object], Path: undefined\nHow can I fix this problem?"
] | [
"vue.js",
"frontend",
"opencart-3"
] |
[
"Boolean::class.java can not cast to boolean (java) when receive data from Signal R and pass to broadcast receiver",
"I'm Android Developer and I Used Signal R for communication with Server and get data when emitting from server:\nhubConnection.on(\n Constants.SIGNALR_TARGET_RECEIVE_CALL_REQUEST,\n { receiveCallRequestDetails, isVideoEnable ->\n intent.putExtra(BROADCAST_SIGNAL_R_RECEIVE_CALL_REQUEST_DETAILS, receiveCallRequestDetails)\n intent.putExtra(BROADCAST_SIGNAL_R_RECEIVE_CALL_REQUEST_IS_VIDEO, isVideoEnable)\n LocalBroadcastManager.getInstance(applicationContext).sendBroadcast(intent)\n // applicationContext.sendBroadcast(intent)\n },\n ReceiveCallRequest::class.java,\n Boolean::class.java\n)\n\nwhen I get Boolean from the server(isVideoEnable is Boolean) and pass it to BroadcastReceiver I got RunTimeError with this description:\n\nHubConnection disconnected with\nWebSocket connection stopping with code null and reason 'Cannot cast java.lang.Boolean to boolean'."
] | [
"java",
"android",
"kotlin",
"signalr",
"broadcastreceiver"
] |
[
"How I can fix json structure to help spark read it properly. Different types for same key",
"I'm reciving json. I don't know on which keys problem will appear. When spark see different types for same key it puts this into string and I need to have data in array type. I'm using spark 2.4 with json lib so I read jsons as \nspark.read.json(\"jsonfile\")\n\nI'm flattening my json schema to this kind of format where col name is: \nB__C \nB__somedifferentColname\n\nSample json look like this \n\n{\n \"A\":[\n {\n \"B\":{\n \"C\":\"Hello There\"\n }\n },\n {\n \"B\":[\n {\n \"C\":\"Hello\"\n },\n {\n \"C\":\"Hi\"\n }\n ]\n }\n ]\n}\n\n\nand I would like to have this json in format like this: \n\n{\n \"A\":[\n {\n \"B\":[{\n \"C\":\"Hello There\"\n }]\n },\n {\n \"B\":[\n {\n \"C\":\"Hello\"\n },\n {\n \"C\":\"Hi\"\n }\n ]\n }\n ]\n}\n\n\nSo as you can see what I have changed is added square brackets to first object.\n\nBut when I have one value as struct type and one value as a list it puts this to string so the column value will be look like:\n\n\"[{\"C\":\"Hello\"},{\"C\":\"Hi\"}]\"\n\nand it should look like that \nB__C\nHello\nHi\nHello There\n\nIs anyone able to help me what trick I can use to resolve this issue? \nTeam which delivers jsons to us said this is not possible to do this from thier side so we have to resolve this on our side."
] | [
"json",
"scala",
"apache-spark"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.