texts
sequence | tags
sequence |
---|---|
[
"PowerShell SQL query using here-string and variable expansion",
"How can I combine the query results for servers that are swSaturday = 1 and swSunday = 1 The [RebootTime] could be swSunBeginTime or swSatBeginTime and it also might not help I'm only trying to run this query on a list of machines in a text file.\n\nError received is Exception calling \"Fill\" with \"1\" argument(s): \"Incorrect syntax near the keyword 'WHERE'.\" and the error goes away if WHERE swName = $($props.Server) is removed.\n\nFunction GetServer-RebootLookUp{\n\nBegin{\n $servers = GC D:\\Scripts\\reboots1.txt\n $SQLServer = 'Server101'\n $Database = 'Database101'\n $SqlConnection = New-Object System.Data.SqlClient.SqlConnection\n $SqlConnection.ConnectionString = \"Server = $SQLServer; Database = $Database; Integrated Security = True\"\n}#End Begin\n\nProcess{\n $servers | ForEach-Object{\n $props = @{}\n $props.Server = $_\n\n $ServerQuery = @\"\nSELECT swName AS [Server], swRack AS [Rack], swEnvironment AS [Environment], swSunBeginTime AS [RebootTime], swSchedule as [Schedule]\nFROM SW_SERVICE_LVL\nINNER JOIN SW_SPECIALTY\n ON swDiscount = swSpecialtyId\nAND swEnvironment IN ( 'Cert', 'Test', 'Prod' )\nAND swSchedule IN ( 'SCCM - Monthly' )\nAND swGrpResp = 'MyGroup'\nAND swRootObjectType = 'Server'\nWHERE swSunday = 1\nWHERE swName = $($props.Server)\n \"@\n $SqlCmd = New-Object System.Data.SqlClient.SqlCommand\n $SqlCmd.CommandText = $ServerQuery\n $SqlCmd.Connection = $SqlConnection\n $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter\n $SqlAdapter.SelectCommand = $SqlCmd\n $DataSet = New-Object System.Data.DataSet\n $SqlAdapter.Fill($DataSet)\n $DataSet.Tables[0]\n}\n}#end process\n\nEnd{\n $SqlConnection.Close()\n}\n}#End function!\nGetServer-RebootLookUp"
] | [
"sql",
"powershell"
] |
[
"JavaScript and jQuery , creating and usng an object. Properties return undefined",
"function DialogWindow(contents, clickEvent){\n// given a contents we can create a DialogWindow of that content\nthis.contents = contents;\nthis.domElement = $(\".hideMe\");\n\nthis.test = function(){\n console.log(this.contents);\n}\n\n$(\"div\").click(this.test); //<-note this spot\n\n/*\nThis function simply returns the html representation of the contents\nThis function should be called withen WindowPage so that it can fully figure out what\nArguments:\n container: the container that containes the WindowPage that this is apart of\n lanes: the number of lanes on the page. Defined as: lanes = (number of columns in WindowPage) * 3 + 1\n*/\nthis.toHtml = function(container, lanes){\n\n var dialogWidth = container.width()/(lanes/2);\n var dialogSep = container.width()/lanes;\n\n var htmlWindow = jQuery('<div/>', {\n id: \"dialogWindow\"\n }).css(\"width\", dialogWidth).css(\"height\", dialogWidth).css(\"position\",\"absolute\");\n\n jQuery(this.contents.toHtml()).appendTo(htmlWindow);\n\n this.domElement = htmlWindow;\n\n return htmlWindow;\n}\n\n\n}\n\nMy goal is to get a click of htmlWindow, to execute a function of DialogWindow. However whenever I do this all of DialogWindows properties return undefined. If I replace the line:\n\n$(\"div\").click(this.test);\n\n\nwith\n\n$(\"div\").click(this.test());\n\n\nThen the function test() fires imediatelly and works (i.e. prints this.contents to the console). However if I leave that line as it was (i.e. I wait for a click to make the test() function fire) then it prints undefined to the console."
] | [
"javascript",
"jquery",
"callback"
] |
[
"How do you write a regex in python which picks out all strings beginning with a specific number",
"I'm trying to get this regex to pick out both 7gh and 7ui but I can only get it to pick out the first one. If anyone knows how to amend the regex such that it also picks out 7ui, I would seriously appreciate it. I should also point out that I mean strings separated by a space.\n\nb = re.search(r'^7\\w+','7gh ghj 7ui')\nc = b.group()"
] | [
"python",
"regex"
] |
[
"Error in my JQuery validation",
"Hello i have error in my Jquery validation, the code dont do nothing, can anybody help me?\n\n<script>\n\n // When the user submits the form,\n // Check what answer they picked\n // And tell them if they're correct\n\n // submit\n $(\"#form\").on(\"submit\", function(event) {\n event.preventDefault();\n var $answer = $(\"#unit_name\"); \n var answer = $answer.val();\n console.log(answer);\n if (answer === \"\") {\n $(\"#result\").text(\"Preencha corretamente o nome da unidade.\");\n } else if(answer.length < 3 ) {\n $(\"#result\").text(\"O nome da unidade é demasiado pequeno.\");\n }\n\n });\n </script>\n\n\n\n\nThis is the code of the form implemented\n \n \n\n <div class=\"pure-u-1\">\n <h3 align=\"center\">Insert</h3>\n </div>\n\n\n\n\n <div class=\"form-group\">\n <label class=\"control-label\" for=\"unit_name\"Name concept:</label>\n <div class=\"input-group\">\n <input class=\"form-control\" placeholder=\"Insert name\" id=\"unit_name\" name=\"unit_name\" type=\"text\" />\n </div>\n </div>\n <input type=\"hidden\" name=\"state\" value=\"insert\">\n <input type=\"submit\" value=\"Insert\">\n <br><br>\n </div>\n\n </form>\n\n\nThis div will show message to the users."
] | [
"php",
"jquery"
] |
[
"Concat string and byte in http header",
"I'm trying to upload a zip by post request. To do this I need to send string and byte data.\n\nOk the problem is the binary encoding still. The original zip encoding first line is PK........,Q?E?;, where as the uploaded copy is PK........,Q.E.; The original has ? whereas the copy converts them to .."
] | [
"powershell",
"powershell-2.0"
] |
[
"How to highlight code snippets inside of html file?",
"I want to highlight some code snippets(mainly java) inside of html document using python3. There are plenty of them in document. The code is tagged with pre-code tags. Can you advice me how can I do it?"
] | [
"python-3.x"
] |
[
"Where does ipad store store icloud file created in windows?",
"The MacOS stores icloud drive files locally in ~/Library/Mobile Documents. Where does Ipad and windows store these files by default?\n\nI found a directory in windows c:\\users\\<username>\\icooud drive, which is supposed to store the file locally. I tested this by deleting synced file in ipad then try recovering file at this location. The recovery tools (recuva and r-studio) could not find files in windows machine deleted from icloud. They could easily find files in other directories.\n\nI want to extend a program to recover accidentally deleted icloud files in ipad and windows. There are solutions (like Dr.fone) which can recover photos, contact information etc in ipad. But it cannot recover other files like word documents.\n\nMay be I am searching in in wrong location. May be icloud saves file in another format. How can I recover deleted icloud files from hard disk data recovery tool. Can anyone suggest where do I need to look and how to look?"
] | [
"windows",
"ipad",
"data-recovery"
] |
[
"Can CSS force a line break after each word in an element?",
"I'm building a multilingual site, with the owner helping me with some translations. Some of the displayed phrases need line breaks to maintain the style of the site. \n\nUnfortunately, the owner isn't a computer guy, so if he sees foo<br />bar there's the chance he'll modify the data somehow as he's translating.\n\nIs there a CSS solution (besides changing the width) to apply to an element which would break after every word?\n\n(I know I can do this in PHP, but I'm wondering if there's a nifty trick I don't know about in CSS to accomplish the same thing, perhaps in the CJK features.) \n\nEDIT\n\nI'll attempt to diagram what's happening:\n\n---------------- ----------------\n| Short Word | | Gargantuan |\n| | | Word |\n---------------- ----------------\n\n\nThe long word breaks automatically, the short word doesn't. I want it to look like this:\n\n---------------- ----------------\n| Short | | Gargantuan |\n| Word | | Word |\n---------------- ----------------"
] | [
"css",
"line-breaks"
] |
[
"How does return works in recursive batch function",
"So, I have this, that has recursion, (which is a plagiarised version of this code). I reworked it a little bit for own understanding\n@echo off\nset /A fst=0\nset /A fib=1\nset /A limit=1000\ncall :myFibo fib, %fst%, %limit%\necho The next Fibonacci number greater or equal %limit% is %fib%.\nexit /B 0\n:myFibo\nSETLOCAL\n echo begin of funct %1, %2, %3\n set /A Number1=%2\n set /A Number2=%1\n set /A Limit=%3\n set /A NumberN=Number1+Number2\n REM\n if %NumberN% LSS %Limit% call:myFibo NumberN, %Number2%, %Limit%\n(\n ENDLOCAL \n set %1=%NumberN%\n)\nexit /B 0\n\nthat gives following output:\nbegin of funct fib, 0, 1000\nbegin of funct NumberN, 1, 1000\nbegin of funct NumberN, 1, 1000\nbegin of funct NumberN, 2, 1000\nbegin of funct NumberN, 3, 1000\nbegin of funct NumberN, 5, 1000\nbegin of funct NumberN, 8, 1000\nbegin of funct NumberN, 13, 1000\nbegin of funct NumberN, 21, 1000\nbegin of funct NumberN, 34, 1000\nbegin of funct NumberN, 55, 1000\nbegin of funct NumberN, 89, 1000\nbegin of funct NumberN, 144, 1000\nbegin of funct NumberN, 233, 1000\nbegin of funct NumberN, 377, 1000\nbegin of funct NumberN, 610, 1000\nThe next Fibonacci number greater or equal 1000 is 1597.\n\nThere is a couple of things I don't understand:\n\nwhy fib and NumberN variables are passed without %% and are treated as strings when I echo them?\nwhat is the purpose of parentheses around ENDLOCAL and set?\nAs of my understanding NumberN variable should be undefined after ENDLOCAL, but it still can be used"
] | [
"batch-file",
"cmd"
] |
[
"Mobile website works on .com domain but not .se?",
"I have two domains that point to the same directory. If a mobile is detected it will show a mobile version of the site via PHP. This changes some of the HTML and the stylesheet.\n\nIf I go to \n\n\n maredovisning.com\n\n\nThe mobile version works without issues. However if I go to\n\n\n maredovisning.se\n\n\nThe mobile version is broken, it seems like the viewport is not working correctly but I am unsure as to what the actual issue is?"
] | [
"html",
"css",
"mobile",
"viewport"
] |
[
"read messages from JMS MQ or In-Memory Message store by count",
"I want to read messages from JMS MQ or In-memory message store based on count.\nLike I want to start reading the messages when the message count is 10, until that i want the message processor to be idle.\nI want this to be done using WSO2 ESB.\nCan someone please help me?\n\nThanks."
] | [
"jms",
"wso2",
"wso2esb",
"ibm-mq"
] |
[
"Android FragmentStatePagerAdapter - Missing view",
"I have created a set of horizontal tabs and for each tab content it has a View pager which in turn allows the content of the view to be swiped.\n\nI am currently harcoding this to 3 views in the adaptor and returning a new inner fragment which represents the detail whenever getItem() is called.\n\nThis works fine until I navigate to another tab and when I go back the middle view is missing, this happens on all of the tabs.\n\nWhen I look at the debugging I only ever see a call to getItem for positions 0 and 2, there is always a view missing though and so instead of the rendered view I just no layout there, if I swipe i get a another view.\n\nIf I dont click another tab but just keep swiping through the views in tab one which is the default then I dont lose a view, it seems to be only be when I have clicked to go to another tab and then back again. I never see a request for view in position 1 though, only ever 0 or 2.\n\nmy adaptor is an inner class of the fragment which represents the ViewPager and looks like:\n\npublic class HomeAddressDetailFragmentStatePageAdapter extends FragmentStatePagerAdapter {\n\n public HomeAddressDetailFragmentStatePageAdapter(FragmentManager fragmentManager) {\n super(fragmentManager);\n }\n\n @Override\n public int getCount() {\n return 3;\n }\n\n @Override\n public android.support.v4.app.Fragment getItem(int position) {\n Log.d(LOG_TAG, \"requesting tab view in position: \" + position);\n android.support.v4.app.Fragment fragment = null;\n\n fragment = new HomeAddressDetailFragment();\n\n return fragment;\n }\n}\n\n\nThe onCreate for the fragment:\n\npublic View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n // Inflate the layout for this fragment\n View rootView = (View)inflater.inflate(R.layout.fragment_home_addresses, container, false);\n HomeAddressDetailFragmentStatePageAdapter homeAddressDetailFragmentStatePageAdapter = new HomeAddressDetailFragmentStatePageAdapter(getFragmentManager());\n homeAddressViewPager = (ViewPager)rootView.findViewById(R.id.home_addr_pager);\n homeAddressViewPager.setAdapter(homeAddressDetailFragmentStatePageAdapter);\n\n return rootView;\n}\n\n\nAnd the xml for this fragment:\n\n<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"match_parent\">\n <android.support.v4.view.ViewPager xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:id=\"@+id/home_addr_pager\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:layout_weight=\"1\">\n\n </android.support.v4.view.ViewPager>\n</FrameLayout>"
] | [
"android",
"fragmentstatepageradapter"
] |
[
"ASP.net Ajax and Page Events",
"During Asynchronous postback (Ajax) will Page_PreInt() ,Page_Init(),Page_Load() events fire again?"
] | [
"asp.net",
"ajax"
] |
[
"What the signature of new String(byte bytes[])",
"I get error when calling the constructor of String.java from JNI.\n\nError:\n\n\n java.lang.NoSuchMethodError: no method with name='< init >' signature='([B)Ljava/nio/ByteBuffer;' in class Ljava/lang/String;\n\n\nJava:\n\nString str = new String(new byte[]{1, 2});\n\n\nJNI:\n\nconst char *CLS_STRING = \"java/lang/String\";\nconst char *MID_NEW_STRING = \"<init>\";\nconst char *SIG_NEW_STRING = \"([B)Ljava/lang/String;\"; // ????\n\n\nFind String.java class\n\nclsString = env->FindClass(CLS_STRING);\nif (clsString == NULL) {\n return JNI_ERR;\n}\n\n_clsString = (jclass) env->NewWeakGlobalRef(clsString);\nif (_clsString == NULL) {\n return JNI_ERR;\n}\n\n\nCall new String(byte[] b) method of String.java (Error in here, maybe signature wrong?)\n\n_midNewString = env->GetMethodID(_clsString, MID_NEW_STRING, SIG_NEW_STRING);\nif (_midNewString == NULL) {\n return JNI_ERR; // ERROR ini here\n}"
] | [
"java",
"android",
"constructor",
"java-native-interface"
] |
[
"if we apply if len(numbers)%2: and if numbers are coming odd then it will execute if block or else block",
"if len(numbers)%2:\n middle_index=len(numbers)//2\n return middle_index\n\nelse:\n middle_index=len(numbers)\n\n\nif the length of numbers is even then it will execute if block or else block?"
] | [
"python-3.x"
] |
[
"tkinter: why images are not dysplayed correctly",
"The code:\n\nfrom tkinter import *\n\nroot = Tk()\n\nf1=Frame(root)\nfor img,rlf in [ ('woman',RAISED),('mensetmanus',SOLID),\n ('terminal',SUNKEN), ('escherknot',FLAT),\n ('calculator',GROOVE),('letters',RIDGE)]:\n filename = img + \".gif\"\n img1 = PhotoImage(file= filename)\n Label(f1, image = img1, relief=rlf).pack(side=LEFT,\n padx=5)\nf1.pack()\n\nroot.mainloop()\n\n\nCould you help me understand why this excerpt produces 5 empty places for images (though borders are drawn correctly according to what was meant), and 1 image. The last image (which is visible) is letters. And it seems to be cropped from than its actual size. My letters.gif contains letters from A to G, but this code displays only from half B to half F."
] | [
"python",
"python-3.x",
"tkinter"
] |
[
"HTML size - computed size?",
"I am confused by the size of the <html> reported by Chrome browser.\nI am working in full-screen with screen resolution 1360x768. I use this css to put the full screen image on the background:\n\nbg-img { position:absolute; top:0; left:0; width:1360px; height:768px; }\n\n\nUnfortunately this doesn't show up the image on full screen, and is smaller. I go for the inspect element on <html> markup and see size like 1790 x 768. Computed size reported by Chrome:\n\ndisplay: block;\nheight: 768px;\nwidth: 1790.6666259765625px;\n\n\nWhat I found this works OK in --chrome-frame mode (width: 1360px, but have another problem with extensions so cant use that)\n\nWhat is going on?\n\n\n\nThe solution with % even if works OK for background image, doesn't solve my problem because I have other absolute elements on this background and I can't position them with %, because it is not enough precise.\n\n\n\nI though that maybe reported 1790.6666259765625px is caused by my extended desktop and 2'nd monitor, but after disabling the same problem."
] | [
"javascript",
"html",
"css",
"dom"
] |
[
"Replicating this tile using CSS3 Tranformations",
"I am trying to create a isometric tile engine just using <div> tags.\n\nI've seen numerous isometric tiling engines for HTML5 but they are either poorly documented nor what I expected them to be (i.e. most are asking me to download freeware to develop on).\n\nI'm trying to replicate this image in CSS3:\n\n\n\nWhen trying to transform: rotate(deg) a div in CSS, I noticed that this tile is not equilateral, so the div box surpassed the image:\n\n\n\nCan anybody shed some light on this?"
] | [
"html",
"css"
] |
[
"How to convert a dynamic url to a secure one",
"I have urls similar to this\n\n http://www.somewebsite.com/sub-category/?q=1\n\n http://www.somewebsite.com/products/?q=1\n\n http://www.somewebsite.com/product/?q=61\n\n\nbut i need to change the url to more secure one so that no one can type some other number and get a product with another id or I dont want anyone to see ?q=1. Someone Please help me. \n\nThanks in advance"
] | [
"php",
"user-interface"
] |
[
"Get JSON data from Controller to Dropdown in View",
"I am new to MVC and do not know how to solve this problem.\n\nIn a controller I have a list (filled with Api data) serialized to JSON, I need to use this JSON data do populate a dropdown in a View.\n\nI am confused as to what should I return from the controller, what should I be doing next, am I doing this right?\n\nFor now I have this:\n\nModel:\n\npublic class Tablet { \n public int Id { get; set; }\n public string ManufactureDate { get; set; }\n public string Description { get; set; }\n public string Country { get; set; }\n}\n\n\nDataController.cs\n\n Public ActionResult GetData(Tablet tablet)\n {\n List<Tablet> data = new List<Tablet>();\n\n // ... Code to retrieve the data from API\n\n string jsonRes = JsonConvert.SerializeObject(data);\n\n return View(jsonRes);\n }\n\n\nIn the view I need to show the ID in a dropdown:\n\nView.cshtml\n\n<select class=\"dropdown\" id=\"dropdownData\"></select>\n\n<script>\n$(document).ready(function () {\n $.ajax({\n url: \"/Data/GetData/\",\n type: 'GET',\n success: function (jsonRes) {\n console.log(jsonRes[i]);\n var s = '<option value=\"-1\">Please Select</option>';\n for (var i = 0; i < jsonRes.length; i++) {\n s += '<option value=\"' + jsonRes[i].Id+ '\">' + '</option>';\n }\n $(\"#dropdownData\").html(s);\n }\n });\n}); \n</script>"
] | [
"c#",
"json",
"model-view-controller",
"dropdown"
] |
[
"allocate text value submitted by a form to a variable after clicking submit button",
"I want to store the text value submitted by clicking the submit button of a form, in a variable, so that I can use that variable for further querying the DB.\n\nMy Code:\n\n<?\nif($submit)\n {\n mysql_connect(\"localhost:3036\",\"root\",\"root\");//database connection\n mysql_select_db(\"sync\");\n $order = \"INSERT INTO country (id,country) VALUES ('44','$submit')\";\n $result = mysql_query($order); \n if($result){\n echo(\"<br>Input data is succeed\");\n } else{\n echo(\"<br>Input data is fail\");\n}\n}\n\n?>\n\n<html>\n<title>form sumit</title>\n\n<body>\n<form method=\"post\" action=\"\">\n<input type=\"text\" name=\"id\" value=\"<?=$submit;?>\"/>\n<input type=\"Submit\" name=\"submit\" value=\"Submit\">\n</form>\n\n</body>\n</html>\n\n\n//In real case, the form has elements with radio button containing values from a DB QUERY,\nI wanted to use the selected item from the form to process another DB query in the same page...\n\nThanks in Advance"
] | [
"php",
"javascript",
"html"
] |
[
"how to navigate between selectors that don't have a selector using next / previous",
"I have a dropdown which I'm trying to make into something like a google suggest. I looked at jQuery Autocomplete but I wanted to see if I coudl make our \ncurrent solution work (done by a different developer). We are populating a autocomplete-results dropdown like the following:\n\n<ul id=\"autocomplete-results\">\n <li class=\"auto-li category\">TAGS</li>\n <li class=\"auto-li\">red wine</li>\n <li class=\"auto-li\">french wine</li>\n <li class=\"auto-li category\">LOCATIONS</li>\n <li class=\"auto-li\">Joe's Restaurant</li>\n <li class=\"auto-li\">Noodle Express</li>\n</ul>\n\n\nand this renders fine. Where there is a keydown event, checkKey is run. The logic I would like to have is that it goes to the first auto-li class which doesn't have a category class.\nBut navigating with this not syntax isn't working correctly. This is just a syntax issue as removing category causes everything to work ok. \n\nHow would I make it so that it is able to jump from 'red wine' to Joes Restaurant? \n\ndocument.onkeydown = checkKey;\n....\nfunction checkKey(e){\nif(e.keyCode==40){\n if($('.auto-li-hover').length > 0){\n var $that=$('.auto-li-hover');\n $that.next('.auto-li:not(.category)').addClass('auto-li-hover')\n $that.removeClass('auto-li-hover');\n }else{\n //alert('NO auto-li-hover');\n // ###\n $('.auto-li:first:not(.category)').addClass('auto-li-hover'); // this doesn't add this class correctly\n }\n}"
] | [
"jquery"
] |
[
"Month and Year picker in MaterialUI ReactJS",
"Is there any way to implement a month Picker and year picker using material UI.\nIn month view the output should be like only month and the year only Eg:- 2020-09"
] | [
"reactjs",
"date",
"datetime",
"material-ui"
] |
[
"Cross compiling my c python extension for kodi / xbmc android",
"I need to compile my c extension that is invokable by python in kodi. Can anyone please list the steps involved. I think I have actually cross compiled the c extension but it wouldn't work with kodi."
] | [
"python",
"xbmc",
"python-c-extension",
"kodi"
] |
[
"docker host port and container port",
"I am running a database container. I know to inspect port mappings, I can use command docker port <container_id or name>. So, I tried that command:\n\n$docker port ea72b2c4ba47\n3306/tcp -> 127.0.0.1:3666\n\n\nI see the output, but which one means the port used by host machine and which one is the port of container?"
] | [
"docker",
"dockerfile",
"docker-machine"
] |
[
"SQL Server Group By Month",
"I have a table which has this schema\n\nItemID UserID Year IsPaid PaymentDate Amount\n1 1 2009 0 2009-11-01 300\n2 1 2009 0 2009-12-01 342\n3 1 2010 0 2010-01-01 243\n4 1 2010 0 2010-02-01 2543\n5 1 2010 0 2010-03-01 475\n\n\nI'm trying to get a query working which shows the totals for each month. So far I've tried DateDiff and nested selects, but neither gives me what I want. This is the closest I have I think:\n\nDECLARE @start [datetime] = 2010/4/1;\nSELECT ItemID, IsPaid,\n(SELECT SUM(Amount) FROM Payments WHERE Year = 2010 And DateDiff(m, PaymentDate, @start) = 0 AND UserID = 100) AS \"Apr\",\n(SELECT SUM(Amount) FROM Payments WHERE Year = 2010 AND DateDiff(m, PaymentDate, @start) =1 AND UserID = 100) AS \"May\",\n(SELECT SUM(Amount) FROM Payments WHERE Year = 2010 AND DateDiff(m, PaymentDate, @start) =2 AND UserID = 100) AS \"Jun\", \n(SELECT SUM(Amount) FROM Payments WHERE Year = 2010 AND DateDiff(m, PaymentDate, @start) =3 AND UserID = 100) AS \"Jul\", \n(SELECT SUM(Amount) FROM Payments WHERE Year = 2010 AND DateDiff(m, PaymentDate, @start) =4 AND UserID = 100) AS \"Aug\", \n(SELECT SUM(Amount) FROM Payments WHERE Year = 2010 AND DateDiff(m, PaymentDate, @start) =5 AND UserID = 100) AS \"Sep\", \n(SELECT SUM(Amount) FROM Payments WHERE Year = 2010 AND DateDiff(m, PaymentDate, @start) =6 AND UserID = 100) AS \"Oct\", \n(SELECT SUM(Amount) FROM Payments WHERE Year = 2010 AND DateDiff(m, PaymentDate, @start) =7 AND UserID = 100) AS \"Nov\", \n(SELECT SUM(Amount) FROM Payments WHERE Year = 2010 AND DateDiff(m, PaymentDate, @start) =8 AND UserID = 100) AS \"Dec\", \n(SELECT SUM(Amount) FROM Payments WHERE Year = 2010 AND DateDiff(m, PaymentDate, @start) =9 AND UserID = 100) AS \"Jan\", \n(SELECT SUM(Amount) FROM Payments WHERE Year = 2010 AND DateDiff(m, PaymentDate, @start) =10 AND UserID = 100) AS \"Feb\", \n(SELECT SUM(Amount) FROM Payments WHERE Year = 2010 AND DateDiff(m, PaymentDate, @start) =11 AND UserID = 100) AS \"Mar\" \nFROM LIVE L INNER JOIN Payments I ON I.LiveID = L.RECORD_KEY \nWHERE UserID = 16178 \n\n\nBut I just get nulls when I should be getting values. Am I missing something?"
] | [
"sql",
"sql-server-2008",
"datediff"
] |
[
"Widget Preferences \"delay\" problem",
"I have a Widget with his android.appwidget.action.APPWIDGET_CONFIGURE Activity with some preferences witch I can set before adding it to the \"desktop\".\n\nMy problem is that the preferences does not get applied because I noticed that as soon as the APPWIDGET_CONFIGURE is called, the widget is created and never refresh after the widget is actually applied to the screen and it actually never reads the updated preferences.\n\nAny thoughts?\n\nThanks\n\nOh, I think I found what it seems to be an easy solution but I don't like it much so I like to have a \"second opinion\". I don't say what it is to not influence the answers.\n\nPS. The configuration activity works fine, the problem is only when the widget is applied for the first time."
] | [
"android",
"android-widget",
"preferences"
] |
[
"Minimum length subarray having MEX greater than or equal to k",
"An array A of size N is given. Find the minimum subarray whose MEX value is greater than or equal to K.\nMEX: Minimum Excluded Value\nI just wanted to understand the algorithm to solve it."
] | [
"arrays",
"data-structures"
] |
[
"jquery ajax response + function calling process in different AppDomain",
"From my asp.net web app I'm calling a WebMethod in a WebService on button click using jquery ajax. This webmethod starts a process on the server in a different AppDomain. When the process is started without switching to another AppDomain the jquery ajax response is received accordingly after 2 milliseconds, however when the process is in another AppDomain the response is never received and Success is never reached although the process is triggered successfully, and this causes other functions to also get delayed. Any idea what could be causing this issue please? \n\nfunction startTests() {\n $.ajax({\n url: \"DataServices/DataServices.asmx/startTests\",\n dataType: \"text\",\n type: \"POST\",\n data: {},\n success: function (data) {\n\n showWarning(\"Started Test Execution\", 5000);\n\n }\n });\n\n}"
] | [
"c#",
"jquery",
"asp.net",
"ajax",
"appdomain"
] |
[
"What should I use in place of SetTexture from d3d9, in case of d3d11?",
"I have multiple textures and I have to use them into stages in d3d11. SetTexture is used in case of d3d9, but what should I use in d3d11?"
] | [
"directx"
] |
[
"How can I use a bundled font in a WebView with React Native on iOS?",
"In my React Native app I have some information I have stored in a local bundled folder and that I display in a WebView. I want this to work consistently with the rest of the app, so I need to use the same fonts as I use through the rest of the app.\nI have this working correctly in Android, but in iOS I can't make it show the fonts at all.\nMy Webview Screen looks like this:\nexport class InstructionView extends React.Component<InstructionScreenRouteProp> {\n\nrender(): JSX.Element {\n \n let filePath = (Platform.OS === 'android') ? 'file:///android_asset/' : './html/';\n filePath += this.props.route.params.file.file + '.html';\n\n return (\n <WebView\n originWhitelist={['*']}\n source={{ baseUrl:'',\n uri: filePath }}\n startInLoadingState = { true }\n />\n );\n}\n}\n\nMy bundle is structured like this:\n/html/instructions.html\n/html/styles.css \n/Resources/MyFont-Regular.ttf\n\nAnd then the css file font declaration looks like this:\n@font-face {\n font-family: 'myFont';\n src: local('MyFont-Regular'), url('MyFont-Regular.ttf'), format('truetype');\n}\n\nh1 {\n font-family: 'myFont';\n font-size: 2em;\n background-color: #622a53;\n color: #fffcdc;\n padding: 0.5em;\n}\n\nI don't think the font would currently work on Android because I've been trying to figure out the iOS version of it, but I have had it working on Android previously by using the explicit path, much like the file path in the render function.\nThe html is loaded and rendered correctly, the other styles from the stylesheet are applied, it is only the font that is missing.\nI have seen various suggestions around this in different places, but none of them satisfy me because they seem to rely on placing the font in the same folder as the html content or even encoding it in the stylesheet, which seems redundant when I already have it included in the app bundle elsewhere. I have tried a lot of different paths in the font-face url and none of them seemed to work, but because of the way React silently caches assets it can be hard to know if I actually saw all the things I tried.\nWhat do I need to do to be able to use an existing font in a WebView on an iOS device?"
] | [
"ios",
"react-native",
"web",
"webview"
] |
[
"Erase an element in vector, which is allocted using 'new' operator",
"please help me understand this case:\n\nI am working in a project of storing data to a vector of struct, my goal is to keep them alive until I call a function to work with the data, then erase them in the queue. But my problem is I don't know how to safely erase the element in vector if I allocate the struct using new operator.\n\nExample:\n\n\n//definition of truct\nstruct MData {\n int dHeight;\n int dWidth;\n};\n\n//definition of queue\nstd::vector< MData* > dataQueue;\n\n\nThis is how I store data in the queue:\n\n//when got the data\nMData* mData = new MData; \nmData->dHeight = sourceHeight;\nmData->dWidth = sourceWidth;\n\n//Then put it in the queue\ndataQueue.push_back( MData);\n\n\nAfter calculating, I want to erase the first element in the queue\n\nSo what method should I use: delete dataQueue.front()? to free the memory. Or using dataQueue.erase(dataQueue.front())?\n\nThank you in advance."
] | [
"c++",
"memory-management",
"vector",
"struct"
] |
[
"How should I maintain my object modules in Perl?",
"I'm writing some object module in Perl using Moose. I use to store instances of created objects then use them.\n\nThe basic representation of my object's data remains the same, but from time to time I add more functionalities - e.g. class methods or object methods.\n\nCan I continue using my stored objects, which were created with an earlier version of the module, with the new functionalities? Or must I create the objects again every time I change the module?\n\nWhat is the common paradigm for developing an object module where the basic data structure does not change but functionalities do?"
] | [
"perl",
"object",
"module",
"backwards-compatibility",
"moose"
] |
[
"Strange nodejs behavior",
"In my package.json I haved a records for one binary - flow-bin. \n\n\"flow-bin\": \"^0.22.1\" \ninto \"devDependencies\" and\n \"flow\": \"flow; test $? -eq 0 -o $? -eq 2\" \ninto \"scripts\". \n\nI uninstalled flow bin package and there is no \"flow-bin\" into devDependencies and removed value from scripts but \n\nnpm run-script flow --version\n\n\nstill working. How I can return to previous state - before installing? \n\nI delete node_modules directory:\n\nrm -r node_modules/\n\n\nand do npm install again but it still working. What to do? \n\nwithout nodejs the output is \"normal\" - what must to be:\n\nflow --version\nbash: /usr/bin/flow: No such file or directory\n\nafter new invocation of npm install there is nothing from flow into node_modules."
] | [
"node.js"
] |
[
"Does MySQL have the concept of \"this\" database?",
"When writing a query, can I reference the current database's name, sort of like with the this keyword in Java? I am writing a script that I will run against several similar databases, and I need to query the information_schema.KEY_COLUMN_USAGE table with the CONSTRAINT_SCHEMA column in my WHERE clause."
] | [
"mysql"
] |
[
"firebase function with custom domain name in Europe",
"I am familiar with cloud functions and custom domain names. But this only works for us-central1.\nAs stated on this page for more information\n\n\n Important: If you are using HTTP functions to serve dynamic content\n for Firebase Hosting, you must use us-central1.\n\n\nFirebase evolved over time, 3 years ago everything was in us-central, now it's possible to run Firestore and Cloud Functions in Europe. \n\nBut sadly the custom domain name for cloud functions is only supported for us-central1. Does anybody know how to get this done for other regions?\n\nIs there such support in the Google Cloud Platform?"
] | [
"firebase",
"google-cloud-platform",
"google-cloud-functions",
"firebase-hosting"
] |
[
"t string error in if statement in function",
"I keep getting this error:\n\nPHP Parse error: syntax error, unexpected T_STRING\n\nFor this line:\n\nif($email_addr == \"\") /* If real email not found, return FALSE*/\n\n\nI can't figure out what is wrong and tried so many things and researched for two days with no correction. I wonder if anyone else can see what I am doing wrong. Why am I getting this error? Thank you. (the function is below)\n\n function searchRecipient() // function to search the database for the real email\n{\n global $MessageSentToMailbox; // bring in the alias email\n $email_addr = mysql_query(\"SELECT email FROM tbl WHERE source='$MessageSentToMailbox'\"); // temp store of the real email\n $row = mysql_fetch_assoc($email_addr); //making temp store of data for use in program\n if($email_addr == \"\") /* If real email not found, return FALSE*/\n {\n return FALSE;\n }\n else /* Else, return find the person's name and return both in an array */\n {\n $query = \"SELECT * FROM tbl WHERE email = '$email_addr'\"; // pulling in the row where the emails match\n $results = mysql_query($query, $email_addr); // temp store of both queries from this function\n $row = mysql_fetch_assoc($results); //making temp store of data for use in program\n $name = $row['author']; // taking the author data and naming its variable\n return array($name, $email_addr); // this is the name and the real email address to be used in function call\n }\n}"
] | [
"php",
"mysql"
] |
[
"localhost/test/web_root/ is ok but localhost/test/web_root/index not found in zend framework",
"i create zend structure following\n\n -test\n -application\n -controllers\n -modules\n -views\n -filters\n -helpers\n -scripts\n -index\n -user\n -library\n +zend //zend file or modules\n -web_root\n -css\n -img\n -js\n .htaccess\n index.php\n\n\ncode in ./test/web_root/ \n\n.htaccess\n\n RewriteEngine On\n RewriteRule .* index.php\n\n\nand index.php code is\n\n <?php\n error_reporting(E_ALL|E_STRICT);\n ini_set('display_errors', true);\n date_default_timezone_set('Europe/London');\n\n $rootDir = dirname(dirname(__FILE__));\n set_include_path($rootDir . '/library' . PATH_SEPARATOR . get_include_path());\n\n require_once 'Zend/Controller/Front.php';\n Zend_Controller_Front::run('../application/controllers');\n\n ?>\n\n\ncode in ./test/application/controllers\n\nIndexController.php code is\n\n <?php\n require_once 'Zend/Controller/Action.php';\n\n class IndexController extends Zend_Controller_Action\n {\n public function indexAction()\n {\n $this->view->assign('title', 'Hello, World!');\n $this->view->assign('wellcome','Wellcome to my site.');\n $this->view->assign('webmaster','Wiwit');\n }\n\n }\n ?>\n\n\nand UserController.php\n\n<?php\n require_once 'Zend/Controller/Action.php';\n\n class UserController extends Zend_Controller_Action\n {\n public function indexAction()\n {\n $this->view->assign('name', 'Wiwit');\n $this->view->assign('title', 'Hello');\n }\n\n public function nameAction()\n {\n $this->view->assign('name', 'Wiwit');\n $this->view->assign('title', 'User Name'); \n } \n\n }\n\n\n?>\n\ncode in ./test/application/views/scripts/index\n\nindex.phtml\n\n <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhmtl\">\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n <title><?php echo $this->escape($this->title); ?></title>\n </head>\n <body>\n <h1><?php echo $this->escape($this->title); ?></h1>\n <?=$this->escape($this->wellcome);?>\n <p>&nbsp;</p>\n <?=$this->escape($this->webmaster);?>\n </body>\n </html>\n\n\ncode in ./test/application/views/scripts/user\n\nindex.phtml\n\n <html xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <title><? echo $this->escape($this->title); ?></title>\n </head>\n\n <body>\n <h1><?=$this->escape($this->title);?>, <?=$this->escape($this->name);?></h1>\n </body>\n </html>\n\n\nsimilar problem not found url\n\n localhost/test/web_root/user"
] | [
"zend-framework"
] |
[
"dropped connection with TLS",
"I have this command which is connecting to a TLS server:\n\nopenssl s_client -connect ec2-xx-xx-xx-xx.us-west-1.compute.amazonaws.com:4004 -reconnect -CAfile ryans-cert.pem\n\n\nI get about 4 of these messages:\n\ndrop connection and then reconnect\nCONNECTED(00000005)\n\n\nand then it will finally connect.\nAnybody know why it has to re-try a few times?"
] | [
"ssl",
"https",
"openssl"
] |
[
"How do you get JQuery to work with Rails 6 and Webpacker 6",
"I really cant believe that getting JQuery to work with Rails 6 and Webpacker 6 can be so hard.\nSuggestions in Rails 6: How to add jquery-ui through webpacker? don't appear to have worked but hard to know if it is the same code stack.\nI am using Rails 6.1 and a pre-release version of Webpacker 6.0 to get Heroku to play nicely. Oh, and most of my "Javascript" is in .coffee files.\nI even tried renaming application.js to application.coffee and reformatting but that didnt work either.\nMy Gemfile has\ngem 'webpacker', '~> 6.0.0.beta.6'\n\nI have done the following"\nyarn add jquery jquery-ui-dist jquery-blockui\n\nThen in webpacker 6 style configured as follows:\n# config/webpacker/base.js\nconst { webpackConfig, merge } = require('@rails/webpacker')\n\nconst customConfig = require('./custom')\n\nmodule.exports = merge(webpackConfig, customConfig)\n\n# config/webpacker/custom.js\nmodule.exports = {\n resolve: {\n alias: {\n jquery: 'jquery/src/jquery',\n jquery_ui: 'jquery-ui-dist/jquery-ui.js'\n }\n }\n}\n\nand\n# code/app/packs/entrypoints/application.js\n\nglobal.$ = require("jquery")\nrequire("jquery") // Don't really need to require this...\nrequire("jquery-ui")\nrequire("jquery-ui-dist/jquery-ui")\n\nThis is all a mish-mash of attempts from a number of sources including this post - Rails 6: How to add jquery-ui through webpacker?, https://github.com/rails/webpacker and others.\nBy the way, I am trying to migrate my Coffescript from Rails 5 and so this makes extensive use of the JQuery $ global.\nAny help much appreciated."
] | [
"javascript",
"jquery",
"ruby-on-rails",
"webpack",
"coffeescript"
] |
[
"Trend line in line chart next to input line chart",
"I cannot figure out why a trend is drawn next to input serie chart. The trend curve should be plotted through the existing data (first serie) and extend 1 month ahead. Instead, it starts where the input serie ends and continues (see the orange dashed line):\n\n\n\nThe code I use for creating the trend line is following\n\n' do stuff for series (0) and (1)....\n' databind before creating trend curve........\nMe.Chart4.DataBind()\n' trend ----------------------\nMe.Chart4.Series.Add(\"TrendCurve\")\nMe.Chart4.Series(\"TrendCurve\").ChartType = DataVisualization.Charting.SeriesChartType.Spline\nMe.Chart4.Series(\"TrendCurve\").BorderWidth = 3\nMe.Chart4.Series(\"TrendCurve\").BorderDashStyle = DataVisualization.Charting.ChartDashStyle.Dash\nMe.Chart4.Series(\"TrendCurve\").IsVisibleInLegend = False\n' ************* calculate trend line **************\nMe.Chart4.DataManipulator.FinancialFormula(\n DataVisualization.Charting.FinancialFormula.Forecasting,\n \"Exponential,1,false,false\", \n Me.Chart4.Series(\"Performance\"), \n Me.Chart4.Series(\"TrendCurve\"))\n\n\nAlso, the trend \"curve\" appears as line, although I selected \"exponential\" and I'd expect it to be slightly curved...\n\nEDIT: I tried to fill the first dataset point by point instead by a dataset (because examples show it this way), but as I expected, it had no effect."
] | [
"vb.net",
"charts",
"trendline"
] |
[
"Connect to SSH using paramiko throue TOR",
"I want know how to add TOR / PROXY to this connection:\n\ndef check_server(host, user, password, port=22):\n ssh = paramiko.SSHClient()\n ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())\n\n #FAILED APPROCH\n #proxy = paramiko.ProxyCommand(\"127.0.0.1:9010\")\n\n if is_work_sshd(host,port):\n return 2\n\n try:\n ssh.connect(host, username=user, password=password, port=port)\n ssh.close()\n except:\n return 1\n\n return 0\n\n\nI made google search lot of time but didn't found any answer to this question !\nAnd there is any way to do it with PHP even with PHPSECLIB :(\n\nIf you have answer with python you're welcome :)"
] | [
"python",
"paramiko"
] |
[
"How can i pass the hidden field value of another page?",
"Hi I have here a simple representation of the page I want to do.\n\n\n\nI want to get the hidden field values of page2.aspx and pass it to the label of page1.aspx using c#.\n\nCan you guys help me tnx :)"
] | [
"c#",
"html",
"asp.net"
] |
[
"How to build a Fluent Nested Guard API",
"I am building a simple Guard API to protect against illegal parameters being passed to functions and so on.\n\nI have the following code:\n\npublic static class Guard\n{\n public static GuardArgument<T> Ensure<T>(T value, string argumentName)\n {\n return new GuardArgument<T>(value, argumentName);\n }\n}\n\npublic class GuardArgument<T>\n{\n public GuardArgument(T value, string argumentName)\n {\n Value = value;\n Name = Name;\n }\n\n public T Value { get; private set; }\n public string Name { get; private set; }\n}\n\n// Example extension for validity checks\npublic static GuardArgument<T> IsNotNull<T>(this GuardArgument<T> guardArgument, string errorMessage)\n{\n if (guardArgument.Value == null)\n {\n throw new ArgumentNullException(guardArgument.Name, errorMessage);\n }\n\n return guardArgument;\n} \n\n\nAt the moment the code can be used in a similar way to (note this is just a dumb example):\n\nvoid DummyMethod(int? someObject) {\n\n Guard.Ensure(someObject, \"someObject\")\n .IsNotNull()\n .IsGreaterThan(0)\n .IsLessThan(10);\n}\n\n\nThis all works fine. What I want to be able to do now is extend the API to include child properties in the checks in the following way:\n\nGuard.Ensure(someObject, \"someObject\")\n .IsNotNull()\n .Property(\n (x => x.ChildProp1, \"childProp1\")\n .IsNotNull()\n .IsGreaterThan(10)\n )\n .Property(\n (x => x.ChildProp2, \"childProp2\")\n .IsNotNull()\n .IsLessThan(10)\n );\n\n\nObviously the new .Property method needs to return the parent GuardArgument in order to chain. Furthermore the child property needs to be able to use the existing check methods (IsNotNull() etc) to avoid code duplication.\n\nI cannot work out how to construct the lambda/Property function parameters or where the .Property method should be located - i.e. should it be a property on the GuardArgument or somewhere else, or even if there is a better structure to the API."
] | [
"c#",
"lambda",
"fluent"
] |
[
"Deserialize object passed as abstract class by SignalR",
"I have a WebAPI server that has a Hub that replies to Subscribe requests by publishing an Dictionary<long, List<SpecialParam>> object.\n\nThe list of SpecialParam contains items of type SpecialParamA & SpecialParamB which both inherit SpecialParam.\n\nWhen I try to capture the publish on the client:\n\nhubProxy.On<Dictionary<long, List<SpecialParam>>>(hubMethod, res =>\n{\n DoStuff();\n});\n\n\nThe DoStuff() method isn't called. If I change the publish return value to string, and change the proxy to receive a string value, the DoStuff() method is called. Therefore, the problem is with the deserialization of the SpecialParam Item.\n\nI tried configuring on the server-side:\n\nvar serializer = JsonSerializer.Create();\nserializer.TypeNameHandling = TypeNameHandling.All;\nvar hubConfig = new HubConfiguration();\nhubConfig.Resolver.Register(typeof(JsonSerializer), () => serializer);\nGlobalHost.DependencyResolver.Register(typeof(JsonSerializer), () => serializer);\n\n\nBut it didn't help.\n\nI also tried adding to the client:\n\nHubConnection hubConnection = new HubConnection(hubPath);\nhubConnection.JsonSerializer.TypeNameHandling = Newtonsoft.Json.TypeNameHandling.Auto;\nhubProxy = hubConnection.CreateHubProxy(hubName);\nhubProxy.JsonSerializer.TypeNameHandling = Newtonsoft.Json.TypeNameHandling.Auto;\n\n\nAnd it also didn't help.\n\nIn other solutions I found that people defined a new IParameterResolver, but it is only called when the server receives the input to the hub method, and not when the output is published from the hub.\n\nPlease help!\n\nUPDATE\n\nHere is what I caught with fidler:\n\n{\"$type\":\"Microsoft.AspNet.SignalR.Hubs.HubResponse, Microsoft.AspNet.SignalR.Core\",\"I\":\"0\"}\n\n\nThis is what the server replies to the client.\n\nUPDATE 2\n\nI'm still trying to figure out how to receive it already deserialized as Dictionary<long, List<SpecialParam>>."
] | [
"c#",
"asp.net-web-api",
"json.net",
"signalr"
] |
[
"Redirect to home page after login using \"login with facebook\" :Javascript",
"I am using \"login with facebook\" in my application. I want to redirect to home page after hitting the \"Login with facebook\" button. I dont know how to implement it...\n\nCode is,\n\n <script>\n window.fbAsyncInit = function() {\n FB.init({\n appId : 'APP ID', // App ID\n channelUrl : 'http://www.***.com/', // Channel File\n status : true, // check login status\n cookie : true, // enable cookies to allow the server to access the session\n xfbml : true // parse XFBML\n });\n\n // Load the SDK Asynchronously\n (function(d){\n var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];\n if (d.getElementById(id)) {return;}\n js = d.createElement('script'); js.id = id; js.async = true;\n js.src = \"js/all.js\";\n ref.parentNode.insertBefore(js, ref);\n }(document));\n </script>\n\n\n<div id=\"fb-root\"></div>\n <div class=\"fb-login-button\" data-show-faces=\"true\" data-width=\"200\" data-max-rows=\"1\"></div>\n\n\nPlease help,\n\nThanks"
] | [
"javascript",
"facebook"
] |
[
"Erase elements from multimap, based on key values?",
"How would I erase all elements from an std::multimap who have a key less than or equal to 20?\n\nI know how to erase, I don't know how to pass in the condition \"key less than 20\"."
] | [
"c++",
"c++11",
"dictionary",
"stl"
] |
[
"HTML Autocomplete (or Emmet or ZenCoding) in Visual Studio 2019 Enterprise does not work when editing JSX. (NOT VS Code)",
"I am using Visual Studio 2019 Enterprise, in HTML files the "emmet" functionality works fine.\nBut in React projects, when I want to write JSX codes it does not work.\nIs there any solution for it?"
] | [
"reactjs",
"autocomplete",
"visual-studio-2019",
"jsx",
"emmet"
] |
[
"What are some best practices and \"rules of thumb\" for creating database indexes?",
"I have an app, which cycles through a huge number of records in a database table and performs a number of SQL and .Net operations on records within that database (currently I am using Castle.ActiveRecord on PostgreSQL).\n\nI added some basic btree indexes on a couple of the feilds, and as you would expect, the performance of the SQL operations increased substantially. Wanting to make the most of dbms performance I want to make some better educated choices about what I should index on all my projects.\n\nI understand that there is a detrement to performance when doing inserts (as the database needs to update the index, as well as the data), but what suggestions and best practices should I consider with creating database indexes? How do I best select the feilds/combination of fields for a set of database indexes (rules of thumb)?\n\nAlso, how do I best select which index to use as a clustered index? And when it comes to the access method, under what conditions should I use a btree over a hash or a gist or a gin (what are they anyway?)."
] | [
"database",
"database-design",
"indexing"
] |
[
"which database to use for android app",
"how can I deploy android application to receive notifications when the online database is changed?\n\nUsing a database phpmysql, how can I communicate this with my android app? Thank you all for the safe response"
] | [
"android",
"database",
"android-intent"
] |
[
"Partially specializing template class in c++",
"I've got a template class:\n\ntemplate <typename T> struct randimpl {\n // default is to not compile, have to pass T to something to get assert\n // evaluated during second phase expansion, is_void is an arbitrary choice.\n static_assert(\n std::is_void<T>::value && false, \"random() not implemented for type\"\n );\n};\n\n\nThis is just a proxy for a random() function that can be overloaded for user-defined types:\n\n// random function, proxies request through randimpl\ntemplate <typename T> T random() {\n return randimpl<T>::random();\n}\n\n\nWhich I'm trying to partially specialize for a type _point1d<T>:\n\n// generate random instances _point1d<T>\ntemplate <typename T>\nstruct randimpl<_point1d<T>> {\n static _point1d<T> random() {\n return _point1d<T>(random<T>());\n }\n};\n\n\nWhich as far as I can tell is the appropriate syntax, but when I compile, I get:\n\ninc/geometry.h: In static member function ‘static _point1d<T> randimpl<_point1d<T> >::random()’:\ninc/geometry.h:287:31: error: expected primary-expression before ‘(’ token\n return _point1d<T>(random<T>());\n ^\ninc/geometry.h:287:40: error: expected primary-expression before ‘>’ token\n return _point1d<T>(random<T>());\n ^\ninc/geometry.h:287:42: error: expected primary-expression before ‘)’ token\n return _point1d<T>(random<T>());\n\n\nIs my syntax off? This seems like it should work, but I don't understand why it's not accepting it."
] | [
"c++",
"c++11",
"templates"
] |
[
"Firebase iOS SDK Crashing with FIRInstallations validateAppOptions:appName",
"I am using Firebase to develop iOS app on Flutter,\n\nMy pubsec.yaml file has\n\n firebase_core: 0.4.3+3\n firebase_auth: ^0.14.0+5\n firebase_database: ^3.1.1\n\n\nBelow is the error I get,\n\n*** First throw call stack:\n(\n 0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350\n 1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48\n 2 CoreFoundation 0x00007fff23c710bc +[NSException raise:format:] + 188\n 3 Runner 0x0000000106000e9f +[FIRInstallations validateAppOptions:appName:] + 799\n 4 Runner 0x00000001060009eb -[FIRInstallations initWithAppOptions:appName:installationsIDController:prefe<…>"
] | [
"ios",
"firebase",
"flutter",
"firebase-realtime-database"
] |
[
"java - one object updating another",
"Let's say I have a jframe class that contains a button and a label. Label displays number of times I've clicked the button. I created 2 objects of this class. Now, I want the first object to update both its own label, and the second object's label immediately as I press the button. How would I go about doing that? Is it possible to make a static variable and some kind of variable listener which would update the label on variable value change?"
] | [
"java",
"swing"
] |
[
"implement a button in table, when clicked, open a dialog box, displays the values of a specific cell as Dropdown/ checkbox button",
"So I want to implement a button for each row in my table. \n\nNow, The functionality that I want my button to provide is: \n\nCLICK -> OPENS A DIALOG BOX -> DISPLAY THE VALUE FROM A SPECIFIC CELL (which is in the same row as the button) -> DISPLAYS THE VALUES AS A DROPDOWN OR CHECKBOX BUTTONS.\n\nThe value in the cell are being populated by using ResultSet.getString method taking the values from a database.\n\nThanks."
] | [
"java",
"jquery",
"oracle",
"sqlplus"
] |
[
"PHPmailer sends to junk email",
"I've just updated a contact form to use PHPMailer to stop emails being marked as junk, with no luck. \n\nIt's a fairly straight forward setup I'm using but its still going into peoples junk mail.\n\nHere is my script, I was wondering if anyone could tell what was wrong?\n\ninclude_once('../inc/phpmailer/class.phpmailer.php');\n\n$mail = new PHPMailer();\n\n$name = $_POST['name'];\n$email = $_POST['email'];\n$body = \"Name: \".$name.\"\\r\\n\";\n$body .= \"Email: \".$email.\"\\r\\n\";\n$body .= \"Message: \".$_POST['message'];\n\n$mail->From = \"[email protected]\";\n$mail->FromName = \"Contact BLah\";\n\n$mail->Subject = \"Contact From: Blah\";\n\n$mail->Body = $body;\n\n$mail->AddAddress(\"[email protected]\", \"john\");\n$mail->AddAddress(\"[email protected]\", \"david\");\n\nif(!$mail->Send()) {\n $errorMsg .= \"Error sending message, please try again later.\";\n} else {\n $errorMsg .= \"Message Sent successfully.\";\n}\n\n\nI thought that PHPmailer normally takes care of inserting proper headers?\n\nAny thoughts?\n\nEDIT: Added spam score\n\n-Spam-Status: \"score=0.0 tests=none version=3.1.7 cmae=v=1.0 c=1 a=8nJEP1OIZ-IA:10\n a=soyWjZv28gkhNSke5wm04A==:17 a=fqdOs_Nl9wd82e3SDigA:9 a=l-lynuxnH-gfU2bevBoA:7\n a=wPNLvfGTeEIA:10 a=nymK5Bb5l1cA:10 a=_6wjLm_vFSYA:10 xcat=Undefined/Undefined\"\nX-Spam-Level: *\n\nEDIT 2: I just tried the script on a different server from the clients and it has the same result. Do I have to send through the SMTP setup for it not to be classed as spam?"
] | [
"php",
"phpmailer"
] |
[
"How is the second argument of the eval function different from the third argument?",
"class all_items(dict):\n def __getitem__(self, key):\n return 1\n\n>>> eval(\"undefined\",dict(),all_items())\n1\n>>> eval(\"undefined\",all_items(),dict())\nTraceback (most recent call last):\n File \"<pyshell#2>\", line 1, in <module>\n eval(\"undefined\",all_items(),dict())\n File \"<string>\", line 1, in <module>\nNameError: name 'undefined' is not defined\n\n\nThe all_items class of dictionary should return 1 for any value. Using the eval function, I want \"undefined\" to evaluate to 1, even though it isn't defined. This works when the all_items dictionary is the third argument of the eval statement, but not when it is the second argument. My question is why doesn't the second statment evaluate to 1? (And how could I make it work?) I'm using Python 2.5."
] | [
"python"
] |
[
"Ionic2 change Tabs selectedIndex property from a childpage",
"I'm kind of a beginer in Angular2 and Ionic2. I am trying to build my own small app using Ionic2's Tabs component.\n\nI want to be able to change the tab using a button in my childpage. I have tried using NavController.setRoot() and NavController.push() but none of them have the desired behaviour.\n\nsetRoot(Homepage) sets the correct view but doesn't change the selected tab in the tab menu.\npush(Homepage) sets the correct view but the Tabs menu is not visible anymore.\n\nI am a bit confused about how should I comnunicate with the TabsPage (the @Component that holds the tabs) from my single pages.\n\nThanks!"
] | [
"angular",
"ionic2"
] |
[
"is it possible to send custom variables to Google analytics while using ecommerce extension",
"So basicly i'm trying to get custom variables trough to google analytics panel while using ecommerce extension. My main goal is to give every item a set of custom values.\n\nMy \"code\" looks like this: \n\nga('require', 'ecommerce');\nga('ecommerce:addTransaction', {\n 'id': 'id', \n 'affiliation': 'affiliation', \n});\nga('ecommerce:addItem', {\n 'id': 'id',\n 'name': 'Loan - name',\n 'sku': '{RIDA:success_loan_id}',\n 'loanSumEur': 'Sum',\n 'loanSumLit': 'Sum LTL',\n 'loanLength': 'length',\n 'loanData': 'data'\n});\nga('ecommerce:send');\nga('ecommerce:clear');\n\n\n\n\nHow should I declare those loanSumEur, loanSumLit, loanlength, loanData variables so Google would pass them trough to the google analytics admin panel. Is it even possible ? \n\nIt's quite easy to declare custom variables for site tracking, however I got a little bit stuck trying to do the same thing on transaction items. \n\nBR's"
] | [
"javascript",
"google-analytics"
] |
[
"Modify Groovy sources from Gradle build before compiling",
"I have a Groovy application that I build with Gradle. As usual I have defined the application version number/string in the build.gradle script.\n\nNow I want to use that version string within the Groovy application, as hard-coded static piece of information. For example as a final static member in the main application class:\n\nclass MyApp {\n final static APP_VERSION = \"0.1\"\n}\n\n\nSince the version information comes from the build.gradle script, that Groovy class member above needs to be set by Gradle before the sources are compiled.\n\nIn other words: I need a Gradle task that allows me to set the value of a variable in the Groovy sources, before they are built by Gradle. I could for search for that value via regular expression and replace it in the Groovy source file, but that feels a bit clunky.\n\nAny \"best practice\" ideas how to achieve that?"
] | [
"grails",
"groovy"
] |
[
"using mocha to test the async function",
"I'm trying to test the following asynchronous function.\n\nasync taskComplete() {\n this.logger.log('Task Complete');\n\n try {\n if (fs.existsSync(`${this.repoDir}/.MENLOLAB_EXIT`)) {\n console.log('.MENLOLAB_EXIT Found');\n\n const exitCode = fs.readFileSync(`${this.repoDir}/.MENLOLAB_EXIT`, 'utf8');\n let msg = '';\n\n if (exitCode.localeCompare('1')) msg = 'Catchall for general errors';\n else if (exitCode.localeCompare('2')) msg = 'Misuse of shell builtins';\n else if (exitCode.localeCompare('126')) msg = 'Command invoked cannot execute';\n else if (exitCode.localeCompare('127')) msg = '“command not found\"';\n else if (exitCode.localeCompare('128')) msg = 'Invalid argument to exit';\n else if (exitCode.localeCompare('128+n')) msg = 'Fatal error signal “n”';\n else if (exitCode.localeCompare('130')) msg = 'Script terminated by Control-C';\n else if (exitCode.localeCompare('255\\\\*')) msg = 'Exit status out of range';\n\n await socket.taskExitCode({ jobID: this.taskData.jobID, exitCode, msg });\n } else {\n await socket.taskComplete(this.taskData.jobID);\n }\n } catch (err) {\n this.logger.error('Error attempting to send task complete');\n return this.taskComplete();\n }\n\n return this.destroyTask();\n }\n\n\nMy test code is bellow, it keeps timing out after 10000 ms. \n\n1) Test MenloLab Runner - Task Class\n Report\n TASK.taskComplete()\n Generate a Report on Task Completion:\n Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure \"done()\" is called; if returning a Promise, ensure it resolves. (/home/yury.stanev/menlolab/runner/test/tasks-tests.js)\n\n\nFrom what I'm seeing the taskComplete() isn't getting called at all. What can be the cause of this behaviour?\n\n describe('Report', () => {\n describe('TASK.taskComplete()', () => {\n it('Generate a Report on Task Completion', async () => {\n try {\n const task = new TASK(taskData, () => {});\n /* const result = */await task.taskComplete();\n // console.log(`${this.repoDir}`);\n\n // shell.exec(`${taskData.cmd}`);\n\n // console.log('HERE ->', result);\n\n // if (fs.existsSync(`${this.repoDir}/.MENLOLAB_EXIT`)) {\n // const exitCode = ['1', '2', '126', '127', '128', '128+n', '130', '255\\\\*'];\n // expect(`${this.repoDir}/.MENLOLAB_EXIT`).to.be.a.file().and.not.empty\n // .to.be.a.file().with.contents('1' || '2' || '126' || '127' || '128' || '128+n' || '130' || '255');\n // } else {\n expect(task.destroyTask()).to.be.true;\n // }\n } catch (err) {\n expect(err).to.not.be.undefined;\n }\n });\n });\n });"
] | [
"javascript",
"async-await",
"mocha.js"
] |
[
"xcode - Network Strength in iOS",
"I know that it is not really going to help me out, but still I have some doubts related to \"CTGetSignalStrength()\" method of Core Telephony framework. What I know about this method is:\n\n\nIt is an undocumented method.\nIt belongs to a Private API.\nIf I use this method, App store will reject my application.\nAlso, I read that there is no public API to get the Signal Strength in iOS.\n\n\nMy reason to pick this topic up again because all the other answers are atleast 2 years old. \n\nAnd also, I have seen some applications on App store which really tells about the cellular/Wifi Strength(Like Dr.Wifi-something). \n\nIf its not possible to get the signal Strength, how those applications are getting it? Or there is some other way now through which we can get the network Strength. I would really appreciate if someone can enlighten me on this. Thank you.\n\nEDIT : I have checked that question before, the one in the comment, but please see that :\n 1. The answer is really old.\n 2. In the comments, you can see someone asked \"How OpenSignal is doing there signal strength measurement?\" and there is no reply to that.\n 3. Every opportunity to get signal strength is either removed in the updated iOS version, or giving null or 0 as output.\n\nSo I am not really sure if there is no solution present for the problem or, the solution is not yet updated to that question."
] | [
"ios",
"objective-c",
"iphone",
"core-telephony",
"mobile-development"
] |
[
"\"Cursor\" and \"FOR XML\" clause in Azure data warehouse",
"while creating stored procedures in azure data warehouse I have got some error on "Cursor" and "FOR XML" so wanted to know are they supported by azure data warehouse or not. if not then what are the alternatives.\nsample code with error msg pictures are attached herein."
] | [
"azure-synapse",
"azure-sqldw",
"azure-sql-data-warehouse",
"azure-sql"
] |
[
"Repro needed : 'picture' graph field not working for posted links",
"I need verification on an error to see if it is just me or a FB bug.\nThe preview image link of posted links doesnot seems to be working, either by Graph or FQL.\n\nTry this one :\nhttps://www.facebook.com/coca-cola/posts/168694756574160\n\nWith the graph explorer, go to \nhttps://graph.facebook.com/168694756574160\nand click on the \"picture\" link. Does the preview image appears ? I have a blank screen.\n\nI see this behaviour on every posted links I could try.\n\nThanks for trying this on your side. If it is a FB bug, I will create a bug report!"
] | [
"facebook",
"facebook-graph-api",
"hyperlink",
"image"
] |
[
"Can we add attribute for wordpress menu",
"i have an HTML menu like this \n\n<ul id=\"menu-main-menu\" class=\"menu\">\n<li class=\"current_page_item\"> <a href=\"index.html\"> Home </a> </li>\n<li class=\"menu-item-simple-parent\"> <a href=\"aboutus.html\">About us &nbsp <i class=\"fa fa-caret-down\"></i></a>\n <ul class=\"sub-menu\" style=\"left:0px;width:340px;\">\n <li data-content=\"mission\"> <a href=\"#\">Mission</a> </li>\n <li data-content=\"vision\"> <a href=\"#\">Vision</a> </li>\n <li data-content=\"management\"> <a href=\"#\">Management</a> </li>\n </ul>\n</li>\n\n\n\n\nI created this menu in wordpress. In that, submenu created as custom link. can I add data-content attribute for my wordpress submenu as shown in HTML code."
] | [
"wordpress"
] |
[
"extjs+link remain in hover condition when i rightclick on it. How to void it",
"I am using links in my Extjs application, I am facing issue with hover state.\n\nWhen I do rightclick on any link it shows the hover state till I click outside. Once I click outside it comes to normal. \n\nI want to show normal state as soon as move mouse away from that link.\n\nHere is my CSS.\n\n.linkbold{\n color:#0080cc;\n font-family:Tahoma;\n font-size:11px;\n text-decoration:none;\n font-weight:bold !important;\n}\na.linkbold:link, a.linkbold:visited{\n color:#0080cc;\n font-family:Tahoma;\n font-size:11px;\n text-decoration:none;\n background-color: #red;\n font-weight:bold !important;\n display:block;\n}\na.linkbold:hover{\n color:#000000;\n font-family:Tahoma;\n font-size:11px;\n text-decoration:none;\n font-weight:bold !important;\n}\na.linkbold:active{\n color:#000000;\n font-family:Tahoma;\n font-size:11px;\n text-decoration:underline !important;\n font-weight:bold !important;\n display:block;\n}"
] | [
"extjs"
] |
[
"Creating a list merging the elements of a previous list and the values of a specific column of a data frame",
"I want to create a new list merging the elements of a previous list plus the values of a specific column of one data frame. See the example below.\nThe list I already have:\nvariables = ['Price_x_x', 'Mkt Cap_x', '24h Volume_x','Contributors_x', 'Commits in Last 4 Weeks_x','Reddit Subscribers_x', 'FB Likes_x','Market Cap Dominance']\n\nThe column:\n0 BTC\n1 ETH\n2 BNB\n3 USDT\n4 DOT\n ... \n995 CPC\n996 BLK\n997 ROUTE\n998 CNN\n999 BULL\nName: COIN, Length: 1000, dtype: object\n\nThe desired output:\n['BTC_Price_x_x', 'BTC_Mkt Cap_x','BTC_24h Volume_x',...,'BULL_FB Likes_x','BULL_Market Cap Dominance']"
] | [
"python",
"pandas",
"list"
] |
[
"Shared preferences with different context",
"What is the difference between these two:\n\nSharedPreferences prefs = getDefaultSharedPreferences(Application context);\n\n\nand \n\nSharedPreferences prefs = getDefaultSharedPreferences(Activity context);\n\n\nI am confused which one to use ?i want to make prefs static so that i can use it everywhere in my app.is it ok?"
] | [
"android",
"sharedpreferences",
"android-preferences",
"android-context",
"android-sharedpreferences"
] |
[
"Python SymPy factoring polynomial over complex numbers",
"I am using SymPy to factor polynomials over the complex numbers.\n\nimport sympy as sp\n\nx, y = sp.symbols('x y')\nz = sp.expand( (x - 1) * (y - 1) )\n\nfactorization_1 = sp.factor(z)\nfactorization_2 = sp.factor(z, extension = [sp.I])\n\n\nHere, z has contains the expression xy - x - y + 1, and factorization_1 indeed has the expected value (x - 1)(y - 1), but for some reason factorization_2 has the value x - 1.\n\nWhere did the factor (y - 1) go?"
] | [
"python",
"sympy"
] |
[
"Visual studio 2010 resizing winforms",
"I develop in a laptop that has a resolution of 1280x800. In my winforms app there are some forms that their height is bigger than 800. Normally I connect a lcd 17\" or 19\", but when not and I open a form that has 1280x1024, visual studio 2010 automatically resizes to my laptop resolution my form and then I have some troubles to resize all the controls.\n\nI wonder if there is an option to avoid this behavior.\n\nThanks a lot"
] | [
"winforms",
"visual-studio-2010"
] |
[
"Finding lines in a text file matching a regular expression",
"Can anyone explain how I could use regular expressions in Ruby to only return the matches of a string. \n\nFor example, if the code reads in a .txt file with a series of names in it:\n\nJohn Smith\nJames Jones\nDavid Brown\nTom Davidson\netc etc\n\n\n..and the word to match is typed in as being 'ohn', it would then just return 'John Smith', but none of the other names."
] | [
"ruby",
"regex"
] |
[
"How can i use custom logger in fastify?",
"My company have a custom developed logger package, and we want to use that as default logger in fastify. I tried to understand how to register my logger with this simple example below, but fastify always use Pino.\nindex.js\nconst log = require("./Logger");\nconst fastify = require("fastify")({ logger: log });\n\nfastify.get("/", (request, reply) => {\n request.log(\n "includes request information, but is the same logger instance as `log`"\n );\n reply.send({ hello: "world" });\n});\n\nfastify.listen(3000)\n\nlogger.js\nfunction Logger(...args) {\n this.args = args;\n}\nLogger.prototype.info = function(msg) {\n console.log("myLogger", msg);\n};\n\nlogger.js also contains error, debug, fatal, warn, trace, child functions but the functions body is same.\nThe result is:\n{"level":30,"time":1553095994942,"msg":"Server listening at http://127.0.0.1:3000","pid":14543,"hostname":"VirtualBox","v":1}\n\nwhitch is the default Pino output."
] | [
"node.js",
"logging",
"fastify"
] |
[
"C program for HC-SR04 ultrasonic sensor is not showing the correct distance",
"I have a raspberry Pi Zero with the AlphaBot2 which has the HC-SR04 ultrasonic sensor. The implementation using Python works well. I want to implement in C because I need to bind it with another program also in C and for optimization reasons. The first thing that I noticed is the Python code uses the RPi.GPIO lib and in C I have to use wiringPi or bcm2835. So I decided to use the wiringPi lib. My program executes but the distance is not correct. One thing that differs from the implementations that I found at web is that I am using TRIG 22 and ECHO 27, because my HC-SR04 is connected at the AlphaBot2. I am not using 2 resistors to connect it to the raspberry Pi. When I put some barrier in front of the sensor I get only 3 and 5 centimeters even if I move it to 30 centimeters.\n\nDistance: 3905724cm\n Distance: 5cm\n Distance: 5cm\n Distance: 5cm\n Distance: 5cm\n Distance: 3cm\n Distance: 3cm\n Distance: 5cm\n Distance: 5cm\n\n\nHere is my code:\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <wiringPi.h>\n\n#include \"ultrasonicClient.h\"\n\n#define TRUE (1==1)\n\n// HC-SR04 ultrasonic sensor on AlphaBot2 Pi Zero\n#define TRIG 22\n#define ECHO 27\n\nstatic volatile long startTimeUsec;\nstatic volatile long endTimeUsec;\ndouble speedOfSoundMetersPerSecond = 340.29;\n\nvoid recordPulseLength() {\n startTimeUsec = micros();\n while (digitalRead(ECHO) == HIGH);\n endTimeUsec = micros();\n}\n\nvoid setupUltrasonic() {\n wiringPiSetup();\n pinMode(TRIG, OUTPUT);\n pinMode(ECHO, INPUT);\n\n // TRIG pin must start LOW\n // Initialize the sensor's trigger pin to low. If we don't pause\n // after setting it to low, sometimes the sensor doesn't work right.\n digitalWrite(TRIG, LOW);\n delay(500); // .5 seconds\n}\n\nint getCM() {\n // Send trig pulse\n // Triggering the sensor for 10 microseconds will cause it to send out\n // 8 ultrasonic (40Khz) bursts and listen for the echos.\n digitalWrite(TRIG, HIGH);\n delayMicroseconds(10);\n digitalWrite(TRIG, LOW);\n\n int now = micros();\n // Wait for echo start\n // The sensor will raise the echo pin high for the length of time that it took\n // the ultrasonic bursts to travel round trip.\n while (digitalRead(ECHO) == LOW && micros() - now < 30000);\n recordPulseLength();\n\n long travelTimeUsec = endTimeUsec - startTimeUsec;\n double distanceMeters = 100 * ((travelTimeUsec / 1000000.0) * 340.29) / 2;\n\n //Wait for echo end\n long startTime = micros();\n while (digitalRead(ECHO) == HIGH);\n long travelTime = micros() - startTime;\n\n //Get distance in cm\n int distance = travelTime * 34000 / 2;\n\n return distanceMeters * 100;\n}\n\nint runUltrasonicClient() {\n int count = 0;\n setupUltrasonic();\n\n while (count < 60) {\n printf(\"Distance: %dcm\\n\", getCM());\n count++;\n delay(500); // 0.5 second\n }\n return 0;\n}"
] | [
"c",
"raspberry-pi",
"arduino-ultra-sonic"
] |
[
"julia: is it possible to play multithreading",
"I'm working with Julia.\n\nThere is a networking library: ZeroMQ.\n\nWhat I need is to create a julia project which can receive multi-zeroMQ-sockets. Here is a simple explanation:\n\ns1 = Socket();\nZMQ.bind(s1, ip1:port1);\ns2 = Socket();\nZMQ.bind(s2, ip2:port2);\ns3 = Socket();\nZMQ.bind(s3, ip3:port3);\nZMQ.recv(s1, msg0, 0); // it's blocking\nZMQ.recv(s2, msg1, 0); // it's blocking\nZMQ.recv(s3, msg2, 0); // it's blocking\n\n\nSo here I have three blocking recv, meaning that I should have a new thread for each of them.\n\nBut I don't know how to play multithreading with Julia."
] | [
"multithreading",
"julia"
] |
[
"How to duplicate WPF dataGrid row by double clicking on that row?",
"I am trying to add a new row into WPF dataGrid. When I double click on the row, I need to add the same row as a new entry. My design pattern is MVVM, can't user code behind.\n\nPlease give some hint to start this work."
] | [
"c#",
"wpf",
"mvvm",
"datagridview",
"mouseevent"
] |
[
"How can I do Routing in Azure Functions?",
"I know that I can use url parameters like this: \n\n\"myfunction?p=one&p2=two\"\n\n\nand in code that becomes\n\nrequest.query.p = \"one\";\n\n\nbut I would prefer to get it like this (express routing style):\n\n\"myfunction/:myvalue\"\n\n\nand use this url:\n\n/myfunction/nine\n\n\nwhich becomes this in code: \n\nrequest.params.myvalue = \"nine\"\n\n\nbut I can't seem to find how to configure a route path like that in Azure Functions, any ideas or docs?"
] | [
"node.js",
"azure",
"routing",
"azure-functions"
] |
[
"Is it possible to customize Bootstrap?",
"Is possible to edit the bootstrap.css file for license accordions?\n\nI mean, I need to edit the general style, and I don't want to use one more css file.\n\nCan I edit the original by hand?"
] | [
"css",
"twitter-bootstrap",
"edit"
] |
[
"NHibernate Conditional Mapping",
"I was recently put in charge of a new project for storing our analytics data. I want to give ORM a shot; the mapping doesn't seem difficult but this problem has me vexed.\n\nThis database will store data for Google Analytics, Quantcast, and any future analytics provider. I was pretty much given the schema that needs to be used. They want it to be very general which is possible until I store the matrices as we track different ones for each provider.\n\nThe table layout is as such:\n\n\n\ntblClient - Stores all the client websites.\ntblProfile - 1 or more belong to a client. Stores profile data such as what provider this profile is is using and the profile_type.\ntblProvider - Stores data as to whether a profile is a GoogleAnalytics, Quantcast, or other analytics profile.\ntblProfile_Type - The type of track for the client site. We have client sites broken down into different sections. That is tracked here.\n\nThe problem comes when I need to link the profile table to a metrix table. On this diagram I only have the one for Google but there will be others. I need it to link based on the FK column for Provider_Type in the profile table. Is that possible?"
] | [
"c#",
".net",
"database",
"nhibernate",
"orm"
] |
[
"android error in style : no resource found that matches the given name",
"i want to do when user press on night/day mode the mode of day to nigh and vice versa can change,after googling i found following :\n\n <style name=\"AppTheme.Light\" parent=\"@android:style/Theme.Holo.Light\">\n <item name=\"android:actionBarStyle\">@style/ActionBar.Light</item>\n <item name=\"android:windowActionBarOverlay\">true</item>\n <item name=\"listDragShadowBackground\">@android:color/background_light</item>\n <item name=\"menuIconCamera\">@drawable/ic_menu_camera_holo_light</item>\n <item name=\"menuIconToggle\">@drawable/ic_menu_toggle_holo_light</item>\n <item name=\"menuIconShare\">@drawable/ic_menu_share_holo_light</item>\n </style>\n\n <style name=\"AppTheme.Dark\" parent=\"@android:style/Theme.Holo\">\n <item name=\"android:actionBarStyle\">@style/ActionBar.Dark</item>\n <item name=\"android:windowActionBarOverlay\">true</item>\n <item name=\"listDragShadowBackground\">@android:color/background_dark</item>\n <item name=\"menuIconCamera\">@drawable/ic_menu_camera_holo_dark</item>\n <item name=\"menuIconToggle\">@drawable/ic_menu_toggle_holo_dark</item>\n <item name=\"menuIconShare\">@drawable/ic_menu_share_holo_dark</item>\n </style>\n\n\nbut i got error no resource found that matches the given name in following :\n\n <item name=\"listDragShadowBackground\">@android:color/background_light</item>\n <item name=\"menuIconCamera\">@drawable/ic_menu_camera_holo_light</item>\n <item name=\"menuIconToggle\">@drawable/ic_menu_toggle_holo_light</item>\n <item name=\"menuIconShare\">@drawable/ic_menu_share_holo_light</item>\n\n\nand in \n\n <item name=\"listDragShadowBackground\">@android:color/background_dark</item>\n <item name=\"menuIconCamera\">@drawable/ic_menu_camera_holo_dark</item>\n <item name=\"menuIconToggle\">@drawable/ic_menu_toggle_holo_dark</item>\n <item name=\"menuIconShare\">@drawable/ic_menu_share_holo_dark</item>\n\n\nso please help me what i forget.\n\nmy menifest file :\n\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n =\"com.example.daynight\"\n android:versionCode=\"1\"\n android:versionName=\"1.0\" >\n\n <uses-sdk\n android:minSdkVersion=\"14\"\n android:targetSdkVersion=\"18\" />\n\n<application\n android:allowBackup=\"true\"\n android:icon=\"@drawable/ic_launcher\"\n android:label=\"@string/app_name\"\n android:theme=\"@style/AppTheme\" >\n <activity\n android:name=\"com.example.daynight.MainActivity\"\n android:label=\"@string/app_name\" >\n <intent-filter>\n <action android:name=\"android.intent.action.MAIN\" />\n\n <category android:name=\"android.intent.category.LAUNCHER\" />\n </intent-filter>\n </activity>\n</application>"
] | [
"android",
"styles"
] |
[
"Deleting rows based on values in multiple cells per row",
"The functioning code below is cobbled together out of answers on this site.\n\nI feel that it is not as elegant as it could be.\n\nThe purpose of the code is to check a range of five cells in each row, and if there are no positive values in those cells, delete the row.\n\nSub DeleteRowtest()\nDim lr As Integer ' are any of these dims redundant or unnecessary? Incorrect?\nDim cval As Variant\nDim ArrCt As Integer\nDim val As Variant\n\n'the initial redim is there on purpose\n' instead of ValArray as Variant then ValArray = array().\n' this seems cleaner but which is better?\nReDim ValArray(0) As Integer \n\nDim T As Boolean\n\nlr = Cells(Rows.Count, 11).End(xlUp).Row\nFor i = lr To 2 Step -1\n ArrCt = 0\n\n 'this loop appears to work the way I want,\n ' but am I using .cells and .value correct here?\n For Each cval In Range(Cells(i, 5), Cells(i, 10)).Cells\n ValArray(ArrCt) = cval.Value\n ArrCt = ArrCt + 1\n ReDim Preserve ValArray(ArrCt)\n Next\n\n 'is there a cleaner way than this array and nested loop\n ' to determine the same info and act on it?\n ' (i.e. if all values of cell range are <1 delete row)\n For Each val In ValArray\n If val > 0 Then\n T = True\n End If\n Next\n\n If T = False Then Rows(i & \":\" & i).EntireRow.Delete\n T = False\nNext\n\n'finally, are there any errors/broken logic at all here that I dont see?\n\nRange(\"B2\").Select\nEnd Sub"
] | [
"excel",
"vba"
] |
[
"jQuery ImageViewer initiates with strange zoom",
"In my website of medieval documents I offer the user a simple interface for viewing a high resolution image of the manuscript page using ImageViewer. For example, at http://medieval-inquisition.huma-num.fr/doc/MS609-0002, clicking on the image opens the modal viewer where one always gets (wrongly) the following - a super-zoomed fragment near the top left of the image:\n\n\n\nBut it should initialize like this:\n\n\n\nThis happens every time the modal viewer opens on the image the first time.\n\nOne then has to click an arrow to force the correct zoom.\n\nAny ideas why this is initializing strangely?\n\nMany thanks in advance.\n\nAdding the script:\n\n $(function() {\n var images = [\n {small : 'http://medieval-inquisition.huma-num.fr/data-images/MS0609_0009_sm.jpeg', \n big : 'http://medieval-inquisition.huma-num.fr/data-images/MS0609_0009.jpeg', \n title : 'BM Toulouse MS609, F°. 1r'}\n ];\n\n var curImageIdx = 1,\n total = images.length,\n wrapper = $('#image-gallery'),\n curSpan = wrapper.find('.current'),\n titleSpan = wrapper.find('.title'), // \n viewer = ImageViewer(wrapper.find('.image-container'));\n\n wrapper.find('.total').html(total);\n\n function showImage() {\n var imgObj = images[curImageIdx - 1];\n viewer.load(imgObj.small, imgObj.big, imgObj.title); // \n curSpan.html(curImageIdx);\n titleSpan.html(imgObj.title); // \n }\n\n wrapper.find('.next').click(function() {\n curImageIdx++;\n if (curImageIdx > total) curImageIdx = 1;\n showImage();\n });\n\n wrapper.find('.prev').click(function() {\n curImageIdx--;\n if (curImageIdx < 0) curImageIdx = total;\n showImage();\n });\n\n showImage();\n });"
] | [
"javascript",
"jquery"
] |
[
"Compare strings in two files",
"I would compare strings in two file and if counted string redirect to file c, but running .bat show the error message \"find paramenter format not correct\".\n\nOtherwise, anything good script design for this! Thanks\n\nExample strings:\n\nFile A: 1 2 3 4\n\nFile B: 1 2 3 4 5 \n\nCode:\n\nfor /F %%a in ( file B ) do (\n for /F %%b in ( 'find /C %%a file A' ) do (\n if [%%b]==[1] ( \n echo %%b >> file c\n ) else (\n echo %%b >> file d\n )\n )\n)"
] | [
"windows",
"batch-file",
"scripting"
] |
[
"How to test if CDK context key exists?",
"I have a use case for storing some key-value in the cdk.context.json, however if cdk.context.json doesn't exist or if it doesn't contain the key I want CDK to fall back to other code to discover the values.\n\nFor example, pretend that the key is \"availability-zones\". I want to store the value in cdk.context.json, like so:\n\n{\n \"availability-zones:account=123456789012:region=us-west-2\": [\n \"us-west-2a\",\n \"us-west-2b\",\n \"us-west-2c\",\n \"us-west-2d\"\n ]\n}\n\n\nBut if it isn't stored there, I want my CDK to use a third-party library to find the values. One way I can do this is to test if the context has the availability-zones key, and retrieve the values if specified. How can I do this with CDK?"
] | [
"aws-cdk"
] |
[
"Get name of delegate method",
"Out of curiosity I've been looking into delegate methods and am interested in getting the name of the current delegate method that is being used (just for fun, really).\n\nThe code I have is as follows (with the current/desired outputs):\n\nprivate delegate int mathDelegate(int x, int y);\n\npublic static void Main()\n{\n mathDelegate add = (x,y) => x + y;\n mathDelegate subtract = (x,y) => x - y;\n mathDelegate multiply = (x,y) => x * y;\n\n var functions = new mathDelegate[]{add, subtract, multiply};\n\n foreach (var function in functions){\n var x = 6;\n var y = 3;\n Console.WriteLine(String.Format(\"{0}({1},{2}) = {3}\", function.Method.Name, x, y, function(x, y)));\n }\n}\n\n /// Output is:\n // <Main>b__0(6,3) = 9\n // <Main>b__1(6,3) = 3\n // <Main>b__2(6,3) = 18\n\n /// Desired output\n // add(6,3) = 9\n // subtract(6,3) = 3\n // multiply(6,3) = 18\n\n\nDoes anyone know of any way(s) I could achieve this? Thanks."
] | [
"c#",
"delegates"
] |
[
"Awk unix making multiple lines into one and extracting words",
"I need to extract the lease IP \"192.168.21.100\", hardware ethernet \"14:10:9f:f2:1d:00\" and client-hostname \"2015cmoran-2\".\n\nAnd it needs to be in one line like this\n\n\"192.168.21.100\", \"14:10:9f:f2:1d:00\", \"2015cmoran-2\"\n\nlease 192.168.21.100 {\n starts 4 2017/03/02 05:43:15;\n ends 4 2017/03/02 17:43:15;\n cltt 4 2017/03/02 05:43:15;\n binding state active;\n next binding state free;\n rewind binding state free;\n hardware ethernet 14:10:9f:f2:1d:00;\n uid \"\\001\\024\\020\\237\\362\\035\\000\";\n client-hostname \"2015cmoran-2\";\n } \nserver-duid \"\\000\\001\\000\\001 IL\\264x\\243Q\\031O\\032\";\n\n\nI have done these but I don't think this is the right way to do it\n\ncat /var/dhcpd.leases | sed 's/;//g' | sed 's/\"//g' | awk '{for (I=1;I<=NF;++I) if ($I == \"client-hostname\") {print $2};}' \n\ncat /var/dhcpd.leases | sed 's/;//g' | sed 's/\"//g' | awk '{for (I=1;I<=NF;++I) if ($I == \"ethernet\") {print $3};}'"
] | [
"unix",
"awk",
"sed"
] |
[
"Guide lines for developing Android Web application",
"Are there any guide lines for developing an Android web application? I am developing a web application and hosting it on the web, and I want to use WebView to incorporate that link in my Android application. \n\nIf we want to develop a mobile website do we need to follow any set of standards? If yes, are there any tutorials or examples?"
] | [
"android",
"css",
"mobile-website"
] |
[
"How to override the objectdatasource",
"Some quick background that i am working below is sample ObjectDataSource .\n\n<asp:ObjectDataSource ID=\"objectDataSourceAdmin\" runat=\"server\" SelectMethod=\"SelectOrgsActive\" TypeName=\"Business.OrganisationComponent\" OnSelecting=\"ObjectDataSource1_Selecting\">\n <SelectParameters>\n <asp:Parameter Name=\"OrgID\" Type=\"String\" />\n <asp:Parameter Name=\"ClientID\" Type=\"String\" />\n <asp:Parameter Name=\"IsActive\" Type=\"Boolean\" DefaultValue=\"True\" />\n </SelectParameters>\n\n\n\n\n\nOne Dropdown on my page that is bind form objectDataSource. I want that when Administrator Login then the dropdownlist will bind with objectDataSourceAdmin. But when client login then i want to use different objectDataSourceClient."
] | [
"asp.net",
"c#-4.0"
] |
[
"Extract last numbers of sequences in a vector in R",
"This my vector: \n\nmyvector<-c(1L, 2L, 4L, 5L, 6L, 7L, 8L, 10L, 12L, 142L, 143L, 149L, 150L)\n\n\nAs you can see there some sequences inside this vector:\n\nSeq1: 1,2\nSeq2: 4,5,6,7,8\nSeq3: 10\nSeq4: 12\nSeq5: 142,143\nSeq6: 149,150\n\n\nIm trying to implement a code that identifies this sequences and extract the last onee. The result should be: \n\noutput<- c(2L, 8L,10L,12L, 143L, 150L)\n\n\nI have other vectors bigger ones. But if I am able to do this with this vector I will be able to do with the others. \n\nI tried to use diff but the last element is deleted.\n\nAny help guys?"
] | [
"r"
] |
[
"Foreign Key Hibernate Annotation",
"I can not manage to make this simple foreign key constraint work.\n\n@Entity\n@Table(name = \"wheel\")\n@Data\npublic class WheelEntity {\n @Id\n @Column(name = \"id\")\n @GeneratedValue(strategy = GenerationType.IDENTITY)\n private Integer id;\n ...\n\n@Entity\n@Table(name = \"bike\")\n@Data\npublic class BikeEntity {\n @Id\n @GeneratedValue(strategy = GenerationType.IDENTITY)\n private Integer id;\n\n @ManyToOne(targetEntity = WheelEntity.class, fetch=FetchType.EAGER, cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})\n @JoinColumn(name = \"wheel_1_id\", referencedColumnName = \"id\")\n @NotNull\n private Integer wheel_1_id;\n\n @ManyToOne(targetEntity = WheelEntity.class, fetch=FetchType.EAGER, cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})\n @JoinColumn(name = \"wheel_2_id\", referencedColumnName = \"id\")\n @NotNull\n private Integer wheel_2_id;\n ...\n\n\nWhen I want to insert a new bike, here is the error I get when persisting the BikeEntity:\n\nCaused by: java.lang.IllegalArgumentException: Can not set java.lang.Integer field com.xxx.xxx.xxx.storage.WheelEntity.id to java.lang.Integer\n at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)\n at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)\n at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58)\n at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36)\n at java.lang.reflect.Field.get(Field.java:393)\n at org.hibernate.property.access.spi.GetterFieldImpl.get(GetterFieldImpl.java:39)\n\n\nCan not set java.lang.Integer to java.lang.Integer. mmmmmm? Strange!\n\nMany thanks for the help"
] | [
"java",
"hibernate",
"foreign-key-relationship"
] |
[
"Subset df by last valid item",
"I can return the index of the last valid item but I'm hoping to subset a df using the same method. For instance, the code below returns the last time 2 appears in the df. But I want to return the df using this index.\n\nimport pandas as pd\n\ndf = pd.DataFrame({ \n 'Number' : [2,3,2,4,2,1], \n 'Code' : ['x','a','b','c','f','y'], \n })\n\ndf_last = df[df['Number'] == 2].last_valid_index()\n\nprint(df_last)\n\n4\n\n\nIntended Output:\n\n Number Code\n0 2 x\n1 3 a\n2 2 b\n3 4 c\n4 2 f"
] | [
"python",
"pandas",
"dataframe"
] |
[
"Remote Debugging Fail - No suitable logon session",
"Receive this error message:\n\nError while trying to run project: Unable to start debugging.\n\nUnable to start program \"D:\\xxx.exe\".\n\nThere appears to be no suitable logon session on the server. Please verify that you are logged on to the server through Terminal Services or that someone is logged into the server locally.\n\nThis is the 1st time i encounter this error message after 4-5 years of using remote debugging. It is a standalone windows application.\nDevelopment PC: WinXP SP2, VS.Net 2003.\nDeployment PC: WinXP SP2\n\nHas anyone encountered similar problem before? Which configuration could have gone wrong thus contributing to this error message?\n\np/s: the end of the message said \"... someone is logged into the server locally.\" However, not many search result returns if i google that phrase."
] | [
".net",
"windows",
"visual-studio",
"remote-debugging"
] |
[
"MPMoviePlayerController detecting single tap or long tap on NEXT button",
"When I tap MPMoviePlayerController NEXT button , the UI turns black . How to identify if we touched NEXT just one time or if its a long tap . Do we have any delegates or notification for the same. ?"
] | [
"ios7",
"mpmovieplayercontroller"
] |
[
"HTML::Treebuilder - Parse between parents",
"Folks,\n\nThere is so much info out there on HTML::Treebuilder that I'm surprised I can't find the answer, hopefully I'm not just missing it.\n\nWhat I'm trying to do is simply parse between parent nodes, so given a html doc like this\n\n<html>\n<body>\n <a id=\"111\" name=\"111\"></a>\n <p>something</p>\n <p>something</p>\n <p>something</p>\n <a href=xxx\">something</a>\n <a id=\"222\" name=\"222\"></a>\n <p>something</p>\n <p>something</p>\n <p>something</p>\n ....\n </body>\n </html>\n\n\nI want to be able to get the info about that 1st anchor tag (111), then process the 3 p tags and then get the next anchor tag (222) and then process those p tags etc etc.\n\nIts easy to get to each anchor tag\n\nuse HTML::TreeBuilder;\nmy $tree = HTML::TreeBuilder->new();\n$tree->parse_file(\"index-01.htm\");\nforeach my $atag ( $tree->look_down( '_tag', 'a' ) ) {\n if ($atag->attr('id')) {\n # Found 'a' tag, now process the p tags until the next 'a'\n }\n}\n\n\nBut once I find that tag how do I then get all the p tags until the next anchor?\n\nTIA!!"
] | [
"perl",
"html-parsing"
] |
[
"mysql inner join on two tables",
"Columns in table wp_users:\n\nid\nuser_login\n\n\nColumns in table wp_usermeta:\n\n user_id\n meta_key [if equals 'primaryblog']\n metav_value\n\n\nThe id in wp_users and the user-id in wp_usermeta are same. I am expecting the result as\n\nid, user_login, meta_key, meta_value\n\n\nI tried:\n\nselect a.user_id,a.meta_key,a.meta_value \nfrom wp_usermeta as a \nwhere meta_key = 'primaryblog' \ninner join b.id, b.user_login \nfrom wp_users as b on a.user_id=b.id\n\n\nHow to get the intended result?"
] | [
"mysql",
"join",
"inner-join"
] |
[
"How to show up/down voting item like Reddit?",
"I am trying to get a similar look like Reddit or HackerNews voting where up/down arrows are get stacked. What I tried rather gives me following look:\n\n\n\nMy Code is given below:\n\nHTML\n\n<ul class=\"list-unstyled\">\n <li class=\"entry\">\n <div class=\"row\">\n <div class=\"col-sm-2 entry__rank\">\n <span class=\"pull-left\">1.</span>\n <i class=\"fa fa-icon fa-caret-up fa-2x pull-left\"></i>\n <i class=\"fa fa-icon fa-caret-down fa-2x pull-left\"></i>\n </div>\n <div class=\"col-md-9\">\n <span class=\"entry__title\">\n <a href=\"#\">This is a great billboard</a>\n </span>\n </div>\n </div>\n </li>\n </ul>\n\n\nCSS\n\n.entry {\n padding: 5px;\n margin-bottom: 20px;\n}\n.entry__rank {\n font-size: 20px;\n font-weight: bold;\n color: grey;\n padding: 5px 0 5px 0;\n margin-top: -10px !important;\n}\n.entry__title {\n font-weight: bold;\n font-family: Helvetica Neue, Helvetica, Arial;\n font-size: 16px;\n\n}\n\n.entry__title a {\n color: #285ddf !important;\n}\n\n\nDesired Look\n\n\n\nEvent something like Stackover flow voting would work."
] | [
"html",
"css",
"twitter-bootstrap-3"
] |
[
"Shortcut for \"Find Result 1\" in Visual Studio?",
"Shortcut for \"Find Result 1\" in Visual Studio?"
] | [
"visual-studio"
] |
[
"Create Map of classes in TypeScript",
"I've got a rendering engine, much like React where I need to store classes rather than instances in an object for compiling. \n\nSo for example, I have a Button component that I would like to be able to dynamically instantiate. Doing this would be as easy as \n\nnew components[\"Button\"]\n\n\nFor this, I need a list of all possible classes. So I've got a Dictionary interface declared like so:\n\ninterface Dictionary<T> {\n [Key: string]: T;\n}\n\n\nThis works well, I'm easily able to add objects to this dictionary. Except if I have an object:\n\nconst components: Dictionary<Component> = {\n Button: Button\n}\n\n\nThen I get an error because Button is a class, rather than an instance. Here, the issue is, I don't want to define the dictionary as Dictionary<Function> because that would mean I allow any function into the dictionary. Specifically, I only want to allow classes into the dictionary that extend the Component class. \n\nHow would I achieve this?"
] | [
"node.js",
"typescript",
"class",
"dictionary"
] |
[
"Create a table in android to display data",
"This should ideally be an easy task but I am unable to figure out how to display data in a table with borders in android.\n\nI have looked at this How can I create a table with borders in Android? and it kind of seems to be what I am looking for , but the number of rows and columns are not known before hand to be. I would have to create them on the fly. Does anyone know how to create a table in xml and then insert a row or column later?"
] | [
"android"
] |
[
"Unable to initialize main class, Caused by: java.lang.NoClassDefFoundError: com/mashape/unirest/http/exceptions/UnirestException [JAVA]",
"PROBLEM\n\nAfter I run the Maven 'compile', 'install' command in Eclipse to create an executable JAR and proceed to run that JAR I get the below error\n\nError: Unable to initialize main class org.example.project.StockTracker`\nCaused by: java.lang.NoClassDefFoundError: com/mashape/unirest/http/exceptions/UnirestException\n\nI have no clue what is going on. How can I resolve this? Below are some further details. I updated the POM with the main-class information and set the classpath to 'true'. \n\nMAIN CLASS CODE\n\npackage org.example.project;\n\nimport com.mashape.unirest.http.HttpResponse;\nimport com.mashape.unirest.http.Unirest;\nimport com.mashape.unirest.http.exceptions.UnirestException;\n\npublic class StockTracker {\n\n public static void main (String[] args) throws UnirestException, InterruptedException {\n HttpResponse<String> response = Unirest.get(\"https://apidojo-yahoo-finance-v1.p.rapidapi.com/market/get-quotes?region=US&lang=en&symbols=TSLA\")\n .header(\"x-rapidapi-host\", \"apidojo-yahoo-finance-v1.p.rapidapi.com\")\n .header(\"x-rapidapi-key\", \"api-key\")\n .asString();\n\n //System.out.println(response.getBody());\n System.out.println(\"response.getBody()\");\n }\n}\n\n\nUNIREST EXCEPTION CLASS CODE\n\npackage com.mashape.unirest.http.exceptions;\n\npublic class UnirestException extends Exception {\n\n private static final long serialVersionUID = -3714840499934575734L;\n\n public UnirestException(Exception e) {\n super(e);\n }\n\n public UnirestException(String msg) {\n super(msg);\n }\n\n}\n\n\nMANIFEST-FILE IN JAR\n\nManifest-Version: 1.0\nArchiver-Version: Plexus Archiver\nCreated-By: Apache Maven 3.6.3\nBuilt-By: Author\nBuild-Jdk: 13.0.1\nClass-Path: unirest-java-1.4.9.jar httpclient-4.5.2.jar httpcore-4.4.4.j\n ar commons-logging-1.2.jar commons-codec-1.9.jar httpasyncclient-4.1.1.\n jar httpcore-nio-4.4.4.jar httpmime-4.5.2.jar json-20160212.jar\nMain-Class: org.example.project.StockTracker"
] | [
"java",
"eclipse",
"maven",
"noclassdeffounderror",
"unirest"
] |
[
"Error in create Trigger with heidi sql 1064",
"I have this following code:\nCREATE TRIGGER t_autoinsert AFTER INSERT\n ON originalattlog\n FOR EACH ROW\nBEGIN\n IF NOT EXISTS (SELECT scan_date FROM triggerattlog WHERE scan_date = NEW.scan_date) THEN\n INSERT INTO triggerattlog (att_id,sn,scan_date,pin,verify_mode,io_mode,work_code,ex_id,flag,rowguid,io_mode_update,TIMESTAMPinfo)\n VALUES (NEW.att_id, NEW.sn, NEW.scan_date, NEW.pin, NEW.verify_mode, NEW.io_mode, NEW.work_code, NEW.ex_id, NEW.flag, NEW.rowguid, NEW.io_mode_update, NEW.TIMESTAMPinfo);\n END IF;\nEND\n\nI have that code and it gets error (1064) my SQL. I use heidisql."
] | [
"mysql",
"triggers"
] |
[
"How to use -libjars on aws emr?",
"There are similar questions on Stack overflow but none of them answer the question. The problem arises when as per the following link http://grepalex.com/2013/02/25/hadoop-libjars/ ,we need to use export HADOOP_CLASSPATH=/path/jar1:/path/jar2 to get it to work. So how can I execute export HADOOP_CLASSPATH=/path/jar1:/path/jar2 for -libjars option to work. \n\nI have implemented a Tool Runner . It works perfectly on hadoop and HDFS. \n\nI tried executing this while using custom jar but it gives Exception java.lang.NoClassDefFoundError: org/json/simple/parser/JSONParser:\n\nThis is what I ran in EMR where I am using MultipleInputs and a file to parse so you can see multiple paths as arguments this works while running in hadoop.\n\nAlert -libjars s3n://akshayhazari/jars/json-simple-1.1.1.jar -D mapred.output.compress=true -D mapred.output.compression.type=BLOCK -D io.seqfile.compression.type=BLOCK -D mapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec s3n://akshayhazari/rule/rule1.json s3n://akshayhazari/Alert/input/data.txt.gz s3n://akshayhazari/Alert/input/data1.txt.gz s3n://akshayhazari/Alert/output\n\nAny help is appreciated."
] | [
"amazon-web-services",
"emr"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.