texts
sequence
tags
sequence
[ "Display two cells per section in UICollectionView", "I'm using UICollectionView to display images , I have stored in an Array like this.\n\nnewsPhotos = [NSArray arrayWithObjects:@\"photo1.png\", @\"photo2.png\", @\"photo3.png\", @\"photo4.png\", @\"photo5.png\", @\"photo6.png\", @\"photo7.png\", @\"photo8.png\", @\"photo9.png\", @\"photo10.png\", Nil];\n\n\nMy Idea its to display the grids on this order\n\n1 | 2\n3 | 4\n5 | 6\n7 | 8\n9 | 10\n\n\nSo two photos by line, my UICollectionView methods looks like this:\n\n- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section {\n\n return 2;\n}\n\n- (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView {\n return newsPhotos.count;\n}\n\n- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath {\n\n Cell *cell = [cv dequeueReusableCellWithReuseIdentifier:@\"Cell\" forIndexPath:indexPath];\n\n UIImageView *recipeImageView = (UIImageView *)[cell viewWithTag:100];\n recipeImageView.image = [UIImage imageNamed:[newsPhotos objectAtIndex:indexPath.section]];\n\n cell.textLabel.text = @\"Data\";\n\n\n\n return cell;\n}\n\n\nBut its printing like this\n\n1 | 1\n2 | 2\n3 | 3\netc..\n\n\nI understand why its happening, and just don't know how to fix it. Any help?\n\nThanks" ]
[ "ios", "objective-c", "uicollectionview" ]
[ "Custom OSD Keyboard suggestion", "I tryed this example with two type of fields with style MaterialDesignFloatingHintTextBox and MaterialDesignFloatingHintPasswordBox, but I noticed that when the event get is triggered the popup is showed correctly but when I go to the popup to press one of the button, the lost focus event of the text field is triggered and the popup is closed :/\n\nMy question is that do you know some solutions? Or do you know some osd keyboard that works with the materialdesignxamltoolkit?" ]
[ "wpf", "xaml", "material-design-in-xaml" ]
[ "sleep for many days with resolution of microseconds", "Is there a way to put a thread to sleep for many days with a resolution of microseconds? usleep can only put the thread to sleep for 1000000 and sleep works in second steps. Is there a way to, may be, use both sleep and usleep to achieve this?" ]
[ "c++", "sleep" ]
[ "Trouble using python's gzip/\"How do I know what compression is being used?\"", "Ok, so I've got an Open Source Java client/server program that uses packets to communicate. I'm trying to write a python client for said program, but the contents of the packet seem to be compressed. A quick perusal through the source code suggested gzip as the compression schema (since that was the only compression module imported in the code that I could find), but when I saved the data from one of the packets out of wireshark and tried to do\n\nimport gzip\nf = gzip.open('compressed_file')\nf.read()\n\n\nIt told me that this wasn't a gzip file because the header was wrong. Can someone advise me what I've done wrong here? Did I change or mess up the format when I saved it out? Do I need to strip away some of the extraneous data from the packet before I try running this block on it?\n\n if (zipped) {\n\n // XML encode the data and GZIP it.\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n Writer zipOut = new BufferedWriter(new OutputStreamWriter(\n new GZIPOutputStream(baos)));\n PacketEncoder.encodeData(packet, zipOut);\n zipOut.close();\n\n // Base64 encode the commpressed data.\n // Please note, I couldn't get anything other than a\n // straight stream-to-stream encoding to work.\n byte[] zipData = baos.toByteArray();\n ByteArrayOutputStream base64 = new ByteArrayOutputStream(\n (4 * zipData.length + 2) / 3);\n Base64.encode(new ByteArrayInputStream(zipData), base64, false);\n\n\nEDIT:\nOk, sorry I have the information requested here. This was gathered using Wireshark to listen in on communication between two running copies of the original program on different computers. To get the hex stream below, I used the \"Copy -> Hex (Byte Stream)\" option in Wireshark.\n\n001321cdc68ff4ce46e4f00d0800450000832a85400080061e51ac102cceac102cb004f8092a9909b32c10e81cb25018f734823e00000100000000000000521f8b08000000000000005bf39681b59c85818121a0b4884138da272bb12c512f27312f5dcf3f292b35b9c47ac2b988f902c59a394c0c0c150540758c250c5c2ea5b9b9950a2e89258900aa4c201a3f000000\n\nI know this will contain the string \"Dummy Data\" in it. I believe it should also contain \"Jonathanb\" (the player name I used to send the message) and the integer 80 (80 is the command # for \"Chat\" as far as I can gather from the code)." ]
[ "java", "python", "reverse-engineering", "compression" ]
[ "Where will be nohup file created/stored", "On executing below given command within a script file:\n\nCommand : \n\nnohup /usr/hp/ism/jboss-3.2.8.SP1/bin/run.sh &\n\n\nWhere will the nohup.out file be created, assuming that script is running in root directory ?" ]
[ "linux", "shell" ]
[ "save nested attributes in textarea", "I have 2 models Deal and Coupon.\n\nDeal \n\nhas_many :couponizations, dependent: :destroy\nhas_many :coupons, through: :couponizations, source: :coupon\naccepts_nested_attributes for :coupons\n\n\nSo each deal has many coupon codes, which are saved in separate table and associated via couponizations table. What I want to do is to save coupon codes attributes for deal via textarea field in Deal form (each coupon code on new line)\n\nForm looks like this:\n\n\n\nDeal title: || New Deal Title ||\n\n\n\nCoupon codes:\n\n\n| TESTCOUPON1 |\n| TESTCOUPON2 |\n| TESTCOUPON3 |\n\n\n\n\nI realize that probably I need to create virtual attribute \"coupon_codes\" and then split it by \"\\n\" and save it in controller. Is there any best-practice for this?" ]
[ "ruby-on-rails", "ruby-on-rails-4" ]
[ "Unity: Wait() in Update almost working (But not quite)", "I have a code (C#) with an update function that needs to wait for a few seconds at some point. The problem is that while it is executing the wait command it continues down the update function, resulting in the bit that is supposed to be delayed, to be completely skipped.\nBecause of the boolean variables the update will only do this stuff once, until I make it available again, so that is no problem.\nThe code works without the whole waiting thing so don't worry about that, I left out most lines that don't have to do with waiting anyways.\n\nvoid Update()\n{\n\n if (RoundOver == false)\n {\n RoundOver = true;\n Seconds = 3;\n Debug.Log(\"Waiting\", gameObject);\n StartCoroutine(Wait());\n if (Continue)\n {\n Continue = false;\n Debug.Log(\"Done Waiting\", gameObject);\n RoundNumber += 1; //Just game stuff\n ZombiesLeft = ZombieAmount(); //Just game stuff\n RoundOver = false;\n }\n Debug.Log(\"Done wit stuff\", gameObject);\n }\n if (counter > DelayTime && RoundOver == false)\n {\n counter = 0;\n Debug.Log(\"Going to spawn a zombie\", gameObject);\n SpawnZombie();\n }\n counter += Time.deltaTime;\n }\n\n\nwith les wait function:\n\nIEnumerator Wait()\n{\n Debug.Log(\"ACTUALLY WAITING\", gameObject);\n yield return new WaitForSeconds(Seconds);\n Continue = true;\n Debug.Log(\"ACTUALLY WAITING DONE\", gameObject);\n}\n\n\nThe output is as follows:\n\nWaiting\nACTUALLY WAITING\nDone wit stuff\nACTUALLY WAITING DONE\n\n\nSo obviously the right order should be\n\nWaiting\nACTUALLY WAITING\nACTUALLY WAITING DONE\nDone wit stuff\n\n\nEDIT:\nThe block in if (continue) is supposed to activate the second block when the (here hidden) requirements are met. The second block would keep doing its thing until it is done (could take minutes) and then by setting RoundOver to false again re-enabling the first block. The first block is essentially to keep rerunning the second block with increasing variables like RoundNumber +=1, and, which is the only problem here, to have the second blocks separated by 3 seconds." ]
[ "c#", "unity3d", "wait" ]
[ "Overlay image on video in ffmpeg for android studio", "When i add image on video but my image cut off right side in ffmpeg android studio so how to give image width?\n[1]: https://i.stack.imgur.com/Y21Si.jpg\nbelow is my command:\n\nString command = "-i '" + uri.toString() + "'"\n+ " -i '" + layer.getAbsolutePath() + "'"\n+ " -filter_complex "[0:v][1:v]overlay="+getX+":"+getY+"[outVideo],[0:a]volume=1:[audio0]"\n-map [outVideo] -map [audio0]"\n+ " '"\n+ mDestinationPath + "'";" ]
[ "java", "android", "android-studio", "ffmpeg", "android-ffmpeg" ]
[ "UITableView separator at wrong position", "On selection I change the height of an UITableViewCell (loaded from a nib).\nBut the separator line is at a wrong position when I do this. \n\n\n\nIn the screenshot the first row is selected, and therefore bigger than the other ones.\nFrom the separator positions it looks like the cell after the selected cell would be the big one. The second cell \"has\" exactly the size the first cell should have.\n\nTo change the height I save the selected indexpath in tableView:didSelectRowAtIndexPath: and compare it in tableView:heightForRowAtIndexPath:. If the indexpaths are the same I return the increased height. With the help of some NSLog I made sure that the correct height is returned.\nAnd if I would resize the wrong cells the views of the cell would overlap, this doesn't happen. \n\nIf I click Line 3 of the first cell the tableView:didSelectRowAtIndexPath: fires and the indexpath is the one for the first cell. So I guess the heights are correct, and the tableview draws the separators on the wrong position. \n\n\n\nDoes anybody has an idea what I did wrong?\nAny solutions? Or should I file another bug with apple?\n\n\n\nEdit: If I don't reuse my cells it works as expected." ]
[ "iphone", "cocoa-touch", "uitableview" ]
[ "Prevent bootstrap dropdown dismiss when selectpicker is clicked", "I want make filter section inside bootstrap dropdown\nbut when i click my select form bootstrap selectpicker, bootstrap dropdown is auto dismiss.\nwhat should I do so that the dropdown doesn't close when the selectpicker is clicked\nhere my fiddle project\nHTML\n<div class="container">\n <div class="row justify-content-center mt-5">\n <div class="col-md-6">\n <div class="dropdown">\n <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">\n Dropdown button\n </button>\n <div class="dropdown-menu p-4" aria-labelledby="dropdownMenuButton">\n <div class="form-group">\n <select id="filter" name="filter">\n <option value=""></option>\n <option value="one">One</option>\n <option value="two">Two</option>\n <option value="three">Three</option>\n </select>\n </div>\n\n <div class="form-group">\n <select id="filter2" class="select-picker" name="filter2">\n <option value=""></option>\n <option value="one">One</option>\n <option value="two">Two</option>\n <option value="three">Three</option>\n </select>\n </div>\n \n </div>\n </div>\n </div>\n </div>\n</div>\n\nJS\n$(document).on('click', '.dropdown-menu', function (e) {\n e.stopPropagation();\n});\n\n$('.select-picker').selectpicker();" ]
[ "javascript", "html", "twitter-bootstrap", "bootstrap-selectpicker" ]
[ "Python3 utf8 codecs not decoding as expected in Docker ubuntu:trusty", "The following thing really bugs me, the version of python on my laptop and the version of python inside Docker's ubuntu:trusty image are printing different results with their codecs, what is the reason for that? \nFor example, python3 on my laptop(ubuntu, trusty):\n\nPython 3.4.3 (default, Apr 14 2015, 14:16:55) \n[GCC 4.8.2] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import codecs\n>>> codecs.decode(b'\\xe2\\x80\\x99','utf8')\n'’'\n>>> \n\n\npython3 on Docker ubuntu:latest:\n\nPython 3.4.0 (default, Apr 11 2014, 13:05:11) \n[GCC 4.8.2] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import codecs\n>>> codecs.decode(b'\\xe2\\x80\\x99','utf8')\n'\\u2019'\n>>> \n\n\nCan i make the python3 codecs on Docker's ubuntu:trusty decode b'\\xe2\\x80\\x99' as '’'?" ]
[ "docker", "locale", "ubuntu-14.04", "python-3.4", "docker-registry" ]
[ "Android actionbar menu icon now shown in tablet", "I've developed an application which contains a menu icon in my actionbar, I create the menu as below: \n\n@Override\npublic boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.main, menu);\n return true;\n}\n\n\nand here's the code for the onOptionsItemSelected:\n\n@Override\npublic boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case R.id.menu_home:\n startActivity(new Intent(this, MainActivity.class));\n return true;\n case R.id.menu_adv_search:\n startActivity(new Intent(this, AdvSearchActivity.class));\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n}\n\n\nusing my smart phone the menu icon is there (using LG phone), but when I test it on my tablet (Galaxy Tab 8) the menu icon is gone, but the functionality is still there. pressing the menu soft button at the bottom, the popup appears, but the icon is missing from the top action bar. How to fix it? any ideas?" ]
[ "android", "android-actionbar", "android-menu" ]
[ "Escaping for proper shell injection prevention", "I need to run some shell commands from a Lua interpreter embedded into another Mac/Windows application where shell commands are the only way to achieve certain things, like opening a help page in a browser. If I have a list of arguments (which might be the result of user input), how can I escape each argument to prevent trouble?\n\nInspired by this article an easy solution seems to be to escape all non-alphanumeric characters, on Unix-like systems with \\, on Windows with ^. As far as I can tell, this prevents that any argument will cause\n\n\nexecution of another command because of on intervening newline, ; (Unix) or & (Windows)\ncommand substitution on Unix with $ or `\nvariable evaluation on Windows with %\nredirection with <, | and >\n\n\nIn addition, any character that on the respective platform works as escape character will be escaped properly.\n\nThis seems sound to me, but are there any pitfalls I might have missed? I know that in bash, \\ followed by a newline will effectively remove the newline, which is not a problem here.\n\nEDIT\n\nMy conclusion: There is no single mechanism that by swapping the escape character will work on both Windows and *nix. It turns out it is not so straightforward to make sure that a Windows program actually sees the command line arguments we want it to see as splitting the command string into arguments on Windows is not handled by the shell but by the called program itself.\n\nTherefore two layers of escaping need to be taken into account:\n\n\nFirst, the Windows shell will process what we give it. What it might do is variable substitution at %, splitting into multiple commands at & or piping to another command at |.\nThen, it will hand on a single command string to the called program which the program will split, ideally but not necessarily following the rules described by Microsoft.\n\n\nAssuming it follows these rules, one can work one's way backwards, first escaping to these rules, then escaping further for the shell." ]
[ "bash", "shell", "batch-file", "escaping", "code-injection" ]
[ "Oxygen XML Eclipse plugin download location", "Where can I download the Oxygen XML Eclipse plugin? I'm looking for a full download link, not the update site for use with Eclipse update. I have the following URL for that:\n\nhttp://www.oxygenxml.com/InstData/Eclipse/site.xml\n\n\nAlso, is the plugin free?" ]
[ "eclipse", "eclipse-plugin", "oxygenxml" ]
[ "Direction of markers in force layout", "For a school project I'm working on a force directed layout with markers. Now I don't know how to change the direction of the markers ... When i implemented them most of them were immediatly in the right direction but some of them need to be reversed. Does anyone know if there is an easy way to do this ?\n\n //defining the markers\n svg.append(\"defs\").selectAll(\"marker\")\n .data([\"normal\", \"reverse\"])\n .enter().append(\"marker\")\n .attr(\"id\", function(d) { return d; })\n .attr(\"viewBox\", \"0 -5 10 10\")\n .attr(\"refX\", 19)\n .attr(\"markerWidth\", 6)\n .attr(\"markerHeight\", 6)\n .attr(\"orient\", \"auto\")\n .append(\"path\")\n .attr(\"d\", \"M0,-5L10,0L0,5\");\n\n//Drawing the markers\n var edgeSelection = svg.selectAll('.edge')\n .data(edges)\n .enter()\n .append('line')\n .classed('edge', true)\n .style(\"marker-start\", \"url()\")\n .style(\"marker-end\", \"url(#normal)\")\n .call(positionEdge, nodes);\n\n\nI have been playing around with \"marker-start\" ,\"marker-end\", \"orient\" and \"refX\" but I can't get it to work ...\n\nThanks" ]
[ "javascript", "d3.js", "force-layout", "markers" ]
[ "How to instantiate global variables by executing a text file lines within a Python3 function?", "I want to use a Python function to instantiate the variable my_var to a default value.\nNext, I want to use the following input.txt text file to modify the value of my_var:\nmy_var = 0.15 # Change the value\nprint(f"In the text file, my_var={my_var}")\nmy_var = 0.15; print(f"In the same line, my_var={my_var}")\n\nHere is the Python script that reads the lines in the text file and executes them one by one:\ndef run_exec():\n my_var = 1.0 # Default value\n f = open("input.txt")\n lines = f.readlines()\n for l in lines:\n exec(l)\n print(f"Within the function, my_var={my_var}")\n return my_var\n\nmy_var = run_exec()\nprint(f"Outside the function, my_var={my_var}")\n\nWhen running this script in my terminal, I get:\nAt the beginning, my_var=1.0\nIn the text file, my_var=1.0\nIn the same line, my_var=0.15\nWithin the function, my_var=1.0\nOutside the function, my_var=1.0\n\nIt looks like each executed text line comes with its own scope... How can I get my_var=0.15 outside the function?" ]
[ "python-3.x", "function", "scope" ]
[ "sorting a report by subreport values", "I have a subreport that provides items and their value, with a sum of the value at the bottom. I would like to sort my main report, which is the owner of the items, by the total sum of the item value.\n\nI have a main report that supplies the user with a persons name and contact information. I have built a sub report that takes the person's ID and displays the name and value of items associated with them. The subreport has a sum of the items. I would like to sort this report so that the highest total value is at the top. I'm new to working with sub reports in SSRS so any help would be appreciated!\n\nthis is my report -> type and balance are the sub report. I know that these are already sorted, but that is just coincidence and I have about a thousand rows that need to be sorted by total balance" ]
[ "reporting-services", "ssrs-2012" ]
[ "Can I validate that models are in sync with database schema?", "Is it possible to validate that all Models can be read/inserted without modifying the DB? sync() doesn't seem to do this.\n\nMy goal is to implement a simple (read: non-migrations-based) check as part of a continuous deployment workflow that a commit won't break compatibility with the live staging or production databases." ]
[ "sequelize.js" ]
[ "Open word document in readonly mode", "I'm using automation to open documents in Word. Sometimes I need to open document in Read mode ON: \n\n var\n WordDocument: _Document;\n WA: TWordApplication; \n begin\n WA := TWordApplication.Create( nil );\n WA.OnQuit := DocumentClose;\n WA.Connect;\n WordDocument := Wa.Documents.Open( FileName, EmptyParam, true {ReadOnly}, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam );\n\n\nBut user can off the Read mode in opened document:\n\n\n\nHow can I handle this in OnQuit event in procedure DocumentClose ?\nIn DocumentClose I want to know if document is in read mode or not.\n\nI do not have any solution because I did not have enough experience with it. \nSo, I need your suggestions, advices about it. Sorry for my English and if I have to add more informations, please let me know. Thanks\n\nUPDATE\n\nI've tried to read protection type, but it's always return the first case. So, when document opening as ReadOnly isn't protected as wdAllowOnlyReading. Some documents can be protected with password, but there is not problem with it. \n\nconst \n wdAllowOnlyReading: Longword = $00000003;\n wdNoProtection: Longword = $ffffffff;\nvar\n ProtectionType: TOleEnum;\nbegin\n ProtectionType := WordDocument.ProtectionType;\n case ProtectionType of\n wdNoProtection : Showmessage('NoProtection'); \n wdAllowOnlyReading: Showmessage('ReadOnly');\n end;\nend;" ]
[ "delphi", "ms-word", "activex", "ole-automation" ]
[ "Python - delete empty line from .txt, but last line don't delete", "i have a test.txt file like this:\n\n1 - test\n2 - \n3 - test\n4 - \n\n\n(the numbers are just for example)\n\nand my python code:\n\nwith open('test.txt') as infile, open('output.txt', 'w') as outfile:\n for line in infile:\n if not line.strip(): continue # skip the empty line\n outfile.write(line) \n\n\nbut the output.txt is:\n\n1 - teste\n2 - teste\n3 - \n\n\nI'd like to delete the last line too, but NOT with the code that erase the last line like this:\n\nlines = file.readlines()\nlines = lines[:-1]\n\n\nHow can i delete this last line checking with python if is a empty line?\n\nThanks!" ]
[ "python", "file" ]
[ "Is it possible to exclude labels with nodeSelector?", "i want to do something like\n\nnodeSelector:\n role: \"!database\"\n\n\nin order to schedule pods on nodes which don't host the database.\n\nThank you" ]
[ "kubernetes" ]
[ "How to know if an item is a leaf level item or not", "See the attached image below. I have created a tree view and I have connected the doubleClicked signal to a slot which prints the row number, column number, hasChildren and childCount\n\nWhen I clicked on \"Property 0\", I got the first print and when I clicked on \"222.1\", I got the 2nd print as shown.\n\nThe first print is correct because Property 0 has 4 children\n\nI was expecting the 2nd print also to be same. Why did it give me a childCount as 0?\n\nI wanted to know that when I clicked on any item in the 2nd column, whether that is leaf level item or not..\nPlease explain and help." ]
[ "qtreeview", "qmodelindex" ]
[ "active record query over datetime array", "Given I have an array of datetimes:\n\narray = [Sat, 30 Jul 2011 00:00:00 CEST +02:00, Sat, 30 Jul 2011 00:15:00 CEST +02:00, Sat, 30 Jul 2011 00:30:00 CEST +02:00, Sat, 30 Jul 2011 00:45:00 CEST +02:00\n\n\nI want my model class method to return the datetimes that dont match (aren't scheduled)\n\n Sat, 30 Jul 2011 00:00:00 CEST +02:00\n\n#appointment.rb (with colum `date` as DateTime)\n\ndef self.booked(array)\n where(\"date NOT IN (?)\", array)\n\nend\n\n\nThx for advise!" ]
[ "ruby-on-rails", "ruby-on-rails-3", "activerecord" ]
[ "read file to c++ vector with size inconsistent", "I used following code to read a binary file and store its content in a vector. But the vector.size() printed is smaller than the file size. What's the problem here?\n\n#include <iostream>\n#include <iterator>\n#include <fstream>\n#include <vector>\nusing namespace std;\n\nint main(){\n ifstream is(myfile,ios::binary);\n istream_iterator<unsigned char> start(is),end;\n vector<unsigned char> v(start,end);\n cout << v.size() << endl;\n return 0;\n}\n\n\n\n Output: 7805148\n \n File size: 7840016" ]
[ "c++" ]
[ "ADODB.Field error '800a0bcd' Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record", "I keep getting this error and I am not sure how to fix it. I am new to this and any help would be awesome. This is used on a website that I am working on for a project and this is the only error that I have encountered. \n\nthe error message is this:\n\n\n ADODB.Field error '800a0bcd'\n\n\nEither BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.\n\n\n /asctutor/includes/header.asp, line 58\n\n\nAnd the code is below(I have highlighted line 58):\n\n\n\n '******************************************************\n ' Retrieve user's real full name\n '******************************************************\n\n Function getRealName (UserName)\n\n if UserName <> \"EMPTY\" then\n EstablishDBCON rstutor7courses, concourses\n\n sqlString = \"Select * from Users where UserName ='\"&UserName&\"'\"\n 'Response.write sqlString\n rstutor7courses.open sqlString\n if rstutor7courses.eof=false then UserType =rstutor7courses(\"Type\")end if \n rstutor7courses.close \n\n sqlString = \"Select F_Name,L_Name from \"&UserType&\" where UserName ='\"&UserName&\"'\"\n 'Response.write sqlString\n rstutor7courses.open sqlString\n UserFName = rstutor7courses(\"F_Name\") \n UserLName = rstutor7courses(\"L_Name\") \n getRealName = UserFName & \" \" & UserLName\n rstutor7courses.close\n else\n getRealName = \"\"\n end if\n\n end function \n\n\nso I have edited the code on line 58 but now I get this error:\nMicrosoft OLE DB Provider for SQL Server error '80040e14'\n\n\n Incorrect syntax near the keyword 'where'.\n /asctutor/includes/header.asp, line 63" ]
[ "sql", "adodb" ]
[ "Push notification with Parse opening before clicking on notification", "This is how my setup looks.\n\nThe LunchActivity has code:\n\nParse.initialize(this, \"MY_APP_ID\", \"MY_APP_KEY\");\nPushService.subscribe(this, \"MyCity\", HomeActivity.class);\nParseInstallation.getCurrentInstallation().saveInBackground();\n\n\nHomeActivity class is a simple activity class that opens a simple screen used as default. I have also written a custom receiver.\n\npublic class CityPushReceiver extends BroadcastReceiver {\n private static final String TAG = \"CityPushReceiver\";\n\n @Override\n public void onReceive(Context context, Intent intent) {\n try {\n JSONObject json = new JSONObject(intent.getExtras().getString(\n \"com.parse.Data\"));\n\n Integer event_id = Integer.parseInt((String) json.get(\"event_id\"));\n\n Intent eventIntent = new Intent(context, EventResult.class);\n eventIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n eventIntent.putExtra(\"event_id\", event_id);\n context.getApplicationContext().startActivity(eventIntent);\n\n } catch (JSONException e) {\n Log.d(TAG, \"JSONException: \" + e.getMessage());\n }\n }\n}\n\n\nManifest file has entry:\n\n<receiver\n android:name=\"com.myapp.CityPushReceiver\"\n android:exported=\"false\" >\n <intent-filter>\n <action android:name=\"com.myapp.CITY_NOTIFICATION\" />\n </intent-filter>\n</receiver>\n\n\nI use Python code to push the notification:\n\nimport json,httplib\nconnection = httplib.HTTPSConnection('api.parse.com', 443)\nconnection.connect()\nconnection.request('POST', '/1/push', json.dumps({\n \"channels\": [\n \"MyCity\"\n ],\n \"data\": {\n \"action\": \"com.myapp.CITY_NOTIFICATION\",\n \"alert\": \"New Event Notification\",\n \"event_id\": \"425\"\n }\n }), {\n \"X-Parse-Application-Id\": \"APP_ID\",\n \"X-Parse-REST-API-Key\": \"API_KEY\",\n \"Content-Type\": \"application/json\"\n })\nresult = json.loads(connection.getresponse().read())\nprint result\n\n\nThis setup is not working as expected. I do get the notification on my device (I am using AVD for testing). But it opens the expected EventResult activity even without me clicking on the notification in the tray. This happens even if I am on device home screen and the app is running only in background. And when I click on the notification in the tray it opens the HomeActivity class which is defined as default class.\n\nExpected behaviour is opening the EventResult only when I click on the notification in the tray. Can you guys tell me what needs to change?" ]
[ "android", "push-notification", "parse-platform" ]
[ "Collect data from different threads", "I have implemented a basic TCP client and server. The client sends a command from an input stream. The server processes received message and replies to the client. \n\nI would like to test my client-server solution in the following manner:\n\n\nCreate multiple client threads;\nEach client thread will read commands from the file and send them to a server;\nAfter a server's reply, each client must collect the reply to a list;\n\n\nI would like to seek any code review and any suggestions (I would appreciate any examples) on how to collect a server replies to a list from each client thread. Currently, I am not able to collect all replies from all client threads in List<String> messages\n\nClass Client spawns a fixed number of ClientTask\n\npublic class Client {\nprivate static Logger logger = Logger.getLogger(Client.class);\nprivate File configs;\nprivate InputStream inputStream;\nprivate int port;\nprivate String ip;\n\n\npublic Client(File file, InputStream inputStream) {\n this.configs = file;\n this.inputStream = inputStream;\n Map<String, Object> configs = ConfigLoader.loadXMLConfigsFromFile(file);\n this.port = (Integer) configs.get(\"port\");\n this.ip = (String) configs.get(\"ip\");\n}\n\n//\npublic void start(int numberOfThreads, List<String> messages) throws InterruptedException {\n for (int i = 0; i < numberOfThreads; i++) {\n List<String> collectedServerReply = Collections.synchronizedList(new ArrayList<>());\n try {\n Thread clientThread = new Thread(\n new ClientTask(port, ip)\n .setInputStream(new FileInputStream(\"commands.txt\"))\n .setReplyListener(message -> {\n //messages.add(message.receive().getMessage());\n collectedServerReply.add(message.receive().getMessage());\n //System.out.println(\"current stack size: \" + messages.size());\n }));\n clientThread.start();\n System.out.println(\"finished client thread\");\n } catch (IOException e) {\n logger.error(\"Exception occurred while reading from System.in. Exception: \", e);\n }\n messages.addAll(collectedServerReply);\n }\n}\n}\n\n\nThe Client class has a setter that accepts any instance that implements the ReplyListerner interface. The latter server as an abstraction to collect a reply data:\n\npublic interface ReplyListener {\n\n void onReply(Message message) throws IOException;\n}\n\n\nI cannot collect all server replies in the method public void start(int numberOfThreads, List<String> messages). However, when I simply do the following: \n\n Thread clientThread = new Thread(\n new ClientTask(port, ip)\n .setInputStream(new FileInputStream(\"commands.txt\"))\n .setReplyListener(message -> {\n System.out.println(message.receive().toString());}));\n\n\nI could see the appropriate server replies in my System.in\n\nWhere did I make a mistake and how can I achieve my goal of collecting server replies? \n\nEDIT:\n\nHow do I use my implementations:\n\npublic static void main(String[] args) throws IOException, InterruptedException {\n List<String> collectedMessages = Collections.synchronizedList(new ArrayList<>());\n\n Thread serverThread = new Thread(new ServerLauncher(new File(\"config.xml\")));\n serverThread.setName(\"server_thread\");\n serverThread.start();\n new Client(new File(\"config.xml\"), new FileInputStream(\"commands.txt\")).start(1, collectedMessages);\n System.out.println(\"Collected output ...\");\n for (int i = 0; i < collectedMessages.size(); i++) {\n System.out.println(collectedMessages.get(i));\n }\n}" ]
[ "java", "multithreading" ]
[ "How to run an mpi executable from julia", "I want to call an MPI exectable from Julia in a Jupyter notebook.\n\nDoing\n\ncmd = Cmd(`mpiexec -np 4 name_of_executable`)\nrun(cmd)\n\n\ncreates 4 processes, but they all use 25% cpu on one core. Is there a way to have it run 100% on four separate cores?" ]
[ "mpi", "julia" ]
[ "Can a parent class array hold children class objects in Java?", "I have a parent class named Student. I have created two children class PermanentStudent and CasualStudent by extending this. I have written constructors for both the extended child classes (both child class have their own constructors). Now, I am making an array of size 10 of Students out of which 4 will be Permanent Students and 6 will be CasualStudents. For this, I did as follows: \n\nStudent[] a = new Student[10];\nint count;\n\n\nNow, I wish to fill the array with 4 permanent students objects and 6 casual student objects with information through their constructor. I do the following, \n\nfor (count = 0; count < 4; count++)\n{\n a[count] = new PermanentStudent(a,b,c); // invoking the constructor\n}\nfor (count = 4; count < 10; count++)\n{\n a[count] = new CasualStudent(x,y); // invoking the constructor of the other class\n}\n\n\nBut this gives me a compilation error. Where am I going wrong in this? Thanks!" ]
[ "java" ]
[ "C# Get Variable Value from Separate Form", "How can I get the values of variables from a separate form?" ]
[ "c#", "winforms" ]
[ "Popup Menu not working as expected in Android", "I have a recycler view and card view. The card layout has 3 dots which on clicked, shows popup menu. Everything is working fine, but there is a small problem. If I clicked the top card, popup menu is displayed at the bottom of recycler view. If I clicked the middle card the popup menu is displayed at the top-left of the activity and like so on. I want that, if card_1's popup menu is pressed, it should show at card_1 and similarly, popup menu should displayed at their respective cards. I don't know where the problem is. Please help!!!\n\nHere is the Menu Layout menu_options.xml\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n\n\n\n<item\n android:id=\"@+id/menu1\"\n android:title=\"Edit \" />\n\n<item\n android:id=\"@+id/menu2\"\n android:title=\"Delete \" />\n\n\n\n\nHere is the method by which menu shows up. It is in CardViewAdapter used for my Recycler View.\n\n@Override\npublic void onBindViewHolder(final ViewHolder holder, final int position) {\n\n ...\n\n threeDots = (TextView)cardView.findViewById(R.id.options);\n threeDots.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n\n PopupMenu popupMenu = new PopupMenu(context, threeDots);\n popupMenu.inflate(R.menu.menu_options);\n popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){\n @Override\n public boolean onMenuItemClick(MenuItem item) {\n\n switch (item.getItemId()){\n\n case R.id.menu1: int pos = holder.getAdapterPosition();\n onEdit(pos);\n break;\n\n case R.id.menu2: Toast.makeText(context, \"Swipe LEFT to delete the card\", Toast.LENGTH_LONG)\n .show();\n break;\n }\n\n return false;\n }\n });\n\n popupMenu.show();\n }\n });\n}" ]
[ "android", "android-recyclerview", "popupmenu" ]
[ "Best Curl Package/Replacement in NodeJS", "I was looking through other posts for replacements for Curl in nodejs, especially with complex behaviors as such:\n\n -H 'Authorization: Basic MjJCTUpROjczNzY0YzkwOWQ2MDczZDRjYzA0YWZhZDBlMDVhMThm' \\\n --data \"clientId=22BMJQ\" \\\n --data \"grant_type=authorization_code\" \\\n --data \"redirect_uri=https%3A%2F%2Fexample.com%2Fcallback\" \\\n --data \"code=5f10eff73e8daf2049be22bb079beee57036c7a5\" \\\n -H 'Content-Type: application/x-www-form-urlencoded' \\\nhttps://api.fitbit.com/oauth2/token\n\n\nAre there any packages you would recommend or have ideas on how the above request could be replicated in nodejs?" ]
[ "node.js", "curl", "oauth-2.0", "request", "fitbit" ]
[ "@WebServlet Annotation and servlet-mapping differences", "In my servlet class, I have annotated the class with:\n\n@WebServlet(\"/OnlinePostListener/testFromAnnotation\")\npublic class OnlinePostListener extends HttpServlet {\n ...\n}\n\n\nMy web.xml contains the following:\n\n<servlet>\n <description>\n </description>\n <display-name>OnlinePostListener</display-name>\n <servlet-name>OnlinePostListener</servlet-name>\n <servlet-class>com.me.forwardingProxy.OnlinePostListener</servlet-class>\n</servlet>\n<servlet-mapping>\n <servlet-name>OnlinePostListener</servlet-name>\n <url-pattern>/testFromWebXML</url-pattern>\n</servlet-mapping>\n\n\nMy servlet only responds when I access the URL:\n\nhttp://localhost:8080/forwardingProxy/OnlinePostListener/testFromAnnotation\n\n\nbut not:\n\nhttp://localhost:8080/forwardingProxy/OnlinePostListener/testFromWebXML\n\n\nWhat is the difference between the @WebServlet's annotation and servlet-mapping?\nWhy is the servlet-mapping not working for this URL-pattern?" ]
[ "web-services", "servlets", "web.xml", "url-pattern" ]
[ "Swift- alert action handler assistance?", "I'm using a tutorial to add an email and iMessage \"share\" action from a custom table view cell. But I am confused. The tutorial stops as \"print ln\" when invoking the action. But doesn't explain the handler. Can anyone help?\n\nI added the (ACTION :UIAlertAction!)in}) as a placeholder, as a guess, but not sure where to go with the rest.\n\nThank you.\n\n override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction] {\n\n let shareAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: \"Share\", handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in\n\n let shareMenu = UIAlertController(title: nil, message: \"Send mail\", preferredStyle: .ActionSheet)\n let emailAction = UIAlertAction(title: \"Email\", style:UIAlertActionStyle.Default, handler: { (ACTION :UIAlertAction!)in})\n\n\n\n let imessageAction = UIAlertAction(title: \"iMessage\", style: UIAlertActionStyle.Default, handler: {\n (ACTION :UIAlertAction!)in})\n\n let cancelAction = UIAlertAction(title: \"Cancel\", style: UIAlertActionStyle.Cancel, handler: nil)\n\n shareMenu.addAction(emailAction)\n shareMenu.addAction(imessageAction)\n shareMenu.addAction(cancelAction)\n\n\n\n self.presentViewController(shareMenu, animated: true, completion: nil)\n }\n\n )\n shareAction.backgroundColor = UIColor(red: 109.0/255.0, green: 188.0/255.0, blue: 219.0/255.0, alpha: 1.0)\n\n\n return [shareAction]" ]
[ "swift" ]
[ "Make a table-cell round and responsive?", "I know only basic stuff when it comes to HTML and CSS, so please forgive me if my question is stupid. Is it possible to make the table-cell a circle and responsive? I has a display:table-cell in the middle where the logo sits in the center. It is a square cell and I want it round. I tried fiddling with and while it came out good on my browser, when it comes to my mobile device it looks oval. \n\nHere's the css that I used:\n\n.tz-header2 .tzlogo a {\n vertical-align: middle;\n display: table-cell;\n width: 200px;\n z-index: 999;\n text-align: center;\n border-radius: 100%;\n height: 193px;\n -webkit-box-shadow: 1px 5px 12px -1px rgba(147,152,153,1);\n -moz-box-shadow: 1px 5px 12px -1px rgba(147,152,153,1);\n box-shadow: 1px 5px 12px -1px rgba(147,152,153,1);\n /* border-style: solid; */\n border-color: whitesmoke;\n background: #d65679;\n }\n\n\nI read somewhere to use width: 100% and height: auto but that made it oval in shape. It wrapped around the img logo. I don't know how to explain it very well. Here's a link of the website to make more sense. \n\nhttp://1d6.60a.myftpupload.com/" ]
[ "html", "css", "wordpress" ]
[ "JAXBElement vs boolean", "What exactly is JAXBElement Boolean and how can I set this to the boolean equivalent of \"true\"?\n\nMethod:\n\n public void setIncludeAllSubaccounts(JAXBElement<Boolean> paramJAXBElement)\n {\n this.includeAllSubaccounts = paramJAXBElement;\n }\n\n\nThis does not compile: \n\nreturnMessageFilter.setIncludeAllSubaccounts(true);" ]
[ "java", "web-services", "soap", "jaxb", "boolean" ]
[ "How to return a HashTable from a WebService?", "My webservice is returning all string variables. Now I want to modify my service so that it can return HashTable object. This is the signature of my WebService entry-point(method):\npublic void getPrevAttempts(string fbUserId, string studentId, string assessmentId, out string isAuthenticated, out HashTable attempts) \n\nThe records in the HashTable are inserted form the result of an SQL query. Whenever I'm tryimg to run my service, I'm getting redirected to accessdenied.htm page(Since my Web.config has this entry <customErrors mode="On" defaultRedirect="accessdenied.htm"/>). Is there any way to return HashTable or the result of SQL query?\nUpdate:\nException:The type System.Collections.Hashtable is not supported because it implements IDictionary." ]
[ "c#", "web-services" ]
[ "SQLite 3 C API Transactions", "I am using SQLite3 for iPhone development and I'm attempting to wrap a few insert statements into a transaction. Currently I have the below code which is working properly however after reading another question on SO I realized it would be better to have these in one transaction rather than one each. I couldn't find the C API call to begin and commit a transaction. Some of the code is in Objective-C but I don't think that's really relevent to the question.\n\n- (void)saveAnimals {\n //Insert all the animals into the zoo database\n int i;\n\n const char *sql = \"insert into Animal(Zoo_ID, Animal_Num, Animal_Text) Values(?, ?, ?)\";\n for (i = 0; i < ([[self animalArray] count] - 1); i++) {\n\n if(addStmt == nil) {\n if(sqlite3_prepare_v2(database, sql, -1, &addStmt, NULL) != SQLITE_OK)\n NSAssert1(0, @\"Error while creating add statement. '%s'\", sqlite3_errmsg(database));\n }\n int animalNum = [[[self animalArray] objectAtIndex:i] animal_Number];\n NSString *animalText = [[NSString alloc] initWithString:[[[self animalArray] objectAtIndex:i] animal_Text]];\n sqlite3_bind_int(addStmt, 1, zoo_ID); \n sqlite3_bind_int(addStmt, 2, animalNum); \n sqlite3_bind_text(addStmt, 3, [animalText UTF8String], -1, SQLITE_TRANSIENT);\n [animalText release];\n if(SQLITE_DONE != sqlite3_step(addStmt)) {\n NSAssert1(0, @\"Error while inserting data. '%s'\", sqlite3_errmsg(database));\n }\n\n //Reset the add statement.\n sqlite3_reset(addStmt); \n }\n}\n\n\nWhat I think needs to be done would be taking the sqlite3_prepare_v2 command out of the for loop, start the transaction, go through the for loop, commit the transaction. However, I'm not sure what the calls for \"start the transaction\" and \"commit the transaction\" are. And would I still use sqlite3_step? Thanks for your help." ]
[ "database", "sqlite", "transactions" ]
[ "Vertically flowing text with css", "I would like to have a div with some text in it. But I'd like the text to flow vertically instead of horizontally. Like this;\n\nM\n\ny\n\nt\n\ne\n\nx\n\nt\n\nAny ideas on how to accomplish this with CSS?" ]
[ "css" ]
[ "Key frames doesn't work in MUI styled components", "I'm trying to create infinity rotating for an image (img tag) using built in styled component implementation from MUI (before it was implemented on external library).\nHere is my fragment of code. If I'm running it I have an error.\nexport const SearchPreloaderContainerDiv = styled('div')({\n margin: '0 auto',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n flex: 1,\n\n '& h4': {\n margin: '50px 0 0 0',\n color: '#282828',\n fontFamily: 'Cuprum',\n fontStyle: 'normal',\n fontSize: '43px',\n lineHeight: '70px',\n },\n\n '@keyframes loader': {\n from: {\n transform: 'rotate(0deg)',\n },\n to: {\n transform: 'rotate(360deg)',\n },\n },\n\n '& img': {\n padding: '20px',\n boxSizing: 'border-box',\n animation: 'loader linear 3s infinite',\n },\n});\n\n\nBefore it was implemented using keyframes helper from external styled-componet library but now I can not find similar helper in MUI" ]
[ "reactjs", "material-ui", "styled-components", "jss" ]
[ "How to collect values from xp:listBox with CSJS?", "How can I collect via CSJS the selected value(s) in a xp:listbox control?\n\nI tried the samples similar for checkboxes / radiobuttons/ input field but this does not give me the correct values in return.\n\nhttp://celinainsurance.blogspot.se/2011/04/getting-setting-values-with-ssjs-and.html" ]
[ "javascript", "xpages" ]
[ "How to receive application.properties values in an itemProcessor", "I'm attempting to pass a value from application.properties into a custom ItemProcessor. However, using the @Value annotation always returns null, which isn't entirely unexpected. However, I'm at a loss for how to pass the necessary value in without @Value.\n\n@Service\nclass FinancialRecordItemProcessor implements ItemProcessor<FinancialTransactionRecord, FinancialTransactionRecord> {\n\nLogger log = LoggerFactory.getLogger(FinancialRecordItemProcessor)\n\n// Start Configs\n\n@Value('${base.url:<redacted URL>}')\nString baseUrl\n\n@Value('${access.token:null0token}')\nString accessToken\n\n// End Configs\n\n\n\n@Override\nFinancialTransactionRecord process(FinancialTransactionRecord financialRecord) throws IllegalAccessException{\n\n // Test to ensure valid auth token\n\n if (accessToken == null || accessToken == \"null0token\"){\n throw new IllegalAccessException(\"You must provide an access token. \" + accessToken + \" is not a valid access token.\")\n }\n}" ]
[ "spring", "spring-batch" ]
[ "Android, camera in my app is rotated", "i'm opening the Camera in my app and the cam display is rotated by 90deg allways even when i rotating the device in my hands.\n\nthe code:\n\nimport java.io.IOException;\nimport java.util.List; \nimport android.content.Context;\nimport android.hardware.Camera;\nimport android.view.Display;\nimport android.view.Surface;\nimport android.view.SurfaceHolder;\nimport android.view.SurfaceView;\nimport android.view.WindowManager;\n\npublic class CameraSurfaceView extends SurfaceView implements SurfaceHolder.Callback\n{\n private SurfaceHolder holder;\n private Camera camera;\n private Context context;\n public CameraSurfaceView(Context context) \n {\n super(context);\n\n //Initiate the Surface Holder properly\n this.holder = this.getHolder();\n this.holder.addCallback(this);\n this.holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);\n this.context = context;\n }\n\n @Override\n public void surfaceChanged(SurfaceHolder holder, int format, int width,\n int height) { \n\n // Now that the size is known, set up the camera parameters and begin\n // the preview.\n Camera.Parameters parameters = camera.getParameters();\n List<Camera.Size> previewSizes = parameters.getSupportedPreviewSizes();\n Camera.Size size = previewSizes.get(0);\n parameters.setPreviewSize(size.width, size.height); \n\n Display display = ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();\n\n if(display.getOrientation() == Surface.ROTATION_0)\n {\n //parameters.setPreviewSize(height, width); \n parameters.setRotation(90);\n }\n\n if(display.getOrientation() == Surface.ROTATION_90)\n {\n //parameters.setPreviewSize(width, height); \n }\n\n if(display.getOrientation() == Surface.ROTATION_180)\n {\n //parameters.setPreviewSize(height, width); \n }\n\n if(display.getOrientation() == Surface.ROTATION_270)\n {\n //parameters.setPreviewSize(width, height);\n parameters.setRotation(180);\n } \n camera.setParameters(parameters); \n camera.startPreview(); \n } \n @Override\n public void surfaceCreated(SurfaceHolder holder) {\n try\n {\n //Open the Camera in preview mode\n this.camera = Camera.open();\n this.camera.setPreviewDisplay(this.holder);\n }\n catch(IOException ioe)\n {\n ioe.printStackTrace(System.out);\n } \n } \n @Override\n public void surfaceDestroyed(SurfaceHolder holder) {\n // Surface will be destroyed when replaced with a new screen\n //Always make sure to release the Camera instance\n camera.stopPreview();\n camera.release();\n camera = null; \n }\n }\n\n\nAny ideas ? Thanks\n\np.s how do i know what is the correct choose for my device in the line\n\nList<Camera.Size> previewSizes = parameters.getSupportedPreviewSizes();" ]
[ "android" ]
[ "zBar sdk not scaning VIN code", "I am using zBAr SDK to scan VIN code. I am following the zBar's tutorial to set scan symbology of Code_39. Each time I run the app it says \"the image picker failing to read\".\n\nI am using the following code \n\n[reader1.scanner setSymbology: ZBAR_CODE39 config: ZBAR_CFG_ENABLE to: 1];\n\nCan anyone tell me what I am doing wrong ??\nThnx in advance" ]
[ "iphone", "ios", "zbar-sdk", "code39", "vin" ]
[ "how to find out max number of characters that a tring can take in php?", "in php m using code for reading a csv file and storing it into a string separated by comma...\nnow my string is something like this:\n\n$string= '9878546512','9785456213','9632587412','9753159821','9467521234','9638527412'..and so on\n in future i may have many numbers like this in $string may be 1000 phone numbers copied from csv file to $string...\n\nnow my question is that what is maximum size of a string variable in php so that i can limit number of characters read into $string variable..." ]
[ "size", "byte" ]
[ "How to set up autoreload with Flask+uWSGI?", "I am looking for something like uWSGI + django autoreload mode for Flask." ]
[ "flask", "uwsgi", "werkzeug" ]
[ "How to write driver for HID device in c# windows application", "I am new in writing diver for HID device. So please tell me how can i start to writing driver for HID device using c# windows application." ]
[ "c#", "windows", "driver" ]
[ "How to use pywinauto to save html in internet explorer", "I want to use pywinauto to save a webpage in internet explorer.\n\nWhen the program executes type_keys('^s'), an error appears\n\nWhat should I do to save the webpage?\n\nThank you very much.\n\nweb_address = r'http://www.apple.com'\napp = application.Application().start(\n r\"c:\\program files\\internet explorer\\iexplore.exe {}\".format(web_address))\nie = app.window(title_re = \".*Windows Internet Explorer.*\")\nie.type_keys('^s')\n\nraise ElementNotFoundError(kwargs)\n\npywinauto.findwindows.ElementNotFoundError: {'title_re': '.*Windows Internet Explorer.*', 'backend': 'win32', 'process': 21052}" ]
[ "python", "pywinauto" ]
[ "Select where in and has same column", "I have the following table\n\namenity_venue (ids are uuids, made them ints for simplicty)\n--------------------------\n| amenity_id | venue_id |\n--------------------------\n| 1 | 1 |\n| 2 | 1 |\n| 1 | 2 |\n| 1 | 3 |\n\n\nI'm trying to write a query where I select by amenity_id but only return results if the venue_id has both amenity_ids.\n\nThis is broken I know but something like:\n\nselect *\nfrom amenity_venue where amenity_id in (1, 2)\nhaving amenity_venue.venue_id = amenity_venue.venue_id\n\n\nMy query should only return \n\n--------------------------\n| amenity_id | venue_id |\n--------------------------\n| 1 | 1 |\n| 2 | 1 |\n\n\nsince venue 1 is the only venue that has both amenity_id 1 and 2. How could I write such a query?" ]
[ "sql", "postgresql" ]
[ "How to prove that the error is not my Java agent or how to debug it?", "One of our clients have contact me complaining that he's getting the following JRE crash while using our Java Agent.\n\nAccording to the error (below) the crash is on the native code since the problematic frame is categorized as 'C'.\n\nI've did some googling and it seems like there are some open bugs which are quite similar around this issue in this while using java agents. See the following links:\n\nhttps://bugs.openjdk.java.net/browse/JDK-8094079\n\nhttps://bugs.openjdk.java.net/browse/JDK-8041920\n\nThe issue is that the customer is reluctant to upgrade the JDK since he mentions that he has other java agents which are running without any issue.\n\nAny suggestions on how to solve this issue?\n\nFor the completeness, please see the error that he had sent: \n\ncat /opt/somecompany/apps/some-product-platform/some-product-name/hs_err_pid6697.log | grep sealights\n7fe19d9b5000-7fe19d9d7000 r--s 00401000 ca:01 3539943 /opt/somecompany/apps/some-product-platform/some-product-name/sealights/sl-test-listener.jar\njvm_args: -javaagent:/opt/somecompany/apps/some-product-platform/hawtio/jolokia-jvm.jar=config=/opt/somecompany/apps/some-product-platform/some-product-name/conf/jolokia-agent.properties -javaagent:/opt/somecompany/apps/some-product-platform/some-product-name/agent/newrelic.jar -DNEWS_product_HOME=/opt/somecompany/apps/some-product-platform/some-product-name -Dsl.environmentName=Functional Tests DEV-INT -Dsl.customerId=myCustomer -Dsl.appName=ABB-product-name -Dsl.server=https://my-server.com -Dsl.includes=com.somecompany.* -javaagent:/opt/somecompany/apps/some-product-platform/some-product-name/sealights/sl-test-listener.jar -Dlog.dir=/opt/somecompany/apps/some-product-platform/logs -Dlog.threshold=debug\njava_class_path (initial): some-product-name.jar:/opt/somecompany/apps/some-product-platform/hawtio/jolokia-jvm.jar:/opt/somecompany/apps/some-product-platform/some-product-name/agent/newrelic.jar:/opt/somecompany/apps/some-product-platform/some-product-name/sealights/sl-test-listener.jar\n\nJVM crash message:\n\n#\n# A fatal error has been detected by the Java Runtime Environment:\n#\n# SIGSEGV (0xb) at pc=0x0000000000000055, pid=6697, tid=140604865455872\n#\n# JRE version: Java(TM) SE Runtime Environment (8.0_20-b26) (build 1.8.0_20-b26)\n# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.20-b23 mixed mode linux-amd64 compressed oops)\n# Problematic frame:\n# C 0x0000000000000055\n#\n# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again\n#\n# An error report file with more information is saved as:\n# /opt/somecompany/apps/some-product-platform/some-product-name/hs_err_pid6697.log\nCompiled method (c1) 565518 13823 1 sun.invoke.util.ValueConversions::identity (2 bytes)\ntotal in heap [0x00007fe1a76857d0,0x00007fe1a7685a48] = 632\nrelocation [0x00007fe1a76858f8,0x00007fe1a7685918] = 32\nmain code [0x00007fe1a7685920,0x00007fe1a7685980] = 96\nstub code [0x00007fe1a7685980,0x00007fe1a7685a10] = 144\nmetadata [0x00007fe1a7685a10,0x00007fe1a7685a18] = 8\nscopes data [0x00007fe1a7685a18,0x00007fe1a7685a20] = 8\nscopes pcs [0x00007fe1a7685a20,0x00007fe1a7685a40] = 32\ndependencies [0x00007fe1a7685a40,0x00007fe1a7685a48] = 8\n#\n# If you would like to submit a bug report, please visit:\n# http://bugreport.sun.com/bugreport/crash.jsp\n#" ]
[ "java", "java-bytecode-asm", "javassist", "javaagents" ]
[ "Check if the keys exist in the other object", "There are two objects metadata and data. \n\nI have written the following code to find if metadata object keys exist in the data object.\n\nI wonder if there is a shorthand of the following approach.\n\nHere is the data\n\n \"data\": {\n \"TripResults\": {\n \"Depth\": [\n 577,\n 694,\n 810\n ],\n \"Speed\": [\n 150,\n 150,\n 150\n ],\n \"Frequency\": [\n 3,\n 3,\n 3\n ]\n },\n // the following two lines are added\n \"Trincot\": true,\n \"Belgium\": 2019, \n \"SurveyResults\": {\n \"Depth\": [\n 577,\n 694,\n 810\n ],\n \"Speed\": [\n 150,\n 150,\n 150\n ],\n \"Frequency\": [\n 3,\n 3,\n 3\n ]\n },\n \"LastCalling\": {\n \"Last_Calling_Duration\": 5699,\n \"Last_Calling_Date\": 20180619\n }\n }\n\n\nHere is the metadata\n\n \"metaData\": {\n \"Depth\": {\n \"FieldName\": \"Depth\"\n },\n \"Time\": {\n \"FieldName\": \"Time\"\n },\n \"Frequency\": {\n \"FieldName\": \"Frequency\"\n },\n \"Speed\": {\n \"FieldName\": \"Speed\"\n },\n \"Last_Calling_Date\": {\n \"FieldName\": \"Last_Calling_Date\"\n },\n \"Last_Calling_Duration\": {\n \"FieldName\": \"Last_Calling_Duration\"\n }\n }\n\n\nHere is my naive approach:\n\nvar unitjson = {}\nvar tempArray = []\nfor (var key in metadata) {\n properties = []\n eachObject = []\n for (var datakey in data) {\n if (data[datakey] != null && data[datakey].hasOwnProperty(key)) {\n console.log(\"key exists\");\n properties.push({ \"propertyName\": key, \"values\": data[datakey][key] })\n eachObject.push({ \"name\" : datakey, \"properties\": properties })\n }\n }\n tempArray.push(JSON.parse(JSON.stringify(eachObject)))\n unitjson[\"entities\"] = JSON.parse(JSON.stringify(tempArray))\n}\n\n\nExpected output is similar to follows:\n\n{\n \"entities\": [\n {\n \"name\": \"TripResults\",\n \"properties\": [\n {\n \"propertyName\": \"Depth\",\n \"values\": [\n 577,\n 694,\n 810\n ]\n },\n {\n \"propertyName\": \"Speed\",\n \"values\": [\n 150,\n 150,\n 150\n ]\n }\n ]\n },\n {\n \"name\": \"SurveyResults\",\n \"properties\": [\n {\n \"propertyName\": \"Depth\",\n \"values\": [\n 577,\n 694,\n 810\n ]\n },\n {\n \"propertyName\": \"Speed\",\n \"values\": [\n 150,\n 150,\n 150\n ]\n }\n ]\n },\n {\n \"name\": \"LastCalling\",\n \"properties\": [\n {\n \"propertyName\": \"Last_Calling_Date\",\n \"values\": [\n 20180619\n ]\n },\n {\n \"propertyName\": \"Last_Calling_Duration\",\n \"values\": [\n 5699\n ]\n }\n ]\n }\n ]\n}" ]
[ "javascript" ]
[ "How to implement a repeating shuffle that's random - but not too random", "I've got a list of n items. I want an algorithm to let me pick a potentially infinite sequence of items from that collection at random, but with a couple of constraints:\n\n\nonce an item has been picked, it shouldn't turn up again in the next few items (say in the next m items, with m obviously strictly < n)\nyou shouldn't have to wait too long for any item to appear - items should appear on average once every n picks\nthe sequence should be non-cyclical\n\n\nBasically, I want an algorithm to generate the playlist for an MP3 player with 'shuffle' and 'repeat' turned on, that makes sure it doesn't play the same song too close to itself, and makes sure it plays all your songs evenly, with no discernible pattern.\n\nThose constraints eliminate two obvious solutions from contention:\n\n\nWe can't simply pick rnd(n) as the index for the next item, because that will not guarantee no repetition; it may also take a long time to pick some items.\nWe can't just pre-shuffle the list with a Fisher-Yates shuffle, and iterate over it repeatedly, reshuffling it each time we reach the end; while that guarantees items turn up at most after 2n - 1 picks, it doesn't completely prevent an item repeating. \n\n\nA naive solution might be to pick at random but reject picks if they occurred in the last m picks; that means keeping a list of m previous picks, and checking each pick against that list every time, which makes the algorithm nondeterministic and slow at the same time - lose-lose. Unless I'm missing something obvious..\n\nSo I have an algorithm I'm using now which I'm a little dissatisfied with. I've derived it by analogy with a deck of cards, where I have a draw-pile and a discard-pile. I start off with the complete list, shuffled, in the draw pile, the discard pile empty. The next item is read from the top of the draw pile, and then placed in the discard pile. Once the discard pile reaches a certain size (m items) I shuffle it, and move it to the bottom of the draw pile.\n\nThis meets the requirement, but that shuffle once every m picks bothers me. It's O(1) normally, but O(m) one time in m. That amounts to constant time, on average, but there must be a cleaner solution that shuffles the discards in as it goes.\n\nIt seems to me that this is such a simple, generic, and common problem, it must have one of those double-barreled algorithms, like Fisher-Yates or Boyer-Moore. But my google-fu is clearly not strong, as I've yet to find the set of terms that locates the inevitable 1973 ACM paper which probably explains exactly how to do this in O(1) time, and why my algorithm is deeply flawed in some way." ]
[ "algorithm", "random", "shuffle" ]
[ "How to deal with my application's unusual usage of memory?", "I have an ASP.NET MVC 3 application hosted on a shared server with the following limitations:\n\n\n100 MB of RAM\n15% of CPU\n\n\nThe host admins say that if an application reaches these limitations, the application pool would be restarted.\n\nAfter deploying, I noticed that application pool is restarting too quickly (after a few minutes). I used MonitorAspNetApplication to check memory usage.\n\nBy first load, allocated memory is around 8 or 9 MB and used memory around 500 or 600 KB. \n\nBut when I start using the application ( CRUD operations, ... ), used memory goes up and down but never goes beyond a few (6-10) megabytes. But the allocated memory increases progressively until it reaches 100 MB and then the application pool resets.\n\nI can't figure out why this is happening. The application is not big, and it doesn't do complicated operations or heavy queries. \n\nI'm using EF code first, StructureMap, AutoMapper and ELMAH in this project.\n\n\nWhat can be the possible reasons for this problem? How can I to detect and solve them?\nCan these tools (EF, StructureMap, etc.) cause this memory usage?\nis this a memory leak ? or it's called something else ?" ]
[ "asp.net", "asp.net-mvc-3", "memory-management", "memory-leaks", "application-pool" ]
[ "php add watermark on a s3 imported image", "I'm trying to add a watermark on an image.\n\nBoth , the image and the watermark image are imported from the aws s3.\n\nI tried to do this \n\n $watermark = tempnam(sys_get_temp_dir(), 'watermark.png');\n\n //save the file from s3 storage to the temporary file\n $content=$this->s3Manager->getFile('watermark.png',$this->verb,$watermark);\n // Set the margins for the stamp and get the height/width of the stamp image\n $marge_right = 10;\n $marge_bottom = 10;\n\nlist($watermark_width,$watermark_height) = getimagesize($watermark);\n\n//Get the width and height of your image - we will use this to calculate where the watermark goes\n$size = getimagesize($tempFile);\n\n//Calculate where the watermark is positioned\n//In this example, it is positioned in the lower right corner, 15px away from the bottom & right edges\n$dest_x = $size[0] - $watermark_width - 15;\n$dest_y = $size[1] - $watermark_height - 15;\n\n\nimagecopy($tempFile, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height);\n//Finalize the image:\n\n\n imagejpeg($tempFile);\n\n\n return $tempFile;\n\n\nIt's failing on the imagecopy method - \n\n\n \"imagecopy() expects parameter 1 to be resource, string given in.\n\n\nI checked if the images a successfully imported by the dest_y and dest_x and they seems ok." ]
[ "php", "amazon-s3", "watermark", "php-gd" ]
[ "Are my solutions to printing an error due to file size and storing values right?", "PART 1: What I need to do is print out an error if the file size exceeds the 500 by 500 measurements (defined at the top as max_width and height). I \n\nPART 2: The other part is that I have to read the pixel information from the input file and store it into a 2d array. Each pixel has 3 values for red, green, and blue, but I'm not sure if this matters.\n\nMy attempt at the solution:\n\nPART 1:\n\nvoid check_file_size //I'm not sure what to put as arguments since width/height are global\n{\n if (width > 500 && height > 500)\n {\n perror(\"Error: File size too big.\\n\");\n }\n}\n\n\nPART 2:\n\n#define max_width 500\n#define max_height 500\nint width, height\n\nvoid read_header(FILE *new)\n{\n int max_color;\n char P[10];\n\n fgets(P, 10, new);\n fscanf(new, \"%d %d\", &width, &height);\n fscanf(new, \"%d\", &max_color);\n}\n\nvoid store_into_array(FILE *input)\n{\n int array[max_width][max_height];\n\n for (x = 0; x < width; x++)\n {\n for (y = height; y >=0; y--)\n {\n fscanf(input, \"%d\", &array[x][y]);\n }\n }\n}" ]
[ "c", "arrays", "printing", "pixel" ]
[ "How to get the title of video that is generated by youtubedl-android", "I am using youtubedl-android to download youtube and other videos and I am able to get the video info like title and extension using\nVideoInfo streamInfo = YoutubeDL.getInstance().getInfo(url);\nString title = streamInfo.getTitle();\nString ext = streamInfo.getExt();\n\nthe URL I get from this is the same as the youtube title of the video but the title of the video downloaded by this library has a title with forwarding slashes replaced by _ and spaces replaced by _ how to get this kind or URL?" ]
[ "android", "youtube-dl" ]
[ "Python Pandas: efficiently aggregating different functions on different columns and combining the resulting columns together", "So far my approach to the task described in the title is quite straightforward, yet it seems somewhat inefficient/unpythonic. An example of what I usually do is as follows:\n\n\n\nThe original Pandas DataFramedf has 6 columns: 'open', 'high', 'low', 'close', 'volume', 'new dt' \n\nimport pandas as pd\n\ndf_gb = df.groupby('new dt')\n\narr_high = df_gb['high'].max()\narr_low = df_gb['low'].min()\narr_open = df_gb['open'].first()\narr_close = df_gb['close'].last()\narr_volumne = df_gb['volume'].sum()\n\ndf2 = pd.concat([arr_open,\n arr_high,\n arr_low,\n arr_close,\n arr_volumne], axis = 'columns')\n\n\n\n\nIt may seem already efficient at first glance, but when I have 20 functions waiting to apply on 20 different columns, it quickly becomes unpythonic/inefficient.\n\nIs there any way to make it more efficient/pythonic? Thank you in advance" ]
[ "python", "pandas", "performance", "aggregate", "pandas-groupby" ]
[ "Unexpected request: GET in angular jasmine testing", "During controller testing I am facing Error: Unexpected request: GET /api/initData,Expected GET /api/empData.For as of now I have two http call in my controller.I have the below issues.\n\n1)After giving $httpBackend.expectGET for both the test cases are passing otherwise I am getting the above error.Here I want to test for one http call\n\n2)In afterEach block again I have to do a $httpBackend.expectGET otherwise the same error it is throwing.\n\nBelow is my code snippet for that controller\n\n describe('Manager Controller',function(){\n\n var $scope,\n $rootScope,\n $injector,\n $controller,\n $httpBackend,\n mockManagerData,\n managerController;\n\n beforeEach(module('APP'));\n\n beforeEach(inject(function(_$rootScope_,_$injector_,_$controller_,_$httpBackend_){\n $rootScope = _$rootScope_;\n $injector = _$injector_;\n $controller = _$controller_;\n $scope = $rootScope.$new();\n $httpBackend = _$httpBackend_;\n mockManagerData = {\n \"manager\": [\n {\n \"id\": 1,\n \"name\": \"Sam\",\n \"department\": \"IT\",\n \"employee\": [\n {\n \"id\": 1,\n \"name\": \"Mak\",\n \"profile\": \"developer\"\n },\n {\n \"id\": 1,\n \"name\": \"John\",\n \"profile\": \"QA\"\n },\n {\n \"id\": 1,\n \"name\": \"Tom\",\n \"profile\": \"Dba\"\n }\n ]\n }\n ]\n }\n managerController = $controller('managerCtrl',{\n $scope:$scope\n });\n }));\n\n it('should get manager details',function(){\n $httpBackend.expectGET('/api/initData').respond(200,'');\n $httpBackend.expectGET('/api/empData').respond(200,mockManagerData);\n $scope.getManagerDetails();//click event in controller\n $httpBackend.flush();\n expect(true).toBe(true);\n });\n\n afterEach(function() {\n $httpBackend.expectGET('/api/initData').respond(200,'');\n $httpBackend.expectGET('/api/empData').respond(200,mockManagerData);\n $httpBackend.verifyNoOutstandingExpectation();\n $httpBackend.verifyNoOutstandingRequest();\n });\n\n})\n\n\nBelow is my controller logic\n\n(function(angular){\n 'use strict'\n angular.module('APP').controller('managerCtrl',managerController);\n managerController.$inject=['$scope','$http'];\n function managerController($scope,$http){\n\n $scope.getManagerDetails = function(){\n $http({\n method: 'GET',\n url: '/api/empData'\n }).then(function successCallback(response) {\n //some login \n }, function errorCallback(response) {\n\n });\n\n }\n $http({\n method: 'GET',\n url: '/api/initData'\n }).then(function successCallback(response) {\n //some logic \n }, function errorCallback(response) {\n\n });\n }\n})(window.angular)\n\n\nThe above code is working fine but when I remove any of the http call I am getting the above mentioned erros. Please some one help.Thanks" ]
[ "angularjs", "karma-jasmine" ]
[ "MD5 with salt in PHP and JavaScript", "I need a common hashing method both in php and javascript, something like MD5 or if not MD5 then something to use salt, but to generate same result from php and javascript.\n\nWhat I wanted to do is, I have a series of questions that I will ask user and users has to answer them, but to make it fast and avoid delay to check the user answers from server, I also want to load the answers with questions and match them in javascript as users answer them. Now I need to bring the answers hashed from php server, and when I am matching them with users answers, I would hash the user answer and match it with the hashed answer from server. \n\nIs it possible?" ]
[ "javascript", "php", "security", "hash", "md5" ]
[ "Cycle through search results pages and halt when the last page is found", "I can not seem to grasp the following implementation technique:\n\npage = '0'\n\nfor new_page_num in range(int(page)+120, 100000, 120):\nurl = 'https://example.com/search/' + str(new_page_num) + 'remainder of url'\n\nprint(url.format(new_page_num))\n\n\nHere I have the code to cycle through pages by it's url pattern, incremental of 120.\n\nHow do I make the program do certain actions on each page and how do I give the program a landmark when it is the last page to halt the process of scrapping results or whatever I want to do there.\n\nI am also specifically addressing the question where to put the scrapping code into? which section of the code?" ]
[ "python", "beautifulsoup" ]
[ "Style will not apply without using a ','", "I just noticed, using the css code below ignores the .input.cmp bit :\n\n.create input.cmp, input.email, input.pswd, input.pswda{}\n\n\nwhile using the code below (with a , before) works fine.\n\n.create ,input.cmp, input.email, input.pswd, input.pswda{}\n\n\nHow is this happening? Is this the right way to do it? Or am I doing something wrong here.\n\nI previously used to use an ID instead of class and things worked fine without the first ','" ]
[ "html", "css" ]
[ "Node js + Objection js + Postgresql. Argument of type '{ token: string }' is not assignable to parameter of type 'PartialUpdate'", "Environment:\n\n\nnode js\nES6\nknex: ^0.16.3\nobjection: ^1.5.3\npg: ^7.8.0 ~ postgresql\n\n\nProblem: \n\nI can't update user token in the database. I get an error message from typescript.\n\nTypescript error message: \n\n\n Argument of type '{ token: string; }' is not assignable to parameter\n of type 'PartialUpdate<User>'. Object literal may only specify known\n properties, and 'token' does not exist in type 'PartialUpdate<User>'.\n\n\nProblem method\n\nIf I write @ts-ignore, the method will work, but I can't understand.\n\nWhy does it give me an error?\n\nimport { User } from '@database/models';\n\n...\nconst setToken = async (id: any, token: string) => {\n try {\n await transaction(User.knex(), trx =>\n User.query(trx)\n // An error appears on this line\n .update({ token })\n .where({ id }),\n );\n } catch (e) {\n throw e;\n }\n};\n\n\nMy user model\n\n'use strict';\n\nimport { Model } from 'objection';\n\nexport default class User extends Model {\n static get tableName() {\n return 'users';\n }\n\n static get jsonSchema() {\n return {\n type: 'object',\n\n properties: {\n id: { type: 'uuid' },\n full_name: { type: 'string', minLength: 1, maxLength: 255 },\n email: { type: 'string', minLength: 1, maxLength: 255 },\n avatar: { type: 'string' },\n provider_data: {\n type: 'object',\n properties: {\n uid: { type: 'string' },\n provider: { type: 'string' },\n },\n },\n token: { type: 'string' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n };\n }\n}" ]
[ "node.js", "postgresql", "typescript", "knex.js", "objection.js" ]
[ "Making FormArray controls required on Reactive Form", "I'm trying to make form fields required on a Reactive Form but the form is always valid, I'd expect it to be invalid until both fields were not empty.\nhttps://stackblitz.com/edit/angular-ivy-y4jby5?file=src/app/app.component.html\nimport { Component, VERSION, OnInit } from "@angular/core";\nimport {Form, FormArray, FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';\n\n@Component({\n selector: "my-app",\n templateUrl: "./app.component.html",\n styleUrls: ["./app.component.css"]\n})\nexport class AppComponent implements OnInit {\n name = "Angular " + VERSION.major;\n testForm = this.fb.group({\n questions: this.fb.array([\n this.fb.group(\n [{testString: ['']}, Validators.required],\n [{testString: ['']}, Validators.required]\n )\n ])\n });\n \n constructor(private fb: FormBuilder) {}\n\n ngOnInit() {\n const control = this.testForm.get('questions') as FormArray;\n control.push(this.fb.group(\n {\n testString: ['']\n }, Validators.required)\n )\n }\n\n get questionControls() {\n return this.testForm.get('questions') as FormArray;\n }\n}\n\n<form [formGroup]="testForm">\n <ng-container formArrayName="questions">\n <ng-container *ngFor="let question of questionControls.controls; let i = index">\n <input type="text" [formGroupName]="i">\n </ng-container>\n </ng-container>\n</form>\nIs Form Valid: {{ testForm.valid }}" ]
[ "angular", "angular-reactive-forms" ]
[ "There advantage in use http2 in Apache when the request is proxied to a backend?", "I have a Java web application in the follow structure:\nApache => Varnish => Tomcat\nI'm researching about the advantages of use http2, and even could manage to configure my Apache to serve requests in http2. Thats cool, but in performance tests using things like New Relic Synthetics, the http2 version of my application doesn't showed considerable performance gains over the http1.\nI've read lots of documentations about to understand how http2 works, but I couldn't figure it out it makes sense to use it in my infrastructure.\nI've learned that Varnish does not use anything but http1 to conect to the backend. And since my varnish does not have https, the Apache => Varnish comunication also would be in http1.\nLooks like to me that Server Push wouldn't work, because Varnish doesn't support, but my main question is: In this scenario I would get any advantage of the http2's Multiplexed streams? Is a matter of tunning my Apache configurations or nothing I do will have any effect?" ]
[ "apache", "varnish", "http2" ]
[ "Neo4j: filtering the label collection", "I have a collection of labels, and i'd like to filter them. So i tried:\n\nMATCH n:myLabel\nWITH filter(t IN labels(n) WHERE t <> 'product') AS notProduct\nRETURN notProduct\n\n\nError:\nType mismatch: expected Collection but was Boolean pointing to the start of labels(n)\n\nI notice that i tend to seek the boundaries of what is possible to do with labels, and i feel like i have yet bumped into their limitations once again. Am i abusing labels or should i just write the query differently?\n\nThe background idea is that after i filter out a bunch of labels each node will only have 1 label left (the way the application is designed) i can then do an ORDER BY on the remaining 1 label. While i can not do an ORDER BY on collections of different size." ]
[ "database", "graph", "neo4j" ]
[ "K/APL style programming in C++?", "I'm writing code in C++, but I really like K/APL's array-oriented style.\n\nDoes anyone know of a good set of operator overloading tricks / macros / ... to allow some K/APL -style programming in C++?\n\nThanks!" ]
[ "c++", "apl", "k" ]
[ "Abstract class with Python 2.5", "I currently refactor a class defining a client or a server. The class had a lot of\n\nif client:\n XXXXXXXXXXXX\nelif server:\n YYYYYYYYYYYY\n\n\nSo I decided to create a class A with the similar code and one class C for the client and an other one S for the server which inherit A. (they don't have theses names of course ^^)\n\nSo class A is some kind of abstract class. But the problem is there is no abstract classes in Python 2.5, it comes with 2.6 version. So I was wondering if there is a way to forbid instantiations of class A.\n\nOne solution would have been to raise a NotImplemented error in the constructor of the class A, but C and S have the same code for it so I put it in the \"abstract\" class A (bad idea ?).\n\nThis may seem stupid but I develop in Python only from time to time and I'm a young programmer.\nWhat are your advices?" ]
[ "python", "refactoring" ]
[ "DC/OS virtual network doesn't work across agents", "I have successfully created host and bridge mode marathon apps without issue, and used l4lb and marathon-lb to host them. That all works without a problem.\n\nI'm now trying to use USER mode networking, using the default \"dcos\" 9.0.0.0/8 network. In this mode my apps can only talk to other containers on the same agent. The host OS's can only talk to containers hosted on themselves. It appears that nodes can't route traffic between each other on the virtual network.\n\nFor testing I'm using the docker \"nginx:alpine\" container, with 2 instances, on different hosts. Their IPs are 9.0.6.130 and 9.0.3.130. No L4LB or Marathon-LB config, no service endpoints, no ports exposed on the host network. Basically:\n\n\"container\": {\n \"docker\": {\n \"image\": \"nginx:alpine\",\n \"forcePullImage\": false,\n \"privileged\": false,\n \"network\": \"USER\"\n }\n },\n \"labels\": null,\n \"ipAddress\": {\n \"networkName\": \"dcos\"\n },\n}\n\n\nin a shell in one of them, I have:\n\n/ # ip addr list | grep 'inet 9'\ninet 9.0.6.130/25 scope global eth0\n\n/ # nc -vz 9.0.6.130:80\n9.0.6.130:80 (9.0.6.130:80) open\n\n/ # nc -vz 9.0.3.130:80\nnc: 9.0.3.130:80 (9.0.3.130:80): Operation timed out\n\n/ # traceroute to 9.0.3.130 (9.0.3.130), 30 hops max, 46 byte packets\ntraceroute to 9.0.3.130 (9.0.3.130), 30 hops max, 46 byte packets\n 1 9.0.6.129 (9.0.6.129) 0.006 ms 0.002 ms 0.001 ms\n 2 44.128.0.4 (44.128.0.4) 0.287 ms 0.272 ms 0.100 ms\n 3 * * *\n 4 * * *\n\n\nFrom the other side:\n\n/ # ip addr list | grep 'inet 9'\ninet 9.0.3.130/25 scope global eth0\n/ # nc -vz 9.0.3.130:80\n9.0.3.130:80 (9.0.3.130:80) open\n/ # nc -vz 9.0.6.130:80\n/ # traceroute 9.0.6.130\ntraceroute to 9.0.6.130 (9.0.6.130), 30 hops max, 46 byte packets\n 1 9.0.3.129 (9.0.3.129) 0.005 ms 0.003 ms 0.001 ms\n 2 44.128.0.7 (44.128.0.7) 0.299 ms 0.241 ms 0.098 ms\n 3 * * *\n 4 * * *\n\n\nInterestingly, I can ping what I think should be the next (virtual) hop, and all intermediate hops, despite traceroute not showing it. The only thing that doesn't ping is the end container's virtual IP. (These are from within one of the containers)\n\n64 bytes from 44.128.0.7: seq=0 ttl=63 time=0.269 ms\n64 bytes from 44.128.0.4: seq=0 ttl=64 time=0.094 ms\n64 bytes from 9.0.3.129: seq=0 ttl=64 time=0.072 ms\n64 bytes from 9.0.6.129: seq=0 ttl=63 time=0.399 ms\nPING 9.0.6.130 (9.0.6.130): 56 data bytes (no response)\n\n\nAny ideas?" ]
[ "dcos" ]
[ "Resolving TTS Memory Leak detected with LeakCanary", "This is the description of a memory leak detected by LeakCanary: (it occurs when the Android back button is pressed)\n\n1 APPLICATION LEAKS\n\n References underlined with \"~~~\" are likely causes.\n Learn more at https://squ.re/leaks.\n\n 356182 bytes retained by leaking objects\n Displaying only 1 leak trace out of 2 with the same signature\n Signature: 2276fec44ae233e0d5bb5b82648d5836c07e3b33\n ┬───\n β”‚ GC Root: Global variable in native code\n β”‚\n β”œβ”€ android.speech.tts.TextToSpeech$Connection$1 instance\n β”‚ Leaking: UNKNOWN\n β”‚ Anonymous subclass of android.speech.tts.ITextToSpeechCallback$Stub\n β”‚ ↓ TextToSpeech$Connection$1.this$1\n β”‚ ~~~~~~\n β”œβ”€ android.speech.tts.TextToSpeech$Connection instance\n β”‚ Leaking: UNKNOWN\n β”‚ ↓ TextToSpeech$Connection.this$0\n β”‚ ~~~~~~\n β”œβ”€ android.speech.tts.TextToSpeech instance\n β”‚ Leaking: UNKNOWN\n β”‚ ↓ TextToSpeech.mContext\n β”‚ ~~~~~~~~\n β•°β†’ com.example.price.SignUpDisplay instance\n ​ Leaking: YES (ObjectWatcher was watching this because com.example.price.SignUpDisplay received Activity#onDestroy() callback and Activity#mDestroyed is true)\n ​ key = 6965e004-28de-464b-87d7-2668461623e7\n ​ watchDurationMillis = 30282\n ​ retainedDurationMillis = 25282\n\n\nThis is how tts is initialised in my activity:\n\nprotected fun initializeTextToSpeech() {\n mtts = TextToSpeech(this, TextToSpeech.OnInitListener { status ->\n // If a success, set the language\n if (status == TextToSpeech.SUCCESS) {\n res = mtts.setLanguage(Locale.UK)\n } else {\n Toast.makeText(\n this,\n \"Feature not supported in your device\", Toast.LENGTH_SHORT\n ).show()\n }\n })\n }\n\n\nThis is the onDestroy method:\n\noverride fun onDestroy() {\n if (mtts != null) {\n mtts.stop()\n mtts.shutdown()\n }\n super.onDestroy()\n }\n\n\nWhy is there a leak and how can I fix it?\n\nI also get this warning in the logs - I'm not sure how bad it is or if it relates to the leak at all:\n\nW/TextToSpeech: stop failed: not bound to TTS engine" ]
[ "android-studio", "memory-leaks", "text-to-speech", "back-button", "leakcanary" ]
[ "How to rotate a 90 degrees?", "I have a <div> that I want to rotate 90 degrees:\n\n<div id=\"container_2\"></div>\n\n\nHow can I do this?" ]
[ "html", "css" ]
[ "Gitlab CI/CD: variables in anchor/global variables not available to Runner", "I want to make variables available to all my Node deployment jobs to DRY out my Gitlab pipeline, but I also want to provide other variables that are dependent on each individual job. This will help when i am dealing with multiple Node services that need unique env vars.\nReading the docs, it seems there are two ways you could do this in the .gitlab-ci.yml file:\nMethod #1\nInclude the global variables in the YAML anchor definition, hoping it will merge with the job-specific vars:\n# anchor: global Node image deployment job\n.deploy_node_image: &deploy_node_image\n image: docker:latest\n stage: deploy\n services:\n - docker:dind\n variables: # global variables\n REGION: "region"\n ACCOUNT_ID: "id"\n CLUSTER_NAME: "cluster"\n script:\n - apk add py-pip\n - pip install awscli\n - echo $CLUSTER_NAME $REGION $IMAGE_NAME $ACCOUNT_ID $SERVICE_NAME $SERVICE_DIR\n - aws ecr get-login-password --region $REGION | docker login --username AWS\n --password-stdin https://$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com\n - cd $CI_PROJECT_DIR/ingenio/new-backend/$SERVICE_DIR\n - docker build\n -t $ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/$IMAGE_NAME:latest .\n - docker push\n $ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/$IMAGE_NAME:latest\n - aws ecs update-service\n --region $REGION\n --cluster $CLUSTER_NAME\n --service $SERVICE_NAME\n\n# specific job\ndeploy:users-service:\n <<: *deploy_node_image\n variables:\n IMAGE_NAME: "users-api"\n SERVICE_NAME: "serviceName"\n SERVICE_DIR: "/endpoint"\n\nMethod #2\nDefine a set of global variables and merge it with the job-specific variables:\nnode_variables: &node_globals\n variables:\n REGION: "region"\n ACCOUNT_ID: "id"\n CLUSTER_NAME: "cluster"\n\n# anchor: global Node image deployment job\n.deploy_node_image: &deploy_node_image\n image: docker:latest\n stage: deploy\n services:\n - docker:dind\n script:\n - apk add py-pip\n - pip install awscli\n - echo $CLUSTER_NAME $REGION $IMAGE_NAME $ACCOUNT_ID $SERVICE_NAME $SERVICE_DIR\n - aws ecr get-login-password --region $REGION | docker login --username AWS\n --password-stdin https://$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com\n - cd $CI_PROJECT_DIR/ingenio/new-backend/$SERVICE_DIR\n - docker build\n -t $ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/$IMAGE_NAME:latest .\n - docker push\n $ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/$IMAGE_NAME:latest\n - aws ecs update-service\n --region $REGION\n --cluster $CLUSTER_NAME\n --service $SERVICE_NAME\n\n# specific job\ndeploy:users-service:\n <<: *deploy_node_image\n variables:\n <<: *node_globals\n IMAGE_NAME: "users-api"\n SERVICE_NAME: "serviceName"\n SERVICE_DIR: "/endpoint"\n\nNeither work, and the first AWS ECR command fails because $REGION is null, as well as all the variables that were included in the Node anchor from Method 1 and the global variables from Method 2 from the log statement in the Node anchor. Only the vars included in the actual job are seen in the logs, which makes me think it just overrides.\nSo how can I merge them?" ]
[ "gitlab", "yaml", "gitlab-ci" ]
[ "Why MY_PACKAGE_REPLACED Android action is ignored by the content scheme", "I have a intent-filter declaration in the manifest for a broadcast.\n\n <intent-filter>\n <action android:name=\"android.intent.action.TIME_SET\"/>\n <action android:name=\"android.intent.action.BOOT_COMPLETED\"/>\n <action android:name=\"android.intent.action.MY_PACKAGE_REPLACED\"/>\n <data android:scheme=\"content\"/>\n </intent-filter>\n\n\nThe problem is when I remove the <data android:scheme=\"content\"/> the MY_PACKAGE_REPLACED action is received otherwise no.\n\nWhat does the data tag in this case? Can't really understand from the documentation." ]
[ "android", "broadcast", "intentfilter" ]
[ "TCP client doesn't receive back server's messages", "I have python server serving multiple android clients over TCP connections. The clients successfully connect to and send messages to the server, but they fail to receive the server's response (if it was sth other than echoing the original message they sent).\nThe blocking mServerMessage = mBufferIn.readLine(); on the client side keeps blocking for ever failing to capture the server's reply. I can't understand what's it that I am doing wrong.\nServer Code:\n\nimport socket\nimport thread\nimport time\n\nTCP_IP = '192.168.1.105'\nTCP_PORT = 5004\n\nBUFFER_SIZE = 20 # Normally 1024, but we want fast response\nNUMBER_OF_CLIENTS = 2\n\ndef on_new_client(clientsocket,addr):\n while True:\n msg = clientsocket.recv(BUFFER_SIZE) \n if not msg: break\n print addr, ' >> ', msg, '\\n'\n #msg = raw_input('SERVER >> ')\n clientsocket.send(msg) #If I sent anything other than the original message (for example: clientsocket.send(bytes(\"ss\")) or clientsocket.send(\"ss\")) the client fails to capture it!!\n\n clientsocket.close()\n\n\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\n\nprint 'Server started!'\nprint 'Waiting for clients...'\n\ns.bind((TCP_IP, TCP_PORT))\ns.listen(NUMBER_OF_CLIENTS) \n\n\nwhile True:\n conn, addr = s.accept() # Establish connection with client.\n print 'Got connection from', addr\n thread.start_new_thread(on_new_client,(conn,addr))\n\ns.close()\n\n\nClient code:\n\nInetAddress serverAddr = InetAddress.getByName(home.SERVER_IP);\n\nLog.i(\"TCP Client\", \"C: Connecting...\");\n\n//create a socket to make the connection with the server\nSocket socket = new Socket(serverAddr, SERVER_REQUESTS_PORT);\n\ntry {\n\n //sends the message to the server\n mBufferOut = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true);\n\n //receives the message which the server sends back -> the number of clients remaining\n mBufferIn = new BufferedReader(new InputStreamReader(socket.getInputStream()));\n\n Log.i(\"tcpClient\", \"mBufferIN\" + String.valueOf(mBufferIn));\n\n mServerMessage = mBufferIn.readLine();\n //home.remainingCount.setText(mServerMessage);\n Log.i(\"tcpClient\", \"mBufferIN = \" + mServerMessage); //This is never excuted when the message \n counterValueRetrieved = true;\n\n while (mRun) {\n\n\n if (mServerMessage != null && mMessageListener != null) {\n //call the method messageReceived from MyActivity class\n mMessageListener.messageReceived(mServerMessage);\n }\n\n }\n\n Log.i(\"RESPONSE FROM SERVER\", \"S: Received Message: '\" + mServerMessage + \"'\");\n\n} catch (Exception e) {\n\n Log.i(\"TCP\", \"S: Error\", e);\n\n} finally {\n //the socket must be closed. It is not possible to reconnect to this socket\n // after it is closed, which means a new socket instance has to be created.\n socket.close();\n}\n\n} catch (Exception e) {\n\nLog.e(\"TCP\", \"C: Error\", e);\n\n}\n\n\nnote that \n\n// used to send messages\nprivate PrintWriter mBufferOut;\n// used to read messages from the server\nprivate BufferedReader mBufferIn;\n\n\nWhat is wrong?" ]
[ "android", "python", "sockets", "tcp" ]
[ "Assignment to dereferenced self - what does it doo?", "I'm new to rust and hope you can explain what will happen if you assign to dereferenced self?\nDoes it change value in memory by the same reference, or it will destroy value in memory and create new with new reference?\nstruct X {\n v: f32,\n}\nimpl X {\n fn new() -> X {\n X {\n v: 0.0,\n }\n }\n\n fn do_it(&mut self) {\n *self = X::new();\n }\n }\n}\n\n\nI'm learning rust by following game creation tutorial and in it if player starts a new game i need to revert GameState to default.\nimpl GS {\n fn new() -> GS {\n GS {\n frame_time: 0.0,\n player: Player::new(),\n obstacle: Obstacle::new(),\n interface_state: InterfaceState::MainMenu,\n }\n }\n\n fn main_menu(&mut self, ctx: &mut BTerm) {\n ctx.cls();\n ctx.print_centered(WINDOW_HEIGHT / 2 - 5, "Menu");\n ctx.print_centered(WINDOW_HEIGHT / 2 - 4, "New Game - Q");\n\n if Some(VirtualKeyCode::Q) == ctx.key {\n *self = GS::new();\n self.interface_state = InterfaceState::Playing;\n }\n }\n}" ]
[ "rust" ]
[ "How to get the header names of a staged csv file on snowflake?", "Is it possible to get the header of staged csv file on snowflake into an array ?\nI need to loop over all fields to insert data into our data vault model and it is really needed to get these column names onto an array." ]
[ "snowflake-cloud-data-platform" ]
[ "Select element using variable not id in JQuery", "How to write below statement\n\nif ($('#SelectedItems option[value=' + optionData.Value + ']').length === 0) ;\n\n\nusing the variable\n\nvar selectedItems = $('#SelectedItems');\n\n//Something like this but not exactly\n\nif ($(**selectedItems** + \"option[value=' + optionData.Value + ']\").length === 0) ;" ]
[ "jquery" ]
[ "How to verify link using selenium web driver", "How to verify a link in selenium-java web driver.\nI need to verify \"linkname\" is a link and pass the test case.\nHow can I verify that." ]
[ "selenium" ]
[ "pagespeed (chrome) not recognizing javascript defer", "After I read pagespeed (chrome) suggestion to defer javascript, I modified the javascript link tag for three files, not all files.\nHowever, when I load the website, pagespeed continues to suggest that I defer javascript, and the modified files continue to appear under the suggestion's list.\nI have attached two images, one shows that pagespeed is suggesting I defer these javascript files, and the other is showing the pagesource, which lcearly shows that the javascript link tag includes the defer attribute.\nPAGE SPEED IMAGE\n\n\nWEB PAGE SOURCE CODE\n\nFor live website: http://redesign.com.s136249.gridserver.com/\nDo you have any insight as to why this is happening (perhaps this files are not being deferred?) do you have any suggestions of what can I do to have pagespeed reflect the deferral of these javascript files?" ]
[ "javascript", "jquery-deferred", "pagespeed" ]
[ "Odd type construction behaviour", "Working with MD simulations, I need to enforce periodic boundary conditions on particle positions. The simplest way of which is using mod(particle position, box dimension). Since I'm working in 3D space, I made a 3D vector type:\n\nimmutable Vec3\nx::Float32\ny::Float32\nz::Float32\nend\n\n\nAnd a mod function:\n\nf1(a::Vec3, b::Vec3) = Vec3(mod(a.x, b.x), mod(a.y, b.y), mod(a.z, b.z))\n\n\nHowever, when using this, it fails horribly:\n\njulia> a = Vec3(11,-2,5)\nVec3(11.0f0,-2.0f0,5.0f0)\n\njulia> b = Vec3(10,10,10)\nVec3(10.0f0,10.0f0,10.0f0)\n\njulia> f1(a,b)\nVec3(5.0f0,10.0f0,NaN32)\n\n\nIf I simply return a tuple, it works fine:\n\nf2(a::Vec3, b::Vec3) = mod(a.x,b.x), mod(a.y,b.y), mod(a.z,b.z)\n\njulia> f2(a,b)\n(1.0f0,8.0f0,5.0f0)\n\n\nAs a test to see if it was not liking the mod inside the type constructor, I tried a more verbose method:\n\nfunction f3(a::Vec3, b::Vec3)\n x = mod(a.x,b.x)\n y = mod(a.y,b.y)\n z = mod(a.z,b.z)\n return Vec3(x,y,z)\nend\n\njulia> f3(a,b)\nVec3(5.0f0,10.0f0,NaN32)\n\n\nAnd then, a version printing the intermediates:\n\nfunction f4(a::Vec3, b::Vec3)\n x = mod(a.x,b.x)\n y = mod(a.y,b.y)\n z = mod(a.z,b.z)\n println(x, \" \", y, \" \", z)\n return Vec3(x,y,z)\nend\n\njulia> f4(a,b)\n1.0 8.0 5.0\nVec3(1.0f0,8.0f0,5.0f0)\n\n\nWhich for some reason now works. I've tried this on multiple computers now, each with the same result. If someone could shed some light on this, I would be most thankful. Julia version is: Version 0.3.2 (2014-10-21 20:18 UTC)" ]
[ "julia" ]
[ "How to correct config NGINX for WSO2 Identity Server Dashboard?", "Now I am facing a problem to proxy websocket for WSO2 Identity Server front-ended by NGINX. I looking for information in official docs and other blogs like: https://docs.wso2.com/display/IS570/Setting+Up+Deployment+Pattern+1#SettingUpDeploymentPattern1-Changinghostnamesandports\nhttps://medium.com/@piraveenaparalogarajah/working-with-wso2-is-5-8-0-dashboard-via-nginx-1b827cbaba23\n Now, at this point, I had configure the follow files inside my IS cluster nodes:\n\n\n/repository/deployment/server/jaggeryapps/portal/conf/site.json \n/repository/deployment/server/jaggeryapps/dashboard/conf/\n/repository/conf/identity/sso-idp-config.xml\n/deployment/webapps/dashboard/authentication/auth_config.json\n\nInside this files, I am using the mgt.HostName and mgt.Port mydomain.is.wso2:443\n\nAt nginx itΒ΄s deployed the follow config:\n\n\nupstream ssl.wso2.is.com {\n server iskm01.wso2:9447;\n server iskm02.wso2:9447;\n ip_hash;\n}\n...\nserver {\n listen 443 ssl;\n server_name mydomain.is.wso2;\n error_log /var/log/nginx/segurnacahml.log ;\n access_log /var/log/nginx/access-segurnacahml;\n\n #SSL CONFIG\n ...\n\n\n location /{\n proxy_set_header X-Forwarded-Host $host;\n proxy_set_header X-Forwarded-Server $host;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header Host $http_host;\n proxy_read_timeout 5m;\n proxy_send_timeout 5m;\n proxy_pass https://ssl.wso2.is.com;\n proxy_redirect https://ssl.wso2.is.com https://mydomain.is.wso2;\n proxy_http_version 1.1;\n proxy_set_header Upgrade $http_upgrade;\n proxy_set_header Connection β€œupgrade”;\n }\n\n\n}\n\n\nThe problem is: every time that I try to access dashboard app like 'My Profile', the websocket responds with \"Error during WebSocket handshake: Unexpected response code: 400\" and generates an empty response as follows:\n\n\n\nI donΒ΄t know how to deal with this problem even after all research...." ]
[ "nginx", "websocket", "wso2", "identityserver4", "wso2is" ]
[ "CSV lines as key/values in a dictionary", "Imagine a CSV that looks like\n\nZipcode State\n0000 CA\n0001 CA\n\n\nI want to create a dictionary where the Key is the zipcode and the Value is the State. \n\nI've already written a function that reads the CSV line by line, \n\nfor i, line in enumerate(reader):\n print ('line[{}] = {}'.format(i, line))\n\noutput: \nline[1] = ['0000', 'CA']\nline[2] = ['0001', 'CA']\n\n\nHow do I take each line and make it an entry in dictionary?\nHoping for an output as return dict[zipcode]" ]
[ "python", "csv", "dictionary" ]
[ "postgres sorting based on multiple date value's", "I have one project table with projects with the columns start_at (date) end_at(date) pauzed_at (date) etc.\nAnd I want to order the projects, based on date values.\n\nSorting should be;\n\n- STARTED projects\n- PAUZED projects\n- IDLE projects \n- ENDED projects\n\n\nproject is started when the date is between start_at & end_at.\n\nproject is idle when start_at date is not reached.\n\nproject is ended when end_at date is reached.\n\nproject is paused when paused_at is set etc etc.\n\nHow can I sort this table, based on the state of the project?" ]
[ "sql", "postgresql", "select", "sql-order-by" ]
[ "How can I categorize Exception errors?", "I have this consumer targeted application that has built in error reporting.\nSometimes I get error reports for exceptions like the remote name could not be resolved\n on host names like google.com for example. \nWhich obviously is not a problem in my application, but rather on the users end.\n\nHow can I, in my application, categorize certain Exceptions and instead of offer sending an error report, show a dialog suggesting the user to check certain things on his/her end.\nAlso taking into account the fact that users have localized .NET framework installations. (Error messages in their language)\n\nEDIT: It's really not a question about separating SQLException from WebException, it's more how I can determine a WebException of type remote name could not be resolved from WebException The operation has timed-out for example." ]
[ "c#", "exception", "globalization" ]
[ "How to fix error logging for item aliases using Sitecore?", "I'm using Sitecore 6.5. There is a multi-language configuration. I use items with aliases.\n\nAliases can be created on a content item. Click on the item > Presentation > Aliases.\nEnter for example: /page/stackoverflow/myitem. Click OK.\n\nThe alias is created in the content tree now, see: /sitecore/system/Aliases/*\n\nThe alias is stored in the content tree as:\n\n- page\n-- stackoverflow\n--- myitem\n\n\nEach item is a part of the alias created.\n\nProblem. \n\n\nWebsite url: http://www.contoso.local\nValid alias url: http://www.contoso.local/page/stackoverflow/myitem\nInvalid alias url: http://www.contoso.local/page OR http://www.contoso.local/page/stackoverflow\n\n\nThe invalid urls (based on the created alias) cause errors in the errorlog.\n51161 12:01:26 ERROR An alias for \"/page\" exists, but points to a non-existing item.\n\nI want to change the:\n\n\nLog level to INFO/WARN or\nLog this error in a seperate errorlog or\nCreate a custom httpRequest pipeline to avoid this error.\n\n\nThe above list is on the preferred order. Unless there are better possibilities to solve this problem. Is there anyone who have experienced this problem and have a good solution?\n\nThanks a lot.\n\nJordy" ]
[ "logging", "sitecore", "log4net", "alias", "sitecore6" ]
[ "Why can't I see my mp3 files in Python?", "Guten tag everybody.\n\nI'm new to Python and am trying to re-create a simple mp3 player.\n\nWhen I run the code below the UI pops up and asks for a directory, but when I navigate to where my mp3 files are located I get the message \"no items match your search\". I can navigate to and play all my files without issue through normal file explorer.\n\nWhen I click on cancel, I get the error \"OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '' \"\n\nI'm on a Windows 10 machine, using Python 3.6. I'm using Sublime with Anaconda to run the code.\n\nI have looked through google, stack, youtube, documentation and can't figure out what I'm doing wrong. Thanks in advance for your help. \n\nimport os\n\nimport pygame\nimport tkinter\nfrom tkinter.filedialog import askdirectory\n\nroot = tkinter.Tk()\nroot.minsize(300, 300)\n\nsongList = []\n\nindex = 0\n\ndef directorychooser():\n\n directory = askdirectory()\n os.chdir(directory)\n\n for files in os.listdir(directory):\n if files.endswith('mp3'):\n songList.append(files)\n print(\"songList\")\n\n\ndirectorychooser()" ]
[ "python", "python-3.x" ]
[ "Asp.net, Active Directory authentication not working", "I'm having trouble getting AD authentication working on my website. I have the following test code that works fine :\n\nDirectoryEntry entry = new DirectoryEntry(srvr, usr, pwd);\nobject nativeObject = entry.NativeObject;\n\n\nOn my website I get an error \"Your login attempt was not successful. Please try again.\". I really haven't been able to figure out what's the underlying error in the process that prevents the login.\n\nHere are the sections in my web.config :\n\n<authentication mode=\"Forms\">\n <forms loginUrl=\"Default.aspx\" \n timeout=\"30\" \n name=\".ADAuthCookie\" \n path=\"/\" \n requireSSL=\"false\" \n slidingExpiration=\"true\" \n defaultUrl=\"Edit.aspx\" \n cookieless=\"UseCookies\" \n enableCrossAppRedirects=\"false\"/>\n</authentication>\n<authorization>\n <allow users=\"*\"/>\n</authorization>\n<membership defaultProvider=\"MyADMembershipProvider\">\n <providers>\n <add name=\"MyADMembershipProvider\" \n type=\"System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" \n connectionStringName=\"ADAuthConnection\" \n applicationName=\"/\" \n connectionProtection=\"Secure\" \n enableSearchMethods=\"true\" \n connectionUsername=\"company\\usr\" \n connectionPassword=\"pwd\"/>\n </providers>\n</membership>\n\n\nShouldn't this be all that is required? I don't plan to use profile so I haven't configured ProfileProvider, could this cause the problems?\n\nThanks for help!" ]
[ "asp.net", "active-directory", "asp.net-membership" ]
[ "MATCH_PARENT width not working", "I try to create a fragment with gravity end to use it with NavigationMenu but my problem is that match_parent not found because the fragment not full-screen width.\n\nthis is my xml:\n\n<!-- The Right navigation drawer -->\n <fragment\n android:id=\"@+id/fragment_navigation_filters\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"end\"\n android:name=\"com.ui.newdesign.FilterNavigationFragment\"/>\n\n\nBut the width is not match parent:\n\n\n\nIf any have idea please help me, Thanks in advance." ]
[ "android", "xml", "width" ]
[ "How to declare a C++ variable type based on platform?", "I'm trying to write some C++ code that will work on both Windows and Linux. I currently have this:\n#ifdef WINDOWS\n HINSTANCE _handle;\n#else\n void* _handle;\n#endif\n\nIs it possible to declare the type to be conditional based on the platform instead so that i could do something like:\n#ifdef WINDOWS\n //define TYPE = HINSTANCE;\n#else\n //define TYPE = void*;\n#endif\nTYPE _handle;" ]
[ "c++", "variables" ]
[ "JasperException: equal symbol expected", "I am using Spring form tag library & a select jquery plugin\n\nAn error occurs on running the jsp \n\n\n org.apache.jasper.JasperException: /WEB-INF/view/home.jsp(51,4)\n /WEB-INF/view/createpost.jsp(19,15) equal symbol expected\n\n\n <li>\n <form:select name=\"mood\" class=\"selectpicker\" data-style=\"btn-sm\" \n multiple data-width=\"100px\" data-size=\"5\" //Line 19\n title='Feeling' path=\"mood\">\n <option value=\"1\">A</option>\n <option value=\"2\">B</option>\n <option value=\"3\">C</option>\n </form:select>\n </li>\n <li>\n <form:select name=\"Working\" class=\"selectpicker\" data-style=\"btn-sm\" \n data-width=\"110px\" data-size=\"5\" title='WorkingAt ..' path=\"WorkingAt\">\n <option value=\"1\">A</option>\n </form:select>\n </li>\n\n\nWhen I remove the multiple attribute from the first select tag, error disappears, but if effects the functionality. multiple attribute enables multiple value selection in the select tag.\n\nSeems like spring form is not allowing multiple attribute to run.\n\nCan anyone help on this?" ]
[ "java", "jquery", "spring", "jsp", "spring-mvc" ]
[ "ParseException No result found for query", "I have a Table \"User\" in cloud with fields username,Longitude,Latitude. I am loged in as a user. And i want to retrieve record of specific ID in Welcome Activity. I have followed parse.com docs,Very helpful. I did as it is mentioned in docs for retrieving record but it gives me error ParseException No result found for query.\nHere is my code for the query. Am i doing it right? Correct me if i am wrong. Please!\n\n ParseQuery<ParseObject> query = ParseQuery.getQuery(\"User\");\n query.getInBackground(\"P0WcLeIgsm\", new GetCallback<ParseObject>() {\n @Override\n public void done(ParseObject parseObject, ParseException e) {\n if(e==null){\n String username = parseObject.getString(\"username\");\n String longitude = parseObject.getString(\"Longitude\");\n String latitude = parseObject.getString(\"Latitude\");\n\n tv1.setText(username);\n tv2.setText(longitude);\n tv3.setText(latitude);\n }\n else{\n Toast.makeText(getApplicationContext(),\"error\"+e,Toast.LENGTH_SHORT).show();\n }\n }\n });" ]
[ "android", "android-studio", "parse-platform" ]
[ "Hosting a simple script with user inputs on PythonAnywhere", "I am a beginner in python, and am trying to host my python script on PythonAnywhere, just for fun. I took my code from a Codecadamy exercise to make a Python piglatin translator, which requires user inputs. I am having trouble getting it to host the actual application part. Here is my current code. \n\nimport os\nfrom flask import Flask\napp=Flask(__name__)\n\n#main page\[email protected](\"/\")\n def translate():\n return \"Welcome to Nathan's Pyglatin Translator!\"\n word1= input(\"Enter your word:\")\n pyg=\"ay\"\n word2=word1.lower()[1:len(word1)]\n word1=word1.lower()\n if len(word1)>1 and word1.isalpha():\n if word1[0]==\"a\" or \"e\" or \"i\" or \"o\" or \"u\" or \"y\":\n print(word1+\" ---->\"+word2+\"-\"+word1[0]+pyg)\n else:\n print(word1+\" ---->\"+word2+\"-\"+word1[0]+pyg)\n else: \n print(\"Please enter a word longer than 1 character, without numbers.\")\n print(\" \")\n print(\"--Note that this doesn't work well with words that begin with a vowel--\")\n print(\"Suggestions? Comments? Contact me.\")\n\nif __name__==\"__main__\":\nport=int(os.environ.get('PORT',5000))\napp.run(host='0.0.0.0',port=port)\n\n\nI'm able to get the code run perfectly (without the Flask code related to hosting it on the web page) in Spyder or Jupyter Notebook, but when I try to host it as is on PythonAnywhere it only shows \"Welcome to Nathan's Pyglatin Translator!\"\n\nWhat is the easiest, least-complex way of getting it to actually prompt the user for their word and then go through the script and print the new word on screen? Hopefully it's just a small thing I'm missing." ]
[ "python", "flask", "pythonanywhere" ]
[ "Netbeans IDE sometimes stopped auto-uploading. How to enable it?", "Sometimes the connection to the server has problems and the automatic uploading feature just goes away. When this happens the file cannot automatically get uploaded after editing. \n\nHow can I re-enable automatic uploading? The only way I know is to restart the netbeans IDE. Is there a better, faster way?" ]
[ "netbeans" ]
[ "Getting an object by name", "Is it possible to create an instance of a class by giving its name, e.g.:\n\ninstance = \"TestXYZ\"()\n\n\nAssuming that TestXYZ is imported by a class that imports the code above and TestXYZ is defined as:\n\nclass TestXYZ(object):\n ..." ]
[ "python", "class" ]
[ "Java Socket, binding to local port", "I am trying to bind the Socket on the client side to any particular local port, in this code I used 20000.\n\nNormal connections such as below works just fine. But does not allow for me to choose the local port.\n\nhostSocket = new Socket(host,80);\n\n\nSo I tried this: \n\nhostSocket = new Socket(host, 80, InetAddress.getLocalHost(), 20000);\n\n\nand this:\n\nhostSocket = new Socket();\nhostSocket.bind(new InetSocketAddress(\"localhost\", 20000));\nhostSocket.connect(new InetSocketAddress(host,80));\n\n\nBut they both leave me with this exception... in the second case the exception occurred on the connect call. I'm not really sure what I am missing and I would love some pointers. \n\njava.net.SocketException: Invalid argument or cannot assign requested address\nat java.net.PlainSocketImpl.socketConnect(Native Method)\nat java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)\nat java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)\nat java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)\nat java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)\nat java.net.Socket.connect(Socket.java:546)\nat java.net.Socket.connect(Socket.java:495)\nat com.mb.proxy.netflix.NetflixPrefetchingAgent.connect(NetflixPrefetchingAgent.java:98)\nat com.mb.proxy.netflix.NetflixPrefetchingAgent.run(NetflixPrefetchingAgent.java:164)\nat java.lang.Thread.run(Thread.java:679)\nException in thread \"Thread-19\" java.lang.NullPointerException\nat com.mb.proxy.netflix.NetflixPrefetchingAgent.prefetchChunk(NetflixPrefetchingAgent.java:272)\nat com.mb.proxy.netflix.NetflixPrefetchingAgent.run(NetflixPrefetchingAgent.java:176)\nat java.lang.Thread.run(Thread.java:679)" ]
[ "java", "sockets", "client", "port", "socketexception" ]
[ "Linker Error prevents me from initializing TA-LIB in C++", "I'm having a problem with TA-LIB in my C++ project. \n\nI just downloaded TA-lib (ta-lib-0.4.0-msvc.zip) and copy-and-pasted c folder to my project folder.\n\nBecause of a linker error, I can't go any further.\n\nWhat I did:\n\n\nI just downloaded TA-lib (ta-lib-0.4.0-msvc.zip) and copy-and-pasted c folder to my project folder.\ninclude \"c\\include\\ta_libc.h\"\n\n\nIs there anything wrong with my steps? Or any steps I missed?\n\n\n\n@AlenL\nThank you for your help.\n\n\n\nI included every proj files in IDE.\n\nBut the result is the same. \n\n+) Error List \n\nLNK2019 unresolved external symbol _TA_Shutdown referenced in function _main \n\nLNK2019 unresolved external symbol _TA_Initialize referenced in function _main \n\nLNK1120 2 unresolved externals" ]
[ "c++", "ta-lib" ]
[ "How to print an integer stored in a variable", "So I have a program in 8086 assembly that allows the user to enter 2 digits, store them in a variable and then print out the number:\n\ndata segment\n\n broj db ?\n\n\nends\n\nstack segment\n\n dw 128 dup(0)\n\nends\n\ncode segment\n\n mov ax, data\n mov ds, ax\n mov es, ax\n\n mov ah, 1h\n int 21h\n\n sub al, 48d\n mov bl, 10d\n mul bl\n\n mov broj, al\n\n mov ah, 1h\n int 21h\n sub al, 48d\n add broj, al\n\n mov dl, broj\n sub dl, 48d\n mov ah, 2h\n int 21h\n\n mov ax, 4c00h\n int 21h\n\nends\n\n\nHowever whenever I enter a number for example 21 it doesn't give me the number instead it gives me ASCII Code for that value.\n\nCan anyone help?!" ]
[ "x86-16" ]
[ "Programmatically use XSD.exe tool feature (generate class from XSD Schema) through .NET Framework classes?", "I want to generate a class from an XML XSD Schema, just as you can do with the Xsd.exe tool. \n\nE.g. XSD.exe /namespace:Generated.Xsd_1 /classes /outputdir:..\\Classes\n\nIs there a way to do this by using classes in the .NET Framework instead of using the standalone tool?" ]
[ ".net", "xsd.exe", "fcl" ]
[ "Debugging file format confusion: ELF/BIN", "I am currently working with some Β΅C systems and I'd like to go deeper into detail to understand what is going on beneath.\nI am currently working with a Motorola Coldfire and an ARM 9. For both I am using the GCC toolchain as a cross compiler!\n\nELF files contain more information than needed to get the application run! A BIN file would be enough though! I know the ELF format keeps some extra information. it concatenates symbols and their addresses in memory, right? Are the extra information for the software debugger (e.g. GDB) only or are some of theses information transfered to the target device as well? So if there is a breakpoint hit, the on-chip debugger tells the host the regarding address and the software debugger can show me the relevant code section instead of the boring memory address only?\nCan I debug using a BIN file only (Ok this would be stupid, but basically?)?\n\nSome enlightenment regarding this topic is appreciated!\n\nthynk you" ]
[ "c", "elf", "bin" ]
[ "How to make the bottom corners of a TextInputLayout rounded", "I am trying to make the bottom corners of a focused filled TextInputLayout rounded. Here's a screenshot of what I want to achieve.\n\nI am setting the properties boxCornerRadiusBottomStart and boxCornerRadiusBottomEnd to 4dp for example, but the bottom corners of the TextInputLayout are then only rounded when it's not focused. As long as it's focused, the corners are not rounded anymore.\nHere's a screenshot of what I am seeing now:" ]
[ "android", "android-layout", "material-design", "android-textinputlayout" ]
[ "preg_replace in simple html dom", "I'm trying to grab the latest news from a website and include it on my own.\nThis site uses Joomla (ugh) and the resulting content hrefs are missing the base href.\nso links will hold contensite.php?blablabla which will result in links http://www.example.com/contensite.php?blablabla\nSo I thought of replacing http:// with http://www.basehref.com before echo-ing it out. but my knowledge stops here.\nWhich should I use: preg_replace, str_replace? I'm not sure." ]
[ "preg-replace", "simple-html-dom" ]