texts
sequence
tags
sequence
[ "Where to put gradle dependencies block in kotlin native project generated by Intellij IDEA?", "I'm trying to make my first app in Kotlin Native. I want to add TornadoFX to my freshly created project.\nI need to add a dependency according to TornadoFX guide\n\ndependencies {\n compile 'no.tornado:tornadofx:x.y.z'\n}\n\n\nThe issue is - I cant figure out where exactly do I put it. \n\nThis is my build.gradle contents (generated by IntelliJ IDEA):\n\nplugins {\n id 'org.jetbrains.kotlin.multiplatform' version '1.3.60'\n}\nrepositories {\n mavenCentral()\n}\nkotlin {\n // For ARM, should be changed to iosArm32 or iosArm64\n // For Linux, should be changed to e.g. linuxX64\n // For MacOS, should be changed to e.g. macosX64\n // For Windows, should be changed to e.g. mingwX64\n mingwX64(\"mingw\") {\n binaries {\n executable {\n // Change to specify fully qualified name of your application's entry point:\n entryPoint = 'sample.main'\n // Specify command-line arguments, if necessary:\n runTask?.args('')\n }\n }\n }\n sourceSets {\n // Note: To enable common source sets please comment out 'kotlin.import.noCommonSourceSets' property\n // in gradle.properties file and re-import your project in IDE.\n mingwMain {\n }\n mingwTest {\n }\n }\n}\n\n// Use the following Gradle tasks to run your application:\n// :runReleaseExecutableMingw - without debug symbols\n// :runDebugExecutableMingw - with debug symbols\n\n\nPlaces I tried:\n\n1. top level\n\n> Could not find method compile() for arguments [no.tornado:tornadofx:1.7.19] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.\n\n2. inside kotlin {}\n\n> Could not find method compile() for arguments [no.tornado:tornadofx:1.7.19] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.\n\n3. inside mingwMain{}\n\n> Could not find method compile() for arguments [no.tornado:tornadofx:1.7.19] on object of type org.jetbrains.kotlin.gradle.plugin.mpp.DefaultKotlinDependencyHandler.\n\nAlso, when put inside mingwMain, the compile line gets highlighted with a notice 'compile' cannot be applied to '(java.lang.String)'" ]
[ "gradle", "intellij-idea", "tornadofx", "kotlin-native" ]
[ "React slick height issue when ading slick items dynamically", "I am using the react-slick slider to display a set of images. after the user crosses some slide position I am calling another API and appending the new results with the existing results using old.concat(new) stored in component state. Each time when the API is called, the slider displays 2 rows(its height is changed) and then adjust its height again.\nOnce the API data is added to the array, is there is a glitch that disturbs the slider and then fixes after few seconds? How do I fix this issue?\nI created codesandbox to replicate the issue here: https://codesandbox.io/s/react-slick-playground-forked-ub5fy" ]
[ "javascript", "reactjs", "slick.js", "react-slick" ]
[ "broken links from news with internal link to page which is hidden in default language", "I have news articles of type internal link. The article is created in the default language and is localized. In the news article the internal link points to a page which has the Hide default translation of page flag set.\n\nNow the editors have used the news plugin with list of selected items. In the default language they picked the above mentioned articles of type internal link. Now TYPO3 generates a broken link to the page in the default language which is hidden.\n\nIs there any way to prevent the link being generated in this setup?\n\nExpected behaviour would be that TYPO3 / tx_news renders the link only when the target page is available.\n\nMy setup:\n\n\nTYPO3 8.7.13\ntx_news 6.3.0" ]
[ "typo3", "typo3-8.x", "tx-news" ]
[ "Laravel - How to disable submit when any of the title field is null", "In my Laravel-5.8, I have a model called Goal:\n\nprotected $fillable = [\n 'id',\n 'weighted_score',\n 'title',\n 'start_date',\n 'end_date',\n ];\n\n\nFor the model, I have a controller:\n\nIndex Controller\n\npublic function index()\n{\n $userEmployee = Auth::user()->employee_id;\n $goals = Goal::where('employee_id', $userEmployee)->get();\n\n return view('goals.index')->with(['goals', $goals);\n}\n\n\nThis controller renders this view\n\nview\n\n<div class=\"card-body\">\n <div class=\"table-responsive\">\n <table class=\" table table-bordered table-striped table-hover datatable\">\n <thead>\n <tr>\n <th width=\"8%\">\n Type\n </th>\n <th width=\"11%\">\n Start Date - End Date\n </th>\n <th>\n Weight(%)\n </th> \n <th>\n  \n </th>\n </tr>\n </thead>\n <tbody>\n @foreach($goals as $key => $goal)\n <td>\n {{$goal->title ?? '' }}\n </td> \n <td> \n {{Carbon\\Carbon::parse($goal->start_date)->format('M d, Y') ?? '' }} - {{Carbon\\Carbon::parse($goal->end_date)->format('M d, Y') ?? '' }}\n </td> \n <td>\n {{$goal->weighted_score ?? '' }}\n </td> \n </tr>\n @endforeach \n </tbody>\n </table>\n </div>\n <div class=\"row no-print\">\n <div class=\"col-12\">\n <a href =\"{{ route('post.publish.all')}}\" class=\"btn btn-primary float-left\"><i class=\"fas fa-arrow-right\"></i> Submit</a> \n </div> \n </div> \n\n </div>\n\n\nroutes:\n\nRoute::resource('goals', 'GoalsController'); \n\nRoute::get('post/publish_all_posts', 'GoalsController@publish_all_posts')->name('post.publish.all');\n\n\nController function for publish_all_posts()\n\npublic function publish_all_posts(){\n\n $unapproved_post = Goal::where('employee_id', $userEmployee)\n ->update([\n 'is_approved' => 1 \n ]);\n\n\n}\n\nFor this that displays all the goals for this particular employee:\n\n\n $goals = Goal::where('employee_id', $userEmployee)->get();\n\n\nI want the application to only enable this:\n\n <div class=\"col-12\">\n <a href =\"{{ route('post.publish.all')}}\" class=\"btn btn-primary float-left\"><i class=\"fas fa-arrow-right\"></i> Submit</a> \n </div> \n\n\nonly when there is no NULL value in the field called title \n\nin\n\n\n $goals = Goal::where('employee_id', $userEmployee)->get();\n\n\nHow do I achieve this?\n\nThanks" ]
[ "laravel" ]
[ "how to make my own container indexed and assignable", "I have a container class like this:\n\nclass A {\npublic:\n // assuming all the other operators used below \n // have been defined.\n // ...\n A operator()(const A& a) const { \n A r(a.size());\n for (int i = 0;i < a.size();++i) r[i] = data[a[i]]; \n return r; \n }\nprivate:\n std::vector<int> data;\n};\n\n\nso I can do things like this:\n\nA a, b, c;\n// ... initialize data here...\nc = a(b); // I can index a by b\n\n\nNow I want to make the indexed container a(b) assignable, e.g.\n\na(b) = c;\n\n\nfor example, if a is {1, 2, 3, 4} and b is {0,2}, c is {0,0}, the above line should give me a = {0,2,0,4}. because a indexed by {0,2} is {1,3} in a, and set them to c {0,0} will give me this.\nhow to do that?" ]
[ "c++", "c++11" ]
[ "Open XML Make excel viewable", "I'm using Open XML to open an excel file as in:\n\nusing (SpreadsheetDocument myWorkbook = SpreadsheetDocument.Open(\"generated.xlsx\", true))\n\n\n...\n\nbut I cannot figure out how to actually launch excel and show the file through code.\n\nThanks for any help." ]
[ "excel", "openxml" ]
[ "Is it possible to check permissions on a Spring Controller method without executing it?", "The JS client of my REST API wants to know, is a query to a certain URL permitted or not. Permissions are configured on the controller methods using the standard annotations:\n\n@Controller\n@RequestMapping(\"/books\")\npublic class BooksController {\n\n @RequestMapping(\"read\")\n @Secured(\"ROLE_READER\")\n public ModelAndView read(int id) { ... }\n\n @RequestMapping(\"write\")\n @Secured(\"ROLE_WRITER\")\n public ModelAndView write(int id, String contents) { ... }\n}\n\n@Controller\n@RequestMapping(\"/util\")\npublic class UtilController {\n\n @RequestMapping(\"check\")\n public String check(String url) {\n //if url is \"/books/read\" and isUserInRole(\"ROLE_READER\")\n //or url is \"/books/write\" and isUserInRole(\"ROLE_WRITER\")\n //return \"true\", otherwise \"false\"\n }\n}\n\n\nFor read-only methods it would be possible to program the JS client to try and access a URL itself, ignore the result and look only on the status (200 or 403-Forbidden). It's not best performance-wise, but at least correct functionally. But for the write method I see no way to work around. Hope there is a sane solution for this problem.\n\nP.S. Thanks to @Bogdan for the solution. This is the full text of the method I need:\n\n@Autowired\nWebInvocationPrivilegeEvaluator evaluator;\n\n@RequestMapping(\"/check\")\npublic String check(String url, Authentication authentication) {\n return Boolean.toString(evaluator.isAllowed(url, authentication));\n}" ]
[ "java", "spring", "security", "rest", "spring-security" ]
[ "Selection Sort Gone Wrong", "I am trying to do a selection sort using a comparable on an array. I am not sure why it is not working. If someone could take a look and help me find what is not working that would be great! Thank you!\n\npublic static Comparable[] no = new Comparable[100];\n\npublic static Comparable[] gen1()\n{\n Random random = new Random();\n for(int i=0;i<no.length;i++)\n {\n no[i] =random.nextInt();\n }\n return no;\n} \n\npublic static Comparable[] selectionSort (Comparable no[])\n {\n int min;\n Comparable temp;\n\n for (int index = 0; index < no.length-1; index++)\n {\n min = index;\n for (int scan = index+1; scan < no.length; scan++)\n if (no[scan].compareTo(no[min]) < 0)\n min = scan;\n temp = no[min];\n no[min] = no[index];\n no[index] = temp;\n }\n return no;\n }\n\npublic static void main(String[] args)\n{\n System.out.println(\"Original Array:\");\n System.out.println(Arrays.toString(gen1()));\n System.out.println(\"Sorted Array:\");\n System.out.println(selectionSort(no));\n\n}" ]
[ "java", "arrays", "sorting", "selection" ]
[ "Volley get pending requests by tag, is possible ?", "I have been worked on a scenario where depending on if a set of request have been successfully executed ex: \n\n\n TAG (s); \"tag1\", \"tag2\", \"tag2\"\n\n\nThen perform a routine, if not successfully performed, for example, lost connection! another routine must be executed.\n\nI know there is this method to cancel a set of request: \n\nApp.getInstance ().cancelPendingRequestsWithFilter (filter) \n\n\nto cancel a tag specifies: \n\nApp.getInstance ().cancelPendingRequestsWithTag (tag) \n\n\nNow, anyone know any way to check whether a given tag (one request), was completed or not? type: \n\nApp.getInstance ().getPendingRequestsWithTag(tag) // I know that this method does not exist in the default implementation but would like something along those lines" ]
[ "android", "android-volley" ]
[ "Pointer of char, two diffrent ways one problem", "I have two different declarations of strings.\nchar * Dateiname;\nchar Dateiname1[LEN_ASCII_TIME];\n\nIn the first case I allocate memory with malloc:\nif(Dateiname = malloc(sizeof(char)*LEN_ASCII_TIME) == NULL){\n perror(NIO_SPEICHER);\n}\n\nthe second case = LEN_ASCII_TIME = 25\nThere no malloc or calloc necessary.\nThen I want to use the asctime() from time.h to copy the string to filename:\nstrncpy_s(Dateiname,LEN_ASCII_TIME,asctime(sysTimeStruct),LEN_ASCII_TIME-1); \n\nOutput case 1:\n(null)\n\nIf I used the second variant:\n strncpy_s(Dateiname1,LEN_ASCII_TIME,asctime(sysTimeStruct),LEN_ASCII_TIME-1);`\n\nOutput Variante 2:\nTue Mar 23 12:57:51 2021\n\nWhere is my thinking error? Why can't I reserve and write a memory area to the charptr * with malloc?" ]
[ "c", "pointers", "malloc" ]
[ "Jquery stop animate if another still running", "I try to show and hide element on hover element. My code works, but when user mouseover and mouseout element very fast, animation run and run even mouseout it :(\n\n$('.EventNameList').hover(\n function() {\n $(this).stop().animate({ backgroundColor: '#eaeaea' }, 200, \"easeInQuad\");\n $(this).find('div#TrainingActionButtons').show(\"fast\");\n },\n function() {\n $(this).stop().animate({ backgroundColor: '#ffffff' }, 800, \"easeOutQuad\");\n $(this).find('div#TrainingActionButtons').hide(\"fast\"); \n }); \n });\n\n\nAnd HTML:\n\n<tr>\n <td class=\"EventNameList\">\n <div id=\"TrainingActionButtons\">\n Some text \n </div>\n </td>\n</tr>" ]
[ "javascript", "jquery", "jquery-ui" ]
[ "Xcode -- reveal a file in the groups&files panel", "I have an Xcode project with (currently) about 300 files. Is there an easy way to reveal a specific file in the Groups&Files panel, assuming I remember the name of the file, but not where it is located?\n\nI don't care if I open the file or not. But I do need to reveal it. In other words, I need the file's group to be opened in the Groups&Files panel, and the file to be highlighted within the group. So \"quick open\" (shift-apple-d) does not fit the bill, because it opens the file without revealing." ]
[ "xcode" ]
[ "Selenium unable to locate dynamic elemet", "I have tried to locate this element in the screenshot by searching for xpath, outerhtml, expanded xpath, css selector, class name, and others. I am automating a program to download a pdf from a website but for some reason the element that I need to click on to download it is a dynamic element. Here is my code (I have censored sensitive information):\nfrom selenium import webdriver\nimport time\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support.ui import WebDriverWait\nfrom selenium.webdriver.support import expected_conditions as EC\nusername = "***"\npassword = '***'\n\ndriver = webdriver.Chrome()\ndef info_fill():\n driver.get ('***')\n driver.find_element_by_xpath('//*[@id="fsLoginUsernameField1249"]').send_keys(username)\n driver.find_element_by_xpath ('//*[@id="fsLoginPasswordField1249"]').send_keys(password)\n\ndef login():\n driver.find_element_by_xpath('//*[@id="fsEl_1249"]/div/div[1]/form/input[5]').click()\n\ndef portal():\n time.sleep(4)\n driver.get('***')\n\ndef get_grade_doc():\n time.sleep(4)\n driver.find_element_by_xpath('//*[@id="navigation-top"]/ic-sidebar/div/ic-tool-list/nav/ul/li[5]/a').click()\n try:\n element = WebDriverWait(driver, 10).until(\n EC.presence_of_element_located((By.CLASS_NAME, "/html/body/iframe[@id='xh-bar']"))\n )\n finally:\n driver.find_element_by_xpath("/html/body/iframe[@id='xh-bar']").click()\n\n\ninfo_fill()\nlogin()\nportal()\nget_grade_doc()\ndriver.quit()\n\nHere is a screenshot of the web inspector. The element that I am targeting is highlighted.\ninspector.jpeg\nthis is the error message I am getting\n<li _ngcontent-pts-c11="" class="divider__content documents__row clickable \nflex--space-between" role="link" tabindex="0"><div _ngcontent-pts-c11="" \nclass="pr-4 float-left"><div _ngcontent-pts-c11="">Gradebook Detail - \nNovember 2020</div><!----><!----><!----><!----><div _ngcontent-pts-c11="" \nclass="text-secondary pt-1"> </div><!----><div _ngcontent-pts-c11="" \nclass="text-secondary pt-1"> 20-21 Upper<!----></div><!----><!----></div><div \n_ngcontent-pts-c11="" class="hide-tiny float-right"><!----><i _ngcontent-pts- \nc11="" class="fa fa-chevron-right fa-light float-right"></i></div><i \n_ngcontent- \npts-c11="" class="fa fa-chevron-right fa-light float-right hide-until-tiny"> \n</i></li>" ]
[ "python", "selenium", "automation" ]
[ "Programming DBA Jobs in Stored procs", "I am a little new to programming, so any help is appreciated.\n\nFind below the code of my stored proc to delete a table and also create a DBA job which will run on a hourly basis.\n\nCREATE OR REPLACE procedure DELETE_My_TABLE(myschema varchar2) as \nBEGIN\n BEGIN\n execute immediate 'delete from '||myschema||'.mytable where clause;';\n END;\n BEGIN\n DBMS_SCHEDULER.create_program (\n program_name => 'DELETE_My_TABLE',\n program_type => 'STORED_PROCEDURE',\n program_action => 'execute DELETE_My_TABLE(myschema)',\n number_of_arguments => 1,\n enabled => FALSE,\n comments => 'Program to delete table using a stored procedure.');\n DBMS_SCHEDULER.define_program_argument (\n program_name => 'DELETE_My_TABLE',\n argument_name => 'myschema',\n argument_position => 1,\n argument_type => 'VARCHAR2',\n default_value => 'myschema');\n\n DBMS_SCHEDULER.enable (name => 'DELETE_My_TABLE');\n END;\n\n BEGIN\n DBMS_SCHEDULER.create_schedule (\n schedule_name => 'DELETE_My_TABLE',\n start_date => SYSTIMESTAMP,\n repeat_interval => 'freq=hourly; byminute=0',\n end_date => NULL,\n comments => 'Hourly Job to purge SEARCH_TEMP_TABLE');\n END;\nEND;\n/\n\n\nIssues:\n\nERROR at line 1:\nORA-00920: invalid relational operator\nORA-06512: at \"MYSCHEMA.DELETE_My_TABLE\", line 4\nORA-06512: at line 1\n\n\nWill the logic (and syntax) work?" ]
[ "oracle", "plsql", "jobs" ]
[ "Oracle 12c - DBA_USERS table - does LAST_LOGIN mean last successful login, or last attempted login?", "Oracle 12c. \n\nI'm not a DBA so maybe this is a dumb question or clarified within the context of DB convention. \n\nWhen I review the DBA_USERS table, does the column 'LAST_LOGIN' refer to the last successful login (i.e. someone is still successfully using that account) or the last attempted login (i.e. someone might be trying to log in with the wrong creds) \n\nHope that's not too simple a question for format. Bafflingly googling turned up nothing, and the docs are not helpful\n\n\n LAST_LOGIN | The time of the last user login.\n\n\nMaybe it's just me... \n\nThanks You!" ]
[ "oracle", "database-administration" ]
[ "How to add second level indices to a pandas dataframe", "I have the following dataframe:\n d={'col1':{('a','aaa'):1,\n ('a','bbb'):2,\n ('b','bbb'):1,\n ('b','ccc'):2} }\n df=pd.DataFrame(d)\n\nI want to change the dataframe, so that it will have all 'aaa', 'bbb', 'ccc' 2nd level indices for both 'a' and 'b' 1st level indices." ]
[ "python", "pandas" ]
[ "Number of threads to limit CPU usage", "My application is a \"thread-per-request\" web server with a thread pool of M threads. All processing of a single request runs in the same thread. \n\nSuppose I am running the application in a computer with N cores. I would like to configure M to limit the CPU usage: e.g. up to 50% of all CPUs.\n\nIf the processing were entirely CPU-bound then I would set M to N/2. However the processing does some IO.\n\nI can run the application with different M and use top -H, ps -L, jstat, etc. to monitor it. \n\nHow would you suggest me estimate M ?" ]
[ "java", "multithreading", "performance", "jvm", "cpu-usage" ]
[ "Fixed positioned div moves to the side while scrolling the in FireFox, works fine in other browsers", "I have 2 pages on my site that have the same layout. Each page has a div in the right sidebar that with the help of jquery changes it's class when you scroll down the page.\n\nI noticed a strange behavior on one of the pages in FF.\n\nOn this page http://bit.ly/QDhrz8 when I start to scroll down, div in right sidebar shifts to the right in Firefox only. Chrome and IE works as intended.\n\nOn the other page http://bit.ly/RLZ4ZK it works as it should without shifting to right on scroll div and it works the same way without issues in FireFox, Chrome, IE.\n\nBoth of the pages use the same layout, css and java code.\n\nWhat causes the div to jump on this page http://bit.ly/QDhrz8 in Firefox?" ]
[ "javascript", "jquery", "html", "css", "firefox" ]
[ "PowerPC: what does 0 / 0 do when floating point exceptions are disabled?", "I don't have access to a physical PowerPC system but am writing an emulator for the 603e model. The programming manual describes the floating point exception model in some detail but is unclear about what result is produced during an invalid floating point operation (namely 0 / 0 and the square root of a negative number). I thought that the IEEE spec mandated 0 / 0 to be a NaN and the PowerPC documentation seems to imply that a QNaN would be generated if floating point exception processing is disabled.\n\nBut I have reason to suspect it may actually be either writing 0 or leaving the destination unaltered.\n\nCan anyone confirm?" ]
[ "assembly", "floating-point", "powerpc" ]
[ "JQWidgets: Adding an autoWidth method to jqxComboBox", "I'm trying to develop a method that calculates the optimal width of a jqxComboBox.\nI first wrote a function called widthFit which does the following:\n\n\nFind the item with the longest text in the list of the jqxComboBox\nFind the width in pixels of that text based on the current theme. This is done by creating a hidden and getting its width (as shown in the code below)\n\n\n\r\n\r\n function widthFit(data,displayMember)\r\n {\r\n var font_size=$(\".jqx-widget\").css(\"font-size\");\r\n var font_name=$(\".jqx-widget\").css(\"font-name\");\r\n var n=data.length;\r\n var width=0;\r\n var lbl='';\r\n for (i=0;i<n;i++)\r\n {\r\n item= data[i][displayMember];\r\n if(item.length>width)\r\n {\r\n width=item.length;\r\n lbl=item;\r\n }\r\n }\r\n $(\"body\").append($(\"<span id='string_span' style='font-name: \"+font_name +\"; font-size:\"+font_size+\"'>\"+lbl+\"</span>\"));\r\n $(\"#string_span\").hide();\r\n width=$(\"#string_span\").width();\r\n $(\"#string_span\").remove();\r\n // +50px to fit the down-arrow button \r\n return width+50;\r\n \r\n }\r\n\r\n\r\n\n\nThen in the bindingComplete event of the jqxComboBox I added a call to resize the widget's width using the function I created as follows:\n\n\r\n\r\n$(\"#jqxComboBox\").on('bindingComplete', function (event) {\r\n $(\"#jqxComboBox\").jqxComboBox({width:widthFit(data,\"title\")});\r\n });\r\n\r\n\r\n\n\nI got what I wanted except that the \"head\" of the combo isn't correctly re-sized as shown in the picture below:\n \n\nHere is a JSFIddle link that shows the whole code.\nhttp://jsfiddle.net/MedYounes/L23x6u4n/\n\nI would be glad if I find help for this point." ]
[ "javascript", "jquery", "jqwidget" ]
[ "ServiceStack IAuthSession empty after authentication with FacebookAuthProvider", "I'm trying to get the user data through IAuthSession after a doing an authentication with facebook, when I try get the user with Request.GetSession(true) which returns AuthUserSession (implements IAuthSession) I get a partial subset of data like the following:\n\n\n\nI'm trying to use it in a service method \n\n[ClientCanSwapTemplates]\n [DefaultView(\"dashboard\")]\n public DashboardResponse Get(FacebookRequest userRequest)\n {\n var user1 = Request.GetSession(true);\n return new DashboardResponse();\n\n }\n\n\nI've added the auth providers my apphost as follows:\n\n Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {\n new FacebookAuthProvider(appSettings), \n new TwitterAuthProvider(appSettings), \n new BasicAuthProvider(appSettings), \n new GoogleOpenIdOAuthProvider(appSettings), \n new LinkedInAuthProvider(appSettings), \n new CredentialsAuthProvider()\n }));\n\n\nAs far as I know the facebookAuthProvider should fill the IAuthSession with the following information:\n\nuserSession.FacebookUserId = tokens.UserId ?? userSession.FacebookUserId;\nuserSession.FacebookUserName = tokens.UserName ?? userSession.FacebookUserName;\nuserSession.DisplayName = tokens.DisplayName ?? userSession.DisplayName;\nuserSession.FirstName = tokens.FirstName ?? userSession.FirstName;\nuserSession.LastName = tokens.LastName ?? userSession.LastName;\nuserSession.PrimaryEmail = tokens.Email ?? userSession.PrimaryEmail ?? userSession.Email;\n\n\nwhat step am I missing?" ]
[ "servicestack" ]
[ "QUERY_STRING only displays first parameter", "I can only access my 1st URL parameter. I think it is because I have ampersands both in my RewriteRule as well as my QUERY_STRING. How can I access each parameter correctly in my PHP script?\n\nI am making a request to\n\nhttp://example.com/subdir/api/transport/1/car?type=fast&color=blue\"\n\n\nIn my .htaccess file I have the following line:\n\nRewriteRule ^(.+)$ index.php?q=%{REQUEST_URI}&params=%{QUERY_STRING}&api=$1 [L]\n\n\nIn my PHP, displaying json_encode($_GET) produces:\n\n {\"q\":\"\\/subdir\\/api\\/transport\\/1\\/car\",\"params\":\"type=fast\",\"color\":\"blue\",\"api\":\"transport\\/1\\/car\"}\n\n\nYou will notice that the \"color\":\"blue\" no longer has an equal sign and is not contained within \"params\".\n\nIf I therefore display `json_enocde($_GET['params']) all I get is the following:\n\n\"type=fast\"\n\n\nWhat can I do to acquire the full set of parameters? Is it an issue with my .htaccess or my PHP file?" ]
[ "php", ".htaccess", "mod-rewrite", "query-string" ]
[ "Define default implementation of template class in C++", "I know it is possible to define default values for template parameters:\n\ntemplate<int N = 10> struct Foo {};\n\n\nYou can use this like Foo<> for example, but I want to be able to write just Foo.\n\nI tried the following, but it doesn't work (throws compiler exception):\n\nstruct Foo : Foo<10> {};\n\n\nIs this possible in C++?" ]
[ "c++", "templates", "default" ]
[ "Redirect http to https and remove .html from pages", "I'm very unfamiliar with how .htaccess to be honest, but what I'm trying to accomplish is that: \n\n\nAll http requests redirect to https\nAll pages remove the .html from the URL\n\n\nI have this code:\n\nRewriteEngine On \nRewriteCond %{HTTPS} off\nRewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]\n\n#example.com/page will display the contents of example.com/page.html\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteCond %{REQUEST_FILENAME}.html -f\nRewriteRule ^(.+)$ $1.html [L,QSA]\n\n#301 from example.com/page.html to example.com/page\nRewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\\ /.*\\.html\\ HTTP/\nRewriteRule ^(.*)\\.html$ /$1 [R=301,L]\n\n\nbut I keep getting an error in Chrome: \n\n\n example.com redirected you too many times.\n\n\nAny ideas?" ]
[ ".htaccess" ]
[ "How to operate each array entry with a different number to solve an optimization condition in Python?", "I have an array A of the form:\n\n1.005 1.405 1.501 1.635\n2.020 2.100 2.804 2.067\n3.045 3.080 3.209 3.627\n4.080 4.005 4.816 4.002\n5.125 5.020 5.025 5.307\n6.180 6.045 6.036 6.015\n7.245 7.320 7.049 7.807\n8.320 8.125 8.064 8.042 \n9.405 9.180 9.581 9.060 \n10.500 10.245 10.100 10.082\n\n\nand B of the form:\n\n10\n9\n8\n7\n6\n5\n4\n3\n2\n1\n\n\nI would like to add or subtract each of the entries with a number that is less than a particular number, in this case 0.5, so that certain conditions are met, e.g. sum of (Bi-Ai)^2 is minimized, much like an optimization problem. As an example, let us take A23, that has a value 2.804, I need to vary it between 2.304 < A23 < 2.804 so that for a particular value in this range, the sum of of (Bi-Ai)^2. And then for A24 I vary it between 1.567 < A24 < 2.567 so that, D is minimized.\n\nReproducible code\n\nimport numpy as np\nA = np.array([[1.005, 1.405, 1.501, 1.635], \n [2.020, 2.100, 2.804, 2.067], \n [3.045, 3.080, 3.209, 3.627], \n [4.080, 4.005, 4.816, 4.002],\n [5.125, 5.020, 5.025, 5.307], \n [6.180, 6.045, 6.036, 6.015], \n [7.245, 7.320, 7.049, 7.807], \n [8.320, 8.125, 8.064, 8.042], \n [9.405, 9.180, 9.581, 9.060], \n [10.500, 10.245, 10.100, 10.082]])\nB = np.array([10, 9, 8, 7, 6, 5, 4, 3, 2, 1])\nC = np.empty(shape = (A.shape[0], A.shape[1]))\nD = np.empty(shape = (A.shape[0], ))\nm, n = A.shape\nfor i in range(m):\n for j in range (n):\n C[i, j] = np.sum((B[i] - A[i, j]) ** 2)\nD = np.sum(C, axis = 0)" ]
[ "python", "numpy", "scipy", "mathematical-optimization" ]
[ "Java class compile time error \"Cannot access interface\"", "I have an interface stores which has two methods getName() and getAddres(), and I have a class Market which implements Stores\nThis is my code:\n\npublic interface Stores {\n public String getName();\n public String getAddress();\n}\n\n\nAnd the concrete class:\n\npublic class Market implements Stores {\n private String name;\n private String address;\n private int size;\n\n public Market(String name, String address, int size) {\n this.name = name;\n this.address = address;\n this.size = size;\n }\n\n @Override\n public String getName() {\n return name;\n }\n\n @Override\n public String getAddress() {\n return address;\n }\n\n public int getSize() {\n return size;\n }\n}\n\n\nI get errors in constructor regarding this.name=name, this.address=address and this.size=size saying that \"Cannot access stores\".\nAny ideas why?" ]
[ "java", "compiler-errors" ]
[ "Koin 2 problem with creating scope for feature in Android project", "I try to create scope for a feature. I define a module like this. \n\nval appModule = module {\n scope(named(\"ARTIST_SCOPE\")) {\n scoped {\n ArtistRepository(get())\n }\n scoped {\n GetArtistsUseCase(get())\n }\n viewModel { ArtistViewModel(get()) }\n }\n}\n\n\nMy goal is to make ArtistRepository, GetArtistUseCase, and ArtistViewModel only accessible inside Artist Feature.\n\nIn my activity \n\nclass ArtistActivity : AppCompatActivity() {\n\n private val artistScope = getKoin().createScope(\"artistScope\", named(\"ARTIST_SCOPE\"))\n private val viewModel: ArtistViewModel by artistScope.viewModel(this)\n...\n}\n\n\nMy problem is when I leave this activity and return back to it.\n\nI got this error.\n\norg.koin.core.error.ScopeAlreadyCreatedException: A scope with id 'artistScope' already exists. Reuse or close it.\nenter code here\n\n\nHow to reuse the existing scope?\nor Am I implement the scope in the right way?" ]
[ "android", "kotlin", "dependency-injection", "android-viewmodel", "koin" ]
[ "Javascript filter an associative array with another array", "How to filter an associative array with another one?\n\nfunction filter (a,f) {\n console.log (a) ;\n console.log (f) ; \n\n //Using f as filter, How to get only these rows fom a ?\n //{\"XD_A\":\"XDR\",\"XD_B_1\":\"38\",\"XD_B_2\":\"PB\"},\n //{\"XD_A\":\"XDR\",\"XD_B_1\":\"38\",\"XD_B_2\":\"PB\"}, \n}\n\nfunction test() {\n var data = [{\"XD_A\":\"XDL\",\"XD_B_1\":\"38\",\"XD_B_2\":\"PB\"},\n {\"XD_A\":\"XDR\",\"XD_B_1\":\"51\",\"XD_B_2\":\"PB\"},\n {\"XD_A\":\"XDL\",\"XD_B_1\":\"58\",\"XD_B_2\":\"PB\"},\n {\"XD_A\":\"XDR\",\"XD_B_1\":\"38\",\"XD_B_2\":\"PB\"},\n {\"XD_A\":\"XDL\",\"XD_B_1\":\"76\",\"XD_B_2\":\"PB\"},\n {\"XD_A\":\"XDR\",\"XD_B_1\":\"38\",\"XD_B_2\":\"PB\"}] ;\n var filters =[{\"XD_A\":\"XDR\"},{\"XD_B_1\":\"38\"}] ;\n filter (data,filters) ;\n}\n\n\nThanks in advance, \n\nbest regards\n\nMassimo" ]
[ "javascript", "arrays" ]
[ "Assign Data from child to parent in json object", "I had a object array containing items\n\n\"0: Object\nEntity: \"Customer\"\nId: 157\nMessage: \"testMessage1\"\nProperty: Object\nName: \"LastName\"\nRules: \"NotEmpty\"\"\n\n\nHere, How could I pass Name value to Property\n\nName is act as key within in Property object.\n\nhow could I Discard the Name and assign the value of Name i.e. (Last Name) to Property\n\nThis is what I have right now:\n\n[\n {\n \"Entity\":\"Customer\",\n \"Property\": {\"Name\": \"Email\", \"Type\": \"System.String\" },\n \"Rules\":\"NotEmpty\",\n \"Message\":\"ssdsdsds\",\n \"Id\":157,\n \"ValueToCompare\": null,\n }\n]\n\n\nHere, I need to assign Name value (i.e : Email) to Property Directly (it would be like this :-- \"Property\": \"Email\")" ]
[ "json" ]
[ "How to connect to cassandra java client with more than one node without mentioning the node details in java code using jdbc or datastax drivers", "I'm new to Cassandra I want to connect to Cassandra through Java client as Cassandra api.I can connect to Cassandra with my java code by using datastax as weel as jdbc drivers by giving the node details in my java code. Now I want to connect to Cassandra cluster where I have 4 nodes in cluster,I want to connect to the Cassandra cluster nodes with out giving the node details in code and need to get connection when 1 node is down in cluster it should get connect to the next node in the cluster,so where to mention my node details in my code when Im using datastax drivers. Can any one help me to do this..It will helps me alot\nThanks in advance" ]
[ "java", "jdbc", "datastax-java-driver", "cassandra-3.0" ]
[ "Cookies Django Project", "I'm writing a django program that interfaces with a page(\"like a javaapplet\" but not) embedded on some other site.\n\nThe idea is that I want people to play a puzzle game. But they only get the piece if they answer the question right.\n\nI don't want them to login, I want to give them a cookie instead. But I need to track and make sure the player is who they are so that they can't gain access to the entire puzzle.\n\nI also want to associate that player with the progress they made, and keep track of that progress on my server\n\nSorry if this is hard to follow. \n\nHow do I do this? Is it possible?\n\nI have this code, but need some pointers:\n\ndef cookietest(request):\n cookie = request.get_signed_cookie('puzzle')\n response = HttpResponse()\n response = render(request, 'cookie.html',{'cookie':cookie})\n response.set_signed_cookie(name='puzzle', value=1, max_age=None)\n return response" ]
[ "javascript", "html", "django", "cookies" ]
[ "Google Chart - Timelines: Scaling Axis", "I'm trying to create a chart using Google's Timeline that shows activity over the last 7 days, and I'm running into problems with scaling the x-axis. \n\nThe chart is always trying to auto-scale to the data, which ruins the consistency I'd like to incorporate. I want the right side of the graph to be today's date, and the left side to be seven days before today's date.\n\nI can't seem to find anything for fixing the x-axis in the documentation for Timelines or even Visualization in general, but I have to believe a charting library has the ability to configure its own axes. Does anyone have a solution that works?\n\nA possible workaround I have is creating two data points -- one for today and one for today-7 -- and add them to the graph. This fixes the scaling problem, but now my graph has two arbitrary data points on it. (I know it's technically a separate question, but if anyone knows how to hide these two data points while still maintaining the fixed axis scale that'd be a win!)\n\nHere's what my graph looks like using just the raw data (notice the axis -- I would like this to be last 7 days):\n\nAnd here's what it looks like with my two 'faked' data points:\n\nEDIT: I have tried using the viewWindow.max and viewWindow.min properties, but it doesn't seem to be working." ]
[ "javascript", "google-visualization" ]
[ "Regex to match all HTML tags except and", "I need to match and remove all tags using a regular expression in Perl. I have the following:\n\n<\\\\??(?!p).+?>\n\n\nBut this still matches with the closing </p> tag. Any hint on how to match with the closing tag as well?\n\nNote, this is being performed on xhtml." ]
[ "html", "regex", "perl" ]
[ "C# cookie based authorization", "I am implementing C# authorization using jquery cookies for my page. I set/encrypt username and password in the cookie and in my admin page, if I recognize cookie, then the user is authorized. If not, he gets redirected to the login page. The problem is, that cookie is read after page is loaded, so I can manually hit admin page and only in couple seconds it will get redirected. How do I prevent loading admin page for visitors, who have no cookie yet? What is a correct architecture for cookie based authorization?\n\nNote: I am not using ASP.NET roles or User tables. I implemented my own tables for users." ]
[ "c#", "jquery", "cookies", "authorization" ]
[ "Flutter Switch widget does not work if created inside initState()", "I am trying to create a Switch widget add it to a List of widgets inside the initState and then add this list to the children property of a Column in the build method. The app runs successfully and the Switch widget does show but clicking it does not change it as if it is not working. I have tried making the same widget inside the build method and the Switch works as expected.\n\nI have added some comments in the _onClicked which I have assigned to the onChanged property of the Switch widget that show the flow of the value property.\n\nimport 'package:flutter/material.dart';\n\nvoid main() {\n runApp(new MaterialApp(\n home: App(),\n ));\n}\n\nclass App extends StatefulWidget {\n @override\n AppState createState() => new AppState();\n}\n\nclass AppState extends State<App> {\n\n List<Widget> widgetList = new List<Widget>();\n bool _value = false;\n\n void _onClicked(bool value) {\n print(_value); // prints false the first time and true for the rest\n setState(() {\n _value = value;\n });\n print(_value); // Always prints true\n }\n\n @override\n void initState() {\n Switch myWidget = new Switch(value: _value, onChanged: _onClicked);\n widgetList.add(myWidget);\n }\n\n @override\n Widget build(BuildContext context) {\n return new Scaffold(\n appBar: new AppBar(\n title: new Text('My AppBar'),\n ),\n body: new Container(\n padding: new EdgeInsets.all(32.0),\n child: new Center(\n child: new Column(children: widgetList),\n ),\n ),\n );\n }\n}" ]
[ "dart", "widget", "flutter" ]
[ "How to ensure that a parameter passed to a function is an instance of a class in typescript?", "I have two classes, Database and DatabaseEnc. I have a function which accepts Database class instance as a parameter. How do I ensure that the function only accepts Database class instance and not any other.\n\nI know I can use instance of to check if instance is of Database inside the checkConn function. But I am looking for a more typescript based solution.\n\n/* database.ts */\n\nclass Database {\n public state: string = null;\n constructor(state: string) {\n this.state = \"some state\";\n }\n}\n\nexport default Database;\n\n/* database_enc.ts */\n\nclass DatabaseEnc {\n public state: string = null;\n constructor() {\n this.state = \"some other state\";\n }\n}\n\nexport default DatabaseEnc;\n\n/* provider.ts */\n\nimport Database from \"./database\";\nimport DatabaseEnc from \"./database_enc\";\n\nfunction checkConn(db: Database): void {\n Log.print(db);\n}\n\n// wrong, I should not be allowed to pass DatabaseEnc\n// instance to the checkConn function parameter\nconst test = new DatabaseEnc();\ncheckConn(test);\n\n// right, checkConn function should only accept Database\n// class instance as a parameter\nconst test1 = new Database();\ncheckConn(test1);\n\n// what is happening? I am allowed to pass any class's instance\n// to the checkConn function.\n\n\nI should not be allowed to pass any instance other than Database to the checkConn function." ]
[ "typescript" ]
[ "Pixelated image downscaling in Microsoft Edge", "I recently made a logo for my website with a resolution of 400x400. It scales down to 40x40 just fine in any other browser I have tested, but it acts weirdly in Edge. Every time I refresh the page, it renders properly for a split second, before changing to an ugly, pixelated look after the page completes loading.\n\nHow it looks before the page loads fully (and how I want it to look):\n\n\n\nHow it looks when page finishes loading:\n\n\n\nHTML:\n\n<img src=\"/images/logo.png\" class=\"logo\">\n\n\nCSS:\n\n.logo {\n width: 40px;\n height: 40px;\n}\n\n\nEDIT: Here's a JSfiddle to reproduce my problem." ]
[ "html", "css", "microsoft-edge" ]
[ "MultiResourcePartitioner - Multiple Partitions Loading Same Resource", "I'm using local partitioning in spring batch to write xml files to the database. I have already split the original file to smaller files and i have used MultiResourcePartitioner to process each one of them as each file will be processed by one thread. I'm getting a violation of primary Key constraint error i don't know how to deal with this issue\n\nList of files\n\n\n\nThe partitionner\n\n@Bean\npublic Partitioner partitioner1(){\n MultiResourcePartitioner partitioner = new MultiResourcePartitioner();\n Resource[] resources;\n try {\n resources = resourcePatternResolver.getResources(\"file:src/main/resources/data/*.xml\");\n } catch (IOException e) {\n throw new RuntimeException(\"I/O problems when resolving the input file pattern.\",e);\n }\n partitioner.setResources(resources);\n return partitioner;\n}\n\n\nThe StaxEventItemReader using XML file as an input for the reader\n\n @Bean\n @StepScope\n public StaxEventItemReader<Customer> CustomerItemReader() {\n\n XStreamMarshaller unmarshaller = new XStreamMarshaller();\n\n Map<String, Class> aliases = new HashMap<>();\n aliases.put(\"customer\", Customer.class);\n\n unmarshaller.setAliases(aliases);\n\n StaxEventItemReader<Customer> reader = new StaxEventItemReader<>();\n\n reader.setResource(new ClassPathResource(\"data/customerOutput1-25000.xml\"));\n\n reader.setFragmentRootElementName(\"customer\");\n reader.setUnmarshaller(unmarshaller);\n\n return reader;\n }\n\n\nThe JdbcBatchItemWriter (writing to the database)\n\n @Bean\n @StepScope\n public JdbcBatchItemWriter<Customer> customerItemWriter() {\n JdbcBatchItemWriter<Customer> itemWriter = new JdbcBatchItemWriter<>();\n\n\n itemWriter.setDataSource(this.dataSource);\n itemWriter.setSql(\"INSERT INTO NEW_CUSTOMER VALUES (:id, :firstName, :lastName, :birthdate)\");\n itemWriter.setItemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider());\n itemWriter.afterPropertiesSet();\n\n return itemWriter;\n }\n\n\nThanks for any help" ]
[ "spring", "spring-batch", "batch-processing" ]
[ "Unicode Encode Error (python)", "i am getting the following pythonerror -\n\nUnicode Encode Error charmap codec cannot encode character '\\u2026' in position 143 character maps to <undefined> \n\n\nFollwing is the code\n\nfrom twython import Twython\nconsumer_key\nconsumer_secret\naccess_key\naccess_sceret\nt=Twython(app_key=consumer_key,app_secret=consumer_secret,oauth_token=access_key,oauth_token_secret=access_sceret)\n\nsearch = t.search(q='#tiago',count=100)\n\ntweets = search['statuses']\n\nfor tweet in tweets:\n print (tweet['id_str'], '\\n', tweet['text'], '\\n\\n\\n')\n\n\n** i have used command - python setup.py install to unzip Twython module in directory which is different from the directory where my code is" ]
[ "python" ]
[ "Highcharts Combo Graph Overlapping eachother", "I want to implement a Combo Graph with \n1. Pie Chart\n2. Column 'Normal'\n3. Spine\n\nNow my problem is that if the column values are big, it overlaps the pie chart which does not make great viewing, I have a sample at JS Fiddle sample\n\n$(function () {\n $('#container').highcharts({\n chart: {\n },\n title: {\n text: 'Combination chart'\n },\n xAxis: {\n categories: ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']\n },\n tooltip: {\n formatter: function() {\n var s;\n if (this.point.name) { // the pie chart\n s = ''+\n this.point.name +': '+ this.y +' fruits';\n } else {\n s = ''+\n this.x +': '+ this.y;\n }\n return s;\n }\n },\n labels: {\n items: [{\n html: 'Total fruit consumption',\n style: {\n left: '40px',\n top: '8px',\n color: 'black'\n }\n }]\n },\n plotOptions: {\n column: {\n stacking: 'normal'\n }\n },\n series: [{\n type: 'column',\n name: 'Jane',\n data: [9, 9, 1, 3, 4]\n }, {\n type: 'column',\n name: 'John',\n data: [2, 9, 5, 7, 6]\n }, {\n type: 'column',\n name: 'Joe',\n data: [4, 3, 3, 9, 0]\n }, {\n type: 'spline',\n name: 'Average',\n data: [3, 2.67, 3, 6.33, 3.33],\n marker: {\n lineWidth: 2,\n lineColor: Highcharts.getOptions().colors[3],\n fillColor: 'white'\n }\n }, {\n type: 'pie',\n name: 'Total consumption',\n data: [{\n name: 'Jane',\n y: 13,\n color: Highcharts.getOptions().colors[0] // Jane's color\n }, {\n name: 'John',\n y: 23,\n color: Highcharts.getOptions().colors[1] // John's color\n }, {\n name: 'Joe',\n y: 19,\n color: Highcharts.getOptions().colors[2] // Joe's color\n }],\n center: [20, 80],\n size: 100,\n showInLegend: false,\n dataLabels: {\n enabled: false\n }\n }]\n });\n});\n\n\nplease give me some hint on how to solve this, one thing that comes to mind is set X range larger then max value of the column but not sure how to do that either." ]
[ "javascript", "asp.net", "highcharts" ]
[ "Facing issues while making scrapy crawl docs from a deep web", "I want my spider to crawl the number of \"Follower\" and \"Following\" info of each person. At this moment it gives 6 results only out of several thousands. How can I get the full results?\n\n\"items.py\" includes:\n\nimport scrapy\nclass HouzzItem(scrapy.Item):\n Following = scrapy.Field()\n Follower= scrapy.Field()\n\n\nSpider named \"houzzsp.py\" includes:\n\nfrom scrapy.contrib.spiders import CrawlSpider, Rule\nfrom scrapy.contrib.linkextractors import LinkExtractor\n\nclass HouzzspSpider(CrawlSpider):\n name = \"houzzsp\"\n allowed_domains = ['www.houzz.com']\n start_urls = ['http://www.houzz.com/professionals']\n\n rules = [\n Rule(LinkExtractor(restrict_xpaths='//li[@class=\"sidebar-item\"]')),\n Rule(LinkExtractor(restrict_xpaths='//a[@class=\"navigation-button next\"]')),\n Rule(LinkExtractor(restrict_xpaths='//div[@class=\"name-info\"]'),\n callback='parse_items')\n ] \n\n\n def parse_items(self, response):\n page = response.xpath('//div[@class=\"follow-section profile-l-sidebar \"]')\n for titles in page:\n Score = titles.xpath('.//a[@class=\"following follow-box\"]/span[@class=\"follow-count\"]/text()').extract()\n Score1 = titles.xpath('.//a[@class=\"followers follow-box\"]/span[@class=\"follow-count\"]/text()').extract()\n yield {'Following':Score,'Follower':Score1}\n\n\nEdit: Have made changes in the Rules and it is working as I expected." ]
[ "python", "scrapy" ]
[ "TypeError: 'tuple' object is not callable - error", "engine = create_engine(\"\")\ndf = pd.read_csv('in.csv', chunksize=1000) \nfor chunk in df: \n list= tuple(list(chunk[\"column2\"])) \n sql = \"SELECT * from table where value in {};\".format(list) \n found = pd.read_sql(sql, engine) \n found.to_csv('out.csv', mode='a', header ['column2'], index=False)\n\n\n\n\nan error appeared and I'm not sure why and how to fix: \n\nlist= tuple(list(chunk[\"column2\"]))\nTypeError: 'tuple' object is not callable" ]
[ "python", "sql", "pandas", "tuples" ]
[ "What is the best way to compare images in a bitmap list", "I'm working on an application where I can load multiple pictures in a list and compare every picture in that list with each others so I can find duplicated pictures. \n\nSo first I successfully got the pictures and loaded them in a IList<Bitmap> :\n\n public IList<Bitmap> getPictures()\n {\n IList<Bitmap> pictures = new List<Bitmap>();\n\n string filepath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);\n DirectoryInfo d = new DirectoryInfo(filepath+ \"\\\\Phone Pictures\\\\\");\n foreach (var picture in d.GetFiles(\"*.png\"))\n {\n pictures.Add(ConvertToBitmap(picture.FullName));\n }\n return pictures;\n }\n\n\nthan I used a pre-made image comparing algorithm : \n\npublic static CompareResult Compare(Bitmap bmp1, Bitmap bmp2)\n {\n CompareResult cr = CompareResult.ciCompareOk;\n\n //Test to see if we have the same size of image\n if (bmp1.Size != bmp2.Size)\n {\n cr = CompareResult.ciSizeMismatch;\n }\n else\n {\n //Convert each image to a byte array\n System.Drawing.ImageConverter ic =\n new System.Drawing.ImageConverter();\n byte[] btImage1 = new byte[1];\n btImage1 = (byte[])ic.ConvertTo(bmp1, btImage1.GetType());\n byte[] btImage2 = new byte[1];\n btImage2 = (byte[])ic.ConvertTo(bmp2, btImage2.GetType());\n\n //Compute a hash for each image\n SHA256Managed shaM = new SHA256Managed();\n byte[] hash1 = shaM.ComputeHash(btImage1);\n byte[] hash2 = shaM.ComputeHash(btImage2);\n\n //Compare the hash values\n for (int i = 0; i < hash1.Length && i < hash2.Length\n && cr == CompareResult.ciCompareOk; i++)\n {\n if (hash1[i] != hash2[i])\n cr = CompareResult.ciPixelMismatch;\n }\n }\n return cr;\n } \n\n\nNow this is how I try to call the algorithm and apply it to my loaded list : \n\npublic void ComparePictureList()\n {\n\n IList<Bitmap> picturesList = getPictures();\n\n foreach (var picture1 in picturesList)\n {\n foreach( var picture2 in picturesList)\n {\n Compare(picture1, picture2);\n }\n }\n\n }\n\n\nBut is there a better way to apply my algorithm to my list , I mean instead of declaring 2 loops picture1 and picture2 is there any functionality in the .NET framework that could be better ? \n\nP.S: for anyone who is wondering what is ConvertToBitmap this is it : \n\n public Bitmap ConvertToBitmap(string fileName)\n {\n Bitmap bitmap;\n using (Stream bmpStream = System.IO.File.Open(fileName, System.IO.FileMode.Open))\n {\n Image image = Image.FromStream(bmpStream);\n\n bitmap = new Bitmap(image);\n\n }\n return bitmap;\n }" ]
[ "c#", "algorithm", "performance" ]
[ "Modules 'base' and 'player' contain entry 'res/layout/exo_playback_control_view.xml' with different content", "I work on an app with multiple Dynamic Modules.\n\nIn order to add the video download's feature to my app, I need to add the ExoPlayer UI dependency (com.google.android.exoplayer:exoplayer-ui:2.11.1) to my base module.\nSince I already have this dependency in my player module, I have this compilation error message :\n\n\n Modules 'base' and 'player' contain entry 'res/layout/exo_playback_control_view.xml' with different content.\n\n\nSince I can't rename the ExoPlayer generated layout file, I've tried to get ride of this file from my base module since I only need it into my player module. \n\nSo far I've tried : \n\nsourceSets {\n main.res.srcDirs += 'src/main/res'\n\n main {\n res {\n exclude 'res/layout/exo_playback_control_view.xml'\n exclude 'layout/exo_playback_control_view.xml'\n exclude 'exo_playback_control_view.xml'\n exclude 'library/ui/src/main/res/layout/exo_playback_control_view.xml'\n }\n }\n }\n\n\nAnd \n\npackagingOptions {\n exclude 'res/layout/exo_playback_control_view.xml'\n exclude 'layout/exo_playback_control_view.xml'\n exclude 'exo_playback_control_view.xml'\n exclude 'library/ui/src/main/res/layout/exo_playback_control_view.xml'\n }\n\n\nAny of these works. \nI am not comfortable with Gradle as you probably can see. \n\nI've also opened an issue on the ExoPlayer Github repository.\n\nDoes anyone have another idea to avoid this compilation error?" ]
[ "android", "exoplayer", "dynamic-feature", "dynamic-feature-module" ]
[ "How to turn off views asp.net and C#", "I have Googled this and similar questions, I've asked questions in Lab discussion, I've searched for the answer here, but for some reason, getting this evades me. \n\nWe have a frmMain.aspx that contains links and image buttons for various pages and functions on the site. Sample of that code is below:\n\n<a href=\"frmSalaryCalculator.aspx\" id=\"linkbtnCalculator\">Annual Salary Calculator \n <img alt=\"Annual Salary Calculator\" src=\"images/calculator.jpg\" \n style=\"width: 57px; height: 54px\" id=\"imgbtnCalculator\" \n name=\"imgbtnCalculator\" /><br /></a>\n\n\nThe instructions are \"Modify the main form so that the following options are turned off for nonadmin users: \"\n\nI'm quite certain I need to use if/else statements, but because I am still learning the syntax, I'm not quite sure how to make this happen. The code for the frmMain.aspx.cs is below. All help would be greatly appreciated.\n\npublic partial class frmMain : System.Web.UI.Page\n{\n protected void Page_Load(object sender, EventArgs e)\n {\n // This is my second comment\n clsDataLayer.SaveUserActivity(Server.MapPath(\"PayrollSystem_DB.mdb\"), \"frmPersonnel\");\n }\n\n private void SetSecurityOptions()\n {\n\n }\n protected void u_ViewChanged(object sender, EventArgs e)\n {\n\n }\n}" ]
[ "c#", "asp.net" ]
[ "Job using crontab python library is not being fired", "I have following job written in python, using the library CronTab. I expect to write in a file every minute:\nfrom crontab import CronTab\nimport os\ncwd = os.getcwd()\n\ncron = CronTab(user='pi')\ncron.remove_all()\njob = cron.new(command=f'python {cwd}/example1.py')\n\nprint(job.is_valid())\nfor item in cron:\n print(item)\n\ncron.write()\n\nThis outputs following:\nTrue\n* * * * * python /home/pi/Documents/coding_area/personal_projects/pineda_camera/example1.py\n\nI checked the permissions of the files, they all belong to pi\n-rw-r--r-- 1 pi pi 39 dic 30 13:12 append.txt\n-rw-r--r-- 1 pi pi 603 dic 30 10:58 camera.py\n-rw-r--r-- 1 pi pi 338 dic 30 13:20 cron.py\n-rw-r--r-- 1 pi pi 117 dic 30 13:12 example1.py\n\nContent of example1.py is just writing the date in the file append.txt\nfrom datetime import datetime\nmyFile = open('append.txt', 'a')\nmyFile.write('\\nAccessed on ' + str(datetime.now()))\n\nWhen using crontab -u pi -l I see the job\n* * * * * python /home/pi/Documents/coding_area/personal_projects/pineda_camera/example1.py\n\nI run the script manually with the shown path and it works.\nI am new to this topic and I don't know how to debug further. I can only suspect that the job from the cron is made by the user root and not from the pi user?" ]
[ "python", "cron" ]
[ "Reduce inside of an apply", "I'm not 100% if using apply + functools.reduce is the best approach for this problem, but I'm not sure exactly if multi-indices can be leveraged to accomplish this goal.\nBackground\nThe data is a list of activities performed by accounts.\n\nuser_id - the user's ID\nactivity - the string that represents the activity\nperformed_at - the timestamp when the activity was completed at\n\nThe Goal\nTo calculate the time spent between 2 statuses. An account can look like this:\n\n\n\n\nuser_id\nactivity\nperformed_at\n\n\n\n\n1\nactivated\n2020-01-01\n\n\n1\ndeactivated\n2020-01-02\n\n\n1\nactivated\n2020-01-03\n\n\n\n\nIn this example, the user was deactivated from January 1st to January 2nd, so the total "Time Deactivated" for this account would be 1 day.\nResulting Dataframe\nHere's an example of the output I'm trying to achieve. The time_spent_deactivated column is just the addition of all deactivation periods on all accounts grouped by account.\n\n\n\n\nuser_id\ntime_spent_deactivated\n\n\n\n\n1\n24 hours\n\n\n2\n15 hours\n\n\n3\n72 hours\n\n\n\nMy Attempt\nI'm trying to leverage .apply with the .groupby on the user_id, but I'm stuck at the point of calculating the total time spent in the deactivated state:\n def calculate_deactivation_time(activities):\n # reduce the given dataframe here\n # this is totally ActiveRecord & JS inspired but it's the easiest way for me to describe how I expect to solve this\n return activities.reduce(sum, current_row):\n if current_row['activity'] == 'deactivated':\n # find next "activated" activity and compute the delta\n reactivated_row = activities.after(current_row).where(activity, '=', 'activated')\n return sum + (reactivated_row['performed_at'] - current_row['performed_at'])\n\n grouped = activities.groupby('user_id')\n grouped.apply(calculate_deactivation_time)\n\nIs there a better approach to doing this? I tried to use functools.reduce to compute the total time spent deactivated, but it doesn't support dataframes out of the box." ]
[ "python", "pandas", "numpy" ]
[ "Displaying search results dynamically as use interacts with controls", "I have a website and want to display search results dynamically meaning that as the user interacts with controls and selects options, the search results are populated in realtime - i.e. the user doesnt need to click the search button.\n\nThe data is stored in a MySQL relational data base.\n\nNow I know this is likely to lead to a large server load for a user-set above a certain size - are there anyways to mitigate this?\n\nMax." ]
[ "mysql", "database", "search", "dynamic" ]
[ "Uninstalled browser-sync, still recieving error \"sh: browser-sync: command not found\"", "I have looked at all the potential existing answers to this that I could find and haven't had any luck.\nI uninstalled browser-sync via: npm uninstall -g browser-sync --save\nI confirmed in the terminal that it was no longer installed via:\nnpm ls -g --depth=0\n/usr/local/lib\n└── [email protected]\nMy code is bare-bones html test code, although this also has been happening with any code I try, including folders from Wes Bos courses on CSS...:\n<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8" />\n <title>Testing Uninstall BrowserSync</title>\n </head>\n <body>\n <h1>Hello world</h1>\n </body>\n</html>\n\nWhen I do npm install (or sudo npm install) and then npm start, the node_modules folder does not appear, the browser does not open, and I recieve the following error:\n> [email protected] start /Users/jamiestuart\n> browser-sync start --server --files "*.css, *.html, *.js"\n\nsh: browser-sync: command not found\nnpm ERR! code ELIFECYCLE\nnpm ERR! syscall spawn\nnpm ERR! file sh\nnpm ERR! errno ENOENT\nnpm ERR! [email protected] start: `browser-sync start --server --files "*.css, *.html, *.js"`\nnpm ERR! spawn ENOENT\nnpm ERR! \nnpm ERR! Failed at the [email protected] start script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above. \n\nPlease if anyone could provide some insight that would be amazing! I also have no idea what [email protected] is and have tried uninstalling it, thinking that might solve the problem, but again, no luck." ]
[ "node.js", "npm", "command-line", "terminal", "browser-sync" ]
[ "looping functions to create a new dataframe and then within each dataframe loop another action", "Currently I have a huge database (replacing my database with mtcars for examples) which I'm using:\n\ncyc_6 <- filter( cars, str_detect(cyc, '6')) \n\n\nto create a new dataframe that only contains rows which have 6 stored in cyc. The reason why I need to do it like this is because some times its 6.3, 6.2 etc.\n\nFrom there I'm using :\n\ncyc_6 %>%\n+ group_by(cyc) %>%\n+ summarise(Total = mean(qsec, na.rm = TRUE)) %>%\n+ arrange(desc(Total))\n\n\nto find the average 1/4 mile per number of cylinders (cyclinders in this case aren't whole numbers, hence the need to group function)\n\nWhat I want to know is how can I automate any of this through looping.\n\nI know that I need to make a vector containing all my new variables c(cyc_6), but then I'm not sure what my function would be.\n\nAny help would be very appreciated." ]
[ "r", "loops", "dplyr" ]
[ "Error: Could not find or load main class Mac Eclipse", "So I'm using Eclipse on a Mac running Mavericks and I changed the default save location to another folder, but every time I try to build a new project this error keeps popping up... error: Could not find or load main class. Here is my code for my two classes if this helps.\n\n//Employee.java\npackage Exercise314;\npublic class Employee \n{\nString firstName;\nString lastName;\ndouble monthlySalary;\n\npublic Employee (String fName, String lName, double mSalary)\n{\n firstName = fName;\n lastName = lName;\n monthlySalary = mSalary;\n}\npublic void setFirstName (String fName)\n{\n firstName = fName;\n}\npublic void setLastName (String lName)\n{\n lastName = lName;\n}\npublic void setMonthlySalary (double mSalary)\n{\n if(mSalary > -1)\n monthlySalary = mSalary;\n}\npublic String getFirstName ()\n{\n return firstName;\n}\npublic String getLastName ()\n{\n return lastName;\n}\npublic double getMonthlySalary ()\n{\n return monthlySalary;\n}\n}\n//EmployeeTest.java\npackage Exercise314;\npublic class EmployeeTest \n{\n\npublic static void main(String[] args) \n{\n Employee employee1 = new Employee(\n \"Joe\", \"Smith\", 150000 );\n Employee employee2 = new Employee(\n \"Jane\", \"Doe\", 95000 );\n System.out.printf(\"First name is: %s\\n\",\n employee1.getFirstName() );\n System.out.printf(\"Last name is: %s\\n\",\n employee1.getLastName() );\n System.out.printf(\"Salary is: %f\\n\\n\",\n employee1.getMonthlySalary() );\n}\n}" ]
[ "java", "eclipse", "macos" ]
[ "VS C++ multiple projects to one dll", "I have a solution with multiple projects (Visual Studio 2010) that compile to static libraries (some compile to dll but naturally generate also a library). All written in C++. I want to provide my solution packed in one dll. So I want to generate from all projects one DLL, that is pack them all into one DLL, what's the best way to do it?" ]
[ "c++", "visual-studio-2010", "visual-c++", "dll" ]
[ "• No instance for (Fractional Int) arising from a use of ‘/’", "test :: Int -> Int -> Int\ntest x y = x/y\nmain = print(test 20 20)\n\n\nerror:\n\nmain.hs:2:12: error:\n • No instance for (Fractional Int) arising from a use of ‘/’\n • In the expression: x / y\n In an equation for ‘test’: test x y = x / y\n\n\nPlease help me would appreciate im a beginner in haskell and wanting to learn it even tho that i dont know where can i use it and how can i implement it somewhere, i already know javascript, java, php and lua somewhat but im the best at javascript and lua, would also like if you could answer me where can i implement haskell and how can i put it to good use, thanks :)\nP.S. I checked some posts like this already but i didn't really find them helpful, i need a simpler explanation, thanks" ]
[ "haskell" ]
[ "Trying to use jQuery, Clone and multiplication function", "I have an issue enabling functions with jQuery AutoComplete and Clone that I’m hoping somebody can help me with. Sorry if this is a bit over-detailed!\n\nI have a table which has title, description, qty, price and total in it. The user can use autocomplete on the product field to fetch the title’s description and price. At the same time, I have an ‘add row’ function using clone and I’m trying to use another function to multiply the qty and price if either are changed. So far, I have the following: \n\nCode for adding new row to table:\n\nvar $table;\n$(function() {\n $table=$('#invoiceitems'); \n var $existRow=$table.find('tr').eq(1);\n bindAutoComplete($existRow);\n});\n\nfunction addRow(){\n var $row=$table.find('tr:last').clone();\n var $input=$row.find('input:first');\n $row.find('input').val(\"\");\n $row.find('#product_description').val(\"\");\n $table.append($row);\n bindAutoComplete($row);\n $input.focus();\n}\n\n\nCode for AutoComplete:\n\nfunction bindAutoComplete($row){\n $row.find(\".product_title\").autocomplete(products, {\n width: 380,\n matchContains: \"word\",\n formatItem: function(row) {\n return row.title;\n }\n });\n $row.find('.product_title').result(function(event, data) {\n $row.closest('.product_description').val(data.description);\n $row.find('.product_price').val(data.price);\n $row.find('.qty').val(\"1\");\n });\n}\n\n\nCode for multiplying price and qty:\n\n$(document).ready(function() { \n$(\".qty, .product_price\").keyup(function() {\n var $row = $(this).closest(\"tr\"),\n price = $row.find(\".product_price\").val();\n qty = $row.find(\".qty\").val();\n $row.find(\".line_total\").text(qty * price);\n});\n\n\nAt the moment, the AutoComplete and clone work fine however the multiplication for the qty and price only works on the first row and now on any new rows that are added. If I replace clone(); with clone(true); then the multiplication works however the AutoComplete does’t work properly as it updates the price on all previous rows when you use it.\n\nI am not very good with JS and jQuery so I am hoping this is a simple mistake to correct?\n\nMany thanks!" ]
[ "jquery", "autocomplete", "clone" ]
[ "How can I reuse code from the android sdk for XML Parsing", "I want to parse a xml file with enumerated values that contain numbers. \nThe KxmlParser from android seems to have a problem with that. I looked inside the code and it only takes letters and some other tokens, but no numbers.\n\nSo I copied the KxmlParser Implementation and changed that part everything worked fine. But to resolve the references I added a libcore-jar to the project. Now I get compile erros because I shouldn't use this library excepto for creating a core libray.\n\nSo here's my question: What is the best way to change android-specific code for my application and to resolve the references to libcore?" ]
[ "java", "android", "android-xmlpullparser" ]
[ "Hello! i want to integrate paypal google pay apple in larvae website,", "i have installed the barintree sdk, enable google pay apple pay on the payment method,but i only see the paypal and credit card ,the apple pay and google pay button is not there,i m confuse how to to setup the google pay and apple pay so to see the button in drop in ui,\nand the other thing is when i pay by credit card the transaction is processing successful, but when i choose paypal button then it's show this error,\n"An error occurred with the message: PayPal pending payments are not supported"\nhere is my code fro drop in ui,\n<script src="https://js.braintreegateway.com/web/dropin/1.13.0/js/dropin.min.js"></script>\n <script>\n var form = document.querySelector('#payment-form');\n var client_token = "{{ $token }}";\n braintree.dropin.create({\n authorization: client_token,\n selector: '#bt-dropin',\n paypal: {\n flow: 'vault'\n }\n }, function (createErr, instance) {\n if (createErr) {\n console.log('Create Error', createErr);\n return;\n }\n form.addEventListener('submit', function (event) {\n event.preventDefault();\n instance.requestPaymentMethod(function (err, payload) {\n if (err) {\n console.log('Request Payment Method Error', err);\n return;\n }\n // Add the nonce to the form and submit\n document.querySelector('#nonce').value = payload.nonce;\n form.submit();\n });\n });\n });\n </script>" ]
[ "laravel", "paypal", "applepay", "google-pay", "braintree-sandbox" ]
[ "Is it possible to prevent tensorflow keras progress bar from flooding IDLE shell?", "When using tensorflow.keras in the default python editor IDLE shell, any time a function shows a progress bar such as in keras.datasets.imdb.load_data() the progress bar floods the editor and the function takes forever. Is there a fix or do I need to find another editor?\n\n(i'm currently working through the TensorFlow tutorials but prefer to do them in an interactive terminal)" ]
[ "python", "tensorflow", "python-idle" ]
[ "select a change to the url", "select a change to the url\n\n<form name=\"language\" action=\"<?php echo $_SERVER['PHP_SELF']; ?>\" method=\"post\">\n <select onchange = \"document.language.submit()\" name=\"lang\">\n <option selected=\"selected\"><?php echo $lang['select-language']; ?></option>\n <option value=\"en\"><?php echo $lang['en']; ?></option>\n <option value=\"es\"><?php echo $lang['es']; ?></option>\n <option value=\"fr\"><?php echo $lang['fr']; ?></option>\n </select>\n </form>\n\n\nHelp remake in URL\n\n<a href=\"\">en</a>\n<a href=\"\">es</a>\n<a href=\"\">fr</a>" ]
[ "url", "select" ]
[ "Combination of std::ios::openmode to avoid modifications of an existing file?", "Is there an available combination of std::ios::openmode to avoid modifications of an existing file and allow only the creation of a new one ?" ]
[ "c++", "file", "c++11", "stream", "iostream" ]
[ "Low-Rank Approximation using Frobenious Norm Tolerance", "I would love some help with an algorithm I've working on. My specific problem is in the while loop of the algorithm. \n\nWhat I want the algorithm to do is to sequentially add a singular value in Sk(until the desired TOL is achieved) in the diagonal while making the rest of the matrix 0. The desired goal is to do this to greyscale images. \n\nI can only get 2x2 cycles. \n\nhere is the code:\n\nA = rand(5)*30;\n[M N] = size(A);\n[U S V] = svds(A);\n% r = rank(A);\nSn = S(1,1);\nSk = blkdiag(Sn,zeros(N-1));\nAk = U*Sk*V;\nX = A - Ak;\nF = norm(X,'fro');\ntol = 10;\n\n\ni = 2;\n\nwhile F > tol\n Snk = S(i,i);\n Snew = diag([Sn;Snk]);\n Sk = blkdiag(Snew,zeros(N-2));\n Ak = U*Sk*V';\n F = norm(A-Ak,'fro');\n i = i + 1;\nend" ]
[ "algorithm", "matlab", "svd", "image-compression" ]
[ "append \",\" before each capital letter of string", "I need to append , before each capital letter of string. Should I use regex or split?\n\nExample:\n\nString s = \"TonyRoyTroyMagic\";\n\n\nI want the output to be like\n\n\"Tony,Roy,Troy,Magic\"" ]
[ "java", "regex" ]
[ "Type mismatch involving sets and collections", "I am trying to write a class that has a Map as a field. The field is as follows: \n\nMap<String, Collection<String>> courses;\n\n\nIn the constructor, I have to have the field in the form:\n\nMap<String, Set<String>;\n\n\nwithout changing the field at all. \nI am getting an error when I try to initialize the field with the set. Can someone tell me why or what to do without altering the original field?" ]
[ "java", "collections", "set" ]
[ "How to disable future date in x-editable?", "I have tried so many ways but not success.\nI want to disable future date selection from date picker in x-editable .\nHere is my html code .\n\n<a href=\"#\" editable-bsdate=\"TeamData.selectedDate\" \n onshow=\"openPicker()\"\n onhide=\"closePicker()\"\n e-is-open=\"TeamData.pickeropened\"\n e-datepicker-popup=\"dd/MM/yyyy\">\n\n {{ (TeamData.selectedDate | date:\"dd/MM/yyyy\") || 'empty'}} \n</a>\n\n\nHere is js code\n\nvar date = new Date();\ndate = $scope.TeamData.selectedDate.toLocaleDateString();\n\n\n //function for date picker when picker is open\n function openPicker() {\n $timeout(function () {\n $scope.TeamData.pickeropened = true;\n });\n }\n\n //function for date picker when picker is close\n function closePicker() {\n\n $scope.TeamData.pickeropened = false;\n }" ]
[ "javascript", "angularjs", "twitter-bootstrap", "jquery-plugins" ]
[ "How to remove whitespace before div", "I am trying to do some basic web development, but for some reason, there is a huge whitespace between the opening body tag and the first div. How do I move the div to the top /or remove whitespace/ without using 'position: fixed;'?\n\n\r\n\r\nbody {\r\n width: 100%;\r\n height: auto;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n.top_bar {\r\n margin: 0;\r\n padding: 0;\r\n text-align: center;\r\n background-color: black;\r\n color: rgb(179, 0, 0);\r\n width: 100%;\r\n height: auto;\r\n font-size: 200%;\r\n position: absolute;\r\n}\r\n<div class=\"top_bar\">\r\n generic string\r\n <br>\r\n <br>\r\n <br>\r\n</div>" ]
[ "html", "css" ]
[ "Initialising a C++ library in Arduino", "I'm trying to use this six axis complementary filter library to interpret data from the LSM6DS3 motion sensor. \n\nCalling it inside my Arduino sketch, I get this error. Sorry for the dumb question, I'm just starting out learning this: \n\n#include \"SparkFunLSM6DS3.h\" \n#include \"Wire.h\"\n#include \"SPI.h\"\n#include \"six_axis_comp_filter.h\"\n\n\nLSM6DS3 myIMU; // Constructor for the motion sensor (this works)\nCompSixAxis test; // this breaks\n\n\nwhen I try to initialise an instance of the CompSixAxis class it gives me this error:\n\nno matching function for call to 'CompSixAxis::CompSixAxis()'" ]
[ "c++", "constructor", "arduino", "sensors", "motion" ]
[ "Parallel Tasking Concurrency with Dependencies on Python like GNU Make", "I'm looking for a method or possibly a philosophical approach for how to do something like GNU Make within python. Currently, we utilize makefiles to execute processing because the makefiles are extremely good at parallel runs with changing single option: -j x. In addition, gnu make already has the dependency stacks built into it, so adding a secondary processor or the ability to process more threads just means updating that single option. I want that same power and flexibility in python, but I don't see it.\n\nAs an example:\n\nall: dependency_a dependency_b dependency_c\n\ndependency_a: dependency_d\n stuff\n\ndependency_b: dependency_d\n stuff\n\ndependency_c: dependency_e\n stuff\n\ndependency_d: dependency_f\n stuff\n\ndependency_e:\n stuff\n\ndependency_f:\n stuff\n\n\nIf we do a standard single thread operation (-j 1), the order of operation might be:\n\ndependency_f -> dependency_d -> dependency_a -> dependency_b -> dependency_e \\\n -> dependency_c\n\n\nFor two threads (-j 2), we might see:\n\n1: dependency_f -> dependency_d -> dependency_a -> dependency_b\n\n2: dependency_e -> dependency_c\n\n\nDoes anyone have any suggestions on either a package already built or an approach? I'm totally open, provided it's a pythonic solution/approach.\n\nPlease and Thanks in advance!" ]
[ "python", "concurrency", "dependencies", "makefile", "parallel-processing" ]
[ "AliasMatch in httpd.conf with django admin", "I have a problem with Alias in apache with django. In my wsgi.conf I have the following alias:\n\nAlias /admin/static/ /opt/python/current/app/django_eb/static/\n<Directory /opt/python/current/app/django_eb/static>\n Require all granted\n</Directory>\n\n\nThe alias works fine but in my django admin I get the static only in some pages. The problem is related with the alias path because the django admin includes additional parts to the url according to the section. An example following:\n\nhttp://blablabla.com/admin/**auth/group**/static/admin/css/base.css/\n\n\nFor each django app, additional information is added to the url and the Alias fails to resolve. Are there any way to map this situation using AliasMatch instead Alias?\n\nI suppose that I can map manually every additional path using a simple alias but that is not an efficient and comfortable solution...\n\nThanks!!" ]
[ "regex", "django", "apache", "django-wsgi" ]
[ "GenMyModel Relational DB", "I want to generate a Relational DB model from GenMyModel.\nHowever, it seems that only stanard XMI files can be exported. I searched about XMI but i didn't get the point and i still want to try GenMyModel.\nMaybe generate XMI from SQL? how?" ]
[ "sql", "database", "relational-database", "modeling", "xmi" ]
[ "What is mask A and mask B conv in Pixel-CNN?", "Im trying to implement a machine learning project that bases on Pixel-Rnn paper Link, and i'm having some problems to understand how to implement some things.\nThe model in the paper is\n\n7x7 conv mask A\nmultiple residual blocks conv 3x3 mask B\n2 Layers of ReLU followed by 1x1 conv Mask B\n\nI didn't understand the differences between Mask A and Mask B and how to implement them.\nalso, is there any residual block class to use in tensorflow library? if not how can i implement it?\nanother problem that i have is that i don't know how to implement the image generator of occured images.\nfor exmaple:\ni've tried to load data(image of size (28,28)) of numbers from MNIST dataset, then all the pixels from row above 13 i reset them to 0.\n(x1, _), (y1, _) = keras.datasets.mnist.load_data()\n\nafter i load the data i display the 4 images.\nf, axarr = plt.subplots(4,1) \naxarr[0].imshow(x1[0])\naxarr[1].imshow(x1[1])\naxarr[2].imshow(x1[2])\naxarr[3].imshow(x1[3])\n\nnow i reset some of the pixel to make them occured images.\nfor i in range(4):\n x1[i, 13:] = 0\n\nand now im stuck.\nbased on the paper i need to generate an image pixel by pixel using this - the probability formula\nwhich assign a probability p(x) to each image x formed of nxn pixels.\nI'm having hard time to understand how to work with generating problems in machine learning.\nIn the end i need to built a project that gets occured images and predicts them.\nHere is an example" ]
[ "python", "tensorflow", "machine-learning" ]
[ "Is Loosely Coupled on MVVM even posible?", "I'm currently working on my first MVVM application using Caliburn.Micro. If understand correctly the concept of Loosely Coupled, I must be able to extract every class of my project, isolated it on a blank solution, and it must compile without problems because there is no direct reference to others classes, right?\n\nSo my question is this: \n\nWhere is the place to create the viewmodels for distinct views and mantain the loosely coupled model?\n\nI ask this because many examples on the web do something like this:\n\npublic class ShellViewModel : Conductor<IScreen>.Collection.OneActive { \nint count = 1; \n\npublic void OpenTab() { \n ActivateItem(new TabViewModel { \n DisplayName = \"Tab \" + count++ \n }); \n} \n} \n\n\nWhere TabViewModel is the viewmodel for the desired view. But here, shellviewmodel is tightly coupled to TabViewModel\n\nOther option i've try is to create some sort of menu class like this:\n\nclass MenuItem\n{\n public string Title { get; set; }\n public Type ViewType { get; set; }\n}\n\n\nand use it like this:\n\nnew MenuItem(){Title=\"My menu\",ViewType=typeof(ProductosViewModel)}\n\n\nAnd use a generic creation procedure, but again this class is coupled with ProductosViewModel.\n\nSo what other options do i have? Or should i forget about strict loosely coupled?\nThank you!" ]
[ "c#", "mvvm" ]
[ "Delete repeated data in Bigquery", "I am optimizing a query in Bigquery that shows non-repeated data, currently it is like this and it works.\n\n\n select * from (select \n ROW_NUMBER() OVER (PARTITION BY id) as num,\n id,\n created_at,\n operator_id,\n description\n from NAME_TABLE\n where created_at >='2018-01-01') where num=1\n\n\nI wanted to ask if it is possible to make a GROUP BY with all the columns (in a simple way it cannot be done, since crated_at is not possible to group it) and keep the first data of created_at that appears for each id\n\nPD:a DISTINCT does not work, since there are more than 80 million records (they increase 2 million per day) and it returns repeated data" ]
[ "sql", "google-bigquery" ]
[ "What does it mean by Framework agnostic?", "I am hearing this phrase for a long time. I read few articles also still I am not able to understand what does it actually mean. I always see they give some framework name. But I want to understand what it means and why it came. Can anyone help me here?" ]
[ "frameworks", "web-component", "micro-frontend" ]
[ "Cannot invoke getText() on the primitive type int", "this is my code to set a value to a TextView\n\nenter code here\n\npublic void addHours(View view){\n final TextView mTextView = (TextView) findViewById(R.id.newHours_Value);\n String hourValue = R.id.enterHours.getText().toint();\n mTextView.setText(\"hourValue\");\n}\n\n\nbut the R.id.enterHours.GetText() comes up with an error \n\nCannot invoke getText() on the primitive type int\n\nwhat am i doing wrong please." ]
[ "java", "android" ]
[ "How do I get the wheelDelta property?", "I'm trying to make it so that my nav-bar 'hides' (via animation) when wheelDelta is negative (scroll down), and when wheelDelta is positive (scroll up) the nav-bar re-appears (animation).\n\nHere is my JavaScript code for this:\n\n\r\n\r\n/* Scrolling Animation */\r\n $(document).scroll(function () {\r\n var evt = window.event();\r\n var delta = evt.wheelDelta;\r\n \r\n if ( delta >= 120 ){\r\n $('.nav').animate({ top: '-65px' }, 200);\r\n $('body').animate({ top: '0px' }, 200);\r\n }\r\n else if ( delta <= -120 ){\r\n $('.nav').animate({ top: '0px' }, 200);\r\n $('body').animate({ top: '65px' }, 200);\r\n }\r\n \r\n });\r\n\r\n\r\n\n\nIt doesn't work, though. I've done some troubleshooting and I've figured out that the problem is that the delta variable is undefined. So I think that I just don't know how to properly get the wheelDelta property.\n\nCan someone show me an example of how to get the wheelDelta property value and store it in a variable?? \n\nThanks." ]
[ "javascript" ]
[ "PG::UndefinedTable: ERROR: relation \"events\" does not exist", "So, I'm working on an existing app and I'm in the process of getting it setup on my local environment however I'm running into a few issues:\n\n1. I've pulled down the latest code, and dumped the DB from the in-house developer. It was a .sql file, so I used the following command: \n\n$psql -h localhost -U root -d thms_development < /Users/me/mypath/public.sql\n\n\n2. This seemed to have work, but throughout the dump process I'd see\n the odd error like:\n\nERROR: role \"rails_staging\" does not exist\n\nNOTICE: table \"bidding_plans\" does not exist, skipping\nDROP TABLE\nERROR: type \"public.eh_allocation_plan_status\" does not exist\nLINE 6: \"status\" \"public\".\"eh_allocation_plan_status\" DEFAULT 'clos...\n ^\nERROR: relation \"public.bidding_plans\" does not exist\nBEGIN\nERROR: relation \"public.bidding_plans\" does not exist\nLINE 1: INSERT INTO \"public\".\"bidding_plans\" VALUES ('8204668e-ca65-...\n\n\nAnd other similar ones.\n\n3. And finally when I boot the app up, and click on the events link, I\n get the following:\n\nStarted GET \"/api/v2/client_events/events_for_venue?venue_id=7d72f8d9-f39f-4ed6-a24e-fb1cf23bd62e\" for 127.0.0.1 at 2015-03-18 19:49:40 -0400\nProcessing by Api::V2::ClientEventsController#events_for_venue as JSON\n Parameters: {\"venue_id\"=>\"7d72f8d9-f39f-4ed6-a24e-fb1cf23bd62e\"}\nPG::UndefinedTable: ERROR: relation \"events\" does not exist\nLINE 5: WHERE a.attrelid = '\"events\"'::regclass\n ^\n: SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod\n FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '\"events\"'::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n\nCompleted 500 Internal Server Error in 8ms\n\nPG::UndefinedTable - ERROR: relation \"events\" does not exist\nLINE 5: WHERE a.attrelid = '\"events\"'::regclass\n ^\n:\n\n\nI've ran db:setup, and this is the EXACT same code and DB that the current developer is using, what is going wrong?\n\nThanks!!" ]
[ "ruby-on-rails", "postgresql", "ruby-on-rails-4" ]
[ "finding the next empty cell so that it wont overwrite the previous pasted data", "I am having a problem to consolidate data from multiple worksheet into a summary worksheet. It is able to copy all the data except when the data is pasted it will overwrite the previous data. Example data in sheet A is pasted to recompile sheet starting from range A2. The problem is data in sheet B,C,D etc will also be pasted starting from range A2 causing it to overwrite each other.\nThis is my code.\n\n Private Sub CommandButton2_Click()\n Dim Sheetname, myrange As String\n Dim A, noOfrows As Integer\n Dim startRow As Integer\n\n For i = 2 To Worksheets(\"Master Sheet\").Cells.SpecialCells(xlCellTypeLastCell).Row\n\n Sheetname = Worksheets(\"Master Sheet\").Cells(i, 27).Value'All the sheets that suppose to transfer to recompile sheet \n noOfrows = Worksheets(Sheetname).Cells.SpecialCells(xlCellTypeLastCell).Row\n myrange = \"A2:N\" & CStr(noOfrows)\n Worksheets(Sheetname).Select\n Worksheets(Sheetname).Range(myrange).Select\n Selection.Copy\n Sheets(\"Recompile\").Select \n Range(\"A2\").Select\n ActiveSheet.Paste\n\n Next i\n\n End Sub" ]
[ "vba", "copy-paste" ]
[ "why i am not able to edit or create system variables in windows?", "I was trying to set the GRADLE_HOME system variable for my system as per this video in youtube. I am admin user and only user in my system.\n\nenter image description here\n\nThis image is screenshot from my desktop. As you can see that I am not able to create or edit the system variable.\n\ncan somebody tell me how to solve this problem?" ]
[ "environment-variables", "system-variable" ]
[ "sql \"like\" search inside javascript array or php array", "i've an array with names of city\nvar names = {\"john\",\"johnny\",\"nash\",\"roni\",\"ron\"};\nnow i want to use the feature of mysql like with it, just like google does, when suppose user typed j i want to return \"john\",\"johnny\", how to implement this, what i tried was returning \"john\" only when i type \"john\"\n\n`\n\n$('#student_name').keyup(function(){\n var name = $('#student_name').val();\n $('#suggestion').text(findStu(name,names));\n});\n function findStu(val,obj){\n var arr,name;\n for(var i in obj){\n if(typeof obj[i] === \"object\" && obj[i] instanceof Array){\n arr = obj[i];\n arr.forEach(function(a){\n if(a === val) name = i;\n });\n }\n }\n return name;\n}\n\n\n`" ]
[ "javascript", "php", "arrays" ]
[ "How To Set The CheckBoxList Properties?", "I have a checkboxList with some 50 values. but I want only 5 to be displayed and navigate others using scroll bar. \n\nI tried using \n\n<asp:CheckBoxList CheckBoxes=\"true\" Width=\"250px\" Height=\"120px\" RepeatColumns=\"5\" RepeatDirection=\"Vertical\" RepeatLayout=\"Flow\" \n runat=\"server\" SelectionMode=\"Multiple\" />\n\n\nBut its not coming proper..\nIts coming like \n\n[] Value1 [] value2 []val \nue3 [] value4 .....\n\n\nI want it to be\n\n[] Value1\n[] Value2 ..." ]
[ "asp.net", "checkbox", "width" ]
[ "Import specific part of a relative submodule in Python", "With a project structure like the following:\n\nmyproject/\n |--- __init__.py\n |--- application.py\n |--- modules/\n |--- __init__.py\n |--- parser.py\n |--- utils/\n |-- __init__.py\n |-- helpers.py\n\n\nIn utils/helpers.py:\n\ndef find_stuff():\n return stuff\n\ndef help_me():\n return some_help\n\n\nIn modules/parser.py, I want to import find_stuff (and only that).\n\nI've tried the following:\n\nfrom ..utils.helpers import find_stuff\n\n\nBut...\n\nImportError: cannot import name 'find_stuff' from 'myproject.utils.helpers' (/Users/myself/myproject/utils/helpers.py)\n\n\nWhat should be done here?\n\nNotes:\n\n\neverything was working fine with the whole project's policy of absolute import, until I started using Pytest, and then all hell broke loose\nno, I don't want to from ..utils import helpers and then use helpers.find_stuff in parser.py — I assume that Python's import system is well-thought enough so that we can precisely avoid that\nin the error message, we can see that Python manages to find the correct file, however for some reason it just won't import the function/class/object name, despite it being present in the file" ]
[ "python", "python-3.x", "python-import" ]
[ "Jquery and Ajax - trigger load with button", "I'm trying to make a page, where the content is shown using jquery. \nWhen the user comes to the website, the content is loaded from datanbase. \nI would like to add a button, that would trigger the load of new data from database, but on the same page. How do I do this? :)" ]
[ "ajax", "jquery" ]
[ "R: count of the number of entries in a column excluding the blanks", "My data looks like this:\n\nCHROM Mutant_SNP_2\n3RD T\n4RD C\n5RD \n6RD G\n7RD A\n8RD \n\n\nI have a CSV dataframe. I want a count from column \"Mutant_SNP_2\" of how many rows have an entry and therefore don't want a count of any blanks \" \". I am separating it out by column \"CHROM\". I am getting the right output in terms of layout using this code in dplyr: \ncount(combined, Mutant_SNP_2, wt = CHROM, sort = FALSE) however it is only counting the blank rows rather than those with a value. Any idea much appreciated.\nThe output I get:\n\n Mutant_SNP_2 CHROM.x n\n (fctr) (fctr) (int)\n1 gi|339957448|gb|AENI01001139.1| 23\n2 gi|339957449|gb|AENI01001138.1| 9\n3 gi|339957451|gb|AENI01001136.1| 97\n4 gi|339957452|gb|AENI01001135.1| 116\n5 gi|339957453|gb|AENI01001134.1| 175\n6 gi|339957454|gb|AENI01001133.1| 2\n7 gi|339957455|gb|AENI01001132.1| 78\n8 gi|339957456|gb|AENI01001131.1| 51\n9 gi|339957457|gb|AENI01001130.1| 2\n10 gi|339957458|gb|AENI01001129.1| 52\n.. ... ... ..." ]
[ "r", "dataframe", "bioinformatics" ]
[ "JavaScript Uncaught Syntax Error Missing ) after argument list, While Sending html data", "I am trying to show my data with onclick function. My data in firebase cloudfirestore database and ı am using django. So in the views.py ı send tutorial data and unit_name data.\nwhich is ı can get data with; {{tutorial_data.to_dict.data | safe}} and {{unit_name.to_dict.data}}\nHere is my data it's look like;\n<pre><code class="language-python"> \nfrom bs4 import BeautifulSoup <br> \n\nimport requests <br> \n\nurl ="http://canilgu.com/" <br>  \n\nrequest  = requests.get(url) <br> \n\nsoup = BeautifulSoup(request.text, 'html.parser') <br> \n\nprint(soup.title)</pre></code>\n\nSo I am trying to show this data in my web browser with using onclick function.. But ı am gettin error..\nHere is my basic function;\n<script>\n function show(content){\n document.getElementById("content").innerHTML=content;\n\n }\n</script>\n\nHere is html side;\n<div class="card background-color p-5" style="color:rgb(235,235,235);"><div id="content">\n {{tutorial_data.to_dict.data | safe}}\n </div>\n\n<div class="unititem" onclick='show("{{unit_name.to_dict.data}}")'>\n\nBut when ı want to show data which is look like this ı am not getting any erros;\n<h4>Beatiful Soup 4</h4> \nIn today's world, we have tons of freely selected unstructured data / here (some web data). Sometimes it is freely available, sometimes easy to read.\n\nSo, when data includes <pre> <code> </code> </pre> ı am getting Uncaught Syntax Error Missing ) after argument list..\nWhere is my mistake? or how can ı solve this issue? Thanks a lot.\nScreenshot of error" ]
[ "javascript", "html", "django" ]
[ "The name 'c' doesn't exist in current context", "I've been writing this code to do the quadratic formula for me, but there's a problem found a problem right here:\n\n if (textBox2.Text != \"\")\n {\n string h = textBox2.Text;\n double c = double.Parse(h);\n }\n else if (textBox2.Text == \"\")\n {\n double c = 0;\n }\n // else error message\n\n //Delta\n double delta = (Math.Pow(b, 2)) - (4 * a * c);\n string dtxt = Convert.ToString(delta);\n\n label5.Text = dtxt;\n\n\nThe problem is, \"The name 'c' doesn't exist in current context\". That also happens with the values b, and a, which have the same conditions as c." ]
[ "c#", "if-statement" ]
[ "Maven build failure when i create a maven project", "Hello i want to write a plug in for jenkins and need maven.\nSo i install maven and checked the installation with this command in cmd(windows 7):\n\nmvn --version\n\n\nThe output ist this\n\nApache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; \nMaven home: C:\\Program Files\\maven\nJava version: 1.8.0_60, vendor: Oracle Corporation\nJava home: C:\\Program Files\\Java\\jdk1.8.0_60\\jre\nDefault locale: de_DE, platform encoding: Cp1252\nOS name: \"windows 7\", version: \"6.1\", arch: \"x86\", family: \"dos\"\n\n\nSo maven ist correctly installed.\nBut when i trying to create a project with this command:\n\nmvn archetype:create -DgroupId=com.itcuties -DartifactId=test\n\n\ni get this Building failure\n\n[INFO] Scanning for projects...\n[INFO] \n------------------------------------------------------------------------\n[INFO] BUILD FAILURE\n[INFO] \n------------------------------------------------------------------------\n[INFO] Total time: 0.084 s\n[INFO] Finished at: 2015-11-10T14:20:49+01:00\n[INFO] Final Memory: 4M/15M\n[INFO] \n------------------------------------------------------------------------\n[ERROR] The goal you specified requires a project to execute but there is no POM\nin this directory (C:\\Users\\meyers). Please verify you invoked Maven from the correct directory. -> [Help 1]\n[ERROR]\n[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch\n[ERROR] Re-run Maven using the -X switch to enable full debug logging.\n\n\n [ERROR]\n[ERROR] For more information about the errors and possible solutions, \nread the following articles:\n[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN\n/MissingProject\nException\n\n\nI read the documantation but it does not help.\nI configured maven from this tutorial \n\nhttps://www.youtube.com/watch?v=FWstBgxcoXw" ]
[ "maven", "jenkins", "build" ]
[ "[PHP Warning: mail(): \" sendmail_from\" not set in php.ini or custom \"From:\" header missing", "I am trying to use PHP's mail() function to send a test mail.\n\n$to = \"****@gourab.me\";\n$sub = \"Php Mail\";\n$msg = \"Test Message From PHP\";\n\nmail($to, $sub, $msg, \"From: **********@gmail.com\");\n\n\nWhen I try to debug it through step in phpdbg, it shows the message:\n\n[PHP Warning: mail(): \" sendmail_from\" not set in php.ini or custom \"From:\" header \nmissing in C:/xampp/htdocs/tinyProj/mail.php on line 4]\n\n\nI cannot understand why?" ]
[ "php", "email" ]
[ "str to datetime returns NaT even with correct format passed", "I have a column of date strings like '2018-W01'\nI have attempted to convert using pd.to_datetime(urldict[key]['Date'],format ="%Y-W%W",errors='coerce'), however the column returns NaT if errors are coerced. I have also checked to make sure that the string format is the same throughout the entire column, and have also tested len of each entry in the column to ensure that they are uniform.\nI have also attempted changing the day of the week/removing it entirely for the to_datetime conversion and still cannot return a date. I have also read through the datetime documentation and cannot figure out the error.\nThe dataframe in question:\nDate Vals\n2018-W01 0\n2018-W02 0\n2018-W03 0\n2018-W04 0\n2018-W05 0\n2018-W06 0\n2018-W07 0\n2018-W08 0\n2018-W09 0\n2018-W10 0\n2018-W11 0\n2018-W12 0\n2018-W13 0\n2018-W14 0\n2018-W15 0\n2018-W16 0\n2018-W17 0\n2018-W18 0\n2018-W19 0\n2018-W20 0\n2018-W21 0\n2018-W22 0\n2018-W23 0\n2018-W24 0\n2018-W25 0\n2018-W26 0\n2018-W27 0\n2018-W28 0\n2018-W29 0\n2018-W30 0\n2018-W31 0\n2018-W32 0" ]
[ "python", "pandas", "datetime", "strptime" ]
[ "loop over list in elixir without creating nil values", "I have an interesting situation. I'm looping over a list several times and I don't know how to produce the list I want. I'm essentially trying to order the second tuple in a list of tuples according to the order of an outside list.\n\naclist = [{2,4},{2,6},{4,1},{4,8},{1, 2},{1,5},{3,3},{3,7}]\nplist = [1,2,3,4]\nnewplist = \nfor pid <- plist do\n Enum.map(aclist, fn({p_id,c_id}) ->\n if p_id == pid do\n c_id\n end\n end)\nend\n\n\nthe output from this code is:\n\n[[2, 5, nil, nil, nil, nil, nil, nil], [nil, nil, 4, 6, nil, nil, nil, nil],\n [nil, nil, nil, nil, 3, 7, nil, nil], [nil, nil, nil, nil, nil, nil, 1, 8]]\n\n\nI need the output to be [2,5,4,6,3,7,1,8] but that would require me to loop over it again in a nested loop to pull those numbers out. So obviously I'm missing something, how do I loop over it and pull out the correct data the first time?" ]
[ "functional-programming", "elixir" ]
[ "Getting error in executing Stored Proc from PHP", "I am new to MSSQL Server and there's a stored proc created by some developer and all I need to is run the proc from my PHP code.\nBut I am getting below error\nThe formal parameter \"@contract_id\" was not declared as an OUTPUT parameter, but the actual parameter passed in requested output.\n\nBelow is my code\n\n $params['contract_id'] = '00990007';\n $params['major_version'] = '1';\n $procedure_params = array(\n array(&$params['contract_id'], SQLSRV_PARAM_OUT),\n array(&$params['major_version'], SQLSRV_PARAM_OUT)\n );\n\n $sql = \"EXEC [MTP].[Process_07a_create_a_contract_version_wrapper] @contract_id = ?, @major_version = ?\";\n $stmt = sqlsrv_prepare($conn, $sql, $procedure_params);\n if( !$stmt ) {\n die( print_r( sqlsrv_errors(), true));\n }\n if(sqlsrv_execute($stmt)){\n while($res = sqlsrv_next_result($stmt)){\n // make sure all result sets are stepped through, since the output params may not be set until this happens\n }\n // Output params are now set,\n\n }else{\n die( print_r( sqlsrv_errors(), true));\n }\n\n\nCan anyone guide me on this please?" ]
[ "php", "sql-server" ]
[ "Pandas: Fastest way to edit values in one column based based on the values from another column", "Instead of relying on queries from SQL, I am trying to find ways that I can use pandas to do the same work but in a more time-efficient manner.\n\nThe problem I am trying to solve is best illustrated through the following simplified example:\n\ndf = pd.DataFrame({'id':list([1,2,3,4,5,6]),\n 'value':[12,8,31,14,45,12]})\n\n\nBased on the data I would like to change the values of the \"value\" column when the id is 1,2,4 to 32,15,14\n\nI managed to do this for one value with the following code: \n\ndf.loc[ df['id'] ==1, 'value'] = 32\n\n\nHowever the problem is that the above code is very time-inefficient. So I wonder if anyone could help come up with a solution where I can update 20-30 values as fast as possible in a pandas table.\n\nThanks in advance" ]
[ "python", "pandas" ]
[ "Floating action button layout anchor not working", "I want a floating action button in between my two relative layouts.\n\nFor this I have taken parent layout as coordinator layout and specified the anchor and anchor gravity to fab button.\n\nBut its not getting set where I want it to be.\n\nI want it to set at right corner of relative layout6 at the end and between relative layout6 and relative layout3 on right corner.\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.design.widget.CoordinatorLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:background=\"@color/bg\"\n android:orientation=\"vertical\">\n\n <ScrollView\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:fillViewport=\"true\">\n\n <LinearLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:orientation=\"vertical\">\n\n <RelativeLayout\n android:id=\"@+id/relativeLayoutParent\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_above=\"@+id/imageView5\"\n android:layout_alignParentLeft=\"true\"\n android:layout_alignParentStart=\"true\"\n android:layout_alignParentTop=\"true\"\n android:layout_marginEnd=\"30dp\"\n android:layout_marginLeft=\"30dp\"\n android:layout_marginRight=\"30dp\"\n android:layout_marginStart=\"30dp\"\n android:layout_marginTop=\"30dp\"\n android:background=\"@color/colorAccent\">\n\n <RelativeLayout\n android:id=\"@+id/relativeLayout6\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"240dp\"\n android:layout_centerHorizontal=\"true\">\n\n <ImageView\n android:id=\"@+id/imageView7\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_alignParentLeft=\"true\"\n android:layout_alignParentStart=\"true\"\n android:layout_alignParentTop=\"true\"\n android:scaleType=\"fitXY\"\n app:srcCompat=\"@drawable/profile_img\" />\n\n </LinearLayout>\n\n </RelativeLayout>\n\n\n <RelativeLayout\n android:id=\"@+id/relativeLayout3\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_alignParentEnd=\"true\"\n android:layout_alignParentLeft=\"true\"\n android:layout_alignParentRight=\"true\"\n android:layout_alignParentStart=\"true\"\n android:layout_below=\"@+id/relativeLayout6\">\n\n\n </RelativeLayout>\n\n\n <android.support.design.widget.FloatingActionButton\n android:id=\"@+id/fab\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n app:layout_anchorGravity=\"center\"\n app:layout_anchor = \"@id/linearLayout\"\n android:layout_margin=\"@dimen/fab_margin\"\n app:srcCompat=\"@android:drawable/ic_dialog_email\" />\n </LinearLayout>\n\n </ScrollView>\n\n\n</android.support.design.widget.CoordinatorLayout>\n\n\nPlease help.. Thank you." ]
[ "java", "android", "floating-action-button", "layout-anchor" ]
[ "How do I organise pure QML projects for reusability?", "I have a QML project that works fine when it's all in the same directory. There's a main.qml with a main.cpp containing the usual:\n\nQQmlApplicationEngine engine;\nengine.load(QUrl(QStringLiteral(\"qrc:/main.qml\")));\n\n\nThere is also my custom component, in pure QML, MyComponent.qml.\n\nWhen it is contained within a single project, it works perfectly. But now I want to think about reusability.\n\nI want to have separate main()s for the demo (what's there now), unit testing and usability testing. I want to be able to run these independently of each other.\n\nI also want to use MyComponent.qml without any of these main()s in other projects (that's the whole point!).\n\nI am not too hung up on the structure here, I just want the demo code to be separate from the widget code and to have a reusable widget.\n\nWhat do I need to do to achieve this?\n\nI've read How to package custom controls in QML?\n but the answer is light on detail. I can create the appropriate files for an Identified Module, but how do my separate projects actually access and incorporate them?\n\nI tried to arrange things as sub-projects, but didn't get very far. If I create a widget sub-project as a library project, I have this .pro file:\n\nTEMPLATE = lib\n\nTARGET = widget-lib\n\nQT += core quick qml\nCONFIG += c++11 plugin\n\nDISTFILES += \\\n MyComponent.qml\n\n\nThe project then fails to build because there's no actual library or entry point or, in fact, any code at all:\n\nLINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12\n\n\ndebug\\widget-lib.dll : fatal error LNK1120: 1 unresolved externals\n\nThe only other project type on offer in Qt Creator is a QML/C++ plugin, but since I have no C++ code in my actual component, that doesn't seem applicable.\n\nAdding the MyComponent.qml file to a demo sub-project also fails. With this QRC file:\n\n<RCC>\n <qresource prefix=\"/\">\n <file>main.qml</file>\n <file>../widget/MyComponent.qml</file>\n </qresource>\n</RCC>\n\n\n...the built demo project can't find MyComponent.qml because ../widget/ doesn't exist in the build output path.\n\nAdding the widget sub-project as a library also fails because there's no actual shared library to link against, so demo can't be built.\n\nI've read Module Definition qmldir Files, but it's all about how to create the file, and has nothing on how to use it.\n\nHow do I actually reuse a \"reusable QML component\"? How do I use the component itself in other projects, or have multiple mini-projects for testing the component itself? And how do I achieve this without just copy-pasting the component QML file into every project that needs it?" ]
[ "qt", "qml", "qt-creator", "qmake" ]
[ "My SQL Using temporary tables with PHP without mysql_pconnect", "I want to use temporary tables in my PHP code. It is a form that will be mailed. I do use session variables and arrays but some data filled in must be stored in a table format and the user must be able to delete entries in case of typos etc. doing this with arrays could work (not sure) but I'm kinda new at the php and using tables seems so much simpler. My problem is that using mysql_connect creates the table and adds the line of data but when i add my 2nd line it drops table and create it again... Using mysql_pconnect works by not dropping the table but creates more than on instance of the table at times and deleting entry's? what a mess! How can I best use temporary tables and not have them droped when my page refreshes? not using temporary tables may cause other issues if the user closes the page and leaving the table in the database." ]
[ "php", "mysql", "temp-tables" ]
[ "Compare variables (strings) and find larger number using if/else", "Ive got two Variables :\n\n$wh_odds_attrib\n$lad_odds_attrib\n\n\nif i preform var_dump on them i get \n\nstring(4) \"1.36\"\nstring(4) \"2.00\"\n\n\nrespectively. \n\nI want to use these vairbales in an if statement, but if i do this what will it be evaluating, the value ie. 1.36 or the string(4) part ? (the part i need to evaluate is the 1.36)\n\nthe if statement im using is \n\n if ($wh_odds_attrib['oddsDecimal'] > $lad_odds_attrib['oddsDecimal']) {\n echo $wh_odds_attrib['oddsDecimal'];\n\n } else {\n echo $lad_odds_attrib['oddsDecimal'];\n }" ]
[ "php", "string", "if-statement" ]
[ "Calling a simple Golang executable from PHP failing with exec: \"zip\": executable file not found in $PATH", "Trying to execute a simple Golang executable from PHP\n\nimport (\n "fmt"\n "os/exec"\n)\n\nfunc main() {\n out, err := exec.Command("zip").Output()\n if err != nil {\n fmt.Println("Error Executing the command: \\n")\n fmt.Printf("%s", err)\n } else {\n output := string(out[:])\n fmt.Println("Command Executed successfully with Output \\n" + output)\n }\n\n}\n\nHere is my php calling script\n<?php\nini_set('display_startup_errors', 1);\nerror_reporting(E_ALL);\n\n$output = shell_exec('zip 2>&1');\necho("Output of Calling zip command from PHP --> ".$output . "<br>");\n\n\n$output = shell_exec('./genfilesdir/gotest 2>&1');\necho("Output of Calling zip command through golang --> ".$output);\n\n?>\n\nHere is the output of the PHP execution\nOutput of Calling zip command from PHP --> adding: -PK-�4PR��������- (deflated 0%) PKPK-�4PR�!-PK/M\nOutput of Calling zip command through golang --> Error Executing the command: exec: "zip": executable file not found in $PATH\n\nWhen I try to execute the golang from command line, It works\n> sudo -u www-data ./gotest\nCommand Executed successfully with Output \nP�4PR��������-PP�4PR�!-PK/M\n\n\nzip is available in /usr/bin and /usr/bin there in $PATH for www-data\nWhen I call the 'zip' from PHP directly , It works ( see the php output above)\nI am not sure , why golang executable when called fro PHP not able to pick "zip" in the path.\n\nHere is the environment details\nApache/2.4.41 (Ubuntu 20.04)\nPHP 8.0.2 (cli) (built: Feb 14 2021 14:21:37) ( NTS )\nWhat am I missing ?" ]
[ "php", "path", "zip", "apache2" ]
[ "How does Google Analytics filters duplicate site entrances", "We are implementing a native analytics system and want to apply the same tracking principles Google Analytics uses. We've figured everything out but one thing:\n\nEvery time I refresh a page with an url that has utm-parameters attached to it, Google Analytics somehow figures out that it's not actually a visit but the same page that gets refreshed and shows only one visit in its dashboard from that particular source. \n\nIs anybody aware how GA specifically does that so I can replicate it in our system?\n\nI know that I can use\n\nperformance.navigation.type\n\n\nin my JS script, but it doesn't give me desired results.\n\nAny help would be much appreciated." ]
[ "google-analytics" ]
[ "OS X load PEM certificate using security framework", "I writing an OS X application that must use security framework, and not OpenSSL, To load the certificate files i have found SecCertificateCreateWithData that can be used for (DER)\nand SecPKCS12Import that can be used for (PKCS #12), but i have not found anything to work with PEM format.\n\nDoes exit a method to load PEM certificate using just the OS X security framework, without using OpenSSL?" ]
[ "macos", "ssl" ]
[ "Can connect between hyperledger composer and Android app?", "I created a network on hyperledger composer on one physical machine and create cards for admin and user\nI have some questions:\n\n1) how can I access the same network using 2 different machines(laptops) ?\n\n2) and if it possible to connect this network on hyperledger composer to Android app ?\n\nI want to know if these possible or not and how can do that?\n\nAnd I want to know if using hyperledger fabric will be best or go on hyperledger composer?" ]
[ "hyperledger-fabric", "hyperledger", "blockchain", "hyperledger-composer" ]
[ "Hive to HFile creation issue: MapR", "I've been working on a small task of converting and loading hive data to HFiles in HBase; framework MapR. Using bulkload I'm loading the data after conversion in HFiles. There isn't any issue with conversion, the conversion is going fine. The only issue I'm facing is MR job failure as and when the size of hive data increases. The job fails because of virtual memory getting filled up. The job breaks if the hive data size limit crosses 10Gigs.\n\nAll data is moved into single region server instead getting distributed on multiple region servers; it's a 10 node cluster I'm working on. It seems there is hbase hotspotting. \n\nI've tried splitting the regions in multiples(NUMREGIONS => 256) and distributing the load equally (SPLITALGO => 'UniformSplit') among the regions. But it doesn't resolve the issue.\nAnybody got any idea how to resolve this hotspotting issue?? \n\nRegards,\nAdil" ]
[ "hadoop", "hbase", "mapr" ]
[ "Color cells depending of their value for each row of a data frame", "I have a data frame which looks like this:\n\n header1 header2 header3 header4 ...\nrowname1 1 2 3 4\nrowname2 4 3 2 1\nrowname3 2 4 1 3\nrowname4 1 4 3 2\n...\n\n\nI would like to make a color gradient depending of the values for each row. Typically I would like the maximum value of each row to be colored green, the minimum value of each row colored red, and the other cells to be colored gradually depending of their value (second worst would be orange, second best would be yellow, etc ...).\n\nAn example of what I would like to obtain:\n\n\nCould you please help me in solving this matter ?" ]
[ "r" ]