texts
sequence
tags
sequence
[ "Android: How to detect Dual sd-card", "Is there any way of identifying if there are two sd-cards in a device?? \n\nEdit: \n\nI have found that at the moment, there is no way of distinguishing between internal storage and true external SD card. In some devices like Samsung Galaxy Tab (7 inches), the system takes the internal storage (usually 16gb) to be as an external storage. Unfortunately there is no way to distinguish between internal storage and secondar/external/sd-card storage. If someone thinks it is possible (for honeycomb and previous versions), write here and I'll prove it." ]
[ "android", "sd-card" ]
[ "Subscribe Orion without receive old entities", "There is some way to subscribe to Orion (e.g. Car entity), without receive the old entities?\n\nExample:\nOrion has -> Car A, Car B.\n\nI do onchange subscription and Orion sends me at same time:\nCar A notification and Car B notification.\n\nWe need the following:\n\nOrion has -> Car A, Car B.\n\nI do onchange subscription but don't receive nothing at this moment. If in a future Orion receives Car B, or changes some attribute of Car A or Car B, then send the notification.\n\nIs that possible?" ]
[ "fiware", "fiware-orion" ]
[ "Issue in Kohana Query", "I'm facing an issue in my query.Kindly help me to sort the issue (I’m newbie in Kohana Framework)\n\n$posts->select(array(DB::expr('( SELECT COUNT(id_visit) FROM `oc2_visits` WHERE `oc2_post`.`id_post` = `oc2_visits`.`id_ad` AND `oc2_visits`.controller = \"Blog\" GROUP BY `oc2_visits`.`id_ad`)'), 'hits'));\n\n //we sort all ads with few parameters\n $posts = $posts->order_by('created','desc')\n ->limit($pagination->items_per_page)\n ->offset($pagination->offset)\n ->limit(Theme::get('num_home_blog_posts', 4))->cached()\n ->find_all(); \n\n\nAs you can see 'hits' is property set at DB:expr(). In my view I'm trying to access the $posts->hits; property. Then the issue appearing hits property doesn't exists.\n\n\nImage is attached, Please help I'm not expert in kohana framework." ]
[ "orm", "model", "kohana" ]
[ "How to create a generic tool to list and edit the properties of any object? (C#)", "I am creating an editor for my game as a windows forms project to enter all of the data into the game.\nThe game includes many different class and struct definitions (eg: Items, Entities, coordinates, Terrains, etc.) And each instance of those things needs to have its properties set in the editor.\n\nCreating a custom tool for every single type of object defined in my code base is too involved. It would take me longer to set up all of those tools than it does to program the game its self. I need to create generic and re-usable tools. So far I have learned to use the \"Property Grid\" which automatically lets you set any data-type in a given object. (assuming that you give it a \"get; set;\" access modifier.) But what about reference types and data structures?\n\nI want to make a generic tool to inspect and edit the properties of any object:\n\n\nCan I make a tool that will display an \"add\" button for any null\nreference type variable in the inspected object?\nAnd a \"Edit\" and \"delete\" button for any reference type variable\nthat is not null in the inspected object?\nCan the \"add\" button prompt me to choose from a list any\nnon-abstract type that derives from the type of the reference?\nCan the tool also display a list of \"edit\" or \"delete\" nodes and a\n'add' button for any 'List' in the inspected object?\nAnd to data type variable need to have a \"get; set;\" access modifier\non them for them to turn up in the property grid? Why can't it\ndetect any public variable in the inspected object?\nHow do you detect all of the properties of an object? How does the\nproperty inspector do it?" ]
[ "c#", "winforms", "generics" ]
[ "Why is my data not being submitted into my database?", "I need to connect an html form to my sql database and I'm starting out with a simple form so I can understand how it works. I can't figure out what I am doing wrong. I have the form created, the php script, and the database created. Whenever I submit the form it takes me to a blank page and nothing has been added to my database. I've written error messages if the connections fail but I'm not seeing those either. I'm not as advanced in programming can someone please help me?\n\nindex1.html\n\n<html>\n<body>\n<form action=\"info.php\" method=\"post\">\n\n<p>Username:<input type=\"text\" name=\"username\" /></p>\n<p>Email:<input type=\"text\" name=\"email\" /></p>\n <input type=\"submit\" value=\"Submit\"/>\n\n\n</form>\n\n </body>\n</html>\n\n\ninfo.php \n\n <?php\n\ndefine('DB_NAME' , 'users' );\ndefine('DB_USER' , 'root');\ndefine('DB_PASSWORD' , '');\ndefine('DB_HOST' , 'localhost');\n\n$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);\n//connection to host\nif (!$link) {\n die('Could not connect: ' . mysql_error());\n}\n//error if not connected to host\n\n$db_selected = mysql_select_db(DB_NAME, $link);\n//select the database\n\nif(!$db_selected){\n die('Can\\'t use ' . DB_NAME . ':' . mysql_error());\n}\n\necho 'Connected successfully';\n\n$value = $_POST['username'];\n$value2 = $_POST['email'];\n\n$sql = \"INSERT INTO guests (username, email) VALUES ('$value', '$value2')\";\n\nif(!mysql_query($sql)){\ndie('Error: ' . mysql_error());\n}\n//error check to see if connected to tables\n\nmysql_close();\n//close connection\n?>" ]
[ "php", "sql", "database-connection" ]
[ "Nodejs always cann't capture child process's stdout data completely, unless child process fllush(stdout)", "I use nodejs to captured its child process's stdout data, but always captured the former part of child process's stdout data. When I add fllush(stdout),It works OK. But I don't know why, and don't want to add flush(stdout).\n\nHere is my code: \n\nvar tail_child = spawn(exefile, [arg1, arg2, arg3]);\ntail_child.stdin.write('msg\\n'); \ntail_child.stdout.on('data', function(data) { \n console.log(data); \n});\n\n\nchild_process.c\n\nprintf(\"data\\n\");\n\n\nNeed your help! Thank you very much!" ]
[ "node.js", "stdout", "child-process", "spawn" ]
[ "Upload a file into a VB.NET application running under terminal services", "We are developing an application in VB.NET that will need to accomodate remote users logging onto a Microsoft Terminal Server using RDP through the MSTSC.exe client.\n\nIs it possible to offer an 'Upload' button which will allow the remote user to pick a file from his/her local hard drive and upload to the server ?" ]
[ "vb.net", "rdp", "terminal-services" ]
[ "Perform a pull without a checkout with Libgit2sharp", "I'd like to perform a pull from a remote branch to a local branch without having to checkout the local branch. I've seen this done in tools like GitKraken and have found a command line solution here: https://stackoverflow.com/a/17722977/1326370. However, I haven't been able to figure out how to do this with Libgit2sharp. Any ideas?" ]
[ "git", "libgit2sharp" ]
[ "Is this a new way to implement Decorator or Multiple inheritance in Java?", "I'm wondering if I found a an alternative way to implement the Decorator Design Pattern in Java? Is this possibly a new way to do something similar to multiple inheritance in Java? Would there be a better way to implement the problem below?\n\nI'm providing a minimal example, for the following problem (image a simple Game Engine):\n\n\nActor: Is a basic actor, which has a position (on the screen) and a flag for visibility\nSome Actors are Damagable, which means they are extended by health-points, methods to apply damage and to destroy them (make the base actor invisible) if necessary.\nSome Actors are Physical, which means they can have forces like gravity applied, which effectively changes the position of the base Actor.\nSome Actors are Damagable and Physical, so they should do a kind of multiple inheritance or apply 2 Decorators (using the Decorator pattern). The EnemyActor is an example of this, which of course has additionally its own methods.\n\n\nHere is my implementation (minimalised):\n\npublic class Actor {\n int posX;\n int posY;\n boolean visible = true;\n}\n\npublic class DamagableActorDecoration {\n float health = 10;\n private final Actor base;\n\n public DamagableActorDecoration(Actor base) {\n this.base = base;\n }\n\n void applyDamage (float dmg) {\n health -= dmg;\n if (health<=0)\n base.visible = false;\n }\n\n boolean isDestroyed () {\n return health<=0;\n }\n}\n\npublic class PhysicalActorDecoration {\n private final Actor base;\n\n public PhysicalActorDecoration(Actor base) {\n this.base = base;\n }\n\n public void applyGravity () {\n base.posY--;\n }\n}\n\npublic interface Damagable {\n DamagableActorDecoration d();\n}\n\npublic interface Physical {\n PhysicalActorDecoration p();\n}\n\npublic class EnemyActor extends Actor implements Damagable, Physical{\n @Override\n public DamagableActorDecoration d() {\n return new DamagableActorDecoration(this);\n }\n @Override\n public PhysicalActorDecoration p() {\n return new PhysicalActorDecoration(this);\n }\n\n public void showExplodingParticleSystem (){}\n}\n\n\nNow I can create an Enemy that extends Actor, has its own methods and is also Damagable and Physical. For example by using it like this:\n\npublic class Runner {\n public static void main(String[] args) {\n EnemyActor enemy1 = new EnemyActor();\n\n // basic actor behavior : appear\n enemy1.visible=true;\n\n // basic actor behavior : move forward\n enemy1.posX++;\n\n // damagable actor behavior : receive damage\n enemy1.d().applyDamage(0.7f);\n\n // physical actor behavior : fall down\n enemy1.p().applyGravity();\n\n // damagable actor behavior : be destroyed\n if (enemy1.d().isDestroyed())\n {\n // enemy actor behavior : explode into pieces\n enemy1.showExplodingParticleSystem();\n }\n }\n}" ]
[ "java", "architecture", "decorator", "multiple-inheritance" ]
[ "Sass mixin for calculating em subtractions", "I have an SCSS setup for a grid like this:\n\n$bp-m: 48em; // 768px \n$bp-l: 60em; // 960px\n\n// 768px to 959px\n@media (min-width: 48em) and (max-width: 59.938em) {\n // Medium to large stuff\n}\n\n// 960px\n@media (min-width: 60em) {\n // Large+ stuff\n}\n\n\nI was curious what could be written in terms of a sass mixin to allow for the max-width calculation, so I could do something like:\n\n$bp-m: 48em; // 768px \n$bp-l: 60em; // 960px\n\n// 768px to 959px\n@media (min-width: $bp-m) and (max-width: @include emCalc($bp-l)) {\n // Medium to large stuff\n}\n\n// 960px\n@media (min-width: $bp-l) {\n // Large+ stuff\n}\n\n\nBasically a mixin that calculates the 1px difference for a grid structure and converts it to em. A bonus would be if it could take em or pixel values and convert it to the proper em regardless. I've done some searching but haven't had too much luck.. any help would be greatly appreciated!" ]
[ "css", "sass", "mixins", "grid-layout", "em" ]
[ "Rails 5 server hangs when receives multiple requests at once", "My development Rails 5 server with Puma keeps freezing and hanging when sending multiple requests at one time from my separate frontend app to the Rails API. There is no error, it just hangs on the POST requests. When I try to kill the server with CTRL + C, nothing happens. I have to manually kill the port. \n\nI've tried setting config.eager_load=true in development.rb. I've tried adding config.allow_concurrency in application.rb. I've Googled relentlessly to no avail. I am sending around 5 requests concurrently from frontend, so I believe this amount of requests is causing it, but I don't know for sure.\n\nHas anyone else experienced this or have an idea of what needs to be done here? I can usually get all the requests coming back to the frontend successfully around 3-4 times, then the server just freezes.\n\nIt especially occurs after I change any one line of code in any file in the project while the server is running." ]
[ "ruby-on-rails", "server", "ruby-on-rails-5", "freeze", "puma" ]
[ "PHP Failed to create COM object `Word.Application'", "I have 3 environments\n1 Test Server, 2 Production Server.\nI have a form where the user can input information and then submit file(doc, docx, rtf) and the system will convert it into a pdf.\nThe code works well in the test server but both production server gives\nFailed to create COM object `Word.Application': Server execution failed \n\n\nMicrosoft Office 2010 is already installed.\naccess permission is already set in dcomcnfg->my computer->properties->com security\nextension=php_com_dotnet.dll is already added in php.ini\n\nCode I am using:\nfunction convert2pdf($path, $year, $savedName)\n{\n $word = new COM("Word.Application") or die ("Could not initialise Object.");\n // set it to 1 to see the MS Word window (the actual opening of the document)\n $word->Visible = 0;\n // recommend to set to 0, disables alerts like "Do you want MS Word to be the default .. etc"\n $word->DisplayAlerts = 0;\n \n //open file\n $word->Documents->Open($path.$savedName);\n\n $word->ActiveDocument->ExportAsFixedFormat($path.$year.'\\\\'.substr_replace($savedName , 'pdf', strrpos($savedName , '.') +1), 17, false, 0, 0, 0, 0, 7, true, true, 2, true, true, false);\n // quit the Word process\n $word->Quit(false);\n // clean up\n unset($word);\n\n //delete temp file\n unlink($path.'\\\\'.$savedName);\n\n //return new file path\n return $year.'\\\\'.substr_replace($savedName , 'pdf', strrpos($savedName , '.') +1);\n}\n\nAny help is much appreciated. Thank you\nUpdates as of Oct 6, 2015\nIt works on Test server, my laptop which runs on Windows 7 but does not work on the Production Server which runs on Windows Server 2008 R2 Standard" ]
[ "php", "com" ]
[ "How do you get the username in Silverlight Out-Of-Browser (SLOOB) apps?", "We currently use Silverlight within the browser. ASP.NET writes the Windows Authenticated user name to the ASPX page that the Silverlight control is on. The username is passed as a parameter in to the control when it loads.\n\nHow would you get the username with an out-of-browser application?" ]
[ ".net", "silverlight" ]
[ "How can I specify the column heading within a WPF datagrid for an observable collection?", "I have the following code that I'm populating a WPF datagrid with:\n\nvar customers = new ObservableCollection<Customer>();\n\nforeach (\n var customer in\n collListItem.Select(\n item =>\n new Customer\n {\n Persona = item[\"Persona\"].ToString(),\n CustomerName = item[\"Title\"].ToString()\n }))\n{\n customers.Add(customer);\n}\n\nthis.dataGridOutstandingOrders.ItemsSource = customers;\n\n\nBased upon my customer class:\n\npublic class Customer\n{\n /// <summary>\n /// Gets or sets the persona.\n /// </summary>\n public string Persona { get; set; }\n\n /// <summary>\n /// Gets or sets the customer name.\n /// </summary>\n public string CustomerName { get; set; }\n}\n\n\nThe problem is once I bind my data to the WPF datagrid the columns come through as the names of my variables in Customer();. Instead I'd like to be able to specify the name of the column (so for example CustomerName would be Customer Name). Is there a way to do this with annotations in my customer class?" ]
[ "c#", "wpf", "datagrid" ]
[ "Calculating time difference when times are cross midnight", "I am trying to calculate the time difference where the times cross midnight. \n\n\n (Difference between 09:00pm and 01:00am)\n\n\nUsing Microsoft SQL, does not recognise datetrunc().\n\nCode using at the moment is \ndatediff(minute, S.Start_, S.End_)/60" ]
[ "sql", "sql-server" ]
[ "AngularJS loading multiple items by AJAX call", "I have a listing page. WHere each listing has comments. I am using AngularJS routes to load the content http://example.com/#mycategory\n\nThe Problem: When user navigates to different category (Say: http://example.com/#mycategory22 ), If i want to load the comments inside every items listed (Below image), do i need to make ajax calls?.\n\nAccording to the below example if i make ajax calls to load comments then it will be 3 ajax calls.\n\nHow to handle this problem." ]
[ "javascript", "php", "ajax", "angularjs" ]
[ "Creating - importing database issue", "I'v made a huge mistake. It's 5 am for me currently, so i didnt think it trough. I'm complete newbie.\n\nBasically, what i did is this. Bought a vps to learn , added site and all configuration. When i was done, it was the next step to add some posts. Since i do have from my old site a backup of mysql i decided just to import it and have all posts in a minute. \n\nI created a new database with the same name as of my old database and hit import. Problem is it ruined everything. My url points to old url (from old database and asks for old site url).\n\nHow i can revert this or fix it whithout deleting a whole vps and starting over.\n\nThanks" ]
[ "mysql", "phpmyadmin" ]
[ "How to add inline script in react js?", "I am converting my HTML site to react and beneath the body tag, I have this script that toggles my mobile nav\n <script>\n window.addEventListener("scroll", function () {\n var nav = document.querySelector("nav");\n nav.classList.toggle("sticky", window.scrollY > 0);\n }, { capture: true });\n\n $(document).ready(function () {\n $('.fa-bars').click(function () {\n $('nav ul').toggleClass('active-2');\n })\n });\n</script>\n\nThen once I go to another page, the nav button stops working(i.e it won't toggle the nav until I refresh the page)\nPlease how can I fix that?" ]
[ "javascript", "reactjs", "react-router", "react-web" ]
[ "Failed to execute Augustus PMML Gaslog Example. Need help to debug", "I ran command testing the Gaslog example of Augutus:\n\n\n Augustus consumer_config.xcfg\n\n\nBut got following error:\n\nTraceback (most recent call last):\n File \"/usr/local/bin/Augustus\", line 171, in <module>\n main(config)\n File \"/usr/local/lib/python2.7/dist-packages/augustus/engine/mainloop.py\", line 532, in main\n mainLoop = MainLoop(configuration, dataStream=dataStream, rethrowExceptions=rethrowExceptions)\n File \"/usr/local/lib/python2.7/dist-packages/augustus/engine/mainloop.py\", line 150, in __init__\n self.model = xmlbase.loadfile(fileLocation, pmml.X_ODG_PMML, lineNumbers=True)\n File \"/usr/local/lib/python2.7/dist-packages/augustus/core/xmlbase.py\", line 1628, in loadfile\n return load(file(fileName), base, validation, dropSpecial, lineNumbers)\n File \"/usr/local/lib/python2.7/dist-packages/augustus/core/xmlbase.py\", line 1807, in load\n parser.parse(stream)\n File \"/usr/lib/python2.7/xml/sax/expatreader.py\", line 107, in parse\n xmlreader.IncrementalParser.parse(self, source)\n File \"/usr/lib/python2.7/xml/sax/xmlreader.py\", line 123, in parse\n self.feed(buffer)\n File \"/usr/lib/python2.7/xml/sax/expatreader.py\", line 210, in feed\n self._parser.Parse(data, isFinal)\n File \"/usr/lib/python2.7/xml/sax/expatreader.py\", line 307, in end_element\n self._cont_handler.endElement(name)\n File \"/usr/local/lib/python2.7/dist-packages/augustus/core/xmlbase.py\", line 1728, in endElement\n raise XMLValidationError(\"%sXMLValidationError: %s.\" % (stacktrace, str(err)))\naugustus.core.xmlbase.XMLValidationError: Below is a traceback to the line that caused the actual exception.\n File \"/usr/local/lib/python2.7/dist-packages/augustus/core/xmlbase.py\", line 1721, in endElement\n last.validate(recurse=False, exception=True)\n File \"/usr/local/lib/python2.7/dist-packages/augustus/core/xmlbase.py\", line 872, in validate\n self.xsd.validate(self)\n File \"/usr/local/lib/python2.7/dist-packages/augustus/core/xmlbase.py\", line 1579, in validate\n xml.post_validate()\n File \"/usr/local/lib/python2.7/dist-packages/augustus/core/pmml41.py\", line 1656, in post_validate\n pmmlApply.top_validate_transformationDictionary(self.transformationDictionary)\n File \"/usr/local/lib/python2.7/dist-packages/augustus/core/pmml41.py\", line 7092, in top_validate_transformationDictionary\n raise PMMLValidationError(\"Apply function \\\"%s\\\" not recognized (not built-in and not user-defined)\" % function)\nXMLValidationError: Apply function \"formatDateTime\" not recognized (not built-in and not user-defined).\n\n\nRef: \n\nExample I was trying: https://github.com/codersofthedark/augustus/tree/master/augustus-examples/gaslog/introductory\n\nAugustus: https://code.google.com/p/augustus/" ]
[ "python", "pmml" ]
[ "serverless invoke local with mocked SNS event", "I'm having some trouble invoking locally using serverless.\n\nUsing Python3.6 runtime\n\nThe function in serverless.yml is:\n\nfunctions:\n myFunction:\n events:\n - sns: arn:aws:sns:us-east-1:123456789:myTopic\n\n\nMy command is\n\nsls invoke local -f myFunction -s dev -r us-east-1 -p events/myMockedSnsMessage.json\n\n\nServerless doesn't like the syntax on the myMockedSnsMessage.json\n\nWhen I log the event in my lambda function I get something like:\n\n{\n 'Records': [\n {\n 'Sns': {\n 'Message': '{\"version\":\"0\",\"id\":\"a965ce94-fcb2-ad15-319d-04adab1072d0\",\"detail-type\":\"AWS API Call via CloudTrail\",...}'\n }\n }\n ]\n}\n\n\nThat is, the SNS message is a string with valid JSON inside\n\nHow should I store a mock event for an SNS message and still have valid JSON so serverless doesn't yell at me for bad JSON syntax?" ]
[ "python", "python-3.x", "amazon-web-services", "amazon-sns", "serverless-framework" ]
[ "What widget is better to use for 2 pages app in kivy?", "I'm trying to create an app with 2 pages. I would like to switch between the two pages using a button: when a button is pressed the page switches. My code does not seem to work. I might be missing something.\nHow can I achieve this?\n\nThis is the code I am working with:\n\n<TrafGridLayout>:\n PageLayout:\n BoxLayout:\n orientation: 'vertical'\n\n BoxLayout:\n TextInput:\n text: ''\n\n BoxLayout:\n TextInput:\n text: ''\n\n # Calculate and show page #2\n BoxLayout:\n Button:\n text: \"Calculate\"\n on_press:\n traffictax.calculate(point_from.text, point_to.text)\n traffictax.show_page(1)\n\n BoxLayout:\n orientation: 'vertical'\n\n # Show page #1\n BoxLayout:\n Button:\n text: \"Back to first page\"\n on_press: traffictax.show_page(0)" ]
[ "python", "kivy" ]
[ "C# Android: googlemaps onclick get the lat and long", "I am looking for a way to get the lat & long when I click on the map. After that, add marker into that position. Here is my code:\n\n public void OnMapReady(GoogleMap googleMap)\n {\n mMap = googleMap;\n mMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(-6.156445, 106.841790), 10));\n mMap.AddMarker(new MarkerOptions().SetPosition(new LatLng(-6.156445, 106.841790)).SetTitle(\"Kino\"));\n mMap.AddMarker(new MarkerOptions().SetPosition(new LatLng(-6.166685, 106.728294)).SetTitle(\"OT\"));\n mMap.AddMarker(new MarkerOptions().SetPosition(new LatLng(-6.155592, 106.679585)).SetTitle(\"Mayora\"));\n mMap.MapClick += delegate\n {\n //mMap.AddMarker here with pointed lat & long\n };\n }\n\n\nIs it possible to set the lat & long into the title of the marker? If not, it's also OK to display it in a textview. Thank you in advance." ]
[ "c#", "android", "google-maps", "xamarin" ]
[ "How Can I save post requests to mongoengine using django forms?", "If I have a mongoengine document,\n\nclass Blog(Document):\n text = StringField()\n tags = ListField(EmbeddedDocumentField(Tag))\n\nclass Tag(EmbeddedDocument):\n tag = StringField()\n\n\nHow can I write a django form to validate and save the post data\n\n{\n \"text\": \"My first blog post\",\n \"tags\": [\n {\"tag\":\"mongo\"}, {\"tag\":\"django\"}\n ]\n}" ]
[ "django", "django-forms", "mongoengine" ]
[ "Run PHP Script in Background", "I have two PHP scripts—we will call them script A and script B. Script A starts running when the user does a certain interaction. Script A needs to run script B in the background—thus return script A's result while script B is still running. I could do this inside script A:\nexec('scriptB.php &'), however since I'm on shared hosting exec is not allowed. Also, an Ajax solution (initiate both scripts on the client-side) will not work since script B MUST run—I can't have the user maliciously stopping the script from running.\n\nIs there any solution that does not involve using a shell command or Ajax?\n\nThanks in advance!" ]
[ "php", "ajax", "shell", "concurrency", "exec" ]
[ "Using LD_PRELOAD on Fedora 25 causes Segmentation Fault", "I have found a strange behavior while I was trying to use a library that I wrote a long time ago. The main problem is, when the program is executed on Fedora 25 and linked to my library by using LD_PRELOAD, the system raises a Segmentation Fault. I've made a small sample of my old library to easily understand the problem.\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <malloc.h>\n\nextern void *__libc_malloc(size_t size);\n\nvoid *malloc(size_t size) \n{\n void *ptr = __libc_malloc(size);\n fprintf(stdout, \"Malloc(%d)->(%p)\\n\", (int) size, ptr);\n return ptr;\n}\n\n\nThis code was compiled by using these parameters:\n\ngcc -c -fPIC -O3 -Wall -o libtest.o libtest.c\ngcc -shared -o libtest.so libtest.o\n\n\nThe program was executed as follows:\n\nLD_PRELOAD=./libtest.so ./progtest\n\n\nI found out that the \"fprintf\" line was causing the Segfault problem. So I've changed the \"stdout\" file descriptor to \"stderr\", and the problem was gone.\n\nThen I tested the same code using the \"stdout\" file descriptor as output for \"fprintf\" on another machine running CentOS 7, and it worked fine in both cases using \"stdout\" and \"stderr\".\n\nBy observing these results, I wonder what I am missing and why this is happening.\n\nGLibc and GCC versions installed on Fedora 25:\n\n\n GNU ld version 2.26.1-1.fc25\n \n gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)\n\n\nGLibc and GCC versions installed on CentOS 7:\n\n\n GNU ld version 2.25.1-22.base.el7\n \n gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)" ]
[ "linux", "gcc", "glibc", "ld-preload" ]
[ "Ubuntu 12.04 redirection command does not work", "I need to stuck logs from ffmpeg.\n\nSo I command like below.\n\nffmpeg -f rtsp -rtsp_transport tcp -ss 600 -i rtsp://aaa.bbb -vframes 1 out.jpg>aaa_log.list\n\n\nI already confirm that this command makes fine outputs, except \">aaa_log.list\" part.\n\nIt makes file with the name \"aaa_log.list\", but does not write anything.\n\nMy OS is Ubuntu 12.04 64bit and ffmpeg version is 1.2.0.\n\nThnaks." ]
[ "file", "redirect", "ffmpeg", "ubuntu-12.04" ]
[ "Finding absolute path to website from a Windows service or desktop app", "I have a Windows service and a desktop app that is located on the same machine as my website but is not part of the site's directory. Is there a way to determine the absolute path of the website from the service or desktop app?\n\nI came across this post:\nServerManager How to get site's physical path on disk?\n\nbut three people commented that the ServerManager has some serious memory leaks, so I'm looking for a better solution." ]
[ "c#", "asp.net" ]
[ "Modified building my project from public folder to a sub-folder dist and it won't work", "I was originally serving up all my assets from the public folder. I then wanted my assets to be in a dist folder, so I edited my scripts and webpack.config.js file. However, I noticed that running my serve script if I am on the create expense page http://127.0.0.1:8080/create and refresh, the app breaks. I can't figure out what to do so that on live-server a refresh on the create expense page doesn't break the app. \n\nHere are my scripts from package.json:\n\n\"scripts\": {\n \"serve\": \"live-server public/\",\n \"build:dev\": \"webpack --mode=development\",\n \"build:prod\": \"webpack -p --env production\",\n \"server\": \"webpack-dev-server --open\",\n \"test\": \"jest --config=jest.config.json\",\n \"start\": \"node server/server.js\",\n \"heroku-postbuild\": \"npm run build:prod\"\n },\n\n\nAnd here is my webpack config file:\n\nconst path = require('path')\nconst HtmlWebpackPlugin = require('html-webpack-plugin')\nconst MiniCssExtractPlugin = require('mini-css-extract-plugin');\n\nmodule.exports = (env) => {\n const isProduction = env === 'production'\n console.log(env);\n return {\n entry: './src/app.js',\n output: {\n path: path.join(__dirname, 'public', 'dist'),\n filename: 'bundle.js',\n publicPath: '/dist/'\n },\n module: {\n rules: [{\n test: /\\.js$/,\n exclude: /node_modules/,\n use: ['babel-loader', 'eslint-loader']\n },\n {\n test: /\\.s?css$/,\n use: [isProduction ? MiniCssExtractPlugin.loader : 'style-loader',\n {\n loader: 'css-loader',\n options: {\n sourceMap: true\n }\n },\n {\n loader: 'sass-loader',\n options: {\n sourceMap: true\n }\n }]\n }]\n },\n devtool: isProduction ? 'source-map' : 'inline-source-map',\n devServer: {\n contentBase: path.join(__dirname, 'public'),\n historyApiFallback: true,\n publicPath: '/dist/',\n port: 3000\n },\n plugins: [new HtmlWebpackPlugin({\n template: './src/index.html',\n filename: '../index.html'\n }), new MiniCssExtractPlugin({\n filename: 'styles.css'\n })]\n }\n}\n\n\n\n\nI need help in getting the files to be served up correctly." ]
[ "javascript", "node.js", "reactjs", "html-webpack-plugin", "npm-live-server" ]
[ "MR for cherry picked commit through gitlab api", "Is it possible to make MR for cherry picked commit through gitlab API?\nIn the gitlab's doc there is only oppotunity to make MR from source branch to target branch." ]
[ "api", "gitlab", "cherry-pick" ]
[ "Why isn't the head node of my linked list being deleted?", "Okay, so i'm playing with linked list in Java. I'm trying to understand why my deleteNode method doesn't delete the head node. It works for other nodes.\n\nHere's the method\n\nNode deleteNode(Node head, int d){\n Node n = head;\n if(n.data == d){\n return head.next;\n }\n\n while(n.next != null){\n if(n.next.data == d){\n n.next = n.next.next;\n return head;\n }\n n = n.next;\n }\n return head;\n }\n\n\nSample input:\n\nNode ll = new Node(1);\nll.appendToTail(2);\nll.appendToTail(3);\n\n\nWhen I call my method\n\nll.deleteNode(ll, 2);\n\n\nand then print the current Nodes, I get the correct output of 1->3, however when I use the method to delete the initial node or the head\n\nll.deleteNode(ll, 1);\n\n\nI get the output 1->2->3, but I expect 2->3, where 2 becomes the new head. Below is the entire implementation just incase\n\npublic class Node {\n\n Node next = null;\n int data;\n\n public Node(int d){\n data = d;\n }\n\n void appendToTail(int d){\n\n Node end = new Node(d); //Item to append to the end\n Node n = this; //To access Class object next\n\n while(n.next != null){\n n = n.next;\n }\n n.next = end;\n }\n\n Node deleteNode(Node head, int d){\n Node n = head;\n if(n.data == d){\n return head.next;\n }\n\n while(n.next != null){\n if(n.next.data == d){\n n.next = n.next.next;\n return head;\n }\n n = n.next;\n }\n return head;\n }\n\n void printNodes(){ \n Node n = this;\n while(n.next != null){\n System.out.println(n.data);\n n = n.next; \n }\n System.out.println(n.data); //print out the last node\n }\n\n //For fun, to simulate how python print's a list\n // printed example [1, 2, 3]\n void listNodes(){\n Node n = this;\n StringBuilder sb = new StringBuilder();\n sb.append(\"[\");\n while(n.next != null){\n sb.append(n.data).append(\", \");\n n = n.next;\n }\n sb.append(n.data);\n sb.append(\"]\");\n System.out.println(sb.toString());\n }\n}" ]
[ "java", "linked-list" ]
[ "JQuery height after scripts load", "I have this situation where I have a bunch of divs that get populated mostly from templates. My data comes from many sources but I am only having trouble with the div (div3) that has data coming from a script. I am trying to get the height for this div but it seems that theJQuery .height() and the .css('height') get the values after the site has rendered but NOT after the script data has returned, therefore I am getting a height of 0 even though there is data coming to populate my div. The data comes from an external source so I have no control over it. Here is what the code looks like:\n\n<div class=\"div1\">\n ...some code\n <div class=\"div2\">data comes from DB</div>\n ...some code\n <div class=\"div3\">data comes from script</div>\n</div>\n<div class=\"div4\">\n ..some code\n</div>\n\n\nAny ideas how to get the height for div3? Thanks in advance." ]
[ "jquery" ]
[ "Run callbacks in Javascript in if else statement", "I have this code snippet and when my $remainingTime becomes zero, I want it to run the stop function in callbacks. I don't know what I have to write in the else statement.\n\nvar clock = $('.clock').FlipClock(\n <?php\n $now = new DateTime('now');\n $tm = new DateTime('2017-12-22 12:00:00');\n $remainingTime = $tm->getTimestamp()-$now->getTimestamp();\n if($remainingTime>0) {\n echo $remainingTime;\n } else {\n }\n ?>\n ,{\n clockFace: 'DailyCounter',\n countdown: true,\n callbacks: {\n stop: function() {\n $(\".timerContainer\").css('display','none');\n }\n }\n});" ]
[ "javascript", "php" ]
[ "Best approach to displaying text", "Xcode 8.3.2\n\nAs as newbie, I'm trying to get acquainted with segues, constraints, text fields and Image Views...mainly the design elements. I'm trying to put together a cheesy recipe book of favorite recipes. I wanted to know what's the best approach to display rich text with bold text and bullet points? Labels seem to be my only option but I was wondering if there were other options? Any advice would be appreciated.\n\nViewController in Storyboard" ]
[ "swift", "xcode" ]
[ "Testing In app purchase using IAB helper class", "Hi Im trying to test in app purchase in my app. It seems that everything has been setup properly but when im trying to purchase an item im getting the following:\n\n\n \"error processing purchase df-ppa-40\"\n\n\nHas anyone encountered this issue?" ]
[ "android", "in-app-billing", "android-billing" ]
[ "Reading device phone number throws NULLPointerException", "I am trying to read the phone number of the device using the following code. When phone number is not available I read the subcriber id. It works in some phones and throws NULL pointer exception in some devices. The device log shows I am getting NULL pointer exception in the following line\n\nif(MyPhoneNumber.equals(\"\"))\n\n\nPlease let me know how to make it work in all devices.\n\nTelephonyManager tMgr =(TelephonyManager)ShowMyLocation.this.getSystemService(Context.TELEPHONY_SERVICE); \n\nString MyPhoneNumber = tMgr.getLine1Number(); \n\n\nif(MyPhoneNumber.equals(\"\"))\n MyPhoneNumber = tMgr.getSubscriberId();" ]
[ "android", "nullpointerexception", "phone-number" ]
[ "How should I detect 3 way collision in Unity 4.3", "I am making a basketball game in Unity, using a trigger collider to detect when the ball passes through the net. At the time this trigger happens, I also want to check if the ball is in contact with the rim (2pts) or not (3pts, swish). I already have an OnCollisionEnter defined for the rim, but I want to know of this collision from the OnTriggerEnter function on the trigger collider itself.\n\nSo far, I have:\n\n#pragma strict\n\n// defined on the basket itself\nfunction OnTriggerEnter(info:Collider) {\n if (info.name == \"ball\") {\n Debug.Log(\"Basket made\");\n }\n}\n\n\nand then \n\n#pragma strict\n\n// defined on the rim\nfunction OnCollisionEnter (info:Collision) {\n if (info.collider.name == \"ball\") {\n Debug.Log(\"Ball hit rim\");\n }\n}\n\n\nI would like to detect the latter in the function of the former, some how." ]
[ "unity3d", "unityscript" ]
[ "In Voldemort, why does the hash ring only extend to 2^31-1?", "On the project voldemort design page:\n\nhttp://project-voldemort.com/design.php\n\nIt is stated that the hash ring covers the interval [0, 2^31-1].\n\nNow, the interval [0, 2^31-1] represents 2^31 total numbers, and the largest number 2^31-1 is just 31 bits all set to 1. (To convince yourself of this, consider 2^3-1. 2^3=8 and is 0x1000. 2^3-1=7 and is 0x111).\n\nThus, if a normal 32-bit address word is used to store the value, you have 1 bit free.\n\nThus, why is 2^31-1 the upper limit? Is that extra bit used for some kind of system bookkeeping? \n\n(e.g. 1 extra bit would provide room for safely adding two valid hash addresses without overflow).\n\nAnd finally, is this choice specific to voldemort, or is it seen in other consistent hashing schemes?" ]
[ "hash", "voldemort", "consistent-hashing" ]
[ "Generic Web Api method", "I've some classes like CustomerModel or CustomerDetailsModel which are inherting from ModelBase.\n\nAlso i don't want to introduce subclasses for each modeltype.\n\nIn one case have a post method foreach.\n\nSo i could manually create multiple routes to call a method which looks like\n\nHandle<T>(T model) where T : ModelBase\n\n\nThey only differ in the path the were called. For example:\n\nbaseurl/api/customer => CustomerModel\nbaseurl/api/customerdetails => CustomerDetailsModel\n\n\nI want to implement a generic web api method like\n\n[HttpPost]\nvoid Post<T>(T model) where T : ModelBase\n\n\nIf I simply create a generic method i got an exception which tells me that the web api method could not have generic methods. But sometime ago I've seen an implementation with web api v1 using some kind of custom lookup mechanisms to handle this. But i can't figure out it anymore.\n\nAs a workaround I created a callwrapper which determines the type and invokes a internal generic method, but this feels quite ugly\n\n public async Task<IHttpActionResult> Post(string id, string moduleType)\n {\n await AsyncGenericCallWrapper(moduleType);\n...\n\n\nIt would be much butter to have the above mentioned generic controllerr.\n\n private async Task AsyncGenericCallWrapper(string moduleType)\n {\n Type type = GetModuleType(moduleType);\n var content = await Request.Content.ReadAsStringAsync();\n var instance = JsonConvert.DeserializeObject(content, type);\n\n MethodInfo method = this.GetType().GetMethod(\"InternalGenericMethod\", BindingFlags.NonPublic | BindingFlags.Instance);\n MethodInfo generic = method.MakeGenericMethod(type);\n var result = generic.Invoke(this, new object[] { instance }) as Task;\n\n await result;\n }\n\n\nI can image to have a custom Attribute which maps the types like\n\n[GenericRoute(\"/customer\", typeof(CustomerModel)]\n[GenericRoute(\"/customerDetail\", typeof(CustomerDetailModel)]\nvoid Post<T>(T model) where T : ModelBase\n\n\nWith this i could create routes for each attribute, but still the method now get invoked as it is generic , nor i know how to interfer the deserialization mechanism\n\nCan anyone tell me how to implement that GenericWebAPiMethod?" ]
[ "c#", "generics", "asp.net-web-api", "asp.net-web-api2", "asp.net-web-api-routing" ]
[ "How to write a Makefile for LEDE to install my new driver?", "I have written a Makefile to compile my driver in LEDE.The problem was the xxx.ko file is available in /lib/modules/uname -r/ directory but that module is no install from the boot.So can you help me to rewrite my Makefile to bring my driver installed from the boot.I have attached my Makefile here.\n\ndefine Build/Compile\n $(MAKE) -C \"$(LINUX_DIR)\" $(MAKE_OPTS) modules\nendef\n\ndefine Package/kmod-ax88772/install\n $(INSTALL_DIR) $(1)/etc/init.d\n $(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION) \n $(INSTALL_DIR) $(1)/usr/sbin\nendef\n\n\nThank you in advance." ]
[ "openwrt" ]
[ "replacing from one column to another using r", "I am new to R but have a very large file to work with.\nI have a table in R that looks like this:\n\nCHROM POS ID REF ALT Sample1 Sample2\n 20 1 rs1000000 G A 1/1 0/0\n 20 2 rs1000002 A G 1/1 0/1\n 20 3 rs1000004 A G 0/0 0/0\n\n\nI would like to look in Column 6 Sample1 and replace the \"0's\" with the letter in the corresponding row in Column 4 REF. I want to delete the slashes and repeat this by replacing the ones in Column 6 Sample1 with the letter in Column 5 ALT. I want to do this for every row in the table. This is the expected result: \n\nCHROM POS ID REF ALT Sample1 Sample2\n 20 1 rs1000000 G A AA GG\n 20 2 rs1000002 A G GG AG\n 20 3 rs1000004 A G AA AA\n\n\nThank you." ]
[ "r" ]
[ "Naming the capturing image third time", "I created a basic service to get images from a camera every 10 second. The service works perfectly, but I'm trying to name the image files like ImageYYYYddmm_HHmmSS. After the second file, the images are getting the same YYYYddmm_HHmmSS, thus overwriting the first image. Where is my mistake?\n\npublic class CP extends Service\n{\n Camera.PictureCallback mCall = new Camera.PictureCallback()\n {\n\n public void onPictureTaken(final byte[] data, Camera camera)\n {\n\n FileOutputStream outStream = null;\n try{\n\n outStream = new FileOutputStream(\"/sdcard/Image\"+tar+\".jpg\");\n outStream.write(data); outStream.close();\n\n\n Log.i(\"CAM\", data.length + \" byte written: /sdcard/Image\"+tar+\".jpg\");\n camClose(sHolder); \n\n\n } catch (FileNotFoundException e){\n Log.d(\"CAM\", e.getMessage());\n } catch (IOException e){\n Log.d(\"CAM\", e.getMessage());\n }\n\n\n }\n };\n\n\n @Override\n public IBinder onBind(Intent intent) {\n\n return null;\n }\n\n public void camClose(SurfaceHolder sHolder) {\n\n\n if (null == mCamera)\n return;\n mCamera.stopPreview();\n mCamera.release();\n mCamera = null;\n Log.i(\"CAM\", \" closed\");\n }\n}" ]
[ "android", "android-camera" ]
[ "proguard-maven-plugin java 8", "I am trying to use Proguard to obfuscate my Java 8 App.\n\nProguard supports Java 8 since version 5.0\n\nFor some reason the program-maven-plugin ignores my configuration to use Proguard version 5.1 and uses 4.3, incompatible with Java 8.\n\nMy configuration is\n\n<plugin>\n <groupId>com.pyx4me</groupId>\n <artifactId>proguard-maven-plugin</artifactId>\n <version>2.0.4</version>\n <executions>\n <execution>\n <phase>package</phase>\n <goals>\n <goal>proguard</goal>\n </goals>\n </execution>\n </executions>\n <configuration>\n <proguardVersion>5.1</proguardVersion>\n <obfuscate>true</obfuscate>\n <options>\n <option>-allowaccessmodification</option>\n <option>-keep class mypackage.Testt</option>\n </options>\n <libs>\n <lib>${java.home}/lib/rt.jar</lib>\n <lib>${java.home}/lib/javafx-mx.jar</lib>\n </libs>\n </configuration>\n <dependencies>\n <dependency>\n <groupId>net.sf.proguard</groupId>\n <artifactId>proguard-base</artifactId>\n <version>5.1</version>\n <scope>runtime</scope>\n </dependency>\n </dependencies>\n </plugin>\n\n\nAny clue?\n\nTks," ]
[ "maven-3", "java-8", "proguard" ]
[ "Ajax.ActionLink in MVC3 Razor and loading gifs not working as expected", "I am using AjaxOptions of in an Ajax ActionLink and I figured the loading gif would display within the UpdateTargetId (containerDiv) and it doesn't. I also expected the loading gif to run as long as the LoadingElementDuration, and it doesn't. No matter duration I use - the gif loads and fades out quickly (and appears to shrink as opposed to a straight fade). Am I missing something in my code that is preventing the expected behaviour from happening?\n\n@{\n ViewBag.Title = \"Index\";\n}\n <script type=\"text/javascript\">\n\n function OnBeginAjax() {\n\n var item = $(\"#spanBegin\");\n item.text(\"Begin Request Fired!\");\n\n }\n\n function OnCompleteAjax() {\n var item = $(\"#spanComplete\");\n item.text(\"Complete Request Fired!\");\n }\n </script>\n<h2>Index View</h2>\n<div id=\"spinner_container\">\n <img id=\"spinner\" src=\"@Url.Content(\"~/content/themes/base/images/ajax-loader.gif\")\" class=\"hidden\"/>\n</div>\n<br />\n<br />\n<span id=\"spanBegin\">Begin Request.....</span><br/>\n<span id=\"spanComplete\">Complete Request.....</span>\n<div>\[email protected](\" << Fire Ajax Link\", \"AjaxMethod\", new AjaxOptions\n {\n UpdateTargetId = \"containerDiv\",\n LoadingElementId = \"spinner\",\n LoadingElementDuration = 100000,\n OnBegin = \"OnBeginAjax\",\n OnComplete = \"OnCompleteAjax\"\n\n })\n</div>\n<div id=\"containerDiv\"></div>\n\n\nAnd if what I have (and what I'm seeing) is the expected behaviour (which seems pretty useless) - any ideas on how I would pass the UpdateTargetId as a param to the OnBegin function?\n\nHere's the rendered HTML:\n\n<!DOCTYPE html>\n<html>\n<head>\n <title>Index</title>\n <link href=\"/Content/Site.css\" rel=\"stylesheet\" type=\"text/css\" />\n <script src=\"/Scripts/jquery-1.7.1.min.js\" type=\"text/javascript\"></script>\n <script type=\"text/javascript\" src=\"/scripts/jquery.unobtrusive-ajax.min.js\"></script>\n</head>\n<h1>\n MVC Sandbox Test Site</h1>\n<body>\n <script type=\"text/javascript\">\n $(document).ready(function () {\n // function OnBeginAjax() {\n // alert(\"Begin no params\");\n // // debugger;\n // // var item = $(\"#activityDiv\");\n // }\n\n // function OnCompleteAjax() {\n // alert(\"Complete no params\");\n // }\n });\n function OnBeginAjax() {\n //alert(\"Begin no params\");\n // debugger;\n var item = $(\"#spanBegin\");\n item.text(\"Begin Request Fired!\");\n\n }\n\n function OnCompleteAjax() {\n var item = $(\"#spanComplete\");\n item.text(\"Complete Request Fired!\");\n }\n </script>\n<h2>Index View</h2>\n<div id=\"spinner_container\">\n <img id=\"spinner\" src=\"/content/themes/base/images/ajax-loader.gif\" class=\"hidden\"/>\n</div>\n<br />\n<br />\n<span id=\"spanBegin\">Begin Request.....</span><br/>\n<span id=\"spanComplete\">Complete Request.....</span>\n<div>\n<a data-ajax=\"true\" data-ajax-begin=\"OnBeginAjax\" data-ajax-complete=\"OnCompleteAjax\" data-ajax-loading=\"#spinner\" data-ajax-loading-duration=\"100000\" data-ajax-mode=\"replace\" data-ajax-update=\"#containerDiv\" href=\"/Home/AjaxMethod\"> << Fire Ajax Link</a>\n</div>\n<div id=\"containerDiv\"></div>\n\n</body>\n</html>" ]
[ "jquery", "ajax", "asp.net-mvc", "asp.net-ajax" ]
[ "AJAX photo slideshow that auto updates from folder", "I'm looking for a PHP/AJAX slideshow solution that reads in images from a directory and auto updates while playing when photos are added or deleted. The images should also auto size to the browser dimensions. I have searched for hours and haven't found anything that auto updates. The topic at Ajax slideshow does not show anything is nice but it uses a meta refresh tag which is not dynamic. I know how to adjust this with PHP to dynamically generate the appropriate refresh time on each cycle but this is not ideal with a page refresh. Any suggestions on how to approach this problem is greatly appreciated." ]
[ "php", "ajax", "slideshow", "photos" ]
[ "Keep looping until API response no longer contains specific key", "I am retrieving a JSON response from an API which includes a 'Next' field if there is another page of results (page only shows 20 results at a time). I want the loop to continue to follow these 'Next' URLS (adding the values on each page) until the 'Next' key is not in the response.\n\nI've tried a couple different things but either it works and only grabs the first page, or it gives an error like: JSONDecodeError: Expecting value: line 1 column 1 (char 0). \n\nHere is the code so far, hopefully I've explained what I am trying to achieve.\n\ntotalOrderCount = 0\ntotalOrderAmount = 0\n\nresponse = session.get(url+'/ordertransactions').json()\n\nwhile 'next' in response:\n nextUrl = response['next']\n for i in response['orders']:\n totalOrderCount = totalOrderCount + 1\n totalOrderAmount = totalOrderAmount + i['amount']\n response = session.get(nextUrl).json() # Grab next page of results and perform the above actions again\nelse:\n for i in response['orders']:\n totalOrderCount = totalOrderCount + 1\n totalOrderAmount = totalOrderAmount + i['amount']\n\nprint(totalOrderCount)\nprint(totalOrderAmount)\n\n\nThank you for your help!" ]
[ "python", "python-3.x", "while-loop", "python-requests" ]
[ "Trying to get list of views in folder in Codeigniter", "I'm using Codeigniter, and all I'm trying to do is to get a list of all the views in a particular folder within the \"views\" folder.\n\nHere's my code, inside of my controller:\n\n$this->data['sections'] = array_diff( scandir('/application/views/portfolio/embeds/work/'), array('.', '..') );\n\n\nAnd here is the error message I'm getting:\n\n\n Message: scandir(/application/views/portfolio/embeds/work/): failed to open dir: No such file or directory\n \n Filename: controllers/Work.php\n \n Line Number: 54\n\n\nAm I just forgetting something? Or is there maybe a way to set a relative path from the location of my controller? Because using the path \"../views/portfolio/embeds/work/\" doesn't seem to work either." ]
[ "php", "codeigniter", "scandir" ]
[ "append to a parent span class only using jquery", "I am trying to generate dynamic forms using jquery.\n\njQuery\n\n<script>\n $(document.body).delegate('#AddFeature', 'click', function(event) {\n event.preventDefault();\n var htm = \"\";\n htm += \"<br/>        <input type='text' name='module[][]' placeholder='Enter Feature'/>\";\n $('#AddFeatureSpace').append(htm);\n });\n\n $(document.body).delegate('#AddModule', 'click', function(event) {\n event.preventDefault();\n var htm = '';\n htm += \"<input type='text' name='module[]' placeholder='Enter Module'/>\";\n htm += \"<span id='AddFeatureSpace'></span><a href='#' id='AddFeature'>Add Feature</a><br/>\";\n $('#AddModuleSpace').append(htm);\n });\n</script>\n\n\nHTML\n\n<form method='post'>\n<input type='text' name='module[]' placeholder='Enter Module' />\n<span id=\"AddFeatureSpace\"></span><a href='#' id='AddFeature'>Add Feature</a>\n<br />\n<a href='#' id=\"AddModule\">Add Module</a>\n<div id=\"AddModuleSpace\">\n</div>\n</form>\n\n\nThe first time it adds very good when i click add feature.\nBut when i try to add module and then add feature under it, it adds to the first module.\nI know the reason for this as they have the same id.\nI need to append them to the parent span instead of a different span." ]
[ "jquery", "html" ]
[ "Cant set a calendar event on android 4.0 >", "I am making an app that access the android calendar and creates an event.\n\nIt work fine in android 2.3, but in 4.0 > it do not creates the event and throws an exception\n\nI dont know what i am doing wrong, this is my code:\n\n public void addReminder() {\n\n Calendar beginTime = Calendar.getInstance();\n\n long startMillis = beginTime.getTimeInMillis();\n\n long endMillis = beginTime.getTimeInMillis() + 60 * 60 * 1000;\n\n\n String eventUriString = \"content://com.android.calendar/events\";\n ContentValues eventValues = new ContentValues();\n\n eventValues.put(Events.CALENDAR_ID, 1);\n eventValues.put(Events.TITLE, \"Test\");\n eventValues.put(Events.DESCRIPTION, \"Test\");\n eventValues.put(Events.EVENT_TIMEZONE, \"Montevideo\");\n eventValues.put(Events.DTSTART, startMillis);\n eventValues.put(Events.DTEND, endMillis);\n\n eventValues.put(\"eventStatus\", 1);\n eventValues.put(Events.HAS_ALARM, 1);\n\n\n Uri eventUri = getContentResolver().insert(\n Uri.parse(eventUriString), eventValues);\n long eventID = Long.parseLong(eventUri.getLastPathSegment());\n\n String reminderUriString = \"content://com.android.calendar/reminders\";\n ContentValues reminderValues = new ContentValues();\n\n reminderValues.put(\"event_id\", eventID);\n reminderValues.put(\"minutes\", 1);\n reminderValues.put(\"method\", 1);\n\n\n\n Uri reminderUri = getContentResolver().insert(\n Uri.parse(reminderUriString), reminderValues);\n\n\n}\n\n\nOn android 4.0 > this is what I get:\n\n09-14 14:39:12.118: E/AndroidRuntime(826): FATAL EXCEPTION: main\n09-14 14:39:12.118: E/AndroidRuntime(826): android.database.sqlite.SQLiteException\n09-14 14:39:12.118: E/AndroidRuntime(826): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:181)\n09-14 14:39:12.118: E/AndroidRuntime(826): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)\n09-14 14:39:12.118: E/AndroidRuntime(826): at android.content.ContentProviderProxy.insert(ContentProviderNative.java:420)\n09-14 14:39:12.118: E/AndroidRuntime(826): at android.content.ContentResolver.insert(ContentResolver.java:866)\n09-14 14:39:12.118: E/AndroidRuntime(826): at com.example.notificationtest.MainActivity.addReminder(MainActivity.java:131)\n09-14 14:39:12.118: E/AndroidRuntime(826): at com.example.notificationtest.MainActivity$2.onClick(MainActivity.java:68)\n09-14 14:39:12.118: E/AndroidRuntime(826): at android.view.View.performClick(View.java:4204)\n09-14 14:39:12.118: E/AndroidRuntime(826): at android.view.View$PerformClick.run(View.java:17355)\n09-14 14:39:12.118: E/AndroidRuntime(826): at android.os.Handler.handleCallback(Handler.java:725)\n09-14 14:39:12.118: E/AndroidRuntime(826): at android.os.Handler.dispatchMessage(Handler.java:92)\n09-14 14:39:12.118: E/AndroidRuntime(826): at android.os.Looper.loop(Looper.java:137)\n09-14 14:39:12.118: E/AndroidRuntime(826): at android.app.ActivityThread.main(ActivityThread.java:5041)\n09-14 14:39:12.118: E/AndroidRuntime(826): at java.lang.reflect.Method.invokeNative(Native Method)\n09-14 14:39:12.118: E/AndroidRuntime(826): at java.lang.reflect.Method.invoke(Method.java:511)\n09-14 14:39:12.118: E/AndroidRuntime(826): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)\n09-14 14:39:12.118: E/AndroidRuntime(826): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)\n09-14 14:39:12.118: E/AndroidRuntime(826): at dalvik.system.NativeStart.main(Native Method)\n\n\nThis is are my permissions:\n\n<uses-permission android:name=\"android.permission.READ_CALENDAR\" />\n<uses-permission android:name=\"android.permission.WRITE_CALENDAR\" />\n\n\nWhat could it be?" ]
[ "android", "android-calendar" ]
[ "Value of auth.provider for Phone Authentication & Facebook in Firebase Database", "As per the documentation, the values for all providers are given except for Phone Authentication. I want to verify in my database if a user has authenticated with both Phone Authentication and Facebook. Writing a rule as auth.provider === 'facebook' works, but auth.provider === 'phone' doesn't. Logically, if the first one worked then the second one shouldn't work, but what if I say that I always sign in with Phone credentials and linked Facebook credentials with the Phone credentials the first time? In a nutshell:\n\n\nIs there a value of auth.provider for Phone Authentication? If yes, what is it?\nIs there a way to check if the user has both Facebook and Phone as providers in my database? I don't care if the user signs in with either of them. The only thing I want is that the user should have linked his Facebook credentials to the Phone.\nAssuming that auth.provider only gives the value of the provider used to sign in, why is auth.provider === 'facebook' working when I never sign in a user with Facebook and only link it with Phone credentials?\n\n\nUpdate:\n\n\nWith some trial and error, it seems that if Phone authentication is the only method used, then auth.provider is actually anonymous, not phone.\nAlso, based on bojeil's answer, auth.token.firebase.identities[\"phone\"] !=null turns out to be true. Point to be noted is that this is not documented in the documentation. Quoting from the documentation:\n\n\n\n firebase.identities: Dictionary of all the identities that are associated with this user's account. The keys of the dictionary can be any of the following: email, google.com, facebook.com, github.com, twitter.com.\n\n\nNo mention of phone here either. The last day the page was updated was May 17, 2017. One can only imagine the level of shoddiness in the documentation considering the Firebase SDK for Javascript (v4.0.0), which includes support for Phone authentication, was released on that very day (see release notes)." ]
[ "firebase", "firebase-realtime-database", "firebase-authentication" ]
[ "Strange spacing for CSS table using fractional heights", "Edit: Sorry folks, looks like this was dumb JS bug I missed. It was inserting multiple empty rows in between each legitimate row. I'm not sure why they only start to show up near the bottom but it was because for every 1 real row there were 3 duplicate empty rows in between.\n\n\n\nEvery TD in the above table has the following classes/styles:\n\n.cell\n{\n background-color: lightgray;\n opacity: 1.0;\n vertical-align: middle;\n text-align: center;\n background-color: gray;\n cursor: pointer;\n}\n\n.hour\n{\n width: 100%;\n height: 8.33%\n}\n\n\nI imagine the 8.33% height is to blame but I have 12 rows and I want each of them to be 1/12th the height of the table. Is there a better way to do this that doesn't create weird gaps other than specifying a static number of pixels?" ]
[ "html", "css" ]
[ "AWS S3: upload failed for large file from ec2 to s3", "I am trying to upload large files from ec2 instance to aws s3. I am using python multi-part load to upload files to s3. It is successfully executing when i am getting files around 40gb but when i am getting files above 70gb, the code is failing after loading around 20%. I am attaching my code and error message below: \n\nimport threading\nimport boto3\nimport os\nimport sys\nfrom boto3.s3.transfer import TransferConfig\n\ns3 = boto3.resource('s3')\n\nlocal_fs_path=sys.argv[1]\nsubject_area=sys.argv[2]\npy_file=sys.argv[3]\ns3_path=sys.argv[4]\n\nBUCKET_NAME = \"***********\"\ndef multi_part_upload_with_s3():\n # Multipart upload\n config = TransferConfig(multipart_threshold=1024 * 5, max_concurrency=10,\n multipart_chunksize=1024 * 5, use_threads=True)\n file_path = os.path.dirname(local_fs_path) + '/' + py_file\n key_path = s3_path + '/' + subject_area + '/' + py_file\n s3.meta.client.upload_file(file_path, BUCKET_NAME, key_path,\n ExtraArgs={'ACL': 'public-read'},\n Config=config,\n Callback=ProgressPercentage(file_path)\n )\nclass ProgressPercentage(object):\n def __init__(self, filename):\n self._filename = filename\n self._size = float(os.path.getsize(filename))\n self._seen_so_far = 0\n self._lock = threading.Lock()\n def __call__(self, bytes_amount):\n # To simplify we'll assume this is hooked up\n # to a single filename.\n with self._lock:\n self._seen_so_far += bytes_amount\n percentage = (self._seen_so_far / self._size) * 100\n sys.stdout.write(\n \"\\r%s %s / %s (%.2f%%)\" % (\n self._filename, self._seen_so_far, self._size,\n percentage))\n sys.stdout.flush()\n\nif __name__ == '__main__':\n multi_part_upload_with_s3()\n\n\nThe error message i am getting is like: \n\n /home/*****/etl/******/*******/*******/*********/***.20190510.dat 13080289280 / 88378295325.0 (14.80%)Traceback (most recent call last):\n File \"/home/*****/etl/******/*******/*******/*********/multipart_load.py\", line 46, in <module>\n multi_part_upload_with_s3()\n File \"/home/*****/etl/******/*******/*******/*********/multipart_load.py\", line 25, in multi_part_upload_with_s3\n Callback=ProgressPercentage(file_path)\n File \"/usr/local/lib/python2.7/dist-packages/boto3/s3/inject.py\", line 131, in upload_file\n extra_args=ExtraArgs, callback=Callback)\n File \"/usr/local/lib/python2.7/dist-packages/boto3/s3/transfer.py\", line 287, in upload_file\n filename, '/'.join([bucket, key]), e))\nboto3.exceptions.S3UploadFailedError: Failed to upload /home/*****/etl/******/*******/*******/*********/********.20190510.dat to aws_bucket_name/******/*****/temp_dir/*******.20190510.dat: An error occurred (RequestTimeout) when calling the UploadPart operation (reached max retries: 4): Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed." ]
[ "python", "python-2.7", "amazon-s3", "amazon-ec2", "aws-lambda" ]
[ "C++0x lambda wrappers vs. bind for passing member functions", "This is basically a question about the readability, style, performance of 2 different approaches to creating/passing a functor that points to a member method from within a class constructor/method.\n\nApproach 1:\n\nusing namespace std::placeholders;\nstd::bind( &MyClass::some_method, this, _1, _2, _3 )\n\n\nApproach 2:\n\n[ this ](const arg1& a, arg2 b, arg3& c) -> blah { some_method( a, b, c ); }\n\n\nI was wondering if using the lambda is just gratuitous in this situation, in some respects it is easier to see what is going on, but then you have to explicitly provide the arg types. Also i prefer not to have \"using namespace whatever;\" but then it makes the bind expression needlessly verbose (eg. _1 becomes std::placeholders::_1), and lambda avoids this issue.\n\nFinally i should note that for the purposes of this question, some_method is a big function that does lots of things, and would be a pain to directly copy into a lambda body.\n\nIf this question seems too vague, then we can focus on answers to the performance differences, if any.\n\nEDIT: A non-trivial use case.\n\nMyClass::MyClass()\n: some_member_( CALLBACK_FUNCTOR )\n{}\n\n\nAs you can see, the CALLBACK_FUNCTOR used in an initializer list (defined with approach 1 or 2) makes it difficult to scope a using declaration (afaik), and obviously we wouldnt bother wrapping a member method that we intended to call straight away." ]
[ "lambda", "c++11", "bind", "member-function-pointers" ]
[ "Where stored array, if I declared it after return?", "I have code C++11: \n\ntemplate<std::size_t n>\nstatic inline constexpr uint32_t mask() noexcept \n{ \n static_assert(n <= 32, \"!\");\n using list = uint32_t[]; \n\n return list{\n 0x0u, \n 0x1u, 0x3u, 0x7, 0xfu, 0x1fu, 0x3fu, 0x7fu, 0xffu, \n 0x1ffu, 0x3ffu, 0x7ffu, 0xfffu, 0x1fffu, 0x3fffu, 0x7fffu, 0xffffu, \n 0x1ffffu, 0x3ffffu, 0x7ffffu, 0xfffffu, 0x1fffffu, 0x3fffffu, 0x7fffffu, 0xffffffu, \n 0x1ffffffu, 0x3ffffffu, 0x7ffffffu, 0xfffffffu, 0x1fffffffu, 0x3fffffffu, 0x7fffffffu, 0xffffffffu\n } [ n ]; \n}\n\n\nQ: where is stored list array? (in static memory, auto memory, or nowhere stored)?" ]
[ "c++", "arrays", "memory", "c++11" ]
[ "JfreeChart and ValueMarker not displayed (headless environment)", "I have a problem while generating a chart. Every part on the chart is well generated except a ValueMarker which is not. I am working on a web application in a headless RedHat environment. I got another problem for the chart generation (which is now solved), the description of my environment is here :\n\nJFreeChart strange rendering (headless RedHat)\n\nIt is working perfectly on Windows.\nThe piece of code adding the ValueMarker is :\n\nMarker distanceTiers = new ValueMarker(Double.parseDouble(resultDistance.replace(Constants.UNITE_DISTANCE, \"\")));\ndistanceTiers.setPaint(Color.BLACK);\nplot.addDomainMarker(distanceTiers);\n\n\nHere is what I obtain, I am supposed to get a vertical line at X = 40 and I cannot figure out why everything except this line is going well :\n\n\n\nIf someone has an explanation for this, please do not hesitate." ]
[ "jfreechart", "redhat", "marker", "headless" ]
[ "Visual Studio truncates message in Test Detail Summary window", "I have test which compares two json objects. If test fails then I print those json objects. \n\nAssert.That(\n json1,\n Is.EqualTo( json2 ).Using<JToken>( JToken.DeepEquals ),\n \"Jsons are not equal\\n{0}\\n{1}\", json1.ToString(), json2.ToString() );\n\n\nBut Visual Studio truncates my message :( Message from TestContext.Out is also truncated.\n\nHow can I increase message length limit?" ]
[ "visual-studio", "nunit", "vstest" ]
[ "problems in installing mylyn mantis connector to eclipse luna", "I am having problems on installing mantis-mylyn connector to eclipse luna. I am getting the following error.\n\n\n Missing requirement: Mylyn Mantis Connector Core 3.10.0.201311082300\n (com.itsolut.mantis.core 3.10.0.201311082300) requires 'bundle\n org.eclipse.mylyn.commons.soap [3.7.0,4.0.0)' but it could not be\n found\n\n\nin previous versions of eclipse (kepler ...) the plugin was working without any problems. But I don't want to return to kepler, because luna is better. In kepler, I had the problem of freezing of editors, which was slowing me down." ]
[ "eclipse", "mylyn", "mantis" ]
[ "How to convert single arrays to double arrays", "Here I made a code but with single array but now I want to convert it to double arrays [][]. \n\nThere are some things should be changed but I can get it to work. \n\nThis is part of the class that got the a single array that I want to change to double arrays. \n\n public House[][] neighbors(House victim) {\n House[][] n = new House[8];\n\n int row = victim.address / size;\n int col = victim.address % size;\n\n if (row != 0 && row != (size - 1) && col != 0 && col != (size - 1)) {\n n[0] = houses[victim.address - 1];\n n[1] = houses[victim.address + 1];\n n[2] = houses[victim.address - size];\n n[3] = houses[victim.address - size - 1];\n n[4] = houses[victim.address - size + 1];\n n[5] = houses[victim.address + size];\n n[6] = houses[victim.address + size - 1];\n n[7] = houses[victim.address + size + 1];\n return n;\n }\n\n if (row == 0 && col != 0 && col != (size - 1)) {\n n[0] = houses[victim.address - 1];\n n[1] = houses[victim.address + 1];\n n[2] = houses[victim.address + size];\n n[3] = houses[victim.address + size - 1];\n n[4] = houses[victim.address + size + 1];\n n[5] = houses[victim.address + (size * (size - 1))];\n n[6] = houses[victim.address + (size * (size - 1)) + 1];\n n[7] = houses[victim.address + (size * (size - 1)) - 1];\n return n;\n }\n\n if (row == (size - 1) && col != 0 && col != (size - 1)) {\n n[0] = houses[victim.address - 1];\n n[1] = houses[victim.address + 1];\n n[2] = houses[victim.address - (size * (size - 1))];\n n[3] = houses[victim.address - (size * (size - 1)) + 1];\n n[4] = houses[victim.address - (size * (size - 1)) - 1];\n n[5] = houses[victim.address - size];\n n[6] = houses[victim.address - size - 1];\n n[7] = houses[victim.address - size + 1];\n return n;\n }\n\n if (col == 0) {\n n[0] = houses[victim.address + (size - 1)];\n n[1] = houses[victim.address + 1];\n n[2] = houses[victim.address - size];\n n[3] = houses[victim.address - size - 1];\n n[4] = houses[victim.address - size + 1];\n n[5] = houses[victim.address - (size * (size - 1))];\n n[6] = houses[victim.address - (size * (size - 1)) + 1];\n n[7] = houses[victim.address - (size * (size - 1)) - 1];\n return n;\n }" ]
[ "java" ]
[ "Node.js - The multi part could not be bound", "I have an error (node:1152) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): RequestError: The multi-part identifier \"SC1.refb\" could not be bound.\n\nIn console log show all select but it seems that comes to the last and gives the error.\n\nMy code:\n\nreturn Promise.all(parts.map(function(part) {\n console.log(\"SELECT sc.scstamp, st.u_posic, st.fornec, st.fornecedor, sc.ref, sc.qtt, sc.design FROM sc INNER JOIN st ON st.ref = sc.ref WHERE sc.refb = '\"+kitRef+\"' AND st.u_posic = '\"+part.u_order+\"'\"+\n \"UNION SELECT SC2.scstamp, st.u_posic, st.fornec, st.fornecedor, SC2.ref, SC2.qtt, SC2.design FROM sc AS SC1\"+\n \"INNER JOIN sc SC2 ON SC2.refb = SC1.ref INNER JOIN st ON st.ref = SC2.ref WHERE SC1.refb = '\"+kitRef+\"' AND st.u_posic = '\"+part.u_order+\"'\");\n return request.query(\"SELECT [sc].[scstamp], [st].[u_posic], [st].[fornec], [st].[fornecedor], [sc].[ref], [sc].[qtt], [sc].[design] FROM sc INNER JOIN st ON st.ref = sc.ref WHERE sc.refb = '\"+kitRef+\"' AND st.u_posic = '\"+part.u_order+\"'\"+\n \"UNION SELECT [SC2].[scstamp], [st].[u_posic], [st].[fornec], [st].[fornecedor], [SC2].[ref], [SC2].[qtt], [SC2].[design] FROM sc AS SC1\"+\n \"INNER JOIN sc SC2 ON SC2.refb = SC1.ref INNER JOIN st ON st.ref = SC2.ref WHERE SC1.refb = '\"+kitRef+\"' AND st.u_posic = '\"+part.u_order+\"'\")\n .then(function(articles) {\n\n return {part:part, articles:articles};\n });\n }));\n\n\nThe query is ok because if i put it in sql works well.\n\nThank you" ]
[ "javascript", "node.js" ]
[ "How to keep an app reactive when needing to subscribe?", "I have a fully reactive web app that aggregates the information from two other backend-services.\nIncoming request -> sends request to service A and B -> aggregates responses -> response is emitted.\npseudocode:\npublic Mono<ResponseEntity<List<String>>> getValues() {\n return Mono.zip(getValuesA(), getValuesB(), \n (a, b) -> Stream.concat(a.stream(), b.stream()).collect(Collectors.toList()))\n .map(result -> ResponseEntity.ok(result));\n}\n\npublic Mono<String> getValuesA() {\n return webClient.get()\n .uri(uriA)\n .retrieve()\n .bodyToMono(new ParameterizedTypeReference<>() {});\n}\n\n// getValuesB same as A, but with uriB.\n\n\nBecause of the high request frequency, I want to bundle requests to the backend-services. I thought using Sinks would be the right way to go. A sink is returned as mono to every requesting party. After a threshold of 10 requests has been exceeded, the request will be handled and the response will be emitted to every sink.\npublic Mono<ResponseEntity<List<String>>> getValues() {\n return Mono.zip(getValuesA(), getValuesB(), \n (a, b) -> Stream.concat(a.stream(), b.stream()).collect(Collectors.toList()))\n .map(result -> ResponseEntity.ok(result));\n}\n\npublic Mono<String> getValuesA() {\n\n Sink.One<List<String>> sink = Sinks.one();\n queue.add(sink);\n\n if(queue.size() > 10) {\n\n webClient.get()\n .uri(uriA)\n .retrieve()\n .bodyToMono(new ParameterizedTypeReference<>() {})\n .subscribe(response -> {\n for(Sink.One<List<String>> sinkItem : queue) {\n sink.tryEmitValue(response);\n }\n });\n }\n \n return sink.asMono();\n\n}\n\n// getValuesB same as A, but with uriB.\n\n\nThe problem in this code is the 'subscribe' part. As soon as we're subscribing to the webclient's response, it will block the thread. This will only happen in 10% of the requests, but this is already too much for an endpoint that's being called very frequently. What can I do to 'unblock' this part. If using sinks wasn't the best choice, what could have been a better one?\nPS. All pseudocode used is NOT production code. It may have many flaws and it is only meant to visualize the problem I'm facing at this moment." ]
[ "java", "spring-webflux", "reactive" ]
[ "For second page onwards, JdbcPagingItemReader is not putting values automatically for sortkey placeholder", "I am using JdbcPagingItemReader as below, \n\n@Bean\n public ItemReader<RemittanceVO> reader() {\n\n JdbcPagingItemReader<RemittanceVO> reader = new JdbcPagingItemReader<RemittanceVO>();\n reader.setDataSource(dataSource);\n reader.setRowMapper(new RemittanceRowMapper());\n reader.setQueryProvider(queryProvider);\n reader.setPageSize(100);\n return reader;\n }\n\n\n@Bean\n public PagingQueryProvider queryProvider() throws Exception{\n SqlPagingQueryProviderFactoryBean queryProviderBean= new SqlPagingQueryProviderFactoryBean();\n queryProviderBean.setDataSource(dataSource);\n queryProviderBean.setSelectClause(Constants.REMITTANCES_SELECT_CLAUSE);\n queryProviderBean.setFromClause(Constants.REMITTANCES_FROM_CLAUSE);\n queryProviderBean.setWhereClause(Constants.REMITTANCES_WHERE_CLAUSE);\n queryProviderBean.setSortKey(Constants.REMITTANCES_SORT_KEY);\n PagingQueryProvider queryProvider = queryProviderBean.getObject();\n return queryProvider;\n }\n\n\nAs of now, I launch job as below ( as I am very new to Spring batch ) \n\nJobLauncher jobLauncher = (JobLauncher) ctx.getBean(\"jobLauncher\");\n Job job = (Job) ctx.getBean(\"runRCMatcher\");\n\n try {\n JobExecution execution = jobLauncher.run(job, new JobParameters());\n }catch (Exception e) {\n e.printStackTrace();\n }\n\n\nI am running this app as SpringBoot app. It fetches first 100 records successfully and hands over to processor and then next query fails. Query fails because sort key value has not been placed in it. This is there in query , AND ((REMIT_ID > ?)) ORDER BY REMIT_ID ASC FETCH FIRST 100 ROWS ONLY; \n\nWhere am I wrong? \n\nMy DB is DB2 so I guess it should be using - Db2PagingQueryProvider\n\nStep & Job are defined as , \n\n@Bean\n public Step step1(StepBuilderFactory stepBuilderFactory,\n ItemReader<RemittanceVO> reader, ItemWriter<RemittanceClaimVO> writer,\n ItemProcessor<RemittanceVO, RemittanceClaimVO> processor) {\n\n return stepBuilderFactory.get(\"step1\")\n .<RemittanceVO, RemittanceClaimVO> chunk(100).reader(reader)\n .processor(processor).writer(writer).build();\n }\n\n\n@Bean\n public Job runRCMatcher(JobBuilderFactory jobs, Step s1) {\n return jobs.get(\"RCMatcher\")\n .incrementer(new RunIdIncrementer())\n .flow(s1)\n .end()\n .build();\n }\n\n\nSort key specified is table column name - Constants.REMITTANCES_SORT_KEY and that is a primary key of table and of type BIGINT" ]
[ "spring-batch" ]
[ "maven in command line succeed, but failed when using the same maven in eclipse", "I'm trying to build the project of hadoop. I followed the official document as follows on how to do that. \n\nhttp://wiki.apache.org/hadoop/HowToContribute\nhttps://wiki.apache.org/hadoop/EclipseEnvironment\n\n\nI've git clone the project, maven install it successfully, but when I import the project, or even a sub-project like 'hadoop-yarn-api', I got the following errors on maven:\n\nDescription Resource Path Location Type\nPlugin execution not covered by lifecycle configuration: org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAPSHOT:protoc (execution: compile-protoc, phase: generate-sources) pom.xml /hadoop-yarn-api line 73 Maven Project Build Lifecycle Mapping Problem\n\n\nThen I'm trying to mvn clean install the project via External Tools Configuration in eclipse, it also failed on:\n\n[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAPSHOT:protoc (compile-protoc) on project hadoop-yarn-api: org.apache.maven.plugin.MojoExecutionException: 'protoc --version' did not return a version -> [Help 1]\n\n\nBut the curious part is that when I cd into the root directory of 'hadoop-yarn-api' and invoke mvn clean install, it can be built successfully.\n\nI'm using m2ecipse in eclipse, and I'm sure that I've changed to the maven which is exactly the one that I'm used in command line, not the embedded one. \n\nAnd I've installed protocol buffers 2.5.0:\n\n$ protoc --version\nlibprotoc 2.5.0\n\n\nCould anyone give me some idea? Many thanks!\n\nP.S.\n\nEclipse Java EE IDE - Juno Service Release 2\n\nm2e - 1.4.1.20140328-1905\n\nMac 1- 0.9.4\n\nmaven - 3.0.5\n\nHadoop - 2.2.0" ]
[ "eclipse", "maven", "hadoop" ]
[ "Android WifiP2pManager discoverServices timeout", "I've been working with the Android WifiP2pManager to discover specific services on other devices. I'm wondering if there is a known timeout period for the function\n\npublic void discoverServices (WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)\n\n\nI can't find any resources on it in the Android API. I'm aware that I can set a listener for a successful discovery, but I don't know how to tell if no discovery has been made.\n\nAdditionally, is there any way to stop discovery without entirely stopping the wifi manager's functionality?\n\nThanks in advance for any help!" ]
[ "android", "wifi", "wifi-direct" ]
[ "WPF DataGrid with variable row heights", "I am programmatically creating a DataGrid and need the row heights to be variable so that rows with multiple lines of text have a great height to accomodate the additional lines.\n\nI tried setting the RowHeight property in code, but this requires a fixed value. If I leave RowHeight unset it just uses an arbitrary value that does not expand if the text doesn't fit.\n\nI would also like to have my DataGrid contents to be scaleable, so if the DataGrid is resized the actual cell resize as well, including the font inside the cells. I could use a Viewbox for this, but I've had issues with the Viewbox as it will not grow to fit the text, it shirks/expands the text to fit in it.\n\nPerhaps I need to walk through all of the rows and columns on a resize and set the height property manually." ]
[ "wpf", "datagrid" ]
[ "BeautifulSoup4: FileNotFoundError for Opening URL", "I'm using BeautifulSoup4 to scrape a site. Here's a condensed version of what I have:\n\nfrom bs4 import BeautifulSoup\n\ndef getTeamRoster(teamURL):\n soup = BeautifulSoup(open(teamURL))\n\ndef main():\n getTeamRoster(\"http://modules.ussquash.com/ssm/pages/leagues/Team_Information.asp?id=11325\")\n\n\nI've pulled up the page and it loads properly in my browser (Chrome). For some reason, I'm getting the following error:\n\nTraceback (most recent call last):\n File \"SquashScraper.py\", line 61, in <module>\n main()\n File \"SquashScraper.py\", line 58, in main\n getTeamRoster(\"http://modules.ussquash.com/ssm/pages/leagues/Team_Information.asp?id=11325\")\n File \"SquashScraper.py\", line 21, in getTeamRoster\n soup = BeautifulSoup(open(teamURL))\nFileNotFoundError: [Errno 2] No such file or directory: 'http://modules.ussquash.com/ssm/pages/leagues/Team_Information.asp?id=11325'\n\n\nAny idea what may be happening?\n\nI've looked at other people's BeautifulSoup4 code and thought what I did was the idiomatic way of accessing a page's HTML.\n\nThanks,\nbclayman" ]
[ "python", "beautifulsoup" ]
[ "How to set formatProvider property in Serilog from app.config file", "I know that it's possible to setup Serilog sinks in app.config file (AppSettings section) and it's pretty simple with scalar types, but how to be with complex ones (IFormatProvider etc.). Does anybody know how to deal with that and is it possible at all? \n\nI'm trying to simulate this example \n\nILogger logger = new LoggerConfiguration()\n .Enrich.WithExceptionDetails()\n .WriteTo.Sink(new RollingFileSink(\n @\"C:\\logs\",\n new JsonFormatter(renderMessage: true))\n .CreateLogger();\n\n\nbut using app.config only." ]
[ "serilog" ]
[ "tell wicket:link not to overwrite markup", "I'm working on some SVG-Buttons for a User Interface. I have to dynamically create a Link in the java files with some code in it from the markup. The following code is an example of my markup-input.\n\nhtml-markup input:\n\n<svg>\n <g>\n <wicket:link wicket:id=\"test\">\n <path ..../>\n <path ..../>\n </wicket:link>\n </g>\n</svg>\n\n\nI want the markup-output to look like this:\n\nhtml-markup output:\n\n<svg>\n <g>\n <a wicket:id=\"test\" xlink:href=\"someurl\">\n <path ..../>\n <path ..../>\n </a>\n </g>\n</svg>\n\n\nThe thing is, that wicket will end up deleting the path-instructions in the markup html which it isn't supposed to do so. Is there any way to do this properly?\nFor testing I came up with some dirty work around I'm not satisfied with because it hurts the wicket convention of not creating html in java. It looks like the following:\n\nhtml-markup dirty way input:\n\n<svg>\n <g>\n <wicket:container wicket:id=\"linkbeginning\">\n <path ..../>\n <path ..../>\n <wicket:container wicket:id=\"linkending\">\n </g>\n</svg>\n\n\njava dirty-way:\n\nadd(new Label(\"linkbeginning\", \"<a xlink:href =\\\"\"+linkurl+\"\\\">\");\nadd(new Label(\"linkending\", \"</a>\");\n\n\nwhich ended in this output:\n\n<svg>\n <g>\n <a xlink:href=\"someurl\">\n <path ..../>\n <path ..../>\n </a>\n </g>\n</svg>\n\n\nI hope you guys can help me!" ]
[ "inheritance", "hyperlink", "wicket", "markup" ]
[ "Azure DevOps (VSTS) - Jenkins Pipeline - Set user agent", "I am using Azure DevOps (formerly known as VSTS) to start a new Jenkins build when changes are pushed. \n\nIs there a way to define a user agent for all HTTP requests that are made from the Azure Agent to the Jenkins Server? At the moment there is no user agent set at all." ]
[ "azure-devops" ]
[ "Angular2: How to instantiate the state of the checkbox in FormGroup?", "Friends, I have some form in angular 2 app. In component I use form group like this:\n\nthis.formPersonalProfile = new FormGroup({\n private: new FormControl(false),\n});\n\n\nIn template of this component I described checkbox as follow:\n\n<input type=\"checkbox\" private=\"private\" formControlName=\"private\" class=\"form-check-input\">\n\n\nOK, after this I open this template in popup window via ngbModal, and I see that my checkbox is unchecked. But when I try to see FormGroup in console, I see that this field of FormGroup is null. Only if I manually click on checkbox, I get needed value.\n\nCan I set the default value of checkbox via FormGroup ?" ]
[ "forms", "angular", "checkbox" ]
[ "How to switch between two CSS classes for one control in ASP.Net?", "<style type=\"text/css\">\n .CssStyle1 \n { \n font: 10pt Verdana; \n font-weight:700;\n color: Green;\n }\n\n .CssStyle2\n { \n font: 15pt Times; \n font-weight:250;\n color: Blue;\n }\n\n</style>\n\n\n<asp:Label ID=\"lblEditor\" runat=\"server\"\n Text='<%#Eval(\"Editor\") %>'\n Font-Bold=\"true\"/>\n\n\nprotected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)\n { Label lblEditor = (Label)e.Item.FindControl(\"lblEditor\");\n\n var a= \"high\";\n if (a == \"high\")\n {\n lblEditor.CssClass = \"CssStyle1\";\n }\n else {\n\n lblEditor.CssClass = \"CssStyle2\";\n }\n\n\nHere it is changing content according to second but for some occasion I want to use first and for some other I want to use second CSS class. I want to use only one CSS class at a time.\n\nHow can I switch between them without button click?" ]
[ "javascript", "jquery", "asp.net", "ajax" ]
[ "Open up in a tab not a window", "Possible Duplicate:\n Open url in new tab using javascript \n\n\n\n\nI'm trying to make it so that something opens up in a tab, not a window. As far as I can tell, this is set by browser preference. Is there no real way to override this? I understand you can use window.open, but is this subject to browser preference? I'm currently using target=\"_blank\"." ]
[ "javascript" ]
[ "how to capture the mouse pointer in screenshot", "I use the python-mss to capture the screenshot and use these screenshot with opencv to generate a video recording. As I want to capture the mouse movement in the video.\nBut it seems that the mouse pointer can not be captured in snapshot. How can I capture the mouse pointer with python-mss?\nThanks in advance if anyone can help." ]
[ "python-mss" ]
[ "How to make a JSON file from a class in C# with correct format", "I'm having troubles making JSON file from my Server class. This is my class:\n\n public class CsServerInfo\n{\n public string ip { get; set; }\n public string name { get; set; }\n}\n\n\nThe idea is to add new servers into JSON file on a Button Click. It means every time I click on a button (in a WPF window which has TextBoxes for IP and Name properties) a new server should be added into JSON file.\n\nCsServerInfo newServ = new CsServerInfo();\nnewServ.ip = this.serverIP.Text;\nnewServ.name = this.serverName.Text;\n\nstring json = JsonConvert.SerializeObject(newServ);\n System.IO.File.AppendAllText(@\"C:\\JSON4.json\", json);\n\n\nThe problem is I get JSON file that is not correctly formatted:\n\n{\"ip\":\"52.45.24.2\",\"name\":\"new\"}{\"ip\":\"45.45.45.4\",\"name\":\"new2\"}\n\n\nThere's no comma between the servers and if I use ToArray()I get:\n\n [{\"ip\":\"52.45.24.2\",\"name\":\"new\"}][{\"ip\":\"45.45.45.4\",\"name\":\"new2\"}]\n\n\nCorrect format should be [{server properties}, {another server}] but I'm not able to get that. Thanks for your help" ]
[ "c#", "json", "json.net" ]
[ "Multi Dimensional array - Maintaining data integrity", "I've got the current array \n\narray\n 161 => \n array\n 'cat_id' => string '5' (length=1)\n 'temp_id' => string '2' (length=1)\n 'prod_id' => string '44' (length=2)\n 162 => \n array\n 'cat_id' => string '3' (length=1)\n 'temp_id' => string '2' (length=1)\n 'prod_id' => string '44' (length=2)\n 164 => \n array\n 'cat_id' => string '2' (length=1)\n 'temp_id' => string '2' (lenth=1)\n 'prod_id' => string '45' (length=2)\n\n\nI am using this function to remove the duplicate array values:\n\nfunction removeDupes($array) {\n $temp = array();\n foreach ($array as $k => &$v) {\n if (in_array($v['prod_id'],$temp)) {\n unset($array[$k]);\n }\n $temp[] = $v['prod_id'];\n }\n return $array;\n}\n\n\nThis removes any duplicate value in the array if prod_id is a duplicate in a previous array. \n\nI'd like to maintain the full category id list for the product and at the moment, these get deleted when I unset the entire key=>value pair.\n\nHas anyone got any ideas how I could achieve this?\n\nEDIT as per comment:\n\nI'm looking for something like this as a result:\n\narray\n 161 =>\n 'cat_id' => array('5','3')\n 'prod_id' => 44\n\n\nSo I have removed the duplicate array entry that duplicated the product ID but maintained the Category ID's. I hope that helps." ]
[ "php" ]
[ "What is the difference between base url and base link url?", "Every time when we setup new magento site or configure site to live domain we put base url and base link url same, but I haven't gone in deep why we put same? If both should contain same url then why magento have this field?\n\nI just want to know is there any special purpose for this field. Hope someone will clarify me.\n\nThanks" ]
[ "php", "magento", "url" ]
[ "Flushing Rake output immediately to Powershell host", "I have rake task which takes input from user.\nI am invoking the rake task from powershell script as below:\n\nrake db:migrate RAILS_ENV=production | Out-Host\n\n\nBut using the above command line , I have issue where the rake task output is not immediately getting flushed out to the host.\n When ruby script S3 is executed and waiting for user input.\nPowershell is also waiting for user input but does not display the message given at S3, instead it just displays as if executing at script S1.\n\nSo both are not in sync and user does not know what to enter?" ]
[ "powershell", "rake" ]
[ "Pycharm cannot import numpy", "My system is Mac OS X.\nI first installed numpy through macport and then download Pycharm and find that whatever interpreter I choose I cannot import numpy. The results are as follows:\n\n/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 \"/Users/erleye/Documents/Python/Pycharm Projects/test.py\"\nTraceback (most recent call last):\n File \"/Users/erleye/Documents/Python/Pycharm Projects/test.py\", line 4, in <module>\n import numpy as np\nImportError: No module named numpy\n\n\nBut if I use python test.py in the terminal it works fine.\nWhen I type which -a python in terminal, i have:\n\n/opt/local/bin/python\n/opt/local/bin/python\n/Library/Frameworks/Python.framework/Versions/2.7/bin/python\n/usr/local/bin/python\n/usr/bin/python\n/opt/local/bin/python\n\n\nI don't know why I have so many versions of python, but I am sure when I chose interpreter in Pycharm, it is the one that has numpy installed.\nWhat can I do?" ]
[ "python", "numpy", "pycharm" ]
[ "elasticsearch ajax call error", "I try to use elasticsearch with an ajax call in my jquery webpage but I fail to make it work...\n\nhere is my ajax query :\n\nvar data = {\n query:{match:{_all:10}},\n fields: 'DEPET'\n };\n $.ajax({\n type : 'POST', // envoi des données en GET ou POST\n url : 'http://localhost:9200/_search' , // url du fichier de traitement\n crossDomain: true, \n async: false,\n data: JSON.stringify(data),\n dataType : 'json',\n beforeSend : function() { // traitements JS à faire AVANT l'envoi\n $('#ajax-loader2').append('<img src=\"/dev/wp-content/themes/codium-dn/images/ripple.gif\" alt=\"loader\" id=\"ajax-loader\" />');\n },\n success : function(data){ // traitements JS à faire APRES le retour d'ajax-search.php\n $('#ajax-loader').remove(); // on enleve le loader\n $('#results').html(data); // affichage des résultats dans le bloc\n console.log(data);\n },\n error: function (data, error) {\n console.log(arguments);\n //alert(\" Can't do because: \" + error);\n }\n })\n\n\nI also put this in my elasticsearch.yml\n\nhttp.cors.enabled: true\nhttp.cors.allow-origin: \"*\"\nhttp.cors.allow-credentials: true\nhttp.cors.allow-headers: \"X-Requested-With, Content-Type, Content-Length, Authorization\"\nhttp.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE\n\n\nAnd this is what the console chrome dev give me :\n\n(index):451 (3) [Object, \"error\", DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://localhost:9200/_s…, callee: function, Symbol(Symbol.iterator): function]\n\nRequest URL:http://localhost:9200/_search\nReferrer Policy:no-referrer-when-downgrade\nRequest Headers\nProvisional headers are shown\nAccept:application/json, text/javascript, */*; q=0.01\nContent-Type:application/x-www-form-urlencoded; charset=UTF-8\nOrigin:https://domain.ovh\nUser-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.33 Safari/537.36\nForm Data\nview source\nview URL encoded\n{\"query\":{\"match\":{\"_all\":10}},\"fields\":\"DEPET\"}:\n\n\nThanks for your inputs" ]
[ "jquery", "ajax", "elasticsearch" ]
[ "How to programmatically get a list of my LinkShare merchants domains", "I would like to know if there is an API I can use to get a LinkShare merchant domain URL.\nThe merchant search endpoint only returns their uid and name." ]
[ "api", "affiliate", "linkshare" ]
[ "How to close Bootstrap collaps after AJAX success", "I am using a Bootstrap collapse control in my webpage. Whenever I click on the link it used to open and close. I am using AJAX to send data to a PHP page and on success print the result. After the AJAX call data-toggle should close. Please see my code below.\n\n<a data-toggle=\"collapse\" href=\"#review\" class=\"open-code btn btn-default\">Write a Review</a>\n<div id=\"review\" class=\"collapse code\">\n <form id=\"review\">\n my code...\n </from>\n</div>\n\n\n$(function() {\n $(document).on('submit', '#review_post', function(e) {\n //var $this = $(this);\n var message = $(this).find(\"#message\").val();\n var rating = $(this).find(\"#input-2c\").val();\n var vendor_id = $(this).find(\"#vendor_id\").val();\n var infostring = 'message=' + message + '&rating=' + rating + '&vendor_id=' + vendor_id;\n\n if(message=='') {\n alert('Please add your Message');\n } else {\n $.ajax({\n type: \"POST\",\n url: \"/review_vendor.php\",\n data: infostring,\n success: function(data){\n //alert(data);\n $('#review_post').each(function() {\n this.reset();\n }); \n // here I want to use the code to close data-toggle\n\n $(\"#flash\").append(data);\n }\n });\n }\n e.preventDefault(); \n }); \n});\n\n\nI tried this code but it's not working:\n\n$(this).find('.collapse').trigger('click');" ]
[ "javascript", "php", "jquery", "ajax" ]
[ "websocket channel for the \"current user\"", "Using websocket-rails, I can use the\nfollowing code in my controller to tricker a websocket publish event:\n\nWebsocketRails[:channel_name].trigger('event_name', { foo: \"bar\" }.to_json)\n\n\nMy goal is to create a pub-sub channel for the current user only. Take for example\nthe event \"new chat message sent\". I want to push this event only the receiver's channel.\n\nI'm currently making a unique channel name for each user based on their ID. \nI put the following code in my controller (having defined a current_user \nmethod elsewhere:\n\nWebsocketRails[:\"user#{current_user.id}\"].trigger(\"event_name\", { foo: \"bar\" }.to_json)\n\n\nAnd then in my Javascript, I subscribe the current user to their own channel with the following:\n\n<% if @current_user %>\n var dispatcher = new WebSocketRails('localhost:3000/websocket');\n channel = dispatcher.subscribe('user<%= @current_user.id %>'); \n channel.bind('event_name', function(data) {\n console.log(data)\n });\n<% end %>\n\n\nThe gist of it is using string interpolation to make a new channel for each user, i.e.\nuser12 and user123 channels.\n\nThe problem is this is not really secure. Any user can access anyone else's\nprivate channel just by pasting some Javascript in. For example, if user #1 wants\nto access user #2's news feed, they could just type dispatcher.subscribe('user2').\n\nHow would you solve this issue? Is there another pub-sub library which has this feature\nbuilt into it?\n\nLooking on WebsocketRails' wiki entry on the subject,\nI tried adding the follolwing code to config/initializers/websockets.rb\n\nWebsocketRails::EventMap.describe do\n namespace :websocket_rails do\n subscribe :subscribe_private, to: ConnectionsController, with_method: :authorize_channels\n end\nend\n\n\nAnd the following to app/controllers/connections_controller.rb\n\nclass ConnectionsController < WebsocketRails::BaseController\n def authorize_channels\n channel_name = WebsocketRails[message[:channel]]\n current_user = User.find_by(id: session[\"current_user_id\"])\n if current_user && \"user#{current_user.id}\".eql?(channel_name)\n accept_channel current_user\n else\n deny_channel({ message: \"auth failed\" })\n end\n end\nend\n\n\nAnd then elsewhere, I'm calling WebsocketRails[:\"user#{@current_user.id}\"].make_private\n\nThis doesn't seem to have any effect though." ]
[ "ruby-on-rails", "ruby", "security", "websocket", "websocket-rails" ]
[ "finding cycles in decimal expansion of rational numbers", "I need to write a program that prints 0.(03) for input 1 and 33.\n(1/33 = 0.03030303.... We use the notation 0.(03) to denote that 03 repeats indefinitely.)\n\nAs another example, \n8639/70000 = 0.1234(142857)\n\nI understand, I need to use an algorithm like floyds. But how do I get 0.0.030303030303 instead of 0.03030303030304 in java." ]
[ "java", "algorithm", "decimal" ]
[ "XML download from a url", "I have written a code to download XML file from a website and store into database. But before download, I should parse the user credentials to the website. The code is working properly but I am unable to find the XML downloaded path. can you help me on this. users are loaded from MySQL database.\nurl='https://emergencyprocedures.pjm.com/\n\nfor user in users:\n authentication_handle=urllib2.HTTPPasswordMgrWithDefaultRealm()\n authentication_handle.add_password(None,url,user[0],user[1])\n\n handler=urllib2.HTTPBasicAuthHandler(authentication_handle)\n\n url_opener=urllib2.build_opener(handler)\n file_details=url_opener.open(url)\n tree=ET.parse(XMLfile)\n root=tree.getroot()\n\n\nfor tree I should parse XML file path. I am unable to find the path." ]
[ "python", "xml", "urllib2" ]
[ "Should be a simple 301 redirect", "What I think should be simple is just not working.\n\nI have switched domains\n\nOld URL example:\ndigital.photorecommendations.com/recs/2015/01/big-zoom-field-review/\n\nNew URL example: \nphotorec.tv/2015/01/big-zoom-field-review/\n\nReally just switching domain and dropping the recs folder from the URL\n\nUsing http://htaccess.madewithlove.be/ to test and the outputs the correct URL\n\n\r\n\r\nOptions +FollowSymlinks\r\nRewriteEngine on\r\nRewriteBase /recs\r\nRewriteCond %{HTTP_HOST} !^www\\.digital.photorecommendations\\.com$ [NC]\r\nRewriteRule ^recs(.*) http://photorec.tv/$1 [L,R=301]\r\n\r\n\r\n\n\nWhen I place this in the htaccess file I get 404 errors on all the pages except the home page. The htaccess file is inside the /recs folder. I have also tried it in the root directory of digital.photorecommendations.com and I get no results at all. \n\nAny suggestions? \n\nThanks!" ]
[ "apache", ".htaccess", "mod-rewrite", "redirect", "http-status-code-301" ]
[ "JasperReport PDF export empty, RTF export fine", "When exporting a JasperReport created with ireport designer 5.0.1 using the Java API the report is always empty. In the report I have set whenNoDataType=\"AllSectionsNoDetail. Also using new JREmptyDataSource() also does not work.\n\nAlso when I export as RTF using JRRtfExporter the result is just fine. Also the PDF preview in ireport correct.\n\nInputStream inputStream = this.getClass().getResourceAsStream(\"/test-report.jasper\");\nByteArrayOutputStream out = new ByteArrayOutputStream();\nJasperPrint jPrint = JasperFillManager.fillReport(inputStream, new HashMap<String, Object>(), new JRXmlDataSource(new ByteArrayInputStream(\"<root><name>John Doe</name</root>\".getBytes(\"UTF-8\")), \"/root\"));\n\nJRPdfExporter reportExporter = new JRPdfExporter();//JRRtfExporter(); does works fine\nreportExporter.setParameter(JRExporterParameter.JASPER_PRINT, jPrint);\nreportExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, out);\nreportExporter.exportReport();\nout.close();\nreportBytes = out.toByteArray();\n\n\nreportBytes is saved to disk." ]
[ "java", "pdf", "jasper-reports" ]
[ "PHP Expire Session after 5 minutes", "I have the following code to expire a session after set amount of time. It is however not working properly. If I set it for example for 1 minute or even 5 minute, it expires immediately. Can you help?\n\n// duration in minutes * seconds\n$duration = (DURATION * 60);\n\nif(isset($_SESSION['started']))\n{\n // show banner and hide form\n echo $msg;\n $showform = 0;\n if((time() - $_SESSION['started'] - $duration) > 0)\n {\n unset($_SESSION['count']);\n unset($_SESSION['offender']);\n $showform = 1;\n }\n}\nelse\n{\n $_SESSION['started'] = time();\n}" ]
[ "php", "session" ]
[ "What is a message pump?", "In this thread (posted about a year ago) there is a discussion of problems that can come with running Word in a non-interactive session. The (quite strong) advice given there is not to do so. In one post it is stated "The Office APIs all assume you are running Office in an interactive session on a desktop, with a monitor, keyboard and mouse and, most importantly, a message pump." I'm not sure what that is. (I've been programming in C# for only about a year; my other programming experience has primarily been with ColdFusion.)\nUpdate:\nMy program runs through a large number of RTF files to extract two pieces of information used to construct a medical report number. Rather than try and figure out how the formatting instructions in RTF work, I decided to just open them in Word and pull the text out from there (without actually starting the GUI). Occasionally, the program hiccuped in the middle of processing one file, and left a Word thread open attached to that document (I still have to figure out how to shut that one down). When I re-ran the program, of course I got a notification that there was a thread using that file, and did I want to open a read-only copy? When I said Yes, the Word GUI suddenly popped up from nowhere and started processing the files. I was wondering why that happened; but it looks like maybe once the dialog box popped up the message pump started pushing the main GUI to Windows as well?" ]
[ "c#", "winapi", "winmain", "message-pump" ]
[ "SyntaxError: JSON.parse: unexpected character at line 2 column 1 of the JSON data on production environnement", "i'm working on a web application with laravel and i made a \"project space\" for users. in this \"project space\" i have to display a table of files for each folder of the \"project\" so i used Ajax to change the content of the table,but this work fine on my localhost but it doesn't on online server.\n\ni made a controller that returns data in json and the Ajax code will change the html and display files of the selected folder. so this is the ajax code:\n\n $.ajax({\n type :\"get\",\n url :\"/bibliotheque/Projet/ajax_liste_maquettes /\"+id_projet, \n data: { id_projet:id_projet },\n success :function(data) {\n var b=\"1\";\n // document.getElementById('titreid').text = tableau[4];\n $('#records_table').empty();\n document.getElementById(\"records_table\").innerHTML = \"<table border = '1'>\" +\n '<tr>' +\n '<th width=\"13%\">Action</th>'+\n '<th>Nom</th>'+ \n '<th>Date</th>'+\n '<th>Ajouter par</th>' +\n '<th>Fonction</th>' +\n '</tr>'; \n $.each(data.response, function(i, item) {\n chaine = \"\"+data.response[i].id_projet+\"-\"+data.response[i].id+\"-\"+data.response[i].url+\"-\"+ data.response[i].nom_fichier;\n $('<tr>').html(\n \"<td>\" + \n '<a href=\"http://docs.google.com/viewer?embedded=true&url=http://nebnibim.dz'+ '/bibliotheque/Projet/download/'+data.response[i].id+'\" target=\"_blank\" class=\"embed\" > <i class=\"fa fa-eye\" aria-hidden=\"true\"></i> </a>' \n\n +'<a href=\"'+ '/bibliotheque/Projet/download/'+data.response[i].id+'\" target=\"_blank\"> <i class=\"fa fa-download\" aria-hidden=\"true\"></i></a>'\n +'<a href=\"'+baseUrl+'bibliotheque/Projet/deletFchier/'+data.response[i].id+'\" onclick=\\\"return(confirm(\\'Etes-vous sur de vouloir supprimer ce fichier\\'));\\\"> <i class=\"fa fa-remove\" aria-hidden=\"true\"></i></a>' \n + \"</td>\"+\n \"<td onclick=\\\"fichierTaches('\"+chaine+\"')\\\">\" + data.response[i].nom_fichier +\".\"+data.response[i].format +\"</td><td>\" + data.response[i].created_at + \"</td><td>\" + data.response[i].nom_collaborateur +\"</td><td>\"+data.response[i].collaboration + \"</td>\").appendTo('#records_table');\n }); \n\n\nthis code display the file's table and it work fine in localhost but in the web server online it doesn't when i check the network section i see this error:\n\n\n SyntaxError: JSON.parse: unexpected character at line 2 column 1 of\n the JSON data" ]
[ "json", "ajax", "laravel" ]
[ "What scripting language should be used to deploy Kubernetes?", "I have to deploy a Kubernetes cluster, and I currently use bash to set up the security key, the environment prop, create pods etc with kuberctl. But I am wondering if bash is a good choice to used when the deployment steps getting big. E.g. ~50 deployment and services.\n\nIs that a better choice than bash on deploying system under kubernetes? Any good example of automatic deployment under Kubernetes?" ]
[ "kubernetes" ]
[ "What does the %12.10lg means in C++ strings formatting", "I have seen this piece of code in one of the C++ project in windows environment. just wondering what does the meaning of %12.10lg. Anyone has idea?\n\nclass Point \n{\n double x, y;\n public Point::Point(double x_cord, double y_cord)\n {\n x = x_cord;\n y = y_cord;\n }\n}\n\nvoid foo(){\n Point ptStart(12.5, 33.5678)\n TRACE(\"%12.10lg, %12.10lg, %12.10lg\\n\", ptStart)\n}" ]
[ "c++", "windows" ]
[ "PHP using GLOB to restrict files being read based on file name", "I am trying to use glob() to read files in a directory that contains various file types. I have managed somehow to fetch the once I want which are .txt files using:\n\nglob($dir.'*.txt')\n\n\nFrom the files read I obtain to types of files which server different functionality and have been grouped based on name. Sample of this files are\n\nMSPP850_36907816201203161900989.txt\nMSPP850_36907816201203161805560.txt\nMSP850_36907816201203161805560.txt\nMSP850_36907816201203161805560.txt\nMSP850_36907816201203161805560.txt\nMSP850_36907816201203161805560.txt\n\n\nNote the files name before the underscore: we have two types i.e MSPP850 and MSP850.\nHow can I use glob to filter and fetch only MSP850 files for instance." ]
[ "php", "regex", "filenames" ]
[ "Trying to place DIV's side by side, but its not working", "Here is my code:\n\n<div class=\"large-6 columns\">\n <div id='box1'>\n <div id='text1'>\n Name\n </div>\n <div id='text3'>\n LastName\n </div>\n </div>\n</div>\n\n\nCSS looks like this:\n\n#box1 {\n float: left;\n height: 125px;\n margin-top: 30px;\n margin-bottom: 30px;\n clear: none;\n width: 125px;\n border-top-left-radius: 95px;\n border-top-right-radius: 95px;\n border-bottom-right-radius: 95px;\n border-bottom-left-radius: 95px;\n background-color: rgb(232, 68, 58);\n position:relative;\n overflow:visible;\n}\n#text1 {\n float: left;\n font-size: 1em;\n color: rgb(255, 255, 255);\n width: 28%;\n height: auto;\n text-align: right;\n font-weight: 400;\n line-height: 1em;\n word-wrap: break-word;\n margin-left: 69.6%;\n margin-top: 53px;\n clear: none;\n min-height: 0px;\n min-width: 0.5em;\n font-family: snippet;\n overflow:auto;\n}\n#text3 {\n float: left;\n font-size: 1em;\n color: rgb(0, 0, 0);\n width: 72%;\n height: auto;\n text-align: right;\n font-weight: 400;\n line-height: 1em;\n margin-left: 125px;\n margin-top: 0px;\n clear: none;\n min-height: 0px;\n min-width: 0.5em;\n font-family: snippet;\n position:relative;\n overflow:visible;\n}\n\n\nNow this is not giving me the required result.\nThe Text-3 should actually appear next to the text-1. But somehow its wrapping down to the next tine.\n\nbtw. I am using this inside a Zurb Foundation code. Writing my custom class on top of the existing CSS styles.\n\nEDIT:\nAlthough I solved the problem, just for the clarity of some of you, Text-1 is inside the circle and is right aligned to the edge of the circle. Text-3 is outside the circle and is left aligned to the edge of the circle. Such that the two text, are next to each other, one inside the circle and one outside." ]
[ "css", "html" ]
[ "How do you enable a GL function in Qt3D with QML", "I am writing an application using Qt3D. Most of the 3D handling I have been doing has used QML not the C++ interface. I have created a QML effect that loads my shader programs similar to the PerVertex color effect QML that ships with Qt5.9.\n\nThe problem I am having is I am trying to write a fragment shader and utilize glBlendFunc(sfactor, dfactor). According to the OpenGL documentation, I need to set glEnable(GL_BLEND) and use glBlendFunc, but I don't know how to do that using QML. I can see how it is done on the C++ side of things, but as I am using QML Scene3D, that would take a great deal of rewriting to accomplish. Can anyone tell me how to enable OpenGL functions (like GL_BLEND) via Qt3D QML?\n\nAs requested, the fragment shader: \n\n#version 330 core\n\n// TODO: Replace with a struct\nuniform vec3 ka; // Ambient reflectivity\nuniform vec3 kd; // Diffuse reflectivity\nuniform vec3 ks; // Specular reflectivity\nuniform float shininess; // Specular shininess factor\nuniform float alpha;\n\nuniform vec3 eyePosition;\n\nin vec3 worldPosition;\nin vec3 worldNormal;\nin vec3 color;\n\nout vec4 fragColor;\n\n#pragma include light.inc.frag\n\nvoid main()\n{\n vec3 diffuseColor, specularColor;\n adsModel(worldPosition, worldNormal, eyePosition, shininess, diffuseColor, specularColor);\n fragColor = vec4( ka * color + kd * color * diffuseColor + ks * color * specularColor, 1.0 );\n}\n\n\nHere is also the Effect component:\n\nimport Qt3D.Core 2.0\nimport Qt3D.Render 2.0\n\nEffect {\n id: root\n\nparameters: [\n Parameter { name: \"k\"; value: Qt.vector3d( 0.1, 0.1, 0.1 ) },\n Parameter { name: \"kd\"; value: Qt.vector3d( 0.7, 0.7, 0.7 ) },\n Parameter { name: \"ks\"; value: Qt.vector3d( 0.95, 0.95, 0.95 ) },\n Parameter { name: \"shininess\"; value: 150.0 }\n]\n\ntechniques: [\n Technique {\n graphicsApiFilter {\n api: GraphicsApiFilter.OpenGL\n profile: GraphicsApiFilter.CoreProfile\n majorVersion: 3\n minorVersion: 1\n }\n\n filterKeys: [ FilterKey { name: \"renderingStyle\"; value: \"forward\" } ]\n\n parameters: [\n Parameter { name: \"light.position\"; value: Qt.vector4d( 0.0, 0.0, 0.0, 1.0 ) },\n Parameter { name: \"light.intensity\"; value: Qt.vector3d( 1.0, 1.0, 1.0 ) }\n ]\n\n renderPasses: [\n RenderPass {\n filterKeys: [ FilterKey { name: \"pass\"; value: \"forward\" } ]\n\n shaderProgram: ShaderProgram {\n vertexShaderCode: loadSource(\"qrc:/shaders/thermal.vert\")\n fragmentShaderCode: loadSource(\"qrc:/shaders/thermal.frag\")\n }\n }\n ]\n }\n]\n}" ]
[ "qt", "opengl", "qml", "qt3d" ]
[ "C# how to set dropDownList default value for selectedValue = null", "I have a dropdownlist1 that has has 6 collection items including Select One. What I want is this ddl is set to Selectedvalue = null. But what I am getting is my ddl always selecting Select One as its initial value. My ddl properties for Select One is selected:false. How to set this ddl to initial selected value = null?\n\n<asp:DropDownList ID=\"DropDownList1\" runat=\"server\" Visible=\"False\" Width=\"146px\">\n <asp:ListItem>Ceiling Speaker</asp:ListItem>\n <asp:ListItem>Remote Microphone</asp:ListItem>\n <asp:ListItem>Digital Source Player</asp:ListItem>\n <asp:ListItem>Remote paging Console</asp:ListItem>\n <asp:ListItem>Modular Mixer</asp:ListItem>\n <asp:ListItem>Select One</asp:ListItem>\n</asp:DropDownList>\n\n\nif (String.IsNullOrEmpty(txtSearchProductname.Text))\n{\n if (DropDownList1.SelectedValue == null)\n {\n txtProductName.Text = \"\";\n }\n else\n {\n SqlProductmaster.InsertParameters[\"ProductName\"].DefaultValue = DropDownList1.SelectedValue.ToString();\n }\n}\nelse\n{\n SqlProductmaster.InsertParameters[\"ProductName\"].DefaultValue = txtProductName.Text;\n}" ]
[ "c#", ".net", "asp.net", "drop-down-menu" ]
[ "Creating dynamic components in loop causes flickering", "I've a loop of items which is updated every few seconds. Based on the type of the item, a different component is loaded. This update causes an empty template for a few seconds of each item.\n\nListing HTML:\n\n<div ngFor=\"let ledgerDeposit of deposits\">\n <ng-template #depositTarget></ng-template>\n</div>\n\n\nListing component:\n\n @ViewChildren('depositTarget', { read: ViewContainerRef }) depositTargets: QueryList<ViewContainerRef>; \n\n async ionViewDidLoad() {\n this.depositTargets.changes.subscribe(() => {\n this.loadComponents();\n });\n\n await this.loadDeposits(false);\n }\n\n async loadDeposits(forceRefresh: boolean) {\n this.deposits = await this.exchanges.getDeposits();\n }\n\n private loadComponents() {\n this.depositTargets.toArray().forEach((viewContainerRef, i) => {\n let deposit = this.deposits[i];\n let exchange = this.exchanges.getExchange(deposit.exchange);\n\n let componentFactory = this.componentFactoryResolver.resolveComponentFactory(exchange.depositSingleComponentName);\n let componentRef = viewContainerRef.createComponent(componentFactory);\n componentRef.instance.deposit = this.deposits[i];\n });\n }\n\n\nIs there a way to prevent flickering? Like caching components, so a component isn't recreated on each update?\n\nFlickering demo:" ]
[ "angular" ]
[ "In Qualtrics, how to dynamically connect two sliders?", "In Qualtrics, I would like to establish a relationship between two sliders (using the \"Draggable Sliders\" question type). \n\nOne slider would dynamically decrease the value of another slider by the same amount. The user should be able to adjust only the first slider, which would automatically adjust the second slider and its associated value (which should be displayed and updated with the dynamic adjustment).\n\nDoes anyone have a suggestion for the javascript necessary to establish this type of relationship between two sliders in Qualtrics?" ]
[ "javascript", "slider", "qualtrics" ]
[ "find shortest path from all vertices to multiple vertices igraph", "I am trying to derive a proximity measure that uses shortest distance between all vertices in my graph and a group of vertices. \n\nI have been able to get the shortest distance using shortest.paths().\nI would like to get the corresponding paths so that I can see how the paths change when I change the edge weights. But I have not been able to do so. I have found get.shortest.path which can only get the shortest path from one vertex to a group of vertices. I do like to get it from all vertices to a group of vertices without having to rely on a for loop.\n\nDo you have any recommendations?\nA sample code you can probably run on is the following:\n\nset.seed(2222)\ngraph <- erdos.renyi.game(50, 0.3)\n# Group of vertices that I want to know the shortest paths to.\nsome_function_that_can_get_the_shortest_path(graph, from=V(graph), to=V(graph)[1:10])\n#Currently get.shortest.paths(graph, 1, to=V(graph)[1:10]) gets me the following \n$vpath\n$vpath[[1]]\n+ 1/50 vertex:\n[1] 1\n\n$vpath[[2]]\n+ 3/50 vertices:\n[1] 1 12 2\n\n$vpath[[3]]\n+ 2/50 vertices:\n[1] 1 3\n\n$vpath[[4]]\n+ 3/50 vertices:\n[1] 1 3 4\n\n$vpath[[5]]\n+ 2/50 vertices:\n[1] 1 5\n\n$vpath[[6]]\n+ 2/50 vertices:\n[1] 1 6\n\n$vpath[[7]]\n+ 3/50 vertices:\n[1] 1 3 7\n\n$vpath[[8]]\n+ 3/50 vertices:\n[1] 1 35 8\n\n$vpath[[9]]\n+ 3/50 vertices:\n[1] 1 14 9\n\n$vpath[[10]]\n+ 3/50 vertices:\n[1] 1 22 10" ]
[ "r", "network-programming", "igraph" ]
[ "'django-admin' is not recognized as an internal or external command, operable program or batch file", "I have installed Django and my python path seems ok. whenever I try to create a new folder with the command line django-admin it is showing me up this message. I have tried reinstalling python but is not working." ]
[ "python", "django", "command", "django-admin", "environment" ]
[ "Restore 64 Bit Database to 32 Bit Database SQL Server", "At My Customer Site they have \n--SQL Server 2008 R2 64Bit Express Edition Installed on Server 2008 OS Machine\nat My Development environment i have\n-- 32Bit Vista Machine and Sql Server 2008 Express Edition Installed \n\nMy Question is how can restore back up of 64bit DB to My 32 bit DB\n\nWhat i tried\n1) Create the Back up of 64 Bit DB and Create DB on my 32 Bit Machine and Restore it \ni get an error\n\nRestore failed for Server 'egov041\\SQLEXPRESS2008'. (Microsoft.SqlServer.SmoExtended)\n\nSystem.Data.SqlClient.SqlError: The database was backed up on a server running version 10.50.1600. That version is incompatible with this server, which is running version 10.00.2531. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server. (Microsoft.SqlServer.Smo)\n\n2) Copy the MDF and LDF File from the Server Machine \nand Attach it on my machine \n\ni get an error\n\nAttach database failed for Server 'egov041\\SQLEXPRESS2008'. (Microsoft.SqlServer.Smo)\n\nADDITIONAL INFORMATION:\n\nAn exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)\n\nThe database 'PwdMhToll' cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported.\nCould not open new database 'PwdMhToll'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 948)\n\ni refer \n1) http://social.msdn.microsoft.com/Forums/en/sqlexpress/thread/49f0adf1-8254-4e4a-b7ce-d9406d0ab6d6\n\n2) http://blog.sqlauthority.com/2011/03/27/sql-server-32-bit-64-bit-html5-database-backup-restore/\n\n3) http://blogs.msdn.com/b/cindygross/archive/2010/04/01/moving-data-between-32-bit-and-64-bit-sql-server-instances.aspx?CommentPosted=true#commentmessage\n\nFrom these post i concluded that it is possible, \ndoes anybody suggest what is wrong with my database restore...\nThanks in Advance" ]
[ "sql-server-2008", "32bit-64bit" ]
[ "C# - Printing the Form", "I am using the code from MS to print a form however it looks like the form needs to be visible with a Show/ShowDialog() to work.\n\nI am trying to use the code for a form that I don't want to show.\n\nAny ideas?" ]
[ "c#", ".net", "winforms", "printing" ]
[ "Handling round screen on regular Android", "I have a smartwatch with round screen that is running regular Android 5.1 (not Android Wear).\n\nMy layout is getting cut off on the sides and would like to adjust it so everything fits on the screen or make a separate layout.\n\nIs there a way to achieve this on regular Android? I've been reading up, but all the solutions require Android Wear APIs." ]
[ "android", "android-layout" ]