texts
sequence
tags
sequence
[ "How would memory be allocated in Java for an array of Generic Objects?", "I have a class Node which has a variable of Generic type.\nclass Node{\n Object obj;\n}\n\nIf I am creating an array of Node objects, How much memory will be allocated for that array?\nNode[] arr = new Node[10];" ]
[ "java", "generics", "dynamic-memory-allocation" ]
[ "Openlayers-3 fitExtent capture replay not working", "I'm creating a 'bookmarking' feature on my map, recording the extent of the current view via ol.View.calculateExtent(). Once I've grabbed this extent I persist it (no loss of precision, in 'EPSG:900913').\n\nProblem now is if I feed this extent into ol.View.fitExtent() I don't get exactly the same view, I get a slightly 'zoomed out' one.\n\nThe coordinates are exactly the same, the map size (ol.Map.getSize()) even the resolution (ol.View().getResolution()) but each time my recorded 'view' when I call it is further out than the recorded one.\n\nAny ideas how I can exactly record the current 'view' and replay it accurately?Is this rounding? Should I not be using fitExtent?\n\nN.B. This doesn't ALWAYS' happen! At high zooms it can sometimes accurately record and return me to the same view - resolutions at 2.388657133911758, 1.194328566955879 and 305.748113140705, when recorded, do not seem to exhibit this behaviour." ]
[ "openlayers-3" ]
[ "TortoiseSVN through a proxy script", "I'm attempting to connect to a remote HTTPS SVN server from inside a corporate firewall using TortoiseSVN. I am required to use a proxy for this connection. My problem is that TortoiseSVN's proxy settings only include an option to set a direct proxy server address. The proxy I am connecting through, however, is configured via a script. In Firefox, for example, I use the \"Automatic proxy configuration URL\" option in the network settings.\n\nIs there any way to use a proxy configuration scripts with Tortoise? I can't find one in the config UI - is there a way to configure it through editing a config file?" ]
[ "svn", "proxy", "tortoisesvn" ]
[ "Phonegap - why jquery loaded in body and not head?", "I noticed many phonegap templates put the javascript (such as jquery or jquery mobile) at the end of the body tag.\n\nIn normal html pages, the jquery etc. files are loaded in the head part of the document.\n\nIs there an advantage to putting it in the body?" ]
[ "cordova" ]
[ "How to see metrics on a website broken by page", "I am hosting a website on Azure as an app service and have Application Insights enabled for it. I have also inserted the following instrumentation code in each of the 5 pages on the website (with correct instrumentation key).\n\nMicrosoft has moved around the Application Insights feature on portal. My goal is to see usage analysis for each page within my website separately. The Page Views section of this documentation states to click on Page View section on Usage blade. I can't find Usage blade nor the page views section in it. Does anyone know how can i see the analytics shown under the Page Views section (broken by page) ?\n\n** I know that i added instrumentation code properly because some other blades such as performance etc are breaking down the data by page.\n\n\r\n\r\n <script type=\"text/javascript\">\r\n var appInsights = window.appInsights || function(a) {\r\n function b(a) {\r\n c[a] = function() {\r\n var b = arguments;\r\n c.queue.push(function() {\r\n c[a].apply(c, b)\r\n })\r\n }\r\n }\r\n var c = {\r\n config: a\r\n },\r\n d = document,\r\n e = window;\r\n setTimeout(function() {\r\n var b = d.createElement(\"script\");\r\n b.src = a.url || \"https://az416426.vo.msecnd.net/scripts/a/ai.0.js\", d.getElementsByTagName(\r\n \"script\")[0].parentNode.appendChild(b)\r\n });\r\n try {\r\n c.cookie = d.cookie\r\n } catch (a) {}\r\n c.queue = [];\r\n for (var f = [\"Event\", \"Exception\", \"Metric\", \"PageView\", \"Trace\", \"Dependency\"]; f.length;)\r\n b(\r\n \"track\" + f.pop());\r\n if (b(\"setAuthenticatedUserContext\"), b(\"clearAuthenticatedUserContext\"), b(\r\n \"startTrackEvent\"),\r\n b(\"stopTrackEvent\"), b(\"startTrackPage\"), b(\"stopTrackPage\"), b(\"flush\"), !a.disableExceptionTracking\r\n ) {\r\n f = \"onerror\", b(\"_\" + f);\r\n var g = e[f];\r\n e[f] = function(a, b, d, e, h) {\r\n var i = g && g(a, b, d, e, h);\r\n return !0 !== i && c[\"_\" + f](a, b, d, e, h), i\r\n }\r\n }\r\n return c\r\n }({\r\n instrumentationKey: \"\"\r\n });" ]
[ "azure", "azure-application-insights" ]
[ "How to store more than 10 mb video into MySql Database?", "I need to insert more than 10 MB size video into MySQL database. how to do that?\nI try following query. \n\n{ \n insert into mscit_video values(1,'bcg',LOAD_FILE('c:\\\\abc\\\\xyz.mpg') \n} \n\n\nusing this query i stored 1 MB video into database successfully, but if i tried\nto insert more than 10MB size of video it give following error. \n\n\"java.sql.SQLException: Result of load_file() was larger than max_allowed_packet (1048576) - truncated\" \n\n\nIs posible to store video in database more than 10 MB? if yes then how?\nGive me any rference or hint.\nThanks in Advance.." ]
[ "mysql", "video", "size", "store" ]
[ "Getting an error message when compiling typescript", "I have the following piece of code:\n\nclass BasketManager {\n private persistPromises: { [key: string]: ng.IPromise<Basket.BasketModel> } = {};\n\n constructor(private $q: ng.IQService) {}\n\n order(basket: Basket.BasketModel, simulate = false): ng.IPromise<Basket.BasketModel> {\n return this.persistPromises[basket.basketId] = this.$q.when(this.persistPromises[basket.basketId] || basket).then(basket => {\n return this.$http.post(url, {})\n .then((response:ng.IHttpPromiseCallbackArg<API.Contracts.IBasketContract>) => this.storeBasket(response.data, true))\n .catch((response:ng.IHttpPromiseCallbackArg<any>) => this.handleBasketErrorResponse(basket, response));\n });\n });\n\n private storeBasket(data: API.Contracts.IBaseBasketContract, withItems = false): Basket.BasketModel {\n /* ... */\n }\n\n private handleBasketErrorResponse(basket: Basket.BasketModel, response: ng.IHttpPromiseCallbackArg<any>): Basket.BasketModel {\n /* ... */\n }\n}\n\n\nWhen I try to compile it, I get this error message:\n\nTypeScript error: app/scripts/objectmanager/basketmanager.service.ts(100,60): error TS2453: The type argument for type parameter 'TResult' cannot be inferred from the usage. Consider specifying the type arguments explicitly.\n Type argument candidate 'IBaseBasketContract' is not a valid type argument because it is not a supertype of candidate 'BasketModel'.\n\n\n100,60 is 7,56 in the above snippet.\n\nI tried explicitly specifying the arguments for each and every variable, but that didn't help. What am I missing?" ]
[ "typescript" ]
[ "Datepart function error in Microsoft Dynamics SQL", "I am currently trying to perform a SQL query in Microsoft Dynamics AX2012, to output a year from delivery date by using a DATEPART function.\n\nI have created a class \"CustRerportDemo\" in the AOT, and while attempting to perform a query, which is to query out only the year from the field \"deliverydate\" in the table \"SalesTable\". I encountered an error that prompts:\n\n\n Variable Datepart has not been declared\n\n\nI understood that datepart is a function call in SQL and shouldnt need to be declared. Hence, I am wondering why and how to rectify this issue? I am only just trying to show the year from the delivery date.\n\nTherefore, if the date is 13/06/2016, the resultant query result will just be 2016 or 16.\nI have attached the following code. Please help.\n\npublic void processReport()\n{\nCustTable custTable;\nSalesTable salesTable;\n\n//select all customers\nwhile select * from custTable\n{\n //clear the temporary table\n custReportRDPTmp.clear();\n //assign customer account and name\n custReportRDPTmp.CustAccount = custTable.AccountNum;\n custReportRDPTmp.Name = custTable.name();\n //select count of invoiced sales order of customer\n select count(RecId) from salesTable\n where salesTable.CustAccount == custTable.AccountNum\n && salesTable.SalesStatus == SalesStatus::Invoiced;\n custReportRDPTmp.SalesOrderInvoiceCount = int642int(salesTable.RecId);\n //New Column to display PaymentMode\n select PaymMode\n from salesTable\n where salesTable.PaymMode == custTable.PaymMode;\n custReportRDPTmp.Payment = SalesTable.PaymMode;\n //New Column to display SalesAmountTotal by drawing from a different table using a JOIN statement\n select smmSalesAmountTotal\n from salesTable;\n custReportRDPTmp.SalesAmt = salesTable.smmSalesAmountTotal;\n\n //New Column to display month from delivery date\n select DATEPART(\"yyyy\", DeliveryDate) as year\n // To extract a single value for year and month from DeliveryDate in SalesTable\n from salesTable\n\n /* where payment in (select count(payment) from salesTable\n where salesTable.CustAccount == custTable.AccountNum\n &&*/\n\n //insert in temporary table buffer\n custReportRDPTmp.insert();\n}\n}\n\n\nEdited code: \n\nselect firstOnly DeliveryDate\nfrom salesTable\nwhere salesTable.CustAccount == custTable.AccountNum;\n//Get Year from date\ncustReportRDPTmp.DateTimeStamp = year(salesTable.DeliveryDate);\n\n\nResult as shown:" ]
[ "sql", "axapta", "x++", "dynamics-ax-2012", "datepart" ]
[ "android wait for animation to finish before activity ends", "I am writing an game application. If the user presses the wrong button I want to show an animation and when the animation is complete then finish() my game; \n\ncurrently, my animation just starts when the finished is called. I want the animation to complete. \n\nBelow is my class that implements AnimationListener\n\npublic final class DisplayNextView implements Animation.AnimationListener {\n View changeView;\n Drawable image;\n\n public DisplayNextView(View parChangeView, Drawable parImage) {\n this.changeView = parChangeView;\n this.image = parImage;\n }\n\n public void onAnimationStart(Animation animation) {\n changeView.post(new SwapViews(changeView, image));\n changeView.postDelayed(new SwapViews(changeView, null), 1000);\n }\n\n public void onAnimationEnd(Animation animation) {\n\n }\n\n public void onAnimationRepeat(Animation animation) {\n\n }\n}\n\n\nThis is my main activity method that starts the animation\n\nprivate void applyRotation(View parChangeView, Drawable image, float start, float end) {\n // Find the center of image\n final float centerX = parChangeView.getWidth() / 2.0f;\n final float centerY = parChangeView.getHeight() / 2.0f;\n\n // Create a new 3D rotation with the supplied parameter\n // The animation listener is used to trigger the next animation\n final Flip3DAnimation rotation =\n new Flip3DAnimation(start, end, centerX, centerY);\n rotation.setDuration(250);\n rotation.setFillAfter(true);\n rotation.setInterpolator(new AccelerateInterpolator());\n rotation.setAnimationListener(new DisplayNextView (parChangeView,image));\n parChangeView.startAnimation(rotation);\n //return rotation;\n }\n\n\nThis is my the SwapView class this is a thread\n\npublic final class SwapViews implements Runnable {\n View changeView;\n Drawable image;\n\n public SwapViews(View parChangeView, Drawable parImage) {\n this.changeView = parChangeView;\n this.image = parImage;\n }\n\n public void run() {\n final float centerX = changeView.getWidth() / 2.0f;\n final float centerY = changeView.getHeight() / 2.0f;\n Flip3DAnimation rotation;\n changeView.setBackgroundDrawable(image);\n //TODO should find a better way!!\n if (image==null)\n changeView.setBackgroundColor(Color.BLACK);\n\n\n rotation = new Flip3DAnimation(-90, 0, centerX, centerY);\n\n\n rotation.setDuration(250);\n rotation.setFillAfter(true);\n rotation.setInterpolator(new DecelerateInterpolator());\n\n changeView.startAnimation(rotation);\n\n }\n}" ]
[ "android", "animation", "android-activity" ]
[ "How To Send Sequence of Specific Object To Mvc Core Action through jquery ajax", "I was created a function that is responsible to created and sending a json :\n\nfunction Send(op) {\n var tr = $(op).parents('tr');\n var item = [];\n\n $(tr).find(\"td\").each(function () {\n item.push($(this).find(\"input\").prop(\"name\") + '\":' + '\"' + $(this).find(\"input\").val());\n });\n var myJsonString = JSON.stringify(item);\n\n $.ajax({\n url: '/Home/Edit',\n data: myJsonString,\n type:'post',\n contentType: 'application/json; charset=utf-8',\n cache: false,\n success: function () {\n alert('send is okay')\n }\n });\n}\n\n\nto an IActionResult :\n\n [HttpPost]\n public ActionResult Edit([FromBody]Hazine hazine)\n {\n return View();\n }\n\n\nbut it (Edit Action) cant get object from jquery.\nso this Action Invoked Succcefully but with null hazine!\n\na json created which I get from console.log is :\n\n[\"id\\\":\\\"4\",\"undefined\\\":\\\"undefined\",\"undefined\\\":\\\"undefined\",\"HazineType1\\\":\\\"1\",\"HazineType2\\\":\\\"1\",\"SendDate\\\":\\\"5\",\"ProjectId\\\":\\\"1\",\"Mablagh\\\":\\\"1\",\"MablaghPaid\\\":\\\"1\",\"HazineDate\\\":\\\"1\",\"HazineDateLong\\\":\\\"1\",\"HazineTitle\\\":\\\"11111\",\"HazineComment\\\":\\\"1\",\"ForoshgahName\\\":\\\"1\",\"PayLastDate\\\":\\\"1\",\"PayDateLong\\\":\\\"111111111\",\"UniqueId\\\":\\\"1111\",\"SaveDate\\\":\\\"8888\",\"SaveDateLong\\\":\\\"888\",\"SendDate\\\":\\\"5\",\"SendDateLong\\\":\\\"5\"]\n\n\nwhat was wrong?" ]
[ "jquery", "ajax", "asp.net-core-mvc", "jquery-ajaxq" ]
[ "Map two lists into one single list of dictionaries", "Imagine I have these python lists:\n\nkeys = ['name', 'age']\nvalues = ['Monty', 42, 'Matt', 28, 'Frank', 33]\n\n\nIs there a direct or at least a simple way to produce the following list of dictionaries ?\n\n[\n {'name': 'Monty', 'age': 42},\n {'name': 'Matt', 'age': 28},\n {'name': 'Frank', 'age': 33}\n]" ]
[ "python", "dictionary", "list" ]
[ "Xamarin.Forms - How to change the cursor position in the input field?", "I am learning to develop cross platform mobile applications using Xamarin.Forms and Visual Studio 2017. Input field Entry has a CursorPosition property in the documentation. But when I try to use it I get the error \"Property not found\". What am I doing wrong? thank" ]
[ "xamarin", "xamarin.forms" ]
[ "TCP/IP Connection error when connecting to SQL Server database", "When I try and connect to the SQL Server database, I get this error :\n\n\n The TCP/IP connection to the host P5CPAJJDAD01.CORP.AD.CTC, port 1433 has failed. \n \n Error: Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall\n\n\nI can access the database using Python and also MS Access database. I'm trying to use KNIME (an analytics tool) to connect with the database but it throws that error. Which is odd considering that I can access the exact same database using Python and MS Access.\n\nCould this be a security issue?" ]
[ "sql", "sql-server", "analytics", "knime" ]
[ "OpenCV Mat Single Cell", "I'm somewhat of a newbie when it comes to OpenCV. I've been sifting through Google search results for days to better understand mats but to no avail. Instead of rambling incoherently I'll just say what I'm looking to do. Basically, I want to create a table on top of an image solely as a way to reference certain image blocks. I then want to calculate intensity gradients of each cell. In other words, I want to be able to say, \"Ok, what's the intensity gradient of C3?\" I know it doesn't work like an Excel spreadsheet but what's the best way of going about this? \n\nHere's what I have thus far. I haven't started on histograms obviously but this may serve as some help.\n\nThank you in advance for any insight.\n\nusing namespace cv;\nusing namespace std;\nint main( int argc, char** argv )\n{\n// Load and convert image to grayscale.\n Mat src;\n src = imread(\"/Users/Mikie/Documents/Xcode/Image Modify/images/HDimage.jpg\", CV_LOAD_IMAGE_GRAYSCALE);\n// Initialize variables to store source size data.\n float h, w, nh;\n h = src.rows;\n w = src.cols;\n nh = (h/w)*640; // Maintain aspect ratio based on a desired width.\n\n// Ensure image loaded.\n if(src.empty()){\n printf(\" No image data \\n \");\n return -1;\n }\n // if(argc != 2 || !image.data)\n // {\n // printf(\" No image data \\n \");\n // return -1;\n // }\n\n// Create destination Mat.\n Mat dst(4, 4, CV_8UC1);\n\n resize(src, dst, Size(640, nh), CV_INTER_LINEAR); // Resize source while maintaing aspect ratio.\n // Show results to verify size change. \n imwrite(\"/Users/Mikie/Documents/Xcode/Image Modify/images/images/Gray_Image.jpg\", dst);\n namedWindow(\"Gray image\", CV_WINDOW_AUTOSIZE);\n imshow(\"Gray image\", dst);\n waitKey(0);\n return 0;\n}" ]
[ "opencv", "histogram", "mat", "gradient" ]
[ "How Can I Change size of the circles?", "I saw a code and i was trying to modify the size of the circles, but i don't know whither i can change it using js or css .Is there any way to change it ?\n\nThe full code is from:\nhttps://codepen.io/XTn-25/pen/NWqeBaz\n\nhesr is js code:\n\n/**\n * index.js\n * - All our useful JS goes here, awesome!\n Maruf-Al Bashir Reza\n */\n\nconsole.log(\"JavaScript is amazing!\");\n$(document).ready(function($) {\n function animateElements() {\n $('.progressbar').each(function() {\n var elementPos = $(this).offset().top;\n var topOfWindow = $(window).scrollTop();\n var percent = $(this).find('.circle').attr('data-percent');\n var percentage = parseInt(percent, 10) / parseInt(100, 10);\n var animate = $(this).data('animate');\n if (elementPos < topOfWindow + $(window).height() - 30 && !animate) {\n $(this).data('animate', true);\n $(this).find('.circle').circleProgress({\n startAngle: -Math.PI / 2,\n value: percent / 100,\n thickness: 14,\n fill: {\n color: '#1B58B8'\n }\n }).on('circle-animation-progress', function(event, progress, stepValue) {\n $(this).find('div').text((stepValue * 100).toFixed(1) + \"%\");\n }).stop();\n }\n });\n }\n\n // Show animated elements\n animateElements();\n $(window).scroll(animateElements);\n});" ]
[ "javascript", "html", "css", "web" ]
[ "Extracting strings surrounded by html tags from within a list?", "I used BeautifulSoup to parse a website and store the content. It is in this form:\n\nrecords = [[[<p>data_1_1</p>], [<p>data_1_2</p>],[], [<li>data_1_3</li>]],\n [[<p>data_2_1</p>], [<p>data_2_2</p>], [], [<li>data_2_3</li>]]]\n\n\nI am having trouble making this:\n\nrecords = [[\"data_1_1\", \"data_1_2\", \"data_1_3\"],\n [\"data_2_1\", \"data_2_2\", \"data_2_3\"]]\n\n\nI tried list comprehensions:\n\ntext_records = [sum(record, []) for record in records]\n\n\nbut the text is still wrapped in <p> or <li> tags.\n\ntext_records = [item.string for item in sum(record, []) for record in records]\n\n\ntakes the text out of tags, but this gives one large list, with the same values repeated multiple times. \n\nI know there is plenty out there on list comprehensions in python, and I've searched SO, but I can't find anything to help with this situation." ]
[ "python", "python-2.7", "beautifulsoup" ]
[ "Update and access alert message variable between Vue components", "I am using VueJS with Laravel 6.0. What I'm trying to achieve is that to create global variables alertStatus and alertMsg, so that every time when an AJAX call is made, the global variables can be updated to display an alert message to user.\n\nSo I decided to use prototype variable for this case. The idea is that when AJAX call is success/fail in User.vue, the prototype variable should be updated, and Alerts.vue should display it accordingly.\n\nHowever, it seems that the prototype variable display does not update when the data is changed in User.vue component.\n\nI'm not sure if my methods are correct, would like to get some ideas from stackoverflow.\n\nThanks\n\nmain.js\n\nVue.prototype.$alertStatus = '';\nVue.prototype.$alertMsg = [];\n\n\nAlerts.vue\n\n<template>\n <div class=\"alert alert-light alert-elevate\" role=\"alert\">\n <div class=\"alert-icon\">\n <i class=\"flaticon-warning kt-font-brand\"></i>\n </div>\n <div class=\"alert-text\">\n {{alertMsg}}\n </div>\n </div> \n</template>\n\n\nUser.vue\n\n<script>\n export default {\n mounted() {\n var datatable = this.init();\n datatable.on('kt-datatable--on-ajax-fail', function(event, data){\n this.$alertStatus = data.responseJSON.status;\n this.$alertMsg = data.responseJSON.msg;\n });\n },\n }\n</script>" ]
[ "laravel", "vue.js" ]
[ "Apereo CAS 5.3.x: hook into delegated Authentication?", "I have implemented delegated authentication to Azure Active Directory as detailed in https://apereo.github.io/cas/5.3.x/integration/Delegate-Authentication.html\nIs there a way to hook into the delegated authentication process in order to do additional custom verifications?\nI need to get data from the Azure ID-Token (or alternatively the userprofile endpoint) and validate that against certain local rules." ]
[ "java", "cas", "apereo" ]
[ "findviewbyid not working in public static class android java", "public static class DatePickerFragment extends DialogFragment\n implements DatePickerDialog.OnDateSetListener {\n\n @Override\n public Dialog onCreateDialog(Bundle savedInstanceState) {\n // Use the current date as the default date in the picker\n final Calendar c = Calendar.getInstance();\n int year = c.get(Calendar.YEAR);\n int month = c.get(Calendar.MONTH);\n int day = c.get(Calendar.DAY_OF_MONTH);\n\n // Create a new instance of DatePickerDialog and return it\n return new DatePickerDialog(getActivity(), this, year, month, day);\n }\n\n public void onDateSet(DatePicker view, int year, int month, int day) {\n EditText dob = findViewById(R.id.dob);\n }\n }\n public void showDatePickerDialog(View v) {\n DialogFragment newFragment = new DatePickerFragment();\n newFragment.show(getSupportFragmentManager(), "datePicker");\n }\n\nI want to put the value I got from user into the EditText in "OnDataSet" Function And The findviewbyid There Is Giving Me Error" ]
[ "java", "android", "static-classes" ]
[ "A loop for modifying and printing an array in VBA", "So, I'm trying to print modified iterations of an array of 100; for the first row I want 1 to 100 of the array, for the second 2 to 100, all the way to the 100th row with just array(100), and all of these rows starting with column A. I can print the first row just fine, but for the subsequent ones I'm not getting any output.\n\nq = 1\nFor m = 1 To last_age\n Sheets(\"Sheet1\").Range(Cells(q, 1), Cells(q, UBound(Data) + 1)) = Data 'Works the first pass, but not for q>1\n For p = 0 To UBound(Data) - 1\n Data(p) = Data(p + 1)\n Next p\n If UBound(Data) > 0 Then\n ReDim Data(0 To UBound(Data) - 1)\n q = q + 1\n End If\nNext m\n\n\nAll my variables seem to be incrementing correctly, but after the first m loop my Data array isn't being put in the second row. Any thoughts?" ]
[ "arrays", "vba" ]
[ "Converting strings to boolean gives only False value", "Trying to convert data (string format from a csv file) to boolean (in a dataframe), I have 'lost' information on their original value, so now all the values are boolean False. \n\nThe columns that I am trying to change into boolean are the following: \n\ndf['Col1'] =df['Col1'].astype('bool')\ndf['Col2'] =df['Col2'].astype('bool')\n\n\nI have also tried with\n\ndf.Col1 = np.where(df.Col1.eq('true'), True, False)\ndf. Col2 = np.where(df.Col2.eq('true') | df.Col2.eq('tbc'), True, False)\n\n\nThe unique values for each column, Col1 and Col2 are: \n\nCol1: array([true, false, nan], dtype=object)\n\nCol2: array(['true', 'false', 'tbc', nan], dtype=object)\n\n\nMy original dataset has the following values. \n\nCol1 Col2\ntrue true\ntrue true\nfalse false\nnan false\nfalse true\ntrue tbc\n\n\nThough they were converted into boolean, all the values are False: \n\nCol1 Col2\nFalse False\nFalse False\nFalse False\nFalse False\nFalse False\nFalse False\n\n\nI would like to treat TBC as True. Why am I getting only False values? Any idea on how I could fix it?\n\nSample of original dataset and code: \n\nDate Checked Verified\n2018-05-23 FALSE TRUE\n2018-05-24 TRUE TBC\n2018-05-26 FALSE TBC\n2018-05-31 nan nan\n2019-12-01 TRUE TRUE\n2019-12-05 TRUE TBC\n2019-12-15 TRUE FALSE\n2019-12-23 FALSE nan\n\n\nCode \n\nRead the file csv:\n\ndf=pd.read_csv(path, sep=';', engine='python')\n\n\nTransform to lower case\n\ndf= df.apply(lambda x: x.astype(str).str.lower())\n\n\nTransform string to boolean\n\ndf['Checked'] = np.where(df['Checked'].eq('true'), True, False)\ndf['Verified'] = np.where(df['Verified'].eq('true') | df['Verified'].eq('tbc'), True, False)\n\n\nThen I test how many rows have value Checked = True:\n\nlen(df[df['Checked']=='true']) \n\n\noutput: 153\n\nConvert to boolean Checked: \n\ndf['Checked'] = np.where(df['Checked'].eq('true'), True, False)\nlen(df[df['Checked']==True])\n\n\noutput: 153\n\nConvert Verified to boolean:\n\ndf['Verified'] = np.where(df['Verified'].eq('true') | df['Verified'].eq('tbc'), True, False)\n\nlen(df[df['Verified']==True])\n\n\noutput: 0 (expected 60)" ]
[ "python", "pandas", "dataframe" ]
[ "Howto create vim bundle to switch theme depending on webcam light measurement", "I have seen several tricks to switch vim theme depending on the time of day, but I want to switch depending on the light in the room and thought that maybe I could use the webcam. Has anyone seen such a vim bundle?\n\nIf I where to take an image with the webcam and take an average rgb value once every minute from the image I would not know how much the image was brightened by the camera/drivers.\n\nI would be using it with Arch Linux with Gnome on a ThinkPad, it would also be nice to use this for theming of other applications as well.\n\nAny ideas?" ]
[ "vim", "themes", "webcam", "gnome", "light-sensor" ]
[ "Creating a dashboard page using NODE-RED in IBM Bluemix", "I am trying to create some charts in NODE-RED by extracting the tweets through twitter node and then generating the visualisation in IBM Big sheets.I could achieve this and able to view the charts/workbook in IBM analytics for hadoop service but I would like to know if the output of the Bigsheets charts can be published as a dashboard page using NODE-RED?I am not sure how to deal with this scenario in IBM Bluemix as i am interested in creating a real time analytics page based on the tweets\n\nAppreciate your response" ]
[ "twitter", "ibm-cloud", "node-red", "biginsights" ]
[ "What is actually the doubleValue function in BigDecimal class of Scala", "The BigDecimal class in scala contains a doubleValue function. The Double is 64 Bit size...But BigDecimal may contain anynumber of digits and any number of digits after decimal point. \n\nI tried in scala REPL to see what it returns. \n\nActually it is useful in writing a program to find square root of BigDecimal to provide an initial guess of square root. My doubt is how a double can store a BigDecimal. Can anybody clarify this?\n\nscala> BigDecimal(\"192837489983938382617887338478272884822843716738884788278828947828784888.1993883727818837818811881818818\"\n)\nres6: scala.math.BigDecimal = 192837489983938382617887338478272884822843716738884788278828947828784888.199388372781883781881\n1881818818\n\nscala> res6.doubleValue()\nres7: Double = 1.928374899839384E71" ]
[ "scala", "bigdecimal" ]
[ "Laravel Log useFiles method is making Log write in multiple files", "I am using Laravel Log Facade in my app. And I have several services like Mandrill, Twilio, Stripe, etc., that need to be logged in separate file. But when I use Log::useFiles() to set separate file for one of the service wrapper class, like this:\n\nClass Mailer\n{\n static function init()\n {\n Log::useFiles(storage_path('logs/mandrill-'.date(\"Y-m-d\").'.log'));\n }\n\n static function send()\n {\n // some code here...\n\n Log::error(\"Email not sent\");\n }\n}\n\n\nAnd I am ending up with log being written in both Laravel log file, and this Mandrill log file.\n\nIs there a way to tell Log to write logs only in one file?\n\nIt's generally strange that it does that, because when I use directly Monolog, it writes only in one file, as it should. As far as I know Log Facade is using Monolog." ]
[ "php", "laravel", "logging", "monolog", "laravel-facade" ]
[ "How to call function inside injected dll", "I'm trying to get keyboard messages from another process using injected dll,but I don't know where have to call function in my own program.\nhere is my injected dll functions :\n\n//this is my dll main function \nBOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)\n {\n /* open file */\n FILE *file;\n fopen_s(&file, \"d:\\\\dll\\\\temp.txt\", \"a+\");\n\n switch (ul_reason_for_call) {\n case DLL_PROCESS_ATTACH:\n hInst = (HINSTANCE)hModule;\n// should be function calling be here????\n installhook(); \n break;\n case DLL_PROCESS_DETACH:\n fprintf(file, \"DLL detach function called.\\n\");\n break;\n case DLL_THREAD_ATTACH:\n fprintf(file, \"DLL thread attach function called.\\n\");\n break;\n case DLL_THREAD_DETACH:\n fprintf(file, \"DLL thread detach function called.\\n\");\n break;\n }\n hInst = (HINSTANCE)hModule;\n /* close file */\n fclose(file);\n return TRUE;\n }\n\n\nhere is my install hook function to installing keyboardproc to process\n\n BOOL __declspec(dllexport)__stdcall installhook()\n {\n HWND targetWnd;\n HANDLE hProcess;\n unsigned long processID = 0;\n hkb = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)KeyboardProc, hInst, GetCurrentThreadId());\n return TRUE;\n }\n\n\nand this is my keyboardproc function body\n\nLRESULT __declspec(dllexport)__stdcall CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)\n{\n char ch;\n MessageBoxA(nullptr, \"key touched\\n\", \"DLL_PROCESS_ATTACH\", MB_OK | MB_ICONWARNING);\n do\n {\n if (((DWORD)lParam & 0x40000000) && (HC_ACTION == nCode))\n {\n if ((wParam == VK_SPACE) || (wParam == VK_RETURN) || (wParam >= 0x2f) && (wParam <= 0x100))\n {\n FILE *file;\n fopen_s(&file, \"d:\\\\dll\\\\temp.txt\", \"a+\");\n fprintf(file, nCode + \".\\n\");\n }\n }\n } while (0);\n return CallNextHookEx(hkb, nCode, wParam, lParam);\n}\n\n\nand finally here is my main program where I injected dll to the destination process\n\nint procID = 9448;\n HANDLE process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID);\n if (process == NULL) {\n printf(\"Error: the specified process couldn't be found.\\n\");\n }\n\n /*\n * Get address of the LoadLibrary function.\n */\n LPVOID addr = (LPVOID)GetProcAddress(GetModuleHandle(L\"kernel32.dll\"), \"LoadLibraryA\");\n if (addr == NULL) {\n printf(\"Error: the LoadLibraryA function was not found inside kernel32.dll library.\\n\");\n }\n\n /*\n * Allocate new memory region inside the process's address space.\n */\n LPVOID arg = (LPVOID)VirtualAllocEx(process, NULL, strlen(buffer), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);\n if (arg == NULL) {\n printf(\"Error: the memory could not be allocated inside the chosen process.\\n\");\n }\n\n /*\n * Write the argument to LoadLibraryA to the process's newly allocated memory region.\n */\n int n = WriteProcessMemory(process, arg, buffer, strlen(buffer), NULL);\n if (n == 0) {\n printf(\"Error: there was no bytes written to the process's address space.\\n\");\n }\n\n cout << procID << \"\\nhandle:\" << process << \"\\nAddress:\" << addr << \"\\nVirtualArg:\" << arg << \"\\nWM:\"<<n<<\"\\n\";\n\n\n /*\n * Inject our DLL into the process's address space.\n */\n HANDLE threadID = CreateRemoteThread(process, NULL, 0, (LPTHREAD_START_ROUTINE)addr, arg, NULL, NULL);\n if (threadID == NULL) {\n printf(\"Error: the remote thread could not be created.\\n\");\n }\n else {\n printf(\"Success: the remote thread was successfully created.\\n\");\n }\n\n /*\n * Close the handle to the process, becuase we've already injected the DLL.\n */\n CloseHandle(process);\n\n\nwhat is the wrong in my code and where must be change to get desired result!" ]
[ "c++" ]
[ "Grails: querying hasMany association", "I know there are several questions on this subject but none of them seem to work for me. I have a Grails app with the following Domain objects:\n\nclass Tag {\n String name\n}\n\nclass SystemTag extends Tag {\n // Will have additional properties here...just placeholder for now\n}\n\nclass Location {\n String name\n Set<Tag> tags = []\n static hasMany = [tags: Tag]\n}\n\n\nI am trying to query for all Location objects that have been tagged by 1 or more tags:\n\nclass LocationQueryTests {\n\n @Test\n public void testTagsQuery() {\n def tag = new SystemTag(name: \"My Locations\").save(failOnError: true)\n def locationNames = [\"L1\",\"L2\",\"L3\",\"L4\",\"L5\"]\n def locations = []\n locationNames.each {\n locations << new Location(name: it).save(failOnError: true)\n }\n (2..4).each {\n locations[it].tags << tag\n locations[it].save(failOnError: true)\n }\n\n def results = Location.withCriteria {\n tags {\n 'in'('name', [tag.name])\n }\n }\n\n assertEquals(3, results.size()) // Returning 0 results\n }\n}\n\n\nI have validated that the data is being created/setup correctly...5 Location objects created and the last 3 of them are tagged.\n\nI don't see what's wrong with the above query. I would really like to stay away from HQL and I believe that should be possible here." ]
[ "grails", "gorm" ]
[ "How can I show only the names of this data I took from my database?", "I have created this table with information I have in my database, but now I have to make a select box with values so I can show only the names for example. Should I use if statements to do so? \n\n<?php\ntry {\n $con = new PDO('mysql:host=localhost;dbname=snm', \"root\", \"\");\n $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n $query = \"SELECT ID,Voornaam,Achternaam,Woonplaats,Postcode,Email,Social,Soort,Categoriebord,Categoriegame FROM gebruiker\";\n print \"<table>\";\n $result = $con->query($query);\n $row = $result->fetch(PDO::FETCH_ASSOC);\n print \" <tr>\";\n foreach ($row as $field => $value) {\n print \" <th>$field</th>\";\n }\n print \" </tr> \";\n $data = $con->query($query);\n $data->setFetchMode(PDO::FETCH_ASSOC);\n foreach ($data as $row) {\n print \" <tr> \";\n foreach ($row as $name => $value) {\n print \" <td>$value</td> \";\n }\n print \" </tr> \";\n }\n print \"</table> \";\n\n} catch (PDOException $e) {\n echo 'ERROR: ' . $e->getMessage();\n}\n?>" ]
[ "php", "mysql", "pdo" ]
[ "Non Intel AVD emulator", "Environment:\n\nAndroid Studio v3.2.1 latest build Oct2018\n\nEmulator version 28.0.20 Dec 2018\n\nHAXM V7.3.2\n\nNon intel Avd Image Nougat (7.1.1) Api level 25, arm64-v8a\n\nCommand line to start avd:\n\nC:\\Android_sdk\\tools\\emulator.exe -avd Pixel_2_API_25arm -verbose -accel on -engine auto -gpu off -netspeed full -netdelay none -logcat '*:s\n\n\nwhere the following options can be applied:\n\nrem options for -gpu: auto, host, swiftshader_indirect, angle_indirect, off\nrem options for -engine: auto, classic ,qemu2. (classic=qemu1)\n\n\nI have tried all options and combinations (eg -engine classic is invalid for non intel)\nbut performance is atrocious. \n\nDoes anyone has any tips on how to make this avd run such that working with it becomes at least possible.\n\nMy other question is a long shot. I need an amd image to run Poweramp (android music app) but am unable to install.\n\nany help appreciated" ]
[ "android", "x86-64", "avd", "amd" ]
[ "Strange behavior with S3 class", "I re-wrote the post with reproducible example. \n\nRunning the following code will create two objects: eem and eem2. Additionally, the class eem has a names.eem function used to retrieve the value of the sample field.\n\nnames.eem <- function(x, ...){\n x$sample\n}\n\n# First constructor\neem1 <- function(sample){\n eem <- list(sample = sample)\n class(eem) <- \"eem\"\n return(eem)\n}\n\n# Second constructor\neem2 <- function(sample){\n eem <- list(sample = sample)\n class(eem) <- \"eem2\"\n return(eem)\n}\n\ntest1 <- eem1(\"justaname\")\ntest2 <- eem2(\"justaname\")\n\n\nLets create two different objects:\n\ntest1 <- eem1(\"justaname\")\ntest2 <- eem2(\"justaname\")\n\n\nThis is \"bugged\":\n\n> str(test1)\nList of 1\n $ justaname: chr \"justaname\"\n - attr(*, \"class\")= chr \"eem\"\n\n\nThis is ok:\n\n> str(test2)\nList of 1\n $ sample: chr \"justaname\"\n - attr(*, \"class\")= chr \"eem2\"\n\n\nThe only thing that differs between the 2 objects is that one has a an S3 function (names.eem) associated to it.\n\nThis is my SessionInfo()\n\n> sessionInfo()\nR version 3.2.2 (2015-08-14)\nPlatform: x86_64-pc-linux-gnu (64-bit)\nRunning under: Ubuntu 14.04.3 LTS\n\nlocale:\n [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 \n [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 \n [7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C \n[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C \n\nattached base packages:\n[1] stats graphics grDevices utils datasets methods base \n\nloaded via a namespace (and not attached):\n[1] tools_3.2.2" ]
[ "r" ]
[ "Custom Components in Scenebuilder 2.0", "In Scenebuilder 1.1, you could import an entire custom component as a whole. \n\nIn 2.0, however, it is importing the component as separate pieces (Container and nodes). Since my custom component relies on being unified to work with its controller and IDs, this breaks it.\n\nIs there anything I can do as of yet? I'd really like to be able to use Java 8 and Scenebuilder 2.0 for its DatePicker. If a full stable release is right around the corner, perhaps I can wait. I'd preferably want to avoid hacky solutions.\n\nAny ideas?" ]
[ "javafx", "javafx-2", "javafx-8", "scenebuilder" ]
[ "Data model in a common web service", "In a common restful service, there are at least 3 models, they are refer to the same thing, but a little different in different situation.\n\n\nThe first model is used to accept data from the post request, with a field template_id valued by \"id12345\".\nThe second model is the DB entity, we also have a DB entity, which also have a template_id field, but the type of the field is int, it's a internal template primary key in db, it's a integer.\n\n\nSo I can't directly convert the post data to DB entity to insert to DB.\n\n\nThe third model is the rest response, for example, I want to add/remove some field in the model. So I also can't directly convert the DB entity to json response.\n\n\nSo I want to know the good way to process the small differences between these three models. \n\nDo I need to create 3 models named postDataModel DBModel responseModel? I think it's not a good idea." ]
[ "java", "web-services", "entity", "data-modeling", "restlet" ]
[ "Creating custom model using other models in ASP.NET MVC", "As the title suggests I have two models Products And Orders which are actually two table in my database and I have used a LINQ to SQL class to create there models. Now I wan to create a model named \"OrderDetails\" which will have properties from both the model like product name and id from product and Order number from orders something like this. An then I want to create a view from this custom model and from which I want to add \"CRUD\" operation. What should be my approach. And in many scenarios I may have to use data from more than 4 models. Please help. I'm wondering helplessly and I have only two days experience in ASP.NET MVC." ]
[ "asp.net-mvc" ]
[ "Pass variable from bash script to ruby script", "I have a bash script that executes a ruby script. It passes in 4 variables to the ruby script. However, the ruby script is not accessing these variables but instead using the variable name as if it was the value.\n\nIn my bash script I define 4 variables eg \n\nvar1 = \"some string\"\nvar2 = \"another string\"\nvar3 = \"string 3\"\nvar4 = \"string 4\"\n\n\nand call the ruby script with \n\nruby ./myScript.rb var1 var2 var3 var4\n\n\nin ruby script I access as ARGV[0], ARGV[1], ARGV[2], ARGV[3]\nhowever, the ruby script does not get \"some string\" but instead \"var1\" etc\n\nhow can I pass these variables correctly?" ]
[ "ruby", "bash" ]
[ "VBA, FileSystemObject, Windows sort order", "I'm tying to make something in VBA that will basically list all the files in one or more directories starting from a root folder. Long story short, I'm using filesystemobject to run through all of the folders and then getting all the files in those folders. Moving to the next folder, etc. \n\nThe problem I'm running into is that I need to spit out my data (onto a sheet) in the same folder sort order as one might find in Windows. I know this isn't a fixed concept per say, so here's a quick example, as it's displayed in Windows(for me): \n\nWindows Sort Order: \n\nFolderTest\\000\nFolderTest\\0\nFolderTest\\0001\n\n\nNot too surprisingly, when using FSO it returns the sub folders in a different (perhaps more logical) order: \n\nFolderTest\\0\nFolderTest\\000\nFolderTest\\0001\n\n\nI was hoping someone might have an idea of what one could do to get this to be resorted as it's displaying in Windows. This is just an example obviously, the files could be named anything, but it certainly seems to behave a lot better with alpha characters in the name. I'm not necessarily married to using FSO, but I don't even know where else to look for an alternative. I know I could potentially resort these in an array, but I'm not sure what kind of wizardry would be required to make it sort in the \"proper\" order. For all I know, there's some method or something that makes this all better. Thanks in advance for any help!" ]
[ "windows", "vba", "sorting", "filesystems" ]
[ "Center all navbar in bootstrap", "I want to center my menu in Bootstrap, but I can't center the logo aside the links.\n\nThis is the idea:\n\nhttp://postimg.org/image/gfi2lups1/\n\nI want to change the above menu to the below menu.\n\nhttp://codepen.io/anon/pen/LpMbLY?editors=100\n\n<div class=\"container-fluid sin-padding navbar-fixed-top\">\n<nav class=\"menu_top navbar-default menu_top\" role=\"navigation\">\n <!-- Encabezado del menu -->\n\n <div class=\"navbar-header\">\n <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-ex1-collapse\">\n\n <span class=\"sr-only\">Toggle navigation</span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n\n </button>\n <a class=\"navbar-brand\" href=\"#\"><img src=\"img/puma_logo.png\" /></a>\n </div>\n\n\n <!-- Cuerpo del menu -->\n <div class=\"collapse navbar-collapse navbar-ex1-collapse\">\n\n\n <ul class=\"nav separacion-nav navbar-nav\">\n\n <li class=\"excepcion\"><a href=\"#\">ABOUT US</a></li>\n <li class=\"dropdown excepcion\">\n <a href=\"#\" style=\"background-color: white;\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">SERVICES <b class=\"caret\"></b></a>\n <ul class=\"submenu-vertical menu-hover dropdown-menu dropdown-sin-fondo\">\n <li><a href=\"#\">Cargo surveys</a></li>\n <li class=\"submenu-lista\"><a onmouseover=\"this.style.color='black'\" onmouseout=\"this.style.color='#989898'\" style=\"color:#989898;\" class=\"submenu-submenu\" href=\"#\">Loss / Damage Survey</a></li>\n <li class=\"submenu-lista\"><a onmouseover=\"this.style.color='black'\" onmouseout=\"this.style.color='#989898'\" style=\"color:#989898;\" class=\"submenu-submenu\" href=\"#\">Pre-Shipment Survey</a></li>\n <li class=\"submenu-lista\"><a onmouseover=\"this.style.color='black'\" onmouseout=\"this.style.color='#989898'\" style=\"color:#989898;\" class=\"submenu-submenu\" href=\"#\">Loading Survey</a></li> \n <li class=\"submenu-lista\"><a onmouseover=\"this.style.color='black'\" onmouseout=\"this.style.color='#989898'\" style=\"color:#989898;\" class=\"submenu-submenu\" href=\"#\">Discharge Survey</a></li> \n <li class=\"submenu-lista\"><a onmouseover=\"this.style.color='black'\" onmouseout=\"this.style.color='#989898'\" style=\"color:#989898;\" class=\"submenu-submenu\" href=\"#\">Outturn / Condition Survey</a></li> \n <li class=\"submenu-lista\"><a onmouseover=\"this.style.color='black'\" onmouseout=\"this.style.color='#989898'\" style=\"color:#989898;\" class=\"submenu-submenu\" href=\"#\">Quantity Survey</a></li>\n <li><a href=\"#\">Containers and cargo in containers surveys</a></li>\n <li><a href=\"#\">Heavy lift, oversized and projects cargos surveys</a></li>\n <li><a href=\"#\">Hull and machinery surveys</a></li>\n <li><a href=\"#\">Claims handling</a></li>\n </ul>\n </li>\n <li class=\"excepcion\"><a href=\"#\">SPECIALIZED AUTOMOBILE SURVEYS</a></li>\n <li class=\"excepcion\"><a href=\"#\">CONTACT US</a></li>\n <li><a href=\"#\"><img class=\"blocked\" src=\"img/lloyd.jpg\"/></a><div class=\"clearfix\"></div></li>\n\n </ul>\n </div>\n</nav>" ]
[ "html", "css", "twitter-bootstrap" ]
[ "Nested Divs with Animated CSS Text overlay", "I've searched through the site and not found anything with a solution exactly pertaining to my issue. I'm creating a banner across a page at full width that will contain four different images that when you rollover will shade the image and display some text. Problem that I'm having is that they either stack on top of one another or when that if fixed the hover only works on one of them. Here is the code that I have so far.\n\nhttps://jsfiddle.net/robertav/n9Le5rzj/1/embedded/result/\n\n<!doctype html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<title>Untitled Document</title>\n<style>\n#wrapper {width:9999px;}\n\n#school-container1 {\n display: inline-block;\n float:left;}\n#school-container2 {\n display: inline-block;\n float:left;}\n\n#school-container1 #school-box1:hover {\n opacity:1;}\n#school-container2 #school-box2:hover {\n opacity:1;}\n\n.SAD-text {\n color: #fff;\n padding-top: 50px;}\n\n#school-container1 #school-box1 {\n width:480px;\n height:320px;\n position:absolute;\n top:0;\n left:0;\n opacity:0;\n background-color: rgba(0,0,0,0.75);\n -webkit-transition: all 0.7s ease;\n transition: all 0.7s ease;}\n#school-container2 #school-box2 {\n width:480px;\n height:320px;\n position:absolute;\n top:0;\n left:0;\n opacity:0;\n background-color: rgba(0,0,0,0.75);\n -webkit-transition: all 0.7s ease;\n transition: all 0.7s ease;}\n</style>\n</head>\n\n<body>\n<div id=\"wrapper\">\n <div id=\"school-container1\">\n <img src=\"http://proservicesbburg.com/A-D-copy320.jpg\" width=\"480\" height=\"320\" alt=\"image1\" title=\"image1\" />\n <div id=\"school-box1\">\n <p class=\"TEST 2</p>\n </div>\n </div>\n\n <div id=\"school-container2\" >\n <img src=\"http://proservicesbburg.com/mlsoc320-2.jpg\" width=\"480\" height=\"320\" alt=\"image2\" title=\"image2\" />\n <div id=\"school-box2\">\n <p class=\"SAD-text\">TEXT</p>\n </div>\n </div>\n</div>\n</body>\n</html>\n\n\nThis is what I have so far, any help would be greatly appreciated." ]
[ "html", "css" ]
[ "How can I clear the CommandLineArgs of an application from code?", "We have a 3rd party login dialog which will skip the login prompt if the login data is passed in via command line arguments. This is used when an application is launched from within the main 3rd party software.\n\nThe custom app I am writing should provide users with a button to change their login info, however since the app is launched with the login info provided in the command line args, the login dialog never appears when the button is clicked.\n\nIs it possible to clear or reset Environment.GetCommandLineArgs() from the code?\n\nEdit\n\nI ended up simply restarting the application prior to startup if login info existed in the command line. This makes the 3rd party login dialog actually show up instead of automatically using the login info provided in the command line arguments.\n\nI'm accepting Jim's answer because I feel it is the most complete answer to my question, although Oded's answer is also a viable alternative." ]
[ "c#", "command-line-arguments" ]
[ "Can ansible molecule be used for unit testing in Ansible Infra automation?", "I am trying to create an EC2 instance using an ansible role and integrated that with a playbook.\nI need to do a unit testing of the EC2 role using molecule.\n\n\nwhen tested using molecule,will it create an EC2 instance?\nOnce molecule execution is over,will the created instance get destroyed as well?If so What changes need to do in molecule YAML ?\n\n\nI have done Unit testing for roles which used to deploy an application/Config change in EC2 instance.Never did for EC2 instance creating role.Hence Need some inputs and ideas." ]
[ "amazon-ec2", "ansible", "molecule" ]
[ "Update the column based on the recurrence of phone num", "I have a table in which I have the following data below:\n\nphone_num repeat_next date\n12345 -1 2017-01-01(initially repeat_next values will be -1 default )\n12345 -1 2017-01-02(if the same phone number exists in other day then by output should be as below)\n\nphone_num repeat_next date\n12345 1 2017-01-01 (which is max date of phone repeat number minus latest date )\n12345 -1 2017-01-02\n\n\nIn this case, my repeat_next value should be updates as above (it is (2017-01-02) - (2017-01-01))\n\nSo I need to update based on the next occurrence date\n\nFor example, if the same phone number comes again like:\n\nphone_num repeat_next date\n12345 1 2017-01-01\n12345 -1 2017-01-02\n12345 -1 2017-01-08 \n\n\nthen in that case the output should be as below\n\nphone_num repeat_next date\n12345 1 2017-01-01\n12345 6 2017-01-02\n12345 -1 2017-01-08 \n\n\nIn this case it is (2017-01-08) - (2017-01-02)\nThanks in advance" ]
[ "mysql" ]
[ "How to align two tables with headers such that same headers come under single column in excel?", "Can anyone please help me with aligning the two tables such that the same table headers come on the single column? Thanks.\nenter image description here" ]
[ "excel", "excel-formula" ]
[ "How do I monitor the amount of SIMD instruction usage", "How can I monitor the amount of SIMD (SSE, AVX, AVX2, AVX-512) instruction usage of a process? For example, htop can be used to monitor general CPU usage, but not specifically SIMD instruction usage." ]
[ "linux", "intel", "cpu-usage" ]
[ "Executing commands over SSH using Java Spring", "Me and a colleague are developing an web application to control a computer cluster. This computer cluster lacks an API so we need to be able use the Linux shell to control and add \"jobs\" via bash scripts. Each user has a specific amount of time to run applications on the cluster so we need to be able to SSH onto the system using the users credentials so their users account gets used to submit the job. \n\nThe web app is written using Spring. We have done some research into executing commands via SSH using Java and found the Jcsh module. However our question is if there is a Spring module to do this. We where quite surprised that we could not find one since the SFTP module is already there and (correct me if i'm wrong) uses the same protocol.\n\nDid we misread the documentation or is there no module to do this?\n\nMany thanks!" ]
[ "java", "spring", "ssh", "spring-boot" ]
[ "Clip-path doesn't work in Safari 12 and below through jQuery", "When I use clip-path through jQuery (3.5.1) like this:\n$(".box").css ("clip-path", "polygon(" + points + ")");\n\nor this:\n$(".box").eq (0).css ("clip-path", "polygon(" + points + ")");\n\nor this:\n$("#box").css ("clip-path", "polygon(" + points + ")");\n\nit doesn't work in Safari 12 and below (I use Browserstack for testing), no inline style are rendered in DevTools at all.\nAnd if I get it right modern jQuery should add vendor prefixes automatically.\nBut if I use clip-path in pure JS like this:\ndocument.getElementsByClassName("box")[0].style.webkitClipPath = "polygon(" + points + ")";\n\nit perfectly works.\nAm I missing something?\nHow to make clip-path work through jQuery in Safari 12 and below?" ]
[ "javascript", "jquery", "safari", "clip-path" ]
[ "Need help connection with Microsoft.SqlServer.Management.Smo Transfer class", "I am trying to copy everything (data, indexes, triggers, stored procedure). From one database to another in C#.\n\nHere is my code:\n\nSqlConnection connection = new SqlConnection(ConnectionString);\n\nServer myServer = new Server(new ServerConnection(connection)); \n\nDatabase db = myServer.Databases[this._myDB];\n\nif (myServer.Databases[this._newDB] != null)\n myServer.Databases[this._newDB].Drop();\n\nDatabase newdb = new Database(myServer, this._newDB);\nnewdb.Create();\n\nTransfer transfer = new Transfer(db);\ntransfer.CopyAllSchemas = false;\ntransfer.CopyAllStoredProcedures = true;\ntransfer.CopyAllTables = true;\ntransfer.CopyAllDatabaseTriggers = true;\ntransfer.CopyAllObjects = true;\ntransfer.CopyAllUsers = true;\ntransfer.Options.WithDependencies = true;\ntransfer.DestinationDatabase = newdb.Name;\ntransfer.DestinationServer = myServer.Name;\ntransfer.DestinationLoginSecure = false;\ntransfer.DestinationLogin = user;\ntransfer.DestinationPassword = pwd;\ntransfer.CopySchema = false;\ntransfer.CopyData = true;\ntransfer.Options.DriAll = true;\ntransfer.Options.Triggers = true;\ntransfer.Options.WithDependencies = true;\ntransfer.Options.ContinueScriptingOnError = true;\n\ntransfer.TransferData();\n\n\nI get the following error:\n\n\n errorCode=-1071636471 description=SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.\n An OLE DB record is available. Source: \"Microsoft SQL Server Native Client 10.0\" Hresult: 0x80004005 Description: \"Login failed for user 'DOMAIN\\user'.\".\n An OLE DB record is available. Source: \"Microsoft SQL Server Native Client 10.0\" Hresult: 0x80004005 Description: \"Cannot open database \"myDB(replacing name, but it is correct)\" requested by the login. The login failed.\".\n helpFile= helpContext=0 idofInterfaceWithError={5BC870EB-BBA5-4B9D-A6E3-58C6D0051F14}\n\n\nThe closest I have come to accomplishing it with a workaround is by doing:\n\nscript = transfer.ScriptTransfer();\n\nforeach (string s in script)\n{\n //run a sqlcommand for s\n}\n\n\nBut this doesn't get the data.\n\nI have given the user every permission I can think of both for SQL Server and for the database itself." ]
[ "c#", "sql", "sql-server", "smo" ]
[ "Update service configuration setting in Azure using powershell", "I've got a deployment running in Azure.\nI need to change one configuration setting of that deployment. What would be the easiest way to do it programmatically using powershell." ]
[ "azure" ]
[ "jsf message severity", "How do I able to fetch all the messages with SEVERITY is ERROR only.\nI tried:\n\nIterator<FacesMessage> messages = facesContext.getMessages(clientId);\nwhile (messages.hasNext()){\n if(messages.next().getSeverity().toString()==\"ERROR 2\")System.out.println(messages);\n}\n\n\nIs this th right way? It doesnot intercept messages with ERROR severity.\n\nAny help would be highly appreciated." ]
[ "jsf", "messages" ]
[ "Set message priority Spring Integration DSL", "I'm trying to set-up a Integration Workflow which publishes messages to RabbitMQ. \n\nI have 2 questions regarding this:\n1. Is my Queue Bean Working as I hope it is :)\n2. How can I set a message's priority with the outbound-amqp-adapter using Integration DSL? \n\n @Configuration\n\npublic class RabbitConfig {\n\n @Autowired\n private ConnectionFactory rabbitConnectionFactory;\n\n @Bean\n TopicExchange worksExchange() {\n return new TopicExchange(\"work.exchange\", true, false);\n }\n\n\n @Bean\n Queue queue() {\n Map<String, Object> args = new HashMap<String, Object>();\n args.put(\"x-max-priority\", 10);\n return new Queue(\"dms.document.upload.queue\", true, false, false, args);\n }\n\n @Bean\n public RabbitTemplate worksRabbitTemplate() {\n RabbitTemplate template = new RabbitTemplate(rabbitConnectionFactory);\n template.setExchange(\"work.exchange\");\n template.setRoutingKey(\"work\");\n template.setConnectionFactory(rabbitConnectionFactory);\n return template;\n }\n\n\n@Configuration\npublic class WorksOutbound {\n\n @Autowired\n private RabbitConfig rabbitConfig;\n\n @Bean\n public IntegrationFlow toOutboundQueueFlow() {\n return IntegrationFlows.from(\"worksChannel\")\n .transform(Transformers.toJson())\n .handle(Amqp.outboundAdapter(rabbitConfig.worksRabbitTemplate()))\n .get();\n }\n\n}\n\n\nUPDATE\nAfter beeing able to push the message with the appropriate \"Priority header\" I can pull the messages according to their priority using the Rabbit Management UI, but I am somehow unable to pull them correctly using spring-amqp consumer...\n\n @Bean\n public SimpleMessageListenerContainer workListenerContainer() {\n SimpleMessageListenerContainer container =\n new SimpleMessageListenerContainer(rabbitConnectionFactory);\n container.setQueues(worksQueue());\n container.setConcurrentConsumers(2);\n container.setDefaultRequeueRejected(false); \n return container;\n }" ]
[ "spring-amqp" ]
[ "How to dynamically open files for writing with a with statement", "I am trying to split out one large file into an unknown number of files based on a field on a row by row basis. In this case, I want all records with a July 2016 date to write to one file, August 2016 to another, etc. I don't want to have to comb through the file twice, first to populate a list of files that need to be created, and then to actually write to them.\n\nMy first thought was to create a dictionary where the key was the file name (based on the date) and the return was a class that would write out to the csv files.\n\nimport csv\n\nclass testClass:\n a = None\n k = None\n\n def __init__(self,theFile):\n with open(theFile,'wb') as self.k:\n self.a = csv.writer(self.k)\n\n\n def writeOut(self,inString):\n self.a.writerow(inString)\n\ntestDict = {'07m19':testClass('07m19_test2')}\n\n\ntestDict['07m19'].writeOut(['test'])\n\n\nWhen i try to run this I get the following error:\n\nValueError: I/O operation on closed file\n\nWhich makes sense, by the time the class is done initializing theFile is closed. \n\nI think the with statement is required because the files are very big and I can't load it all into memory. That being said, I am not sure how else to approach this." ]
[ "python" ]
[ "Blank Dashboard Page when logging into WordPress", "I have tried logging into my wordpress page to add new pages and do other stuff to develop my website but when I login as admin, I keep getting a page with nothing as shown below. I'm not using localhost, we have this site that we are trying to build through wordpress tools." ]
[ "wordpress", "wordpress-theming" ]
[ "Predicting any Value from the Model using the Predict Function R", "I have developed a simple linear regression model by having some training data and then predicting some new or testing data.\n\nregressor = lm(formula=Discount ~ Bill, data = trainingData) \ny_pred1 = predict(regressor,newdata = testingData)\n\n\nNow i want to use the same for predicting some other new value. Here is what i am trying\n\npred_discount = predict(regressor, newdata=84)\n\n\nBut it throws the following Error\n\nError in eval(predvars, data, env) : not that many frames on the stack\n\n\nThen i searched on Google and StackOverflow and come to know that i should do something like this\n\npred_discount = predict(regressor, newdata = data.frame(x=64))\n\n\nBut this is also not working..Maybe the same type of question was answered many years ago and now this method is also not working.. Here is what the error i am getting\n\nError in eval(predvars, data, env) : object 'Bill' not found\n\n\nWhat i am getting wrong? It is also worth mentioning that Bill is my independent variable in my dataset" ]
[ "r" ]
[ "Custom component in Angular 6: values to boolean attributes", "I'm developing a web application using Angular 6. I have a question: \nI would like to create some custom components that are inspired by the components of HTML input. However, there are differences in native attributes between attributes that assume values and attributes that can be written / not written, such as:\n\n<input type=\"text\" required maxlength=\"10 />\n\n\nIn this case, maxlength must receive a data, while required has a different typology: it can be there or not!\nHere is mine costom component:\n\nTypeScript\n\nexport class CustomComponent {\n\n @Input() maximumLength: number;\n\n @Input() isRequired: boolean;\n}\n\n\nTemplate HTML\n\n<input type=\"text\"\n [attr.maxlength]=\"maximumLength\"\n [required] = \"isRequired\"\n/>\n\n\nmaximumLength seems to work perfectly, but I have a question about isRequired: I don't understand if this is the right way to personalize it... this written attribute (required) receives a value (isRequired), but in reality there should be or not be according to the value passed to it.\nUsing the component like that:\n\n<custom-component maximumLength=\"10\" isRequired=\"true\"></custom-component>\n\n\nit would seem that the associated HTML (<input type=\"text\">) \ndoes not have the required attribute." ]
[ "html", "angular", "typescript", "components" ]
[ "NoSuchMethodError coming while setting values to Cell using Apache POI", "i am getting below error at cell.setCellValue("sdjcb");\ncan any one please help\nException in thread "main" java.lang.NoSuchMethodError: 'org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STXstring org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst.xgetT()'\nat org.apache.poi.xssf.usermodel.XSSFRichTextString.<init>(XSSFRichTextString.java:92)\nat org.apache.poi.xssf.usermodel.XSSFCell.setCellType(XSSFCell.java:928)\nat org.apache.poi.xssf.usermodel.XSSFCell.setCellTypeImpl(XSSFCell.java:903)[![enter image description here][1]][1]\nat org.apache.poi.ss.usermodel.CellBase.setCellType(CellBase.java:57)" ]
[ "java", "excel", "apache-poi" ]
[ "Android rxKotlin crash in subcribe combineLatest", "I want enable/disable button when code & name is not empty.\n\nMy code:\n\nbtnAddItem.isEnabled = false\n\n val codeIsValid = RxTextView.textChanges(txvCode)\n .debounce(350, TimeUnit.MILLISECONDS)\n .map { code ->\n code.isNotEmpty()\n }\n\n val nameIsValid = RxTextView.textChanges(edtName)\n .debounce(350, TimeUnit.MILLISECONDS)\n .map { name ->\n name.isNotEmpty()\n }\n\n disposableEnableButtonSave = Observables.combineLatest(codeIsValid, nameIsValid) \n { b1, b2 -> b1 && b2 }\n .subscribe {\n if (btnAddItem.isEnabled != it){\n btnAddItem.isEnabled = it //crash here.\n }\n }\n\n\nBut it error when run:\n\nLogcat:\n\n\n io.reactivex.exceptions.OnErrorNotImplementedException: Animators may only be run on Looper threads\n android.util.AndroidRuntimeException: Animators may only be run on Looper threads\n\n\ncode crash is enable/disable button.\n\nbtnAddItem.isEnabled = it" ]
[ "android", "kotlin", "rx-kotlin2" ]
[ "treeView1_NodeMouseClick method for left click event in an array of nodes", "I have created a custom windows form and I have emdeded a TreeView. I have specific parent/children nodes in the TreeView. Although, for certain nodes, I want to create different children nodes according to an output array from an application programming interface that I develop. For instance, if my output is an array of length = 2, I want to create 2 children nodes in the first children node. Up to this point, I have successfully managed to carry out this task. However, when I am trying to connect my children nodes when left clicking with different methods, my program crashes. \n\nI attach a part of my code with some explanation:\n\n public partial class FeatureTree : Form\n{\n\n\n public TreeNode rootRootChildren01, rootRootChildren02;\n public object[] rootRootChildren;\n public TreeNode rootNode;\n public TreeNode rootChildNode01, rootChildNode02;\n\n\n public FeatureTree(AddinClass addin)\n {\n userAddin = addin;\n App = (api)userAddin.Application;\n InitializeComponent();\n PopulateTreeView();\n this.treeView1.MouseDown += new MouseEventHandler(treeView1_MouseDown);\n this.treeView1.NodeMouseClick += new TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseClick);\n }\n\n public void PopulateTreeView()\n {\n // Clear the TreeView each time the method is called.\n treeView1.Nodes.Clear();\n\n rootNode = new TreeNode(\"Parent Node 1\");\n rootChildNode01 = new TreeNode(\"Child1\");\n rootChildNode02 = new TreeNode(\"Child2\");\n // Parent root\n treeView1.Nodes.Add(rootNode);\n // firts children root \n rootNode.Nodes.Add(rootChildNode01);\n\n // here I check whether the output array is nothing\n if (userAddin.outputArray != null)\n {\n // if the output is not null create userAddin.outputArray.Length children roots\n rootRootChildren = new object[userAddin.outputArray.Length];\n for (int i = 0; i < userAddin.outputArray.Length; i++)\n {\n\n rootRootChildren[i] = new TreeNode(userAddin.beasyShell[i].Name);\n rootChildNode01.Nodes.Add((TreeNode)rootRootChildren[i]);\n\n }\n rootRootChildren01 = (TreeNode)rootRootChildren[0];\n rootRootChildren02 = (TreeNode)rootRootChildren[1];\n }\n\n // second children root\n rootNode.Nodes.Add(rootChildNode02);\n\n treeView1.ShowPlusMinus = false;\n treeView1.ExpandAll();\n treeView1.ShowNodeToolTips = true;\n }\n\n void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)\n {\n if (e.Node == rootRootChildren01 && e.Button == MouseButtons.Left)\n {\n\n userAddin.method_1;\n\n }\n if (e.Node == rootRootChildren02 && e.Button == MouseButtons.Left)\n {\n\n userAddin.method_2;\n\n }\n\n }\n\n\nThe above code works pretty well. However, how could I set in the treeView1_NodeMouseClick method the right click event according to the rootRootChildren array? For this occasion only two nodes are created. But what if the output array is much bigger?\n\nMany thanks in advance!" ]
[ "c#", "winforms", "treeview" ]
[ "jquery fullcalendar hide certain hours", "I want to use jquery fullcalendar but I want to hide certain hours.\nI want to show the calendar from 8.00am->11.00am and from 16:00pm->19:00pm\n\nSo the hours between 11:00am and 16:00pm must be 'hidden'.\n\nI don't see an option to do this :\nHow can I force this ?\n\nthx in advance\nKristof" ]
[ "jquery-ui", "fullcalendar" ]
[ "angular directive highlight if any of inputs in div has focus", "I have created an angular directive for a repeatable section with form elements\nI want the whole section/div to be highlighted when any of then input fields inside the div are in focus\n\ntemplate.html\n\n<div class=\"col-md-12 employee-section\">\n<label for=\"name_{{$index}}\">Name</label>\n<input type=\"text\" id=\"name_{{$index}}\" class=\"col-md-6\" ng-model=\"model.name\"/>\n\n<label for=\"address_{{$index}}\">Address</label>\n<input type=\"text\" id=\"address_{{$index}}\" class=\"col-md-6\" ng-model=\"model.address\"/>\n</div>\n\n\ndirective\n\nangular.module('test').directive('employee' , function(){\n return {\n link: function(scope, element){\n },\n restrict: 'AE',\n scope: {\n model: \"=\"\n },\n templateUrl: 'template.html'\n };\n }\n\n\ncontroller\n\nangular.module('test').controller('employeeCtrl' , function($scope){\n $scope.employees = [{name:'Jackk',address:'Main st'}, {name:'Jill',address:'Main st 123'}\n});\n\n\nhtml page \n\n<div ng-repeat=\"employee in employees>\n <employee model=\"employee\"></employee>\n</div>" ]
[ "javascript", "jquery", "css", "angularjs", "html" ]
[ "rails nested attributes rails record_not_found when update", "I have 2 models like:\n\nclass Customer < ActiveRecord::Base\n has_many :passengers\n accepts_nested_attributes_for :passengers, allow_destroy: true\nend\n\nclass Passenger < ActiveRecord::Base\n belongs_to :customer\nend\n\n\ncustomer_params contain :\n\n:name,...\n:passengers_attributes: [:id, :name, :_destroy]\n\n\nand when pass passengers_attributes to update customer (id=1) like\n\n{\n \"passengers_attributes\": [\n {\n \"name\": \"abc\",\n \"id\": 5\n }\n ]\n}\n\n\nWith passenger \"abc\" is new record\n\nWhen i run customer.update_attributes!(customer_params), it raise error ActiveRecord::RecordNotFound: Couldn't find Passenger with ID=5 for Customer with ID=1\n\nDo you know this error? i need your help. Thanks" ]
[ "ruby-on-rails", "ruby", "nested-attributes" ]
[ "Only users can facebook connect by using PHP SDK 3", "I have integrated Facebook Connect to my website by using PHP SDK 3 which uses Graph API\n\nexactly like this post\n\nok...\n\nThe php for login url is\n\n$loginUrl = $facebook->getLoginUrl(\n array(\n 'scope' => 'email,publish_stream',\n 'redirect_uri' => $fbconfig['baseurl']\n )\n);\n\n <a href=\"<?=$loginUrl?>\">Facebook Login</a>\n\n\nI just have one problem and I have tried to find solution for it :\n\nIf the visitor is trying to login but he is not registered to my APP, \nFacebook will redirect him to example.php page without asking him to accept my App and register.\n\nIn other words I only need to lead my current user to path of the Fblogin url and if he is not a user then I will redirect him to other page without asking him to register for my App.\n\nCould anyone help me please ?\n\nThanks" ]
[ "php", "facebook", "sdk", "connect" ]
[ "MenuInflater in SherlockActivity", "I am trying to get the menu inflater inflate the menu xml in my SherlockActivity class.\n\nMy onCreateOptionsMenu method is like this - \n\n@Override\npublic boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {\n MenuInflater inflater = this.getSupportMenuInflater();\n inflater.inflate(R.menu.messagespagemenu, menu);\n return true;\n}\n\n\nand my messagespagemenu.xml looks like this - \n\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n<item\n android:id=\"@+id/text\"\n android:title=\"@string/deleteall\">\n</item>\n\n\n\n\nAnd my activity class extends SherlockActivity.\n\nCould anyone please point me to the mistake I am doing.\n\nEDIT:\n\nThe menu is not showing. When I try this same code in another class is extending SherlockListActivity then it works. So I am wondering if I am missing anything in this class" ]
[ "android", "actionbarsherlock" ]
[ "use jQuery to get 'true size' of image without removing the class", "I am using Jcrop on an image that is resized with css for uniformity.\n\nJS\n\n<script type=\"text/javascript\">\n $(window).load(function() {\n //invoke Jcrop API and set options\n var api = $.Jcrop('#image', { onSelect: storeCoords, trueSize: [w, h] });\n api.disable(); //disable until ready to use\n\n //enable the Jcrop on crop button click\n $('#crop').click(function() {\n api.enable();\n });\n });\n function storeCoords(c) {\n $('#X').val(c.x);\n $('#Y').val(c.y);\n $('#W').val(c.w);\n $('#H').val(c.h);\n };\n</script>\n\n\nHTML\n\n<body>\n <img src=\"/path/to/image.jpg\" id=\"image\" class=\"img_class\" alt=\"\" />\n <br />\n <span id=\"crop\" class=\"button\">Crop Photo</span>\n <span id=\"#X\" class=\"hidden\"></span>\n <span id=\"#Y\" class=\"hidden\"></span>\n <span id=\"#W\" class=\"hidden\"></span>\n <span id=\"#H\" class=\"hidden\"></span>\n</body>\n\n\nCSS\n\nbody { font-size: 13px; width: 500px; height: 500px; }\n.image { width: 200px; height: 300px; }\n.hidden { display: none; }\n\n\nI need to set the h and w variables to the size of the actual image. I tried using the .clone() manipulator to make a copy of the image and then remove the class from the clone to get the sizing but it sets the variables to zeros.\n\nvar pic = $('#image').clone();\npic.removeClass('image');\nvar h = pic.height();\nvar w = pic.width();\n\n\nIt works if I append the image to an element in the page, but these are larger images and I would prefer not to be loading them as hidden images if there is a better way to do this. Also removing the class, setting the variables, and then re-adding the class was producing sporadic results.\n\nI was hoping for something along the lines of:\n\n$('#image').removeClass('image', function() {\n h = $(this).height();\n w = $(this).width();\n}).addClass('image');\n\n\nBut the removeClass function doesn't work like that :P" ]
[ "jquery", "image-manipulation", "removeclass", "jcrop" ]
[ "Create Delegate Type Non-Generic", "static void CallUnmanageFunction(string dllName, string functionName, params object[] parameters)\n {\n IntPtr dllHandle = LoadLibrary(dllName);\n IntPtr functionHandle = GetProcAddress(dllHandle, functionName);\n List<Type> typeParameters = new List<Type>();\n foreach (object p in parameters)\n {\n typeParameters.Add(p.GetType());\n }\n Type type = Expression.GetDelegateType(typeParameters.ToArray()); \n Delegate function = Marshal.GetDelegateForFunctionPointer(functionHandle, type);\n function.DynamicInvoke(parameters);\n }\n\nstatic void Main(string[] args)\n {\n CallUnmanageFunction(\"user32.dll\", \"MessageBoxA\", IntPtr.Zero, \"Es funktioniert\", \"Test\", (uint)0);\n }\n\n\nI want to call an unmanaged function by giving the libraryname and the functionname as a string and the parameters as normal types (params object[] parameters).\nThe function \"GetDelegateForFunctionPointer\" expects a non-generic delegate type, but the function \"GetDelegateType\" of the \"Expression\" class gives a generic \"Action\" or \"Func\"-Delegate. Has somebody any idea for solving this problem? \n\nSorry for my bad english, its my worst subject at school.\nThank you very much in advance for your answer! :)" ]
[ "c#", "types", "delegates", "marshalling" ]
[ "Pass a file through different step in PHP", "I have a scenario like this:\n\n\npage-1 with a form where a select a file (XML) to import\nafter submit, i get redirected to a page-2 where all inputs all pre-compiled by info readed from XML file (the file is uploaded and temporary saved with tmpfile() function)\nif I want to discard or cancel the process to save my data, i can close browser or change page that is ok, cause the file uploaded is a temp file thanks to tmpfile() function so it will be deleted automatically by the system....\nbut if I want to confirm the form in page-2 I need to: 1- save all inputs in my database (ok no problem they are all text), 2- move the file selected in step 1 from temp to a directory\n\n\nThe problem is on step 4.2 cause file generated with tmpfile() get deleted after script ends. So I can't move it to a directory.\n\nWhat's the best way to \"propagate\" a file from an form-1 to a form-N in PHP ?\n\nI think using file_get_contents() can be a solution using a hidden textarea to pass it on every pages...but for large files i don't know if it's a good idea.\n\nLittle pieces of code:\n\npage-2.php\n\n <?php\n\nif ( isset($_POST['action']) && $_POST['action'] == \"import\" ) {\n\n if (file_exists($_FILES['fileXMLimport']['tmp_name']) || is_uploaded_file($_FILES['fileXMLimport']['tmp_name'])) {\n\n $content = file_get_contents($_FILES['fileXMLimport']['tmp_name']);\n\n $filename = $_FILES['fileXMLimport']['name'];\n\n}\n\n//omitted: code to read the file xml\n\n//$f1 = \"data readed from file\";\n\n//\n\n}\n\n?>\n <body>\n <form id=\"form2\">\n\n <input type=\"text\" name=\"f1\" value=\"<?php echo $f1; ?>\">\n <input type=\"text\" name=\"f2\" value=\"<?php echo $f2; ?>\">\n ...list of field readed from file\n <input type=\"text\" name=\"fn\" value=\"<?php echo $fn; ?>\">\n\n <textarea class=\"hidden\" name=\"fileContent\"><?php echo base64_encode($content); ?></textarea>\n <input type=\"hidden\" name=\"fileName\" value=\"<?php echo $filename; ?>\">\n\n <input type=\"submit\" value=\"Submit and save file\">\n\n </form>" ]
[ "php", "file" ]
[ "Slider (carousel) aligning with other elements", "I've built a very basic single-page website which has a nagivation, a slider (carousel with 3 images), and a footer. My problem is that, while the slider fades the images in and out of each other properly, because it is positioned absolutely I cannot get the footer out from underneath it.\n\nThe slider overlaps everything, which I guess makes sense since it's absolute.\n\nMy question is if it is wiser to keep the slider positioned absolutely (it allows the jQuery to work it's magic fading in/out) and position my footer differently... OR if I should re-work the slider completely.\n\nHTML:\n\n<div id=\"carousel\">\n <img class=\"slideshow\" src=\"img/slide2.jpg\">\n <img class=\"slideshow\" src=\"img/slide3.jpg\">\n <img class=\"slideshow\" src=\"img/slide1.jpg\">\n</div>\n\n\nSass:\n\n#carousel {\n img {\n background-position: center;\n background-repeat: none;\n background-size: cover;\n width: 100%;\n margin: 0;\n padding: 0;\n }\n}\n\n.slideshow {\n display: hidden;\n position: absolute;\n}\n\n\nHere's a sample of my page (as well as the JS working the slider) on JSfiddle: https://jsfiddle.net/josectello/7n8c5bq8/\n\nThank you immensely in advance." ]
[ "jquery", "html", "css", "slider", "absolute" ]
[ "Are WebRTC SDP blobs reusable between peers?", "I'm trying to use WebRTC for purely decentralised and peer-to-peer communications. I'm trying to build a P2P overlay network, wherein nodes exchange details of other nodes so that they may connect to them. \n\nIf I exchange SDP blobs (session description objects) between nodes, are they reusable in the sense that I could establish a connection to a node simply given this blob and an ICE candidate?" ]
[ "javascript", "html", "webrtc", "sdp" ]
[ "Find text enclosed by character multiples times", "The problem: \n\nFind pieces of text in a file enclosed by @\n\nInput:\n\n@abc@ abc @ABC@\ncba @cba@ CBA\n\n\nOutput:\n\n@abc@ @ABC@\n@cba@\n\n\nI've tried the following:\n\ncat test.txt | perl -ne 'BEGIN { $/ = undef; } print $1 if(/(@.*@)/s).\"\\n\"'\n\n\nBut this results in:\n\n@abc@ abc @ABC@\ncba @cba@\n\n\nAdditional:\nI was not complete. The goal of the above is the replace the characters between the @ with something else:\na should become chr(0x430)\nb should become chr(0x431)\nc should become chr(0x446)\nA should become chr(0x410)\nB should become chr(0x411)\nC should become chr(0x426)\nso with the above input in mind it should result in:\nабц abc АБЦ\ncba цба CBA\n\nSorry for my imcompleteness. Thanks Kluther" ]
[ "regex", "perl" ]
[ "PHP File Uploading - No File Uploaded Error", "I've created an image uploading form , using twitter bootstrap and the jansy extention, using the next code section:\n\n <form action=\"fileName.php\" method=\"post\" enctype=\"multipart/form-data\">\n <div class=\"fileupload fileupload-new\" data-provides=\"fileupload\">\n <div class=\"fileupload-preview thumbnail\" style=\"width: 200px; height: 150px;\"></div>\n <div>\n <span class=\"btn btn-file\"><span class=\"fileupload-new\">Select image</span><span class=\"fileupload-exists\">Change</span><input type=\"file\" name=\"pic\" id=\"pic\"/></span>\n <a href=\"#\" class=\"btn fileupload-exists\" data-dismiss=\"fileupload\">Remove</a>\n <button type=\"submit\" class=\"btn\">Upload</button>\n </div>\n </form>\n\n\non the fileName.php the following code is executed:\n\nprint_r($_FILES);\nif($_FILES[\"pic\"][\"error\"] > 0){ /*image uploading has failed*/\n echo \"Error occured \".$_FILES[\"pic\"][\"error\"]; \n }\nelse {\n echo \"image was uploaded successfully\";\n}\n\n\nand returns the next message :\n\nArray ( [pic] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) ) Error occured 4\n\n\nHow come the file is not uploaded ? How could I solve this?\n\nThanks." ]
[ "php", "html", "forms", "twitter-bootstrap" ]
[ "Flow type for React props.children (union Element | Array)", "I have a container component and it's props type with children property:\n\ntype Props = {\n children: Array<React.Element<any>> | React.Element<any>,\n settings: string | Object\n};\n\n\nContainer can contain the only one React.Element or multiple and depends on that it should choose the right operation.\n\nIn the render function I have something like that:\n\nconst children = this.props.children;\n\nif ( _.isArray(children) ) {\n return _.map(children, (child, key) => checkListComponent(child, key));\n}\n\nelse if ( _.isObject(children) ) {\n return checkListComponent(children);\n}\n\n\nThe main function is that:\n\nconst checkListComponent = (child: React.Element<any>, key) => {\n return child.props.list\n ? React.cloneElement(child, key ? { options, key } : { options })\n : child;\n };\n\n\nAnd after all I get a Flow error in else if\n\nreturn checkListComponent(children);\n\n\nFlow: array type. This type is incompatible with the expected param type of React$Element.\n\nIt seems to ignore possible type of non Array for the children prop. I found issue on Github about union Array and Object type but there is nothing.\n\nIs there any solution for that situation?\n\nUPD:\n\nThe same problem I have with props.settings, it can be an API url to fetch settings object from the server or a direct settings object. When I call an axios.get(settings) (obviously check before that props.settings is a string for now) Flow ignores possible string type and complains that Object given instead of string. BUT in the next line when I check settings for an object type and set container state\n\nthis.setState({ settings: this.props.settings });\n\n\nIt complains that String given instead of Object. \n\nHow it is possible and what can I do with that? I can but don't want to have two different props for settings API and Object. And definitely this is impossible for the props.children part of a problem." ]
[ "reactjs", "flowtype", "flow-typed" ]
[ "Vectorize the following for loop", "i = [1 2 3 4 5];\na = {[1 3 4 5] [5 4 3] [1 2 3] [4] [5 2]};\nb = {[1] [4 2 3] [1 3] [2 1 4] [1 2 3]};\n\n\nFor aand b the following conditions hold\n\n\nCell arrays aandbare of the size of i\nEach element in each array of aand b are from the elements of i\n\n\nIs there any way to Vectorise the following code to avoid for loop\n\nx = 0;\nfor elem = i\n x = x + sum(ismember(cell2mat(a(a{elem})),b{elem}));\nend\nx\n\n\nThanks" ]
[ "matlab", "for-loop", "vectorization", "cell-array" ]
[ "Is there any FOSS lib for reading Excel files using C", "As the title says, I am looking for source code that shows how to read(write) MS Excel files in pure C (OS agnostic). I have seen some Java code (e.g. JExcel) and would use that if I can't find some existing C code with similar functionality.\n\nWhat I need is to read an Excel file and convert it to XML (or some other more manageable format).\n\nTIA" ]
[ "c", "objective-c", "excel", "macos" ]
[ "How to create a has_many relationship between two models, with several models in between? (Ruby on Rails ActiveRecord)", "What I'd like to do is join one model to another using two intermediary models in between..Here's the abstraction:\n\n\nCountry has_many Companies\nCompany has_many Buildings, Company belongs_to Country\nBuilding has_many Rooms, Building belongs_to Company\nRoom belongs_to Building\n\n\nI want to be able to do Country.first.rooms, so I thought the Country model would be as simple as:\n\nclass Country < ActiveRecord::Base\n has_many :companies\n has_many :buildings, :through=>:companies\n has_many :rooms, :through=>:buildings\nend\n\n\nHowever, this tries to generate SQL like:\nSELECT * FROM rooms INNER JOIN buildings ON rooms.building_id = building.id WHERE ((building.country_id = 1))\n\nObviously, building.country_id does not exist. How do I get around this?" ]
[ "ruby-on-rails", "activerecord" ]
[ "How can I make an interactive Ruby program nicer?", "(Windows 7 x64 running Ruby 1.9.3)\n\nHere's the situation: I've made text game in Ruby, and I'm using the traditional gets method to get input from the user. When something is happening in the game (i.e. stuff is being printed to the screen), whatever the user has typed for input gets lost and the user has to continue typing what he/she has typed on a new line. What he/she has originally typed before it got lost is still there, just doesn't get shown.\n\nIf the above didn't make sense try executing this code, and you'll see the problem:\n\nThread.new do\n loop do\n puts \"Hello!\"\n sleep 2\n end\nend\n\nThread.new do\n loop do\n gets\n end\nend\n\n\nWhat I want is the line printed (in this case \"Hello!\") to be placed before the line the user is typing into.\n\nI understand that to achieve this I might need to delve into the Windows API. It may even be impossible. But if there's a way, I'd really like to know." ]
[ "ruby" ]
[ "How to prevent event propagation for \"Enter\" key press in ag-grid-react cellEditor component?", "My question primarily revolves around this statement in the docs w.r.t. the react component:\n\ncellEditor Params\nonKeyDown Callback to tell grid a key was pressed - useful to pass\ncontrol key events (tab, arrows etc) back to grid - however you do not\nneed to call this as the grid is already listening for the events as\nthey propagate. This is only required if you are preventing event\npropagation.\n\nI understand that the cellEditor params exist as the props being passed to the react version of the component but I can't seem to find how to attach to onKeyDown as specified in the docs. In my constructor for my cellEditor the onKeyDown function exists and matches the onKeyDown specified in cellEditorParams inside my column definition (if it exists).\nconstructor(props) {\n super(props);\n // console.log(typeof props.onKeyDown == 'function') => 'true'\n}\n\nBut it's never reached if it simply exists in the component\nonKeyDown(event) {\n console.log('not reached');\n}\n\nIt does get invoked if I put onKeyDown={this.props.onKeyDown} inside of a top level wrapping div around my input but it still doesn't catch the "Enter" press.\nI tried listening to the cell containing my custom cell editor\nthis.props.eGridCell.addEventListener('keyup', (event) => {\n console.log(event.keyCode === 13)\n})\n\nWhich does capture the enter press but it seems to unmount when enter is pressed before I can capture the final enter press inside the field? I've seen behavior where this doesn't work too so I'm very confused.\nI currently have a simple cell editor MyCellEditor that I am trying to make focus and select the next cell when enter is pressed in addition to just tab. I already have the ability to extract the rowIndex and column properties I need from the rowRenderer at this.props.api.rowRenderer which I then use like:\nthis.props.api.rowRenderer.moveFocusToNextCell(rowIndex, column, false, false, true);\nMy issue is where to prevent the event propagation by default from the "Enter" press.\nBelow is my Cell Editor and the usage.\nimport React from 'react';\nimport _ from 'lodash';\n\nclass MyCellEditor extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n value: props.value,\n };\n }\n\n getValue() {\n return this.state.value;\n }\n\n isPopup() {\n return false;\n }\n\n isCancelBeforeStart() {\n return false;\n }\n\n afterGuiAttached() {\n const eInput = this.input;\n eInput.focus();\n eInput.select();\n }\n\n onKeyDown(event) {\n // Never invoked!\n }\n\n onChangeListener = (e) => {\n this.setState({ value: e.target.value });\n }\n\n render() {\n return (\n <input\n ref={(c) => { this.input = c; }}\n className="ag-cell-edit-input"\n type="text"\n value={this.state.value}\n onChange={this.onChangeListener} />\n );\n }\n}\nexport default MyCellEditor;\n\nColumn definition:\ncolumnDefs = [{\n headerName: 'CustomColumn',\n field: 'customField',\n editable: true,\n cellClass: 'grid-align ag-grid-shop-order-text',\n sortable: false,\n cellEditorFramework: MyCellEditor,\n // Do I need cellEditorParams?\n cellEditorParams: {\n // onKeyDown: (event) => console.log('does not output')\n }\n },\n ...\n}\n\nReact:\n<AgGridReact\n columnDefs={columnDefs}\n rowData={this.props.rows}\n enableColResize="false"\n rowSelection="single"\n enableSorting="false"\n singleClickEdit="true"\n suppressMovableColumns="true"\n rowHeight="30"\n // onKeyDown also does nothing here\n onGridReady={this.onGridReady}\n onGridResize={() => console.log('grid resized')}\n onColumnResize={() => console.log('column resized')} />" ]
[ "reactjs", "ag-grid", "ag-grid-react" ]
[ "Printing a Dict() with Rich", "I'm trying to print a dict() using Pythons Rich. From my understanding, this should output the data on different lines etc. A bit like pprint.\nBut I'm getting:\n>>> from rich import print\n>>> print(output)\n\n{'GigabitEthernet0/1': {'description': '## Connected to leaf-2 ##', 'type': 'iGbE', 'oper_status': 'up', \n'phys_address': '5000.0009.0001', 'port_speed': 'auto speed', 'mtu': 1500, 'enabled': True, 'bandwidth': 1000000, \n'flow_control': {'receive': False, 'send': False}, 'mac_address': '5000.0009.0001', 'auto_negotiate': True, \n'port_channel': {'port_channel_member': False}, 'duplex_mode': 'auto', 'delay': 10, 'accounting': {'other': {'pkts_in':\n0, 'chars_in': 0, 'pkts_out': 431258, 'chars_out': 25875480}, 'ip': {'pkts_in': 513383, 'chars_in': 42910746, \n'pkts_out': 471188, 'chars_out': 45342027}, 'dec mop': {'pkts_in': 0, 'chars_in': 0, 'pkts_out': 7163, 'chars_out': \n551551}, 'arp': {'pkts_in': 3845, 'chars_in': 230700, 'pkts_out': 3846, 'chars_out': 230760}, 'cdp': {'pkts_in': 72010,\n'chars_in': 18866620, 'pkts_out': 79879, 'chars_out': 31221768}}, 'ipv4': {'10.1.1.5/30': {'ip': '10.1.1.5', ...\n\nAny suggestions?" ]
[ "python", "rich" ]
[ "The program does not seem to be exiting the loop. Why is that?", "This is a simple for loop which the program cannot exit.\n\nfor(j=4;j<8;j++)\n{\n label4:\n b=(rand()%100+1)/1000;\n temp1a[l]=(chrom[i][j]*(0.1-b))+(b*chrom[i+1][j]);\n temp2a[l]=(chrom[i+1][j]*(0.1-b))+(b*chrom[i][j]);\n if(temp1a[l]>0.1&&temp2a[l]>0.1)\n {\n l++;\n continue;\n }\n else\n {\n goto label4;\n }\n}\nprintf(\"Initial temp arrays stored\\n\");\n\n\nThe end statement is not being printed and there is no output. Can someone please help me out." ]
[ "c", "loops" ]
[ "What are the benefits of learning a new language, as a game developer?", "I'm an independant game developer/designer, and I'm wondering what specific benefits are there to learning a new programming language. I do my programming in C++ currently, and I want to know if there are any tangible benefits to learning a different language, as in, benefits to writing a game x in language y versus game w in language z?\n\nBasically, I understand that learning a new programming language will help me think about a problem in different ways, but what are some actual benefits to using one language over another in specific scenarios?" ]
[ "language-agnostic" ]
[ "Trying to create a generic function that balances values (unsure exactly how to word it)", "Given an array like this:\n\nvar buckets = [\n {name: \"bucket1\", value: 10000},\n {name: \"bucket2\", value: -5000},\n {name: \"bucket3\", value: -2000},\n]\n\n\nI am trying to \"zero out\" the negative numbers. In every situation given, the total of all the values added together will never be negative. What I mean by \"zero out\" is take any positive numbers, and reduce them by the negative numbers, in the order in which they appear.\n\nSo if the first number and third number is negative, and the second number is positive, it will reduce the the second by the first, and then by the third.\n\nThe end values of my example afterwards would be 3000, 0, 0 - respectively.\n\nThe numbers can appear in any combination and order, as long as the sum of all of them are positive." ]
[ "javascript" ]
[ "Why is my code generating an extra query?", "I have the following code in my controller : \n\n@unanswered_questions = Question.unanswered_with_tag(params[:tag_id]).paginate(per_page: 10, page: params[:page])\n\n\nWhich calls this method in my Question model: \n\ndef self.unanswered_with_tag id\n joins(:taggings).where(taggings: { tag_id: id }).where(questions: { num_answers: 0})\nend\n\n\nI expect one sql query that fetches the first 10 unanswered questions on that page, but my logs are showing 2 queries: \n\n Question Load (0.4ms) SELECT \"questions\".* FROM \"questions\" \n INNER JOIN \"taggings\" ON \"taggings\".\"question_id\" = \"questions\".\"id\" \n WHERE \"taggings\".\"tag_id\" = $1 AND \"questions\".\"num_answers\" = $2 \n ORDER BY \"questions\".\"id\" ASC LIMIT $3 OFFSET $4 \n [[\"tag_id\", 3], [\"num_answers\", 0], [\"LIMIT\", 1], [\"OFFSET\", 0]]\n\n\n^^Note the LIMIT 1 part.\n\nAnd the second query : \n\n SELECT \"questions\".* FROM \"questions\" INNER JOIN \"taggings\" \n ON \"taggings\".\"question_id\" = \"questions\".\"id\" \n WHERE \"taggings\".\"tag_id\" = $1 AND \"questions\".\"num_answers\" = $2 \n LIMIT $3 OFFSET $4 \n [[\"tag_id\", 3], [\"num_answers\", 0], [\"LIMIT\", 10], [\"OFFSET\", 0]]\n\n\nWhich has LIMIT 10. \n\nWhy is this behaviour?" ]
[ "ruby-on-rails", "activerecord", "will-paginate" ]
[ "styled-component - passing props best practices", "Imagine a scenario like this: you create a theme and pass it to ThemeProvider.\nIt could look like this:\nconst theme = {\n palette: {primary: {main: 'blue', contrastText: 'white'}, surface: 'gray'},\n borderWidth: '1px',\n shadowMixin: size => `0px 0px ${size} black`\n}\n\nThen you create a component:\nconst Something = styled.div`\n color: ${props => props.theme.palette.primary.contrastText};\n background: ${({theme}) => theme.palette.surface};\n border: ${props => props.theme.borderWidth} solid ${({theme}) => theme.palette.primary.main};\n box-shadow: ${props => props.theme.shadowMixin('10px') };\n`;\n\nand well... it looks very messy. You can use object destruction, fake mixins or whatever, but it's hard to keep it clean when you keep passing functions in each line. I thought of doing something like this:\nconst Something = styled.div`\n ${({ theme: { palette, borderWidth, shadowMixin } }) => {\n css`\n color: ${palette.primary.contrastText};\n background: ${palette.surface};\n border: ${borderWidth} solid ${palette.primary.main};\n box-shadow: ${ shadowMixin('10px') };\n `;\n }}\n`;\n\nbut it's not perfect either.\nIs there a better way to approach this?" ]
[ "javascript", "css", "reactjs", "styled-components", "css-in-js" ]
[ "throw new Error(string) not showing in F12", "I have a JS script that thrown an Error \n\n$.when(verifyInitArgs(initArgs))\n .then(function argsAreValid() {\n initialiseForm();\n }, function argsInvalid(error) {\n throw new Error(error);\n });\n\n\nthe error variable is a string. I can see this with typeof when a breakpoint is set:\n\n>> typeof error\n\"string\"\n\n\nHowever, the thrown error is not showing in the console window in IE or Firefox.\n\nIf I enter throw new Error(\"something\"); directly in the browser console then it works as expected, it's displayed as an error in the console.\n\nWhat's happening here?" ]
[ "javascript", "jquery", "error-handling" ]
[ "show_module tediousness in ocaml utop", "I am using ocaml utop, with Core.Std module.\n\nTo see the help on a module, I have to follow the link of aliases like so:\n\nutop # #show_module Array;;\nmodule Array = Core_kernel.Std_kernel.Array \n\nutop # #show_module Core_kernel.Std_kernel.Array;;\nmodule Array = Core_kernel.Std_internal.Array \n\nutop # #show_module Core_kernel.Std_internal.Array;;\nmodule Array = Core_kernel.Core_array\n\n\nAnd finally show_module on that will show the information. Is there a quicker way?\n\nThanks!" ]
[ "ocaml", "utop" ]
[ "Connector/NET connecting to MSSQL error - access denied for user 'sa'@'localhost' (using password yes)", "I'm making a program in web api, ASP.NET in Visual Studio Code, using a MSSQL database. I'm making a chat application with SignalR and I want to make the connection in my ChatHub file. When I write the connection correctly, I got an error message: access denied for user 'sa'@'localhost' (using password yes)\n\nHere is my ChatHub.cs code\n\n public async Task SendMessage(string user, string message)\n {\n MySql.Data.MySqlClient.MySqlConnection conn;\n string myConnectionString;\n\n myConnectionString = \"server=localhost;uid=sa;\" +\n \"pwd=123456789;database=DBChatApp\";\n\n try\n {\n conn = new MySql.Data.MySqlClient.MySqlConnection();\n conn.ConnectionString = myConnectionString;\n conn.Open();\n }\n catch (MySql.Data.MySqlClient.MySqlException ex)\n {\n Console.WriteLine(ex.Message);\n }\n\n Console.WriteLine($\"user={user}, message={message}\");\n await Clients.All.SendAsync(\"ReceiveMessage\", user, message);\n }\n }" ]
[ "c#", "mysql", "asp.net", "sql-server", "visual-studio-code" ]
[ "fetch larger images from Facebook with Koala using the get_connection method", "The documentation of the Koala gem gives an example how to fetch posts from Facebook, including a picture. \n\nclient = Koala::Facebook::API.new(oauth_token)\nclient.get_connection('someuser', 'posts',\n {limit: @options[:max_items],\n fields: ['message', 'id', 'from', 'type',\n 'picture', 'link', 'created_time', 'updated_time'\n ]})\n\n\nBelow this example the documentation makes a note:\n\n\n You can pass a ‘type’ hash key with a value of ‘small’, ‘normal’, ‘large’, or ‘square’ to obtain different picture sizes, with the default being ‘square’. Also, you may need the user_photos permission.\n\n\nUnfortunately, this doesn't seem to work:\n\nclient.get_connection(\"officialstackoverflow\", \"posts\", \n {limit: 5, type: \"large\", fields: [:picture, :message, :type]})\n\n\nUnfortunately, I get the same picture as I would get when omitting the type param. How do I have to pass the type hash correctly?" ]
[ "ruby", "facebook-graph-api", "koala" ]
[ "How to use a cookie with nodejs and mongodb?", "I am using nodejs (express) with mongodb and I am trying to figure out how cookies work. I am currently able to let a user login and authenticate it. How do I bring cookies into play and how do I use cookies to query mongodb for the user's info to pull it onto the next page and pages after that, once they login.\n\nCurrently I have a route file that posts the login request and then redirects based on success to a userProfile page, I want to include user specific details on that page and then be able to show user other pages and have him return to his unique pages again while querying. \n\nUPDATED CODE: (Can cookie be called the way it is called in the updated code?)\n\nlogin post route file\n\nexports.loginPost = function(req, res, next) {\n passport.authenticate('local', function(err, user, info) {\n if (err) { return next(err) }\n if (!user) { return res.redirect('loginError'); }\n req.logIn(user, function(err) {\n if (err) { return next(err); } \n res.cookie('name', req.params.email, { expires: new Date(Date.now() + 900000), httpOnly: true }); \n return res.redirect('userProfile');\n });\n })(req, res, next);\n};" ]
[ "node.js", "mongodb", "cookies" ]
[ "How to display Details records of Selected Master Record on Entity Framework?", "I'm new to Entity Framework and trying to learn the basics through simple examples. \n\nThese are my two tables with some of their columns:\n\nCUSTOMERS_BASE:\n\nCB_REFNO (primary key)\nCB_NAME etc.. \n\n\nORDERS:\n\nOR_REFNO (primary key)\nOR_M_REFNO (foreign key) to CONTACTS_BASE table etc..\n\n\nI have inserted some sample data to both tables and what I want to accomplish now is to view all orders of a a customer on the datagridview.\n\nI have a bindingNavigator, CONTACTS_BASEBindingSource and ORDERSBindingSource on my crud.\n\nMy code: \n\nCONTACTS_BASEBindingSource.DataSource = lobo.CONTACTS_BASE.ToList(); \nbindingNavigator1.BindingSource = CONTACTS_BASEBindingSource;\n\n\nSo now when I click next/previous buttons on the bindingNavigator I am able to view all the records that are on the CUSTOMERS_BASE table. But what do I have to do so that the ORDERSGridView will display each order record for each record on CONTACTS_BASE? \n\nThanks" ]
[ "c#", "entity-framework" ]
[ "Constexpr static array initialization and usage (with avr-g++)", "In the example below, the initializer is one element smaller than the static array. In this case avr-g++-6.3 as well as avr-g++-7.0 produces code with no elements in the data-section (initializer). That is what I would expect.\n\n#include <stdint.h>\n\nvolatile uint8_t x = 0;\nvolatile uint8_t y = 0;\n\nint main() {\n constexpr uint8_t l[4] = {0, 1, 2};\n y = l[x];\n while(true) {}\n}\n\n\nBut, if I change the code to \n\n#include <stdint.h>\n\nvolatile uint8_t x = 0;\nvolatile uint8_t y = 0;\n\nint main() {\n constexpr uint8_t l[3] = {0, 1, 2};\n y = l[x];\n while(true) {}\n}\n\n\n(here the static array length is as smal as possible)\n\nboth compiler generate a data section of 4 bytes. Thats very(!) surpising for me.\nThe effect is reproducible with all kinds of static arrays as well as with std::array<>, if the size of the array is the same as the number of initializers.\n\nWhats going on here?\n\nHeres the assembler output for the first case:\n\n .file \"bm10a.cc\"\n__SP_H__ = 0x3e\n__SP_L__ = 0x3d\n__SREG__ = 0x3f\n__tmp_reg__ = 0\n__zero_reg__ = 1\n .section .text.startup,\"ax\",@progbits\n.global main\n .type main, @function\nmain:\n push r28\n push r29\n rcall .\n rcall .\n in r28,__SP_L__\n in r29,__SP_H__\n/* prologue: function */\n/* frame size = 4 */\n/* stack size = 6 */\n.L__stack_usage = 6\n std Y+1,__zero_reg__\n std Y+2,__zero_reg__\n std Y+3,__zero_reg__\n std Y+4,__zero_reg__\n ldi r24,lo8(1)\n std Y+2,r24\n ldi r24,lo8(2)\n std Y+3,r24\n lds r30,x\n add r30,r28\n mov r31,r29\n adc r31,__zero_reg__\n ldd r24,Z+1\n sts y,r24\n.L2:\n rjmp .L2\n .size main, .-main\n.global y\n .section .bss\n .type y, @object\n .size y, 1\ny:\n .zero 1\n.global x\n .type x, @object\n .size x, 1\nx:\n .zero 1\n .ident \"GCC: (GNU) 7.0.1 20170218 (experimental)\"\n.global __do_clear_bss\n\n\nAnd here for the second case:\n\n .file \"bm10a.cc\"\n__SP_H__ = 0x3e\n__SP_L__ = 0x3d\n__SREG__ = 0x3f\n__tmp_reg__ = 0\n__zero_reg__ = 1\n .section .rodata\n.LC0:\n .byte 0\n .byte 1\n .byte 2\n .section .text.startup,\"ax\",@progbits\n.global main\n .type main, @function\nmain:\n push r28\n push r29\n rcall .\n push __zero_reg__\n in r28,__SP_L__\n in r29,__SP_H__\n/* prologue: function */\n/* frame size = 3 */\n/* stack size = 5 */\n.L__stack_usage = 5\n lds r24,.LC0\n lds r25,.LC0+1\n lds r26,.LC0+2\n std Y+1,r24\n std Y+2,r25\n std Y+3,r26\n lds r30,x\n add r30,r28\n mov r31,r29\n adc r31,__zero_reg__\n ldd r24,Z+1\n sts y,r24\n.L2:\n rjmp .L2\n .size main, .-main\n.global y\n .section .bss\n .type y, @object\n .size y, 1\ny:\n .zero 1\n.global x\n .type x, @object\n .size x, 1\nx:\n .zero 1\n .ident \"GCC: (GNU) 7.0.1 20170218 (experimental)\"\n.global __do_copy_data\n.global __do_clear_bss" ]
[ "c++", "arrays", "gcc", "constexpr" ]
[ "How to get application process to wait until the socket has data to read using libevent bufferevents?", "I'm working with libevent for the first time and have been having an issue trying to get my application to not run until the read callback is called. I am using bufferevents as well. Essentially I am doing is trying to avoid the sleep in my main application loop and instead have the OS wake up the process (via libevent) when there is data to be read off the socket. Anyone know how to do this? I found in an alpha build of libevent that you can set a base event loop to be EVLOOP_NO_EXIT_ON_EMPTY, but from looking at the libevent code that will just use up my whole proc I believe. I also read on this question that it is a bad idea to set a socket to blocking on windows which is why I haven't done that as a solution either. I will mark this with libuv and libev too since they are similar and might contribute to my solution." ]
[ "sockets", "blocking", "libevent", "libev", "libuv" ]
[ "GenericRecord to POJO", "I am consuming from Kafka Avro record and creating a GenericRecord Stream. Now for some computation I want to convert GenericRecord to Pojo Object. I have already generated a class using Avro-maven-plugin from the schema. \n\nBut I am not able to convert the generic record to This generated class Object. \n\nPlease help me how to do this. I want to know how to implement ConvertoPojo function in the below code. \n\n public void flatMap(Tuple2<Long, GenericRecord> recordTuple2, Collector<Tuple4<Long, Long, Long, Long>> collector) throws Exception {\n GenericRecord record = recordTuple2.f1;\n String event_name = record.get(\"event_name\").toString();\n\n if (event_name.equals(\"search_list_keyless\")) {\n SearchListKeyelss object = ConvertoPojo(record)\n }\n\n }" ]
[ "java", "apache-flink", "avro" ]
[ "Member variables of a object get overridden when creating another object in the object", "I have a memory issue with a class of mine. The issue occurs when I create an object in a member function of a class. It is about the class below. I removed the member functions because they aren’t necessary: \n\nclass User\n{\nprivate:\n bool locked;\n bool active;\n\n std::vector<City> * userCitys;\n UserData userData;\n Credentials credentials;\n\n\nThe problem occurs when I call this function:\n\nint User::addCity(CityData cityData) \n{\n lockUserObject(); //Everything is fine here\n\n City cityToAdd; //When this object is created, the memory of userCitys will get overridden\n cityToAdd.activate();\n userCitys->push_back(cityToAdd);\n int cityID = userCitys->size() - 1;\n\n userCitys->at(cityID).editCityData(cityData);\n\n unlockUserObject();\n return cityID;\n}\n\n\nIn the first place I created userCitys on the stack. For test purpose I placed it on the Heap. The address of userCitys get overridden by some data. I can’t find the problem. the City is just a basic class:\n\nPart of the header:\n\nclass City\n{\nprivate:\n bool active;\n Supplies supplies;\n std::vector<Building> buildings;\n std::vector<Company> companies;\n std::vector<Share> shares;\n std::vector<Troop> troops;\n CityData cityData;\n\n\nConstructor:\n\nCity::City()\n{\n active = false; \n}\n\n\nHow is it possible that userCitys get overridden? This all happens on a single Thread so that can’t be a problem. I tried a lot of thing, but I can’t get it to work. What is the best approach to find the problem?\n\nEdit:\nLock function:\n\nvoid User::lockUserObject()\n{\n for( int i = 0; locked ; i++)\n {\n crossSleep(Settings::userLockSleepInterval);\n\n if( i >= Settings::userLockMaxTimes )\n Error::addError(\"User lock is over userLockMaxTimes\",2);\n }\n\n locked = true;\n}\n\n\nI call the code here (Test function):\n\nCity * addCity(User * user)\n{\n Location location;\n location.x = 0;\n location.y = 1;\n\n CityData citydata;\n citydata.location = location;\n citydata.villagers = 0;\n citydata.cityName = \"test city\";\n\n int cityID = user->addCity(citydata); //addCity is called here\n City * city = user->cityAction(cityID);;\n\n if( city == NULL)\n Error::addError(\"Could not create a city\",2);\n\n return city;\n}\n\n\nThe add user (Test code):\n\nUser * addUser()\n{\n UserData test;\n test.name = \"testtest\";\n Credentials testc(\"testtest\",3);\n\n //Create object user\n int userID = UserControle::addUser(test,testc);\n User * user = UserControle::UserAction(userID);\n\n if( user == NULL)\n Error::addError(\"Could not create a user\",2);\n\n return user;\n}\n\n\nMy test function:\n\nvoid testCode()\n{\n User * user = addUser();\n City * city = addCity(user);\n}\n\n\nThis function in called in main:\n\nint main()\n{\n testCode();\n return 0;\n}\n\n\nHere are UserAction and addUser in UserControle:\n\nint UserControle::addUser(UserData userdata, Credentials credentials)\n{\n int insertID = -1;\n for( int i = 0; i < (int)UserControle::users.size(); i++)\n {\n if( !UserControle::users.at(i).isActive() )\n {\n insertID = i;\n break;\n } \n }\n\n User userToInsert(userdata,credentials);\n\n if( insertID != -1 )\n {\n UserControle::users.insert( UserControle::users.begin() + insertID,userToInsert);\n return insertID;\n }\n else\n {\n UserControle::users.push_back(userToInsert);\n return UserControle::users.size() - 1;\n }\n}\n\nUser* UserControle::UserAction(int userID) //check all indexes if greater then 0!\n{\n if( (int)UserControle::users.size() <= userID )\n {\n Error::addError(\"UserAction is out of range\",3);\n return NULL;\n }\n\n if( !UserControle::users.at(userID).isActive())\n {\n Error::addError(\"UserAction, the user is not active.\",3);\n return NULL;\n }\n\n return &UserControle::users[userID];\n}" ]
[ "c++", "windows", "visual-studio" ]
[ "jquery: submit form and pass values of the variables to Python", "I'm trying to pass the values of the form and the values of the from and till variables to the Python. But it turns out to transfer or values of the form or value of variables.\n\nIf I post only var a = $('#form').serialize(); then in the python I can freely obtain the value by applying form.projects.data\n\nIf I post var a = $('#form').serialize(); and variables from and till that in a python a variable is displayed in the following form: projects=1 and this leads to additional processing.\n\n{% set d_from, d_till = from_till %}\n\n{% block module_scripts %}\n {{ super() }}\n <script>\n var from = '{{ d_from.strftime(\"%m/%d/%Y\") }}';\n var till = '{{ d_till.strftime(\"%m/%d/%Y\") }}';\n\n $(function my() {\n $(\"#reservation\").daterangepicker({\n \"locale\": {\n \"format\": \"DD/MM/YYYY\"\n },\n \"opens\": \"right\",\n \"showDropdowns\": true,\n \"showWeekNumbers\": true\n }, function (start, end, label) {\n from= start.format('MM/DD/YYYY');\n till = end.format('MM/DD/YYYY');\n });\n });\n\n $( \"#go\" ).click(function() {\n var a = $('#form').serialize();\n $.post(\n '{{ url_for(\"reporting_backoffice.download_report\") }}', {\n a:a,\n d_from: from,\n d_till: till\n }\n );\n });\n </script>\n\n{% endblock %}\n\n{% block report_block_content %}\n <form id=\"form\">\n <div class=\"form-group\">\n <div class=\"input-group\">\n <div class=\"input-group-addon\"><i class=\"fa fa-calendar\"></i></div>\n <input type=\"text\" class=\"form-control pull-right\" id=\"reservation\"\n value=\"{{ d_from.strftime(\"%m/%d/%Y\") }} - {{ d_till.strftime(\"%m/%d/%Y\") }}\">\n </div>\n </div>\n\n <div class=\"row\">\n <div class=\"col-lg-6\">\n {{ wtf.form_field(form.projects, class=\"form-control select2\") }}\n\n <button class=\"btn btn-primary\" id=\"go\">{{ _(\"Download report\") }}</button>\n </div>\n </div>\n\n </form>\n\n\nPlease tell me, maybe there is a more correct and simple way to POST data to the Python?" ]
[ "javascript", "jquery", "post", "forms" ]
[ "How to iterate over array nested in object as props", "I have a JSON file that I'm parsing for data but I am trying to map a subarray (nested in an object). However, I am getting an error sayin that the array is not iterable. I logged the array to the console where it prints the array but when I check its type it says "object".\nHere is my code:\nexport default function Projects({ children, ...props }) {\n\n return (\n <div>\n <div>\n <div className={styles.text}>\n <p>{props.description}</p>\n <ul>\n {props.features.map((feature) => (\n <li>{feature}</li>\n ))}\n </ul>\n </div>\n </div>\n </div>\n );\n}\n\nThe JSON file:\n[\n {\n "id": 1,\n "name": "Netflix Clone",\n "img": "/netflix-clone.jpg",\n "direction": "row",\n "description": "This project is a minimalistic Netflix clone utilising Firefox for storage and authorisation. It utilises Styled Components for styling, compound components, large-scale React architecture, and custom hooks.",\n "features": [\n "React",\n "Styled Components",\n "Compound components",\n "Large-Scale React Architecture",\n "Firebase (Firestore & Auth)",\n "Functional components",\n "Firebase (Firestore & Auth)",\n "Custom hooks"\n ]\n },\n]\n\nThe error:\nTypeError: Cannot read property 'map' of undefined" ]
[ "javascript", "json", "reactjs" ]
[ "Session Variable getting only one value", "I am trying to get the radio button values from the page \"add_attendance.php\" through session variable and process it in \"store_attendance.php\"\nHere is the code of add_attendance.php \n\n if (mysqli_num_rows($result) > 0) \n {\n $radio = 1;\n\n while ($row = mysqli_fetch_assoc($result))\n {\n\n $radio_arr = array();\n array_push($radio_arr, $radio);\n\n $name_array[] = $row[\"Name\"];\n $_SESSION['name_array'] = $name_array;\n $roll_array[] = $row[\"RollNo\"];\n $_SESSION['roll_array'] = $roll_array;\n\n $_SESSION['radioKeys'] = $radio_arr;\n isset($radio);\n\n\nHere is the code of \"store_attendance.php\" that gets the radio button value and outputs.\n\n <?php\n\nsession_start();\n$posted = array();\n\nif(isset($_SESSION['username']) && isset($_SESSION['password']))\n{\n\n var_dump($_SESSION['name_array']); echo \"<br>\";\n var_dump($_SESSION['roll_array']);echo \"<br>\";\n //var_dump($_SESSION['radioKeys']);\n\n foreach ($_SESSION['radioKeys'] as $radioKey) {\n # code...\n if (isset($_POST[$radioKey])) {\n $posted[$radioKey] = $_POST[$radioKey];\n }\n }\n\n $_SESSION['radio'] = $posted;\n foreach ($_SESSION['radio'] as $radioKey => $radioValue)\n { \n var_dump($radioValue);\n }\n}\n\n\nThe output i get is \n\narray(2) { [0]=> string(9) \"Dhatchana\" [1]=> string(6) \"Deepak\" }\narray(2) { [0]=> string(1) \"1\" [1]=> string(1) \"2\" }\narray(1) { [0]=> int(2) } **string(7) \"present\"**\n\n\nstring(7) \"present\" the value i select in the second radio button. But i want both the values. What am i doing it wrong here ? thanks in advance." ]
[ "php" ]
[ "postgresql db structure script", "How to get my db structure without the data, (schema, tables, ...) as a script by command line." ]
[ "postgresql", "scripting", "dump" ]
[ "How Google App Engine Java Task Queues can be used for mass scheduling for users?", "I am focusing GAE-J for developing a Java web application. \n\nI have a scenario where user will create his schedule for set of reminders. And I have to send emails on that particular date/time. \n\nI can not create thread on GAE. So I have the solution of Task Queues.\n\nSo can I achieve this functionality with Task Queues. User will create tasks. And App Engine will execute it on specific date and time.\n\nThanks" ]
[ "google-app-engine" ]
[ "Uncaught TypeError: this.impl.controls.activateTool is not a function", "I am using Autodesk Viewer to view rvt models in browser. It is working fine on desktop browsers but not in mobile browsers. I tried remote debugging and found the error. This is the screenshot of the console showing the error message.\n\nScreenshot\n\nAnyone know why this error is showing on the mobile browsers." ]
[ "autodesk-viewer" ]
[ "Why does footer not go all the way to the bottom?", "I have a web page as follows:\nhttp://www.transeeq.com/health/bq17a.html#\n\nThe yellowish footer does not get pushed all the way to the bottom. Any ideas? Here is the CSS code:\n\n#container {\n min-height:100%;\n position:relative;\n}\n\n#body {\n padding-bottom:60px; /* Height of the footer */\n}\n\n#footer {\n position:absolute;\n bottom:0;\n width:100%;\n height:60px; /* Height of the footer */\n background:#CCCC66;\n}" ]
[ "css" ]
[ "CSS pseudo class overrides class", "I have following CSS:\n\ninput:not([type=submit]):not([type=file]) {\n width: 500px;\n}\n\n.filterTextbox {\n width: 150px;\n}\n\n\nI want to be able to assign filterTextbox class to certain input elements and have textbox be 150px wide. What is happening now, as you can guess, is that first style overrides the .filterTextbox class and I end up having all input textboxes 500px wide.\n\nSo, any idea on how to easily resolve this?" ]
[ "jquery", "html", "css" ]
[ "How to implement auto-incrementing build number in maven project?", "How to implement auto-incrementing build number in maven project?\n\nCurrent version of my project is 0.9 and I'd like this from 0.9.1 to 0.9.2 and so on every build.\n\nI've been searching for this but I couldn't get anything to work.\n\nI've tried this question,also tried maven build number plugin and I've tried this blog, but nothing seems to work. \n\nI tried the maven version plugin but it changes the jar name to app-0.9.[commit_hashcode].jar but I don't want this.\n\nI want the jar name to be app-0.9.jar and I want to access the build number from a properties file or something." ]
[ "maven", "version" ]
[ "Write output of process to log4j", "I start a process with ProcessBuilder and want to write the output to log4j. How can I achieve this?\n\nI know that I can redirect the output of the process to a File and then read that File back, but I hope there is some easier way.\n\nI would like to avoid to write my own OutputStream implementation if there is a simpler solution. I hope that I am not the first who would like to get the output of a ProcessBuilder as a \"good java object\" like a \n\n List<String> \n\n\nor something else which is easy to handle." ]
[ "java", "process", "log4j" ]
[ "jekyll-ga set up for jekyll", "I am at the moment starting a new jekyll project. I have from now created a new project inger (jekyll new inger). So I have the default tree of my project. I am trying to set up all the plugins I want to use. \nThe first one is Google Analytics plugin (jekyll-ga). I followed the tutorial at https://github.com/developmentseed/jekyll-ga.\nI followed all the following steps \nSet up a service account for the Google data API\n\n-Go to https://code.google.com/apis/console/b/0/ and create a new project.\n-Turn on the Analytics API and accept the terms of service\n-Go to API Access on the left sidebar menu, create a new oauth 2.0 client ID, give your project a name, and click next.\n-Select Application type: Service account, and click Create client ID\n-note the private key's password. It will probably be notasecret unless Google changes something. You'll need to enter this value in your configuration settings.\n-Download the private key. Save this file because you can only download it once. Copy it to the root of your Jekyll repository. Safety tip: To protect this file, add its file name to your .gitignore file and to the exclude list in your _config.yml file\n-Note the Email address for the Service account. You'll need this for your configuration settings and in the next step.\n\n\nSo I have the following page in my google page (https://console.developers.google.com/iam-admin/iam/project?project=inger-analytics)\n\n\nThe last step is the following : Log into Google Analytics and add the service account email address as a user of your Google Analytics profile: From a report page, Admin > select a profile > Users > New Userhttps://analytics.google.com/analytics/web/provision/?authuser=0#provision/SignUp/) I have the following page\n\nAnd the sign up button leads me to a form where I must enter information about the site that will use for my site. I don't recognize the instruction of the tutorial (https://github.com/developmentseed/jekyll-ga).\nThank you for your help" ]
[ "google-analytics", "jekyll" ]