texts
sequence | tags
sequence |
---|---|
[
"log4j.properties inside a jar file",
"I've made an component (lets Say SUBSCRIPTION jar) and exported it as jar file. This components includes log4j implementation and I am successfully able to generate the log file. (if ran independently).\n\nBut, when this jar (SUBSCRIPTION JAR) is used by other project/component, the log file that I mentioned (in log4j.properties of my component) is NOT getting generated.\n\nHow to do I make sure that log file generated, if my component is used by other project/component? (even if they implement log4j or not)\n\nHere is my log4j.properties\n\nlog4j.rootLogger=INFO, stdout, logfile\nlog4j.logger.stdout=DEBUG, stdout\nlog4j.logger.logfile=DEBUG, logfile\n\nlog4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender\nlog4j.appender.logfile.Threshold=INFO\nlog4j.appender.logfile.File=logs/subscritionLogFile.log\nlog4j.appender.logfile.DatePattern='.'yyyy-MM-dd\nlog4j.appender.logfile.layout=org.apache.log4j.PatternLayout\nlog4j.appender.logfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5p] %c:%M:%L -%X{userLoginId} %m%n\n\n\nNote: Using Apache Log4j framework"
] | [
"java",
"log4j"
] |
[
"knife cookbook upload --all returns internal server error",
"When I run: knife cookbook upload --all\n\nThis is returned:\n\nUploading apache2 [1.6.2]\nERROR: Server returned error for https://chef.lbox.com/sandboxes/000000000000a7f169ffc8cbaefb57e7, retrying 1/5 in 3s\nERROR: Server returned error for https://chef.lbox.com/sandboxes/000000000000a7f169ffc8cbaefb57e7, retrying 2/5 in 8s\nERROR: Server returned error for https://chef.lbox.com/sandboxes/000000000000a7f169ffc8cbaefb57e7, retrying 3/5 in 16s\nERROR: Server returned error for https://chef.lbox.com/sandboxes/000000000000a7f169ffc8cbaefb57e7, retrying 4/5 in 18s\nERROR: Server returned error for https://chef.lbox.com/sandboxes/000000000000a7f169ffc8cbaefb57e7, retrying 5/5 in 53s\nERROR: internal server error\nResponse: internal service error\n\n\nI checked the server logs with chef-server-ctl tail\n\nAnd the logs are crazy. http://pastebin.com/ee9fR90j\n\nAny suggestions on why I can't upload cookbooks? Where can I go to see more detailed errors? I'm at a loss. Thank you."
] | [
"chef-infra",
"knife"
] |
[
"Android: PagerAdapter creating double Fragments after config change",
"I am currently using a custom PagerAdapter (note not a FragmentPagerAdapter). My problem? When I titl the smartphone for screen rotation the Activity as we all know gets destroyed then is recreated. In this notion the Fragments are stored.\n\nMy problem is that I am not using a PagerAdapter that returns Fragments(this is what FragmentPagerAdapter does). I am returning an inflated layout, as seen here.\n\n public Object instantiateItem(ViewGroup container, int position) {\n\n LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n View itemView = null;\n FragmentManager fm = getSupportFragmentManager();\n FragmentTransaction ft;\n\n switch (position) {\n case 0:\n itemView = inflater.inflate(R.layout.left, container, false);\n\n leftFragment = new LeftFragment();\n ft = fm.beginTransaction();\n ft.replace(R.id.left, leftFragment);\n ft.commit();\n\n break;\n case 1:\n itemView = inflater.inflate(R.layout.middle, container, false);\n\n MiddleFragment middleFragment = new MiddleFragment();\n ft = fm.beginTransaction();\n ft.replace(R.id.middle, middleFragment);\n ft.commit();\n\n break;\n case 2:\n itemView = inflater.inflate(R.layout.right, container, false);\n\n rightFragment = new RightFragment();\n ft = fm.beginTransaction();\n ft.replace(R.id.right, rightFragment);\n ft.commit();\n\n break;\n case 3:\n itemView = inflater.inflate(R.layout.right_right, container, false);\n\n rightRightFragment = new RightRightFragment();\n ft = fm.beginTransaction();\n ft.replace(R.id.right_right, rightRightFragment);\n ft.commit();\n\n break;\n }\n\n ((ViewPager) container).addView(itemView);\n return itemView;\n }\n\n\nWhat this does is that it creates a new instance of a Fragment. However the Activity already stores some of these.\n\nThis is causing onCreate() etc. to fire twice, which is not a good thing for my app (I have Threads which are created in onCreate(), this means I get 2x the amount of Threads I want casuing havoc for synchronization).\n\nDoes nyone know how to either force the Activty not to store the fragments, if not, how could one restore them properly into a custom pager adapter."
] | [
"android",
"android-fragments"
] |
[
"parse string of integer sets with intervals to list",
"I have \"2,5,7-9,12\" string.\n\nI want to get [2, 5, 7, 8, 9, 12] list from it.\n\nIs there any built-in function for it in python?\n\nThanks.\n\nUPD. I suppose, the straight answer is No. Anyway, thanks for your \"snippets\". Using one, suggested by Sven Marnach."
] | [
"python",
"string",
"parsing",
"list",
"intervals"
] |
[
"Calling iprintf causes image to fail",
"I am building a small bare metal test program for a Cortex-M3 (in a SmartFusion2). I am using the GCC ARM Embedded toolchain (5-2016-q1-update). The first thing I do in my main function is to initialise a UART for debug output. I then output some characters directly to the UART to indicate boot. This UART is also used within the newlib syscalls in _write_r. The next line in my main function calls printf. If I leave this as a call to printf, as it has no arguments, the compiler optimises it to a call to puts (even though I am specifying -O0). This works correctly. If I make the call to iprintf the compiler does not optimise it, and now I see no output at all, even from the earlier call directly to the UART. This suggests that something is going wrong during start up, but I have no idea what.\n\nIn summary:\n\nvoid main(void)\n{\n UART_init();\n UART_printBuffer(\"Starting...\\r\\n\");\n printf(\"Working\\r\\n\");\n while(1);\n}\n\n\nworks correctly and nm tells me that the printf call has become puts. I see the two lines of output as expected.\n\nHowever for the following code I see no output at all:\n\nvoid main(void)\n{\n UART_init();\n UART_printBuffer(\"Starting...\\r\\n\");\n iprintf(\"Working\\r\\n\");\n while(1);\n}\n\n\nAny clues on where to start debugging this would be appreciated."
] | [
"c",
"gcc",
"arm",
"newlib"
] |
[
"Have Oracle automatically roll back abandoned sessions?",
"Is there any way to guarantee that an application won't fail to release row locks in Oracle? If I make sure to put commit statements in finally blocks, that handles the case of unexpected errors, but what if the app process just suddenly dies before it commits (or someone kicks the power cord / lan cable out).\n\nIs there a way to have Oracle automatically roll back idle sessions after X amount of time? Or roll back when I somehow detects that the connection was lost?\n\nFrom the experiments I've done, if I terminate an app process before it commits, the rows locks stay forever until I log into the database and manually kill the session.\n\nThanks."
] | [
"java",
"sql",
"oracle",
"hibernate",
"jdbc"
] |
[
"How to run multiple datetimepickers on the same page?",
"There are a lot of date and time plugins for jQuery, but it seems that there is a problem when trying to run more than one instance of this plugin.\n\nMy code:\n\n //date and time\n $('.datepick').datepicker({\n format: \"yyyy-mm-dd\",\n language: 'nb',\n weekStart: 1,\n autoclose: true,\n todayHighlight: true\n }); \n\n $('.timepick').timepicker({\n minuteStep: 15,\n showInputs: false,\n disableFocus: true,\n showMeridian: false\n });\n\n\nSome html:\n\n<div class=\"col-md-2\">\n<label class=\"text-muted\">Date</label>\n<div class=\"input-group date\">\n <input type=\"text\" class=\"form-control datepick\" name=\"date\">\n <span class=\"input-group-addon\"><i class=\"fa fa-calendar fa-lg\"></i></span>\n</div>\n\n\n\n\n<div class=\"col-md-2\">\n <label class=\"text-muted\">TIME</label>\n <div class=\"input-group date\">\n <input type=\"text\" class=\"form-control timepick\" name=\"time\">\n <span class=\"input-group-addon\"><i class=\"fa fa-clock-o fa-lg\"></i></span>\n </div> \n</div> \n\n\nI have a script that copies this code when I click a add button; the issue is that the datetimepickers won't work on the fields added to the form.\n\nDoes anyone have pointers how to make the datetimepickers show on all inputfileds that have the class datepick/timepick? \n\nUPDATE\nSeams this code did the trick.\n\n $(\"body\").delegate(\"input[type=text].datepick\", \"focusin\", function(){\n $('.datepick').datepicker({\n format: \"yyyy-mm-dd\",\n language: 'nb',\n weekStart: 1,\n autoclose: true,\n todayHighlight: true\n }); \n }); \n\n $(\"body\").delegate(\"input[type=text].timepick\", \"focusin\", function(){\n $('.timepick').timepicker({\n minuteStep: 15,\n showInputs: false,\n disableFocus: true,\n showMeridian: false\n });\n });"
] | [
"jquery",
"datepicker",
"datetimepicker"
] |
[
"Scala Parser Combinator Custom Error Messages",
"I have read a few posts on here about Scala parser-combinators and better error handling, but a lot of the \"solutions\" seem to say \"just use '~!'\", or \"Anticipate failure cases with grammar rules\".\n\nSo I attempted to implement some of that advice, but I am stuck understanding how the failure / err parsers work:\n\nval foo: Parser[String] = \"\"\"foo\"\"\".r | err(\"Custom Message\")\nval test: Parser[List[String]] = repsep(foo, \",\") | err(\"Custom Message Repsep\")\nval r = parseAll(foo, \"\"bar\") //[1.1] error: Custom Message -- YAY\nval r = parseAll(test, \"foo, bar\") //[1.2] failure: string matching regex `foo' expected but `b' found -- NOOOOOO\n\n\nMy question is basically: if foo is being repeatedly attempted against the input string because of repsep, then why - since its definition includes a | on failure to try and force an err - is the error message from the leftmost terminal in the foo production being displayed? \n\nIs there a way to view a stack of error messages in the parse result and always find mine and display to the user? Or do I need to implement my own version of repsep or something? I believe I am missing something about the conceptual model of what is going on :("
] | [
"scala",
"parser-combinators",
"custom-error-handling"
] |
[
"Exception: Failed to solve dependencies: 1:perl-JSON-XS-2.27-2.el6.x86_64 requires perl(:MODULE_COMPAT_5.10.1)",
"Scenario: new installation of plesk 12.5 on centOS 7 into an OpenVZ container (proxmox):\nInstalling Plesk 12.5 I get the following error:\nException: Failed to solve dependencies: 1:perl-JSON-XS-2.27-2.el6.x86_64 requires perl(:MODULE_COMPAT_5.10.1)\n\nany tips?"
] | [
"perl",
"installation",
"centos",
"plesk"
] |
[
"Laravel Cashier list all user invoices",
"How to display all user invoices for referencing in the admin section of the application.\n\nI can get a user invoices by \n\n$userinvoices = $user->invoices();\n\n\nOr I can get all invoice by stripe API:\n\n$invoices = \\Stripe\\Invoice::all(array(\"limit\" => 30));\n\n\nin the second case, I can't get the details of the user the invoice belongs to.\n\nOr is there any way to save invoice data to database on every creation of the invoice in stripe."
] | [
"laravel",
"stripe-payments",
"laravel-5.3",
"laravel-cashier"
] |
[
"Alloy , nl.fokkezb.loading giving error on show function. I need to upgrade some old apk, when I rebuild the old code getting this issue",
"My current Ti SDK is 9.2.0.GA, and ti cli is 5.2.5. I need to upgrade an old application that was built with 3.2.0.GA. I changed the tiapp.xml file and updated the SDK version to 9.2.0.GA. Then I am getting this error. Please help me to resolve the issue.\n[ERROR] TiExceptionHandler: (main) [1736,2805] /alloy/widgets/nl.fokkezb.loading/controllers/window.js:151\n[ERROR] TiExceptionHandler: $.loadingIndicator.show();\n[ERROR] TiExceptionHandler: ^\n[ERROR] TiExceptionHandler: Error: Unable to convert null\n[ERROR] TiExceptionHandler: at Controller.open (/alloy/widgets/nl.fokkezb.loading/controllers/window.js:151:20)\n[ERROR] TiExceptionHandler: at Controller.show (/alloy/widgets/nl.fokkezb.loading/controllers/widget.js:67:9)"
] | [
"titanium",
"appcelerator"
] |
[
"How annotations are being scanned in a spring boot application internally and post processors works?",
"I am creating an application based on some custom annotations and I feel the need to validate my whole application that whether there is any class annotated with the same annotations.\n\nI created a PostProcessors as per existing Spring Post Processor but not able to see how i can include the same post processor while loading my application as my Post Processor is in a JAR file.\n\nI wanted to know how existing post processors are included to get the annotated classes validated since my class is in a separate jar not in the application in which i need to use it..."
] | [
"spring-boot",
"annotations",
"classloader"
] |
[
"including a .lib file compiled in vs2010 in a project that is using vs2005",
"Is there any way I can have the main functions for a library built in vs 2010 be accessible from a vs2005 project? The problem that I face is that I have a project in vs 2005 that needs to use the clang frontend library to parse c code. The clang library requires vs 2010 to compile.\n\nAny light you could shed on my problem is appreciated.\n\nThanks,\nSaketh\n\nEDIT:\n\nI receive the following linker errors on compilation\n\n1>hello.lib(hello.obj) : error LNK2019: unresolved external symbol \"__declspec(dllimport) public: __int64 __thiscall std::ios_base::width(_int64)\" (_imp_?width@ios_base@std@@QAE_J_J@Z) referenced in function \"class std::basic_ostream > & __cdecl std::operator<< >(class std::basic_ostream > &,char const *)\" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z)\n1>hello.lib(hello.obj) : error LNK2019: unresolved external symbol \"__declspec(dllimport) public: __int64 __thiscall std::basic_streambuf >::sputn(char const *,_int64)\" (_imp_?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE_JPBD_J@Z) referenced in function \"class std::basic_ostream > & __cdecl std::operator<< >(class std::basic_ostream > &,char const *)\" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z)\n1>hello.lib(hello.obj) : error LNK2019: unresolved external symbol \"__declspec(dllimport) public: __int64 __thiscall std::ios_base::width(void)const \" (_imp?width@ios_base@std@@QBE_JXZ) referenced in function \"class std::basic_ostream > & __cdecl std::operator<< >(class std::basic_ostream > &,char const *)\" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z)\n1>C:\\Users\\sakethk\\Perforce\\sakethk_SAKETHK_7702\\source\\qcom\\qct\\modem\\uim\\tools\\sakethk\\hello05\\Debug\\hello05.exe : fatal error LNK1120: 3 unresolved externals"
] | [
"c++",
"visual-studio-2010",
"visual-c++",
"visual-studio-2005"
] |
[
"Inserting data to database via web form",
"I have looked for the answer to my question and seeing as all programming varies I can't seem to fix my problem. I have created a php file that does in fact connect to my database. However, when I try submitting data to my database via my php webpage it won't go through. The same happens when I try to display info from my database to a webpage. Seeing as it is in fact connecting to the database, I'm not sure what the issue is. Any help is appreciated, try to dumb it down for me as much as possible when you answer. Also, I have triple-checked my database name and table names to make sure they match up with my coding. Here's my code:\n\nConnection to database:\n\n<?php\n\nDEFINE ('DB_USER', 'root');\nDEFINE ('DB_PSWD', '');\nDEFINE ('DB_HOST', 'localhost');\nDEFINE ('DB_NAME', 'art database');\n\n$dbcon = mysqli_connect(DB_HOST, DB_USER, DB_PSWD, DB_NAME);\n\n?>\n\n\nMy form to insert data to my database:\n\n<?php\n\nif (isset($_POST['submitted'])) {\n\n include('connect-mysql.php');\n\n $fname = $_POST['fname'];\n $lname = $_POST['lname'];\n $sqlinsert = \"INSERT INTO users (first name, last name) VALUES ('$fname','$lname')\";\n\n if (!mysqli_query($dbcon, $sqlinsert)) {\n die('error inserting new record');\n } //end of nested if\n\n $newrecord = \"1 record added to the database\";\n\n\n} // end of the main if statement\n?>\n\n<html>\n<head>\n<title>Insert Data into DB</title>\n</head>\n<body>\n\n\n<hl>Insert Data into DB</hl>\n\n<form method=\"post\" action=\"insert-data.php\">\n<input type=\"hidden\" name=\"submitted\" value=\"true\"/>\n<fieldset>\n <legend>New People</legend>\n <label>First Name:<input type=\"text\" name=\"fname\" /></label>\n <label>Last Name:<input type=\"text\" name=\"lname\" /></label>\n</fieldset>\n<br />\n<input type=\"submit\" value=\"add new person\" />\n</form>\n<?php\necho $newrecord;\n?>\n\n</body>\n</html>"
] | [
"php",
"html",
"mysql",
"database"
] |
[
"Sending Large file after converting to json to Action in MVC controller",
"I am reading a file in bytes using ReadAllBytes() method. Then convert these bytes to base64. Then send this base64 string as a part of JSON. On server side (which is MVC action) I receive the JSON and convert the base64 into bytes and then save it.\nSmall files in KB are transferring very fast and saving in temp folder. But the files in MB is not transferring at all.\n\nI have set maxrequestlength, execution timeout done every thing with web config and even test by using httpwebrequest.keepalive = true and false.... but still all in vain. I can't send file chunks because its not the requirement. Want to send a Complete file at once...\n\nbyte[] b = File.ReadAllBytes(\"D://test.pdf\");\n\nstring convert = Convert.ToBase64String(b);\n\nCustomer cs = new Customer();\n\ncs.JsonString = convert;\n\nJavaScriptSerializer js = new JavaScriptSerializer();\n\njs.MaxJsonLength = Int32.MaxValue;\n\nstring json = js.Serialize(cs);\n\nvar request (HttpWebRequest)WebRequest.Create(\"http://localhost:46360/Home/Tester\");\n\nrequest.Method = \"POST\";\n\nrequest.ContentType = \"application/json; charset=utf-8\";\n\nrequest.ContentLength = (json.Length);\n\nrequest.KeepAlive = false;\n\nrequest.Timeout = System.Threading.Timeout.Infinite;\n\nrequest.Accept = \"Accept=application/json\";\n\nrequest.SendChunked = false;\n\nrequest.AllowWriteStreamBuffering = false;\n\nusing (var streamWriter = new StreamWriter(request.GetRequestStream()))\n\n{\n streamWriter.Write(json);\n streamWriter.Close();\n}\n\nvar response = (HttpWebResponse)request.GetResponse();\n\nusing (var streamReader = new StreamReader(response.GetResponseStream()))\n{\n var result = streamReader.ReadToEnd();\n}"
] | [
"javascript",
"json",
"asp.net-mvc-2",
"httpwebrequest",
"large-files"
] |
[
"forum input 100% width",
"I have truble setting input width to 100% in my search form. \nI'm not sure what I'm doing wrong. Tried setting 100% everywhere posible, put it's only changes when I set size px.\n\nhttp://jsfiddle.net/26Gmz/\n\n.searchInput {\n background: none repeat scroll 0 0 #FFFFFF;\n border: 1px solid #CCCCCC;\n border-radius: 5px;\n display: table-cell;\n height: 29px;\n padding: 0 4px;\n vertical-align: middle;\n width: 100%;\n}\n\n\n.searchIn {\n -moz-appearance: none;\n -moz-box-sizing: border-box;\n background: none repeat scroll 0 0 rgba(0, 0, 0, 0);\n border: 0 none;\n font-size: 15px;\n margin: 0;\n outline-width: 0;\n padding-left: 4px;\n width: 97%;\n}\n\n <form method=\"post\">\n <div class=\"searchEn\">\n <input type=hidden name=\"do\" value=search>\n <input type=\"hidden\" name=\"subaction\" value=\"search\" />\n <div class=\"searchInput\">\n <input class=\"searchIn\" name=\"story\" width=\"100%\" type=\"text\" />\n </div>\n\n </div>\n </form>"
] | [
"html",
"css"
] |
[
"Running Android Emulator from Android Studio terminal",
"I am trying to learn about creating Android Apps, using Android Studio 3.1.2\n\nI want to run this app on an emulator, so I created an Emulator called it OREO Emulator.\n\nBut whenever I press the run button, I get a GPU error, and went to this thread, one of the solutions is to use Android Studio Terminal, go to the address where the emulator is located, and type in the following command\n\nemulator -avd [avd_name] -gpu [mode]\n\nBut unfortunately that address doesn't exist in my laptop, so what I should type in the terminal is:\n\nemulator -avd OREO_Emulator -gpu host\nbut when I do that it says that emulator is not recognised as a command.\n\nCan anyone help me with that.\n\nThank you in advance"
] | [
"android",
"android-studio",
"android-emulator"
] |
[
"jQuery include variable as class name",
"Running into some weird issue, can't quite figure out what's wrong. No errors popping up on my console.\n\nI'm trying to filter my selector with a variable as it's class. See jsFiddle and below\n\nThanks!\n\nhttp://jsfiddle.net/danielredwood/SUxQx/2/\n\nJavaScript:\n\n$('.titles li').click(function() {\n $(this).addClass('selected').siblings().removeClass('selected');\n\n var selected = $(this).attr('class').replace(' selected', ''),\n next = $('.lyrics article').hasClass(selected);\n\n $('#w').html(selected); //for testing, shows what the value is\n $('#x').html(next); //ditto\n\n $('.shown').fadeOut(400, function() {\n $(this).removeClass('shown');\n next.fadeIn(400).addClass('shown');\n });\n});"
] | [
"jquery",
"class",
"variables",
"filter"
] |
[
"tableHeaderView disappeared after rotating the screen",
"I want to show the table header/footer (not section's) in a view controller embedded in the navigation bar, so in viewDidLoad I add this: https://gist.github.com/romyilano/5035458. \nIt seems worked. But, when I rotate the screen, the header disappeared! Reason unknown? What I use: Xcode7+iOS8+Obj-C. Any ideas? \nAt the very beginning, everything is OK. \n\nAfter rotating the screen, the header is disappeared!"
] | [
"objective-c",
"ios8",
"tableheader"
] |
[
"Ant replaceregexp task - Match and replace HTML comments block",
"I have the following block that starts and ends with HTML comments:\n\n <!--source scripts-->\n <script type=\"text/javascript\" src=\"/assets/js/namespaces.js\"></script>\n <script type=\"text/javascript\" src=\"/assets/js/main.js\"></script>\n <script type=\"text/javascript\" src=\"/assets/js/header.js\"></script>\n <script type=\"text/javascript\" src=\"/assets/js/headerPremiumForm.js\"></script>\n <script type=\"text/javascript\" src=\"/assets/js/bootstrap.js\"></script>\n <!--end source scripts-->\n\n\nI created an ant task that finds everything between the <!--source scripts--><!--end source scripts--> and replaces it with a new script file (in this case min.js), but I have trouble making it work.\n\nThis is what I've done so far:\n\n<target name=\"update-source-with-new-compiled-files\">\n <replaceregexp match=\"\\&lt;!--source scripts--\\&gt;(.*?)\\&lt;!--end source scripts--\\&gt;\" replace=\"\\&lt;script src='min.js'\\&gt;\\&lt;/script\\&gt;\" flags=\"g\">\n <fileset dir=\"${basedir}/../dist\" includes=\"*\"/>\n </replaceregexp>\n</target>"
] | [
"regex",
"apache",
"ant"
] |
[
"Why Cloudfront returning 403 with Guzzle?",
"I'm consuming a API that uses the CloudFront service,\nAnd I'm getting a 403 error for the requests with Guzzle, but if uses for example PHP Curl or call via Postman or Browser works.\nHere a log of the Guzzle:\nLog of guzzle\nAnd here part of code:\n/**\n * @return void\n */\npublic function __construct()\n{\n $this->client = new Client([\n 'base_uri' => env('API_HOST'),\n 'headers' => [\n 'Accept' => 'application/json',\n 'Content-Type' => 'application/json',\n ],\n 'timeout' => 30,\n 'debug' => true,\n ]);\n}\n\n/**\n * @param string $method\n * @param string $url\n * @param array $body\n * @param bool $isMultipart\n *\n * @return ResponseInterface\n */\nprivate function request(string $method, string $url, array $body = [], bool $isMultipart = false): ResponseInterface\n{\n if ($isMultipart) {\n $params['multipart'] = [$body];\n } else {\n $params['json'] = $body;\n }\n\n $url = $this->appedAuthTokensToUrl($url);\n\n return $this->client->request($method, $url, $params);\n}"
] | [
"php",
"amazon-cloudfront",
"guzzle"
] |
[
"How would I do a nested sort in MATLAB?",
"I am looking to do a nested sort with a matrix in MATLAB. Say my matrix looks like this:\n\n[b a; \n b c;\n a c;\n a a]\n\n\nI would like to first sort by the first column and maintain that sort, then sort by the second column. The result would be:\n\n[a a;\n a c;\n b a;\n b c]\n\n\nHow would it be done?"
] | [
"matlab",
"sorting",
"matrix",
"nested"
] |
[
"Filter if String contain sub-string pyspark",
"I have 2 datasets. In each one I have several columns. But I want to use only 2 columns from each dataset, without doing any join, merge or combination between the both of the datasets.\n\nExample dataset 1:\n\ncolumn_dataset_1 <String> | column_dataset_1_normalized <String>\n-----------------------------------------------------------------------\n11882621-V021BRP161305-1 | 11882621V021BRP1613051\n-----------------------------------------------------------------------\nW-B.7120RP1605794 | WB7120RP1605794\n-----------------------------------------------------------------------\nD/57RP.1534421 | D57RP1534421\n-----------------------------------------------------------------------\n125858G_022BR/P070751 | 125858G022BRP070751\n-----------------------------------------------------------------------\n300B.5190C57/51507 | 300B5190C5751507\n-----------------------------------------------------------------------\n\n\nExample dataset 2\n\ncolumn_dataset_2 <String> | column_dataset_2_normalized <String>\n-------------------------------------------------------------------------------------------------------------------------------------------------------------\nPor ejemplo, si W-B.7120RP1605794se trata de un archivo de texto, | PorejemplosiWB7120RP1605794setratadeunarchivodetexto \n------------------------------------------------------------------------------------------------------------------------------------------------------------- \nse abrirá en un programa de procesamiento de texto. | seabrirenunprogramadeprocesamientodetexto\n-------------------------------------------------------------------------------------------------------------------------------------------------------------\n |\n-------------------------------------------------------------------------------------------------------------------------------------------------------------\nutilizados 125858G_022BR/P070751 frecuentemente (por ejemplo, un texto que describe | utilizados125858G022BRP070751frecuentementeporejemplountextoquedescribe\n\n--------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n\ncolumn_dataset_1_normalized is the result of column_dataset_1 is normalized\ncolumn_dataset_2_normalized is the resut of column_dataset_2 is normalized\n\nI want to compare column_dataset_1_normalized if is exist in column_dataset_2_normalized.\nIf yes I should extract it from column_dataset_2\n\nExample: \n\nWB7120RP1605794 is in the second line of column_dataset_1_normalized, is exist in the first line of column_dataset_2_normalized, so I should extract it's real value [W-B.7120RP1605794], from column_dataset_2 and store it in a new column in dataset 2.\n\nAnd the same for 125858G022BRP070751 is in forth line in column_dataset_2_normalized, I should extract it from column_dataset_2 [125858G_022BR/P070751].\nThe comparaison should, take one by one value of column_dataset_1_normalized and search it in all the cell of column_dataset_2_normalized.\n\nFor normalization I used this code to kepp only number and letter:\n\ndf = df.withColumn(\n \"column_normalized\",\n F.regexp_replace(F.col(\"column_to_normalize\"), \"[^a-zA-Z0-9]+\", \"\"))\n\n\nSomeone can propose me a suggestion how can I do it ?\nThank you"
] | [
"pyspark",
"apache-spark-sql"
] |
[
"how to store the response of a service in a model with alamofire",
"I am learning to programme in swift, I developed with android previously the consumption of services and stored them in a model with the help of retrofit and serializable. Now in swift, I use the Alamofire 4.0 and SwiftyJson to consume a service and the problem is how to save all the response JSON in a model and then use this data, I have reviewed several examples but I still do not understand how to do it.\nCould you tell me how to do it or what I need to add to complete this action to get the information and then use it\nso I consume the service\n\nstatic func loginService(email : String, password : String, completionHandler : @escaping (LoginResponse) -> Void){\n let parameters : Parameters = [\"email\": email, \"password\": password]\n Alamofire.request(AlamofireConstants.LOGIN, method: .post, parameters: parameters, encoding: URLEncoding.default).validate(statusCode: 200..<300).responseData { response in\n switch response.result {\n case .failure(let error):\n print(\"error ==> \\(error)\")\n case .success(let data):\n do{\n let result = try JSONDecoder().decode(LoginResponse.self, from: data)\n print(result)\n } catch {\n print(error)\n }\n }\n }\n }\n\n\nthis is my model\n\n struct LoginResponse : Decodable {\n let user : User?\n let status: Int\n let success: Bool\n let message: String\n}\n\nstruct User : Decodable {\n let id: Int\n let firstName, lastName, surName, email: String\n let emailToken: String?\n let validate: String\n let token, nationality, documentType, documentNumber: String?\n let legalName, legalNumber, birthdate: String?\n let gender: String\n let phoneMovil, phoneFix, icon: String?\n let wishOffers, acceptTerms, isCustomer: Int\n let active: Bool\n let createdAt, updatedAt: String\n}\n\n\nand this is the json from response\n\n {\n\"user\": {\n \"id\": 183,\n \"first_name\": \"teste\",\n \"last_name\": \"testet\",\n \"sur_name\": \"este\",\n \"email\": \"[email protected]\",\n \"email_token\": null,\n \"validate\": \"S\",\n \"token\": null,\n \"nationality\": null,\n \"document_type\": null,\n \"document_number\": null,\n \"legal_name\": null,\n \"legal_number\": null,\n \"birthdate\": null,\n \"gender\": \"O\",\n \"phone_movil\": null,\n \"phone_fix\": null,\n \"icon\": null,\n \"wish_offers\": 0,\n \"accept_terms\": 1,\n \"is_customer\": 0,\n \"active\": true,\n \"created_at\": \"2019-05-13 17:04:50\",\n \"updated_at\": \"2019-05-14 10:19:31\"\n},\n\"status\": 0,\n\"success\": true,\n\"message\": \"\"\n\n\n}\n\nI get this error\n\n\n keyNotFound(CodingKeys(stringValue: \"firstName\", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: \"user\", intValue: nil)], debugDescription: \"No value associated with key CodingKeys(stringValue: \\\"firstName\\\", intValue: nil) (\\\"firstName\\\").\", underlyingError: nil))"
] | [
"swift",
"xcode",
"alamofire",
"swifty-json"
] |
[
"How to find newest files with a certain name?",
"Suppose I have a directory with many files of the same name in subdirectories (for example, comes up when keeping BibTeX files for multiple academic papers).\n\nWhat's the best way to find the newest version of a file with a given name?\n\nI've come up with the following command\n\nfind . -name \"someFile\" -exec ls -alF {} \\;\n\n\nwhich lists all the files named someFile along with their dates, but does not sort them from old to new.\n\nNote that the -t option to ls can't be used here because it is being run separately for each file."
] | [
"linux",
"sorting",
"date",
"command-line",
"find"
] |
[
"Saving a PFFile into cloud - where did it go?",
"According the the Files section of the Parse documentation, to save a PFFile, we should follow these steps:\n\n\nCreate the PFFile\nSave the PFFile to the cloud\nAfter saving completes, associate the PFFile with a PFObject\n\n\nI have troubles visualizing step #2. Here's the example code they provided, which I tried to run myself:\n\n//1. Creating the PFFile\nlet str = \"Working with Parse is great!\"\nlet data = str.dataUsingEncoding(NSUTF8StringEncoding)!\nlet file = PFFile(name: \"resume.txt\", data: data)\n\n//2. Saving the PFFile\nfile.saveInBackgroundWithBlock { succeeded, error in\n if error != nil {\n println(error)\n }\n if succeeded {\n println(\"succeeded saving PFFile to cloud\")\n }\n}\n\n\nWhen I ran the code, the file succeeded in saving. But upon checking in my Parse app database, I see nothing that indicates the object is saved.\n\nWhat is the point of step #2?"
] | [
"parse-platform"
] |
[
"I'm trying to use Java's HttpURLConnection to do a \"conditional get\", but I never get a 304 status code",
"Here is my code:\n\n final HttpURLConnection conn = (HttpURLConnection) sourceURL.openConnection();\n if (cachedPage != null) {\n if (cachedPage.eTag != null) {\n conn.setRequestProperty(\"If-None-Match\", cachedPage.eTag);\n }\n conn.setIfModifiedSince(cachedPage.pageLastModified);\n }\n\n conn.connect();\n\n if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {\n\n newCachedPage.eTag = conn.getHeaderField(\"ETag\");\n newCachedPage.pageLastModified = conn.getHeaderFieldDate(\"Last-Modified\", 0);\n\n } else if (conn.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {\n // Never reaches here\n }\n\n\nI never seem to get the HTTP_NOT_MODIFIED response code, even hitting the same server several times in quick succession - where there is definitely no change to the page. Also, conn.getHeaderField(\"ETag\") always seems to respond null, and sometimes conn.getHeaderFieldDate(\"Last-Modified\", 0) returns 0. I've tried this against a variety of web servers.\n\nCan anyone tell me what I'm doing wrong?"
] | [
"java",
"http",
"caching",
"http-caching"
] |
[
"How can I remove a video thumbnail from my Google listing?",
"Take a look at this image:\n\n\n\nDo I have to work with rich snippets?"
] | [
"google-search",
"google-rich-snippets",
"rich-snippets"
] |
[
"Loop through table php",
"Below is a while loop from my php script that populates a HTML table. I want the IF statement at the bottom to set the attribute of <td id=\"status\"></td> depending on its value. But when I run the code, only the value in the first row is set. \nI guess the problem is with using a single element ID in a loop. Can I use the element ID \"status\" for every row in the table?\n\nwhile($row=mysqli_fetch_assoc($result)){\n $dd=strtotime($row[\"due_date\"]);\n $dd=Date('d-m-Y',$dd);\n $bd=strtotime($row[\"borrow_date\"]);\n $bd=Date('d-m-Y',$bd);\n\n echo '\n <tr>\n <td>'.$row[\"user_email\"].'</td>\n <td>'.$row[\"last_name\"].'</td>\n <td>'.$row[\"first_name\"].'</td>\n <td>'.$row[\"movie_ID\"].'</td>\n <td>'.$row[\"title\"].'</td>\n <td>'.$row[\"year\"].'</td>\n <td>'.$bd.'</td>\n <td>'.$dd.'</td>\n <td id=\"status\"></td>\n\n\n\n </tr>\n ';\n $i++;\n\n if($dd<$cd){\n echo' <script type=\"text/javascript\">\n document.getElementById(\"status\").innerHTML=\"Overdue\";\n </script>';\n }\n else{\n echo '\n <script type=\"text/javascript\">\n document.getElementById(\"status\").innerHTML=\"Not Due\";\n </script>';\n }\n }"
] | [
"php",
"html"
] |
[
"Caused by: java.lang.NoSuchMethodError: No static method listOf(Ljava/lang/Object;)Ljava/util/List; in class Lk/v/i; or its super classes",
"I'm using kotlin collections library (listOf, first, toList, etc,..) methods in our AndroidTest package to run UI tests using AndroidJunit4 runner and I'm coming across these type of errors wherever I refer to kotlin collections library.\njava.lang.NoSuchMethodError: No static method listOf(Ljava/lang/Object;)Ljava/util/List; in class Lk/v/i; or its super classes (declaration of 'k.v.i' appears \n\nThe strange thing is I don't see any issues in Compile time nor when I run tests independently at the class level. The issue happens only when I run the whole test suite using Gradle\nThis is the command I use to run the UI test suite using Gradle\n./gradlew connectedCheck --info --full-stacktrace --no-build-cache --debug\n\nWhat I'm suspecting is the classes that get loaded during runtime seems to be different from compile time\nHere's the build.gradle dependencies\n\n implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.71"\n\n // Instrumented Tests\n testImplementation "androidx.test:core:1.2.0"\n androidTestImplementation 'androidx.test.ext:junit:1.1.1' \n androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.1'\n androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'\n androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' \n \n\n defaultConfig {\n testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"\n }"
] | [
"android",
"kotlin",
"android-uiautomator",
"android-junit",
"androidjunitrunner"
] |
[
"Javascript why wrap a variable or constructor in an IIFE?",
"I saw something like this today\n\nvar Visualizer = (function() {\n function Visualizer() {\n //...\n }\n Visualizer.prototype.function1 = function () { /* ... */ }\n //...\n return Visualizer;\n})();\n\nvar viz = new Visualizer();\n\n\nI don't understand the point of this versus just getting rid of the iife wrapper."
] | [
"javascript",
"iife"
] |
[
"How do I Authenticate a Service Account to Make Queries against a GDrive Sheet Backed BigQuery Table?",
"My situation is as follows:\n\nGoogle Account A has some data in BigQuery.\n\nGoogle Account B manages Account A's BigQuery data, and has also been given editor privileges for Account A's Cloud Platform project.\n\nAccount B has a Sheet in Google Drive that has some cool reference data in it. Account B logs into the BQ Web console, and creates a table in Account A's BQ project that is backed by this sheet.\n\nAll is well. Account B can query and join to this table successfully within Account A's BQ data from the web UI.\n\nProblem:\n\nGoogle Account A also has a service account that is an editor for Google Account A's Cloud Platform Project. This service account manages and queries the data in BQ using the python google-cloud API. When this service account attempts to query the reference table that is backed by Account B's GDrive Sheet, the job fails with this error:\n\nEncountered an error while globbing file pattern. JobID: \"testing_gdrivesheet_query_job1\"\n\n\nNear as I can tell this is actually an authentication issue. How can I give Account A's service account appropriate access to Account B's GDrive so it can access that reference table?\n\nBonus Points:\nIs there any performance difference between a table backed by a GDrive Sheet vs a native BQ table?"
] | [
"google-sheets",
"google-bigquery",
"google-cloud-platform",
"google-spreadsheet-api"
] |
[
"Segmentation Fault when copying content from argv[] to a char*",
"I have seen some questions about this kinds of issues but none of them helped so far.\nThe code works fine on the console but the debugger tells that there happens a segmentation fault when I allocate memory for the pointer *word, on main, right after the while that contains a switch statement. It says that argv[optind] points to NULL, I assume its because during debug it has no values attributed to it.\nSo, if I feel like I know what happens, why am I asking this question, you may ask. Its because one of my classes uses an online code tester and my code is segfaulting there, so, I, not being very well versed in this, am not sure if its my fault.\nThe code runs as I posted it, you can compile and run, it searches for a word in a file of text; Example: ./my_grep "word" "file"\nThank you.\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <ctype.h>\n#include <unistd.h>\n\n#define LINE 1000\n\nstatic char* word=NULL;\nint hasMultiWords=0, iflag=0, vflag=0, lflag=0, cflag=0;\n\nvoid lowCase(char* s){\n //Nesta funcao recebe um apontador para o inicio de uma string, assim funciona com arrays in *char;\n for(int j=0; j<strlen(s); j++){\n *(s+j) = tolower(*(s+j));\n }\n\n}\n\nvoid readFile(FILE* in, FILE* out, int argc, char *file_name){\n\n char line[LINE];\n memset(line, 0, sizeof(char)*1000);\n int n_linhas=0;\n\n while( fgets(line, LINE, in) ){\n n_linhas++;\n if( cflag==1 && strstr(line, word) !=NULL ){\n printf("%d\\n", n_linhas);\n continue;\n }\n if(iflag == 1){\n lowCase(word);\n char *ptr;\n ptr = &line[0];\n lowCase(ptr);\n }\n if( strstr(line, word) != NULL && vflag == 0){\n if(lflag == 1){\n fprintf(stdout, "%s", file_name); \n break;\n }\n fprintf(stdout, "%s", line);\n }\n if( strstr(line, word) != NULL && vflag == 1 ){\n if(lflag == 1){\n fprintf(stdout, "%s", file_name); \n break;\n }\n fprintf(stdout, "%s", line);\n }\n }\n \n}\n\nint main(int argc, char* argv[]){\n \n FILE* read;\n char* file_name;\n int opt, weirdArgs=0;\n\n\n while( (opt=getopt(argc, argv, "ivlc")) != -1){\n switch(opt){\n case 'i':\n iflag=1;\n break;\n case'v':\n vflag=1;\n break;\n case 'l':\n lflag=1;\n break;\n case 'c':\n cflag=1;\n break;\n default: \n break;\n }\n }\n\n if(optind > 0){\n word = malloc(sizeof(char)*strlen(argv[optind]));\n word = argv[optind];\n }\n\n optind++;\n\n for(; optind<argc; optind++){\n \n weirdArgs++;\n \n file_name = realloc(file_name, sizeof(char)*strlen(argv[optind]));\n file_name = argv[optind];\n\n if( strcmp(file_name, "-") == 0){\n readFile(stdin, stdout, argc, "stdin");\n }else{\n if( access(file_name, F_OK) != 0 ){\n fprintf(stderr, "%s : No such file.\\n", file_name);\n continue;\n } \n read = fopen(file_name, "r");\n readFile(read, stdout, argc, file_name);\n fclose(read);\n }\n free(file_name);\n }\n\n if(weirdArgs == 0) readFile(stdin, stdout, argc, "stdin");\n\n return 0;\n}\n\n\nEDIT: So, its fixed, I added a if statement that checks if there are arguments and make the program print in stderr if there is not, thus it won't find out about the not assigned optind. Thank you!\nif(argc == 1){ \n fprintf(stderr, "No arguments found.\\n"); \n exit(2);\n }"
] | [
"c",
"pointers",
"debugging",
"segmentation-fault",
"argv"
] |
[
"How to do Something like a transpose in SQL?",
"I am new to SQL, where I just change my job and I need to use SQL quite frequently.\n\nPreviously, I used to work with Excel which I can easily do the following conversion from picture 1 to picture 2 by using a pivot table\n\n\n\n\n\nWhere I would like to work on the original data source like in picture 1,\nand add a few new columns in picture 2 which correspond to each type in the dimension 'customer type'.\n\nI would like to know to how I can achieve this in SQL."
] | [
"sql",
"sql-server",
"tsql"
] |
[
"Escaping special characters in Jelly for a Jenkins plugin",
"In my config.jelly for the page in question I want the default value to have a dollar sign in it.\n\nFor example,\n\n<f:entry field=\"testField\" name=\"testField\" title=\"Test Field\">\n <f:textbox name=\"testField\" value=\"${testField}\" default=\"${Non_Jenkins_Variable}\" field=\"testField\" />\n</f:entry>\n\n\nWhen I do the above, however, the ${Non_Jenkins_Variable} get interpreted and ends up being blank. I found http://wiki.servicenow.com/index.php?title=How_to_Escape_in_Jelly but apparently don't understand it enough to know what to do. I've tried &#36;{Non_Jenkins_Variable} and &amp;#36;{Non_Jenkins_Variable} with no luck. To be clear when the page is rendered I want the input box to have \"${Non_Jenkins_Variable}\" as the value.\n\nthanks"
] | [
"plugins",
"jenkins",
"jenkins-plugins",
"jelly"
] |
[
"Exclude file/folder form a release merge using git-flow",
"I was wondering if there is any way to exclude a file/folder from develop to master branch merge when I finish a release using git-flow?\n\nExample: I have index.html and Gruntfile.js on develop branch and I only want the index.html to be merge on the master branch.\n\nI'm asking this because I have a dev folder on my develop branch that include files which are not necessary for the master branch (like gruntfile.js, scss file, etc) so I would prefer not to include it.\n\nAny suggestions?"
] | [
"git",
"workflow",
"git-flow"
] |
[
"jquery datepicker animation options wont work",
"I have a textbox which has JQuery UI DatePicker control registered to it. It works fine but when I try to add animation options, control itself wont work.\n\n<head runat=\"server\">\n<script>\n $(document).ready(function() {\n $(\"#TextBox1\").datepicker(\"option\", \"showAnim\", 'slideDown');\n });\n</script>\n</head>\n<body>\n <form id=\"form1\" runat=\"server\">\n <div>\n <asp:TextBox ID=\"TextBox1\" runat=\"server\"></asp:TextBox>\n </div>\n </form>\n</body>\n\n\nWithout the options, the picker would at least show itself. Can someone tell me a solution and better, what's happening? \nThanks!"
] | [
"jquery-ui",
"jquery-animate"
] |
[
"Styling an attached property with inheritance",
"My question is similar to this: WPF Style with no target type? but the problem is that mine is an attached property:\n\n<Style TargetType=\"Shape\" >\n <Setter Property=\"z:Zommable.Unscale\" Value=\"StrokeThickness\" />\n</Style>\n\n\nMy goal is: all object deriving from shape must have the attached property Zommable.Unscale with a value, but I can't find how to do it.\nThanks !"
] | [
"wpf",
"styles",
"attached-properties"
] |
[
"c# How To test Inheritance of an Abstract class with protected methods with xunit",
"Assume that I have a public Class A and an Abstract class B such that B only contains protected methods. Now let A inherit from B.\n\nNow my question is how do I(or should I) test if A inherits from B."
] | [
"unit-testing",
"c#-3.0",
"xunit.net"
] |
[
"Replacing a value in table based on string value",
"I have a table which must not display date if a string is a certain value (if warning == P) using AngularJS\n\nI'm trying to use ng-if to accomplish this, but this method would add 2 columns, one for the hidden date and one with correct date:\n\n<table ng-table=\"vm.IncidentList\" class=\"table table-hover\">\n<tr ng-repeat=\"row in $data\">\n <td data-title=\"'Incident Number'\" {{row.IR_ID_NUM}}{{row.warning}}</td>\n <td data-title=\"'Type'\"{{row.type}} </td>\n <!--if warning == p, do not display date-->\n <td ng-if \"{{row.warning}} == \"P\"\">---</td>\n <!--if warning !== p, display date-->\n <td ng-if \"{{row.warning}} != \"P\"\" data-title=\"'Date'\" {{row.date | date}}</td>\n</tr>\n</table>"
] | [
".net",
"angularjs",
"html"
] |
[
"facebook login button in android doesn't work",
"I have used the graph api in android app to get events of facebook page so I added a facebook login button to get access Token from it and I had followed the steps of the tutorial but when I press on the button nothing occur \n\nthis is my java code :\n\ncallbackManager = CallbackManager.Factory.create();\nloginButton = (LoginButton) myView.findViewById(R.id.login_button);\nloginButton.setReadPermissions(\"email\");\n// If using in a fragment\nloginButton.setFragment(this);\n\n// Callback registration\nloginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {\n\n @Override\n public void onSuccess(LoginResult loginResult) {\n accessToken=loginResult.getAccessToken();//TODO : check\n }\n\n @Override\n public void onCancel() {\n\n }\n\n @Override\n public void onError(FacebookException error) {\n\n }\n});\n\n\nand this is my xml code:\n\n<com.facebook.login.widget.LoginButton\n android:id=\"@+id/login_button\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"center_horizontal\"\n android:layout_marginTop=\"30dp\"\n android:layout_marginBottom=\"30dp\" />\n\n\nI don't need to have login button in my app is there another way to get access token without using the login button?"
] | [
"java",
"android",
"android-studio",
"facebook-graph-api",
"facebook-access-token"
] |
[
"Special parameters in Python 3",
"According to this tutorial the under the section \"Special parameters\" (https://docs.python.org/3/tutorial/controlflow.html#defining-functions) the following unusual function definition should be valid:\n\ndef test_special(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):\n print(\"in test_special\")\n print(\"pos1: \" + pos1)\n print(\"pos2: \" + pos2)\n print(\"pos_or_kwd: \" + pos_or_kwd)\n print(\"kwd1: \" + kwd1)\n print(\"kwd2: \" + kwd2)\n\n\nHowever I get the error:\n\n$ python TestArgs.py\n File \"TestArgs.py\", line 11\n def test_special(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):\n ^\nSyntaxError: invalid syntax\n\n\nI'm using Python version 3.7.5."
] | [
"python",
"python-3.x"
] |
[
"How to process the rdf version of a DBpedia page with Jena?",
"In all dbpedia pages, e.g.\n\nhttp://dbpedia.org/page/Ireland\n\nthere's a link to a RDF file.\nIn my application I need to analyse the rdf code and run some logic on it.\nI could rely on the dbpedia SPARQL endpoint, but I prefer to download the rdf code locally and parse it, to have full control over it.\n\nI installed JENA and I'm trying to parse the code and extract for example a property called: \"geo:geometry\".\n\nI'm trying with:\n\nStringReader sr = new StringReader( node.rdfCode ) \nModel model = ModelFactory.createDefaultModel()\nmodel.read( sr, null )\n\n\nHow can I query the model to get the info I need?\n\nFor example, if I wanted to get the statement:\n\n<rdf:Description rdf:about=\"http://dbpedia.org/resource/Ireland\">\n<geo:geometry xmlns:geo=\"http://www.w3.org/2003/01/geo/wgs84_pos#\" rdf:datatype=\"http://www.openlinksw.com/schemas/virtrdf#Geometry\">POINT(-7 53)</geo:geometry>\n</rdf:Description>\n\n\nOr \n\n<rdf:Description rdf:about=\"http://dbpedia.org/resource/Ireland\">\n<dbpprop:countryLargestCity xmlns:dbpprop=\"http://dbpedia.org/property/\" xml:lang=\"en\">Dublin</dbpprop:countryLargestCity>\n</rdf:Description>\n\n\nWhat is the right filter?\n\nMany thanks!\nMulone"
] | [
"java",
"parsing",
"rdf",
"jena",
"dbpedia"
] |
[
"Enterprise Architect user interface diagram checked checkbox",
"How to make my checkbox on user interface diagram checked? I'm using Enterprise Architect 11.\n\nedit: It's checkbox left control which I put on Screen control. It's all on user interface diagram."
] | [
"user-interface",
"checkbox",
"uml",
"enterprise-architect"
] |
[
"How do I aggregate file content correctly with Apache Camel?",
"I am writing a tool to parse some very big files, and I am implementing it using Camel. I have used Camel for other things before and it has served me well.\n\nI am doing an initial Proof of Concept on processing files in streaming mode, because if I try to run a file that is too big without it, I get a java.lang.OutOfMemoryError.\n\nHere is my route configuration:\n\n@Override\npublic void configure() throws Exception {\n from(\"file:\" + from)\n .split(body().tokenize(\"\\n\")).streaming()\n .bean(new LineProcessor())\n .aggregate(header(Exchange.FILE_NAME_ONLY), new SimpleStringAggregator())\n .completionTimeout(150000)\n .to(\"file://\" + to)\n .end();\n}\n\n\nfrom points to the directory where my test file is.\n\nto points to the directory where I want the file to go after processing.\n\nWith that approach I could parse files that had up to hundreds of thousands of lines, so it's good enough for what I need. But I'm not sure the file is being aggregated correctly. \n\nIf i run cat /path_to_input/file I get this:\n\nLine 1\nLine 2\nLine 3\nLine 4\nLine 5\n\n\nNow on the output directory cat /path_to_output/file I get this:\n\nLine 1\nLine 2\nLine 3\nLine 4\nLine 5%\n\n\nI think this might be a pretty simple thing, although I don't know how to solve this. both files have slightly different byte sizes as well.\n\nHere is my LineProcessor class:\n\npublic class LineProcessor implements Processor {\n\n @Override\n public void process(Exchange exchange) throws Exception {\n String line = exchange.getIn().getBody(String.class);\n System.out.println(line);\n }\n\n}\n\n\nAnd my SimpleStringAggregator class:\n\npublic class SimpleStringAggregator implements AggregationStrategy {\n\n @Override\n public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {\n\n if(oldExchange == null) {\n return newExchange;\n }\n\n String oldBody = oldExchange.getIn().getBody(String.class);\n String newBody = newExchange.getIn().getBody(String.class);\n String body = oldBody + \"\\n\" + newBody;\n\n oldExchange.getIn().setBody(body);\n\n return oldExchange;\n }\n\n}\n\n\nMaybe I shouldn't even worry about this, but I would just like to have it working perfectly since this is just a POC before I get to the real implementation."
] | [
"java",
"io",
"apache-camel"
] |
[
"How do I setup nginx on a nuxt.js website preferably on Heroku",
"I am having a problem setting up nginx on a webserver. \nI am deploying my application on Heroku and I need to have nginx infront of nuxt.js.\nThe docs say a little on how to use nginx on nuxt but only a little. They describe a\nconf file but they do not state where to put the conf file. And then they go all the way to Laravel. \nI am using node.js and vue.js and I turned to nuxt.js thinking it was easier to set up nginx on it.\nAny help will be appreciated."
] | [
"node.js",
"heroku",
"deployment",
"nuxt.js"
] |
[
"Two same routes doing different actions error",
"I've the same two routes (see below) which can be activated by two different buttons, which call two different buttons.\n\nMy scenario is:\n\nI've two buttons on the same page (\"Release Version\" and \"Publish Version\"). For each of these buttons I call a different remote method (exec_client and exec_release). \n\nSo, for questions of routes ambiguity (I think...) I couldn't call the second function I've defined on my routes.rb. Every time when I click on \"Publish Version\" button I call the exec_client method, whereas this button was supposed to call the exec_release method.\n\nMy question is: What can I do to fix it?\n\nBelow my routes code, where I think is the problem of code.\n\nmatch 'projects/:id/repository', :action => 'exec_client', :controller => 'repositories', :via => :post\nmatch 'projects/:id/repository/:branch', :action => 'exec_client', :controller => 'repositories', :via => :post\nmatch 'projects/:id/repository', :action => 'exec_release', :controller => 'repositories', :via => :post\nmatch 'projects/:id/repository/:branch', :action => 'exec_release', :controller => 'repositories', :via => :post\n\n\nIf you need another piece of my code, please ask and I'll put here."
] | [
"ruby-on-rails",
"redmine-plugins"
] |
[
"What is the first (int (*)(...))0 vtable entry in the output of g++ -fdump-class-hierarchy?",
"For this code:\n\nclass B1{\npublic: \n virtual void f1() {} \n};\n\nclass D : public B1 {\npublic:\n void f1() {}\n};\n\nint main () {\n B1 *b1 = new B1();\n D *d = new D();\n\n return 0;\n}\n\n\nAfter compilation, the vtable I get with g++ -fdump-class-hierarchy is:\n\nVtable for B1\nB1::_ZTV2B1: 3u entries\n0 (int (*)(...))0\n8 (int (*)(...))(& _ZTI2B1)\n16 B1::f1\n\n\nVtable for D\nD::_ZTV1D: 3u entries\n0 (int (*)(...))0\n8 (int (*)(...))(& _ZTI1D)\n16 D::f1\n\n\nI failed to understand what do the entries like (int ()(...))0* correspond to. Of course it means something like, it is a function which returns an int and takes unlimited number of arguments, I don't understand anything further.\nTo which function does this function pointer correspond to? and how do you know that? Mine is a 64 bit machine.\n\nThe second function pointer has an address associated at end?? To whom does that correspond to?\n\nEDIT\n\nThe compiler, I use is g++:\n\ng++ -v\nUsing built-in specs.\nTarget: x86_64-suse-linux\nConfigured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.4 --enable-ssp --disable-libssp --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --program-suffix=-4.4 --enable-linux-futex --without-system-libunwind --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux\nThread model: posix\n*gcc version 4.4.1 [gcc-4_4-branch revision 150839] (SUSE Linux)*"
] | [
"c++",
"gcc",
"virtual-functions",
"vtable"
] |
[
"Xamarin.IOS: localization does not work",
"I have a Xamarin.IOS application and try to localize some images. \nAs a guideline I took this article: https://developer.xamarin.com/guides/ios/advanced_topics/localization_and_internationalization/\n\nI try to display the image \"ImageInstructionStep1\"\n\nHere is a screenshot of my Ressources Folder:\n\n\n\nAll images have the build action \"BundleResource\".\nI assign the image in the code with this line:\n\n imageInstructionStep.Image = UIImage.FromBundle(\"ImageInstructionStep1\");\n\n\nAnd I registered the localizations in my Info.Plist:\n\n <key>CFBundleDevelopmentRegion</key>\n <string>en</string>\n <key>CFBundleLocalizations</key>\n <array>\n <string>de</string>\n <string>fr</string>\n <string>it</string>\n </array>\n\n\nBut it always displays the english version.\n\nI checked the locale the app has when I start it with this:\n\n NSLocale.CurrentLocale.LocaleIdentifier;\n NSLocale.AutoUpdatingCurrentLocale.LocaleIdentifier;\n\n\nand both give as a result \"de_US\". My expectations would have been that this would load the german localization.\n\nAlso I tried clean and rebuild the app to the simulator, including remove it from the simulator before without success.\n\nMaybe interessting as a sidenote: all my textes who are localized in resx file are shown in german as expected.\n\nWhat do I miss?"
] | [
"ios",
"xamarin",
"xamarin.ios"
] |
[
"Can we avoid npe while checking for null in nested java objects?",
"1) if(null != parentObj.childObj)\n\n2) if(parentObj.childObj != null)\n\nDo you think that \"1\" will avoid a potential null pointer exception in the case where 'parentObj' is null, in contrast to \"2\"?"
] | [
"java",
"pointers",
"null",
"object",
"nested"
] |
[
"Downloading files from a server and put it to /raw folder",
"Here is I want to make. I want to make an app, for example it has a button that will download a certain video file and put it on the resource(raw) folder. Is it possible?"
] | [
"java",
"android"
] |
[
"Readline functionality on windows with python 2.7",
"I need to import the readline functionality in a program written in python. I am currently using version 2.7 and the 3rd party packages I have seen only work up to version 2.6. Does anyone know of a 3rd party readline package for Windows with Python 2.7?"
] | [
"python",
"windows",
"readline",
"python-2.7"
] |
[
"Find all the documents in Mongodb according to distance",
"I have a collection of documents on the following format:\n\n{\n \"type\" : \"car\",\n \"distance\" : 30,\n \"location\" : {\n \"type\" : \"Point\",\n \"coordinates\" : [ \n 51.7867481, \n -0.2016516\n ]\n }\n}\n\n\nEach document has different coordinates (which are lat/long). Now, given another document of type \n\n{\n \"type\" : \"passenger\",\n \"location\" : {\n \"type\" : \"Point\",\n \"coordinates\" : [ \n 47.7867481, \n -2.2016516\n ]\n }\n}\n\n\nwhat is the best way to find out all the documents of type \"car\" that are withing the distance of the document type \"passenger\""
] | [
"mongodb",
"geospatial"
] |
[
"SQL update last occurrence",
"I have a simple SELECT query that works fine and returns one row, which is the last occurrence of a specific value in order_id column. I want to update this row. However, I cannot combine this SELECT query with the UPDATE query.\n\nThis is the working query that returns one row, which I want to update:\n\nSELECT *\nFROM (\n SELECT *,\n ROW_NUMBER() OVER(PARTITION BY order_id\n ORDER BY start_hour DESC) rn\n FROM general_report\n WHERE order_id = 16836\n ) q\nWHERE rn = 1\n\n\nAnd I tried many combinations to update the row returned by this statement. For example, I tried to remove SELECT *, and update the table q as in the following, but it didn't work telling me that relation q does not exist.\n\nUPDATE q\nSET q.cost = 550.01685\nFROM (\n SELECT *,\n ROW_NUMBER() OVER(PARTITION BY order_id\n ORDER BY start_hour DESC) rn\n FROM general_report\n WHERE order_id = 16836\n ) q\nWHERE rn = 1\n\n\nHow can I combine these codes with a correct UPDATE syntax? In case needed, I test my codes at SQL Manager for PostgreSQL."
] | [
"sql",
"database",
"postgresql",
"sql-update"
] |
[
"MooTools onLoad SmoothScrolling (Lim Chee Aun Method)",
"From the post Lim Chee Un made here:\nhttp://davidwalsh.name/mootools-onload-smoothscroll\n\nwindow.addEvent(‘domready’, function() {\nnew SmoothScroll({ duration:700 }, window);\nvar el = window.location.hash.substring(1); // the hash\nif(el) {\nwindow.scrollTo(0,0);\nvar scroll = new Fx.Scroll(window, { wait: false, duration: 700, transition: Fx.Transitions.Quad.easeInOut });\nscroll.toElement(el);\n}\n});\n\n\nI would like to have the page automatically smooth scroll to the # in the URL when the page loads. \n\nSmooth scrolling works when the link is like this, ie same page:\n\n<a href=\"#pageHeading\">Books & Booklets</a>\n\n\nRather than how I need it like this:\n\n<a href=\"books.html#pageHeading\">Books & Booklets</a>\n\n\nCan anybody shed some light on why this isn't working?\n\nThanks"
] | [
"javascript",
"mootools",
"smooth-scrolling"
] |
[
"How to query in Doctrine2 WHERE = 'value from a related Entity'",
"The relationship is as easy as \nMany posts -> one User \n\n// Acme\\AppBundle\\Entity\\UploadPlugin\\Post\n/**\n * @ORM\\ManyToOne(targetEntity=\"Acme\\AppBundle\\Entity\\AuthBundle\\LiveUser\")\n * @ORM\\JoinColumn(name=\"posts\", referencedColumnName=\"id\")\n **/\nprivate $postOwner;\n\n\nSo when I create a new Post like this : \n\n $image = new Post();\n\n $image->setName($imagetitle);\n $image->setPostowner($this->getUser());\n //(...) set further stuff\n $em = $this->getDoctrine()->getManager();\n $em->persist($image);\n $em->flush();\n\n\nI'd just return a json from the controller: \n\n$posts= $em->createQuery(\n \"SELECT p\n FROM GabrielAppBundle:UploadPlugin\\Post p\"\n)->getResult();\n\n$serializer = $this->container->get('jms_serializer');\n$json = $serializer->serialize($posts, 'json');\n\n$response = new Response($json);\n$response->headers->set('Content-Type', 'application/json');\nreturn $response;\n\n\nit returns a JSON like this\n\n[{\n\"id\": 10,\n\"name\": \"So das Alkoholfrei\",\n\"path\": \"so-das-alkoholfrei_546.png\", \n\"type\": \"image\", \n\"post_owner\": {\n \"uname\": \"gabriel\",\n \"fname\": \"Will\",\n \"lname\": \"Smith\",\n \"ppic\": \"profilepic_61602.png\"\n},\n\"created_at\": \"2015-06-19T23:58:35+0200\",\n\"updated_at\": \"2015-06-19T23:58:35+0200\"\n}\n]\n\n\nNow I need a code that will let me fetch all user posts based on the username, but I don't know how to achieve this.\n\nI need something similar to this ,or another solution\n\n $posts= $em->createQuery(\n \"SELECT p\n FROM GabrielAppBundle:UploadPlugin\\Post p WHERE p.postOwner.uname = :username\"\n )->setParameter('username','john')\n ->getResult();"
] | [
"php",
"json",
"symfony",
"orm",
"doctrine-orm"
] |
[
"Importing AD attributes from CSV using powershell",
"Im new to PowerShell and I'm attempting to update AD attributes using PowerShell from a .csv file\nbelow are the rows in my csv file and what attributes I'm trying to update\nDepartment > Department\nDivision > Division\nService > info\nEmployeeFullname (using to identify the object)\nLineMangerFullname > manager\nCostCentre > departmentNumber\nJobTitle > title\nSo far i've only been able to update the Department, Division , Title (Job Title) & Manager attributes in Active Directory\nI am using the script below which updates these attributes successfully\n$Users = Import-CSV C:\\Users\\user\\Documents\\CurrentWork\\userlist.csv\n\nForEach ($User in $Users) {\n Get-ADUser -Filter * -property displayname | where {$_.displayname -eq $User.EmployeeFullName} | Set-ADUser -department $User.Department -Division $User.Division -Title $User.JobTitle -Manager $User.LineMangerFullname\n}\n\nhowever when adding info and departmentNumber to the script (below), it fails with:\n\n"parameter name 'info' is ambiguous" and A parameter cannot be found that matches parameter name 'departmentNumber'\n\n\n$Users = Import-CSV C:\\Users\\user\\Documents\\CurrentWork\\userlist.csv\n\nForEach ($User in $Users) {\n Get-ADUser -Filter * -property displayname | where {$_.displayname -eq $User.EmployeeFullName} | Set-ADUser -department $User.Department -Division $User.Division -Title $User.JobTitle -Manager $User.LineMangerFullname -info $User.Service -departmentNumber $User.'Cost Centre'\n}\n\ndoes anyone know what im doing wrong or how I can get these to update please and also how i can export the results to see if the update is successful? really stuck here"
] | [
"powershell",
"active-directory"
] |
[
"Android using SQLite cursor to display next item or previous item",
"A common Android application feature is to swipe on each detail item to get to the next item or previous item.\n\nThe database cursor contains a list of items which are displayed in the onCreate of a ListActivity:\n\nif (cursor.moveToFirst()) {\n listThings.setAdapter(new ResourceCursorAdapter(this, R.layout.my_simple_expandable_list_item_2, cursor) {\n @Override\n public void bindView(View view, Context context, Cursor cursor) {\n TextView tvFirst = (TextView)view.findViewById(android.R.id.text1);\n TextView tvSecond = (TextView)view.findViewById(android.R.id.text2);\n\n tvFirst.setText(cursor.getString(1) + \" - \" + getPctString(cursor.getString(2)));\n tvSecond.setText(cursor.getString(3));\n }\n });\n} else {\n....\n\n\nThat works fine. The built-in layout resource R.layout.my_simple_expandable_list_item_2 tells the adapter to display each item in the cursor in a single text view. On click, I'm able to show the details of the item in the follow-on activity:\n\nAdapterView.OnItemClickListener itemClickListener = new AdapterView.OnItemClickListener() {\n public void onItemClick(AdapterView<?> listView, View v, int position, long id) {\n Intent intent = new Intent(ThingListActivity.this, ThingActivity.class);\n intent.putExtra(FollowOnActivity.EXTRA_ID, (int) id);\n startActivity(intent);\n }\n};\n\n\nOnce in FollowOnActivity I can lookup the details and populate the view. I can also listen for and react to swipes.\n\nProblem: I don't have access to what the next and previous items in the list are. So far, I've not come-up with what I consider a clean solution. Since this is a common requirement, there's probably a nice pattern for this. I'd like to know what that is.\n\nI was able to get this screen slide example working, but the list in that example is fixed at five items, and those items are text in xml files instead of database items. I created ThingSlideActivity based on their ScreenSlidePagerActivity, ThingSlidePageAdapter based on their ScreenSlidePageAdapter and ThingSlideFragment based on their ScreenSlidePageFragment. But I don't know how to wire that up to the list view that I'm coming from. It might have a big list, and I'm trying not to pull details on all of them. \n\nI'm sitting in a list view that's been populated with a cursor (the first block of code at the top of this question). The user clicks on a random one in the list and onListItemClick runs. What should it do to enable swiping left and right to see previous and next items?"
] | [
"android",
"sqlite",
"android-layout",
"listview",
"ontouchlistener"
] |
[
"DATEADD function have severe performance degradation on linked server query",
"I am running a query from our on premise SQL server which is linked to an azure database via a linked server and I run the below query in milliseconds:\n\nSELECT *\nFROM [Cloud].[website].[dbo].[Topup]\nWHERE CAST(senttovpn AS DATE) = '7 aug 2016'\nGO\n\n\nDue to the server time being 1 hour behind our current time I want to add an hour to the timestamp and so run the following query:\n\nSELECT *\nFROM [Cloud].[website].[dbo].[Topup]\nWHERE CAST(DATEADD(hour, 1, senttovpn) AS DATE) = '7 aug 2016'\nGO\n\n\nThis however takes 1 minute and 19 seconds to run. Can anyone tell me why this degradation is so severe a what is the best SQL solution to this?"
] | [
"sql",
"sql-server",
"linked-server"
] |
[
"Create a subset of a dictionary, sorting the original dictionary by a list of values.",
"I'm creating a dictionary (first block of code) and would like to be able to filter out the keys I don't need according to their values, then output this to a CSV. \n\nThe values I'd like to match are stored in a list, generated below in the second block of code. \n\nAll are strings, no integers. \n\nHere is my code so far:\n\n#new_dict = raw_input(\"Enter Dictionary Name\")\n#source: http://bit.ly/1iOS0e3\nimport csv\nnew_dict = {}\nwith open(raw_input(\"Enter csv file (including path)\"), 'rb') as f:\n reader = csv.reader(f)\n for row in reader:\n if row[0] in new_dict:\n new_dict[row[0]].append(row[1:])\n else:\n new_dict[row[0]] = row[1:]\nprint new_dict\n\n\nAnd the list:\n\n#modified from: http://bit.ly/1iOS7Gu\nimport pandas\ncolnames = ['Date Added to Catalog', 'PUBMEDID', 'First Author', 'Date', 'Journal', 'Link', 'Study', 'DT', 'Initial Sample Size', 'Replication Sample Size', 'Region', 'Chr_id', 'Chr_pos', 'Reported Gene(s)', 'Mapped_gene', 'p-Value', 'Pvalue_mlog', 'p-Value (text)', 'OR or beta', '95% CI (text)', 'Platform [SNPs passing QC]', 'CNV']\ndata = pandas.read_csv('C:\\Users\\Chris\\Desktop\\gwascatalog.csv', names=colnames)"
] | [
"python",
"dictionary",
"filter",
"genetics"
] |
[
"How to resolve Cannot read property 'loadChildren' of undefined",
"I have a route like:\n\napp-routing.module.ts\n\nlet routes: Routes;\nroutes = [\n {\n path: '',\n children: [\n {\n path: '',\n children: [\n {\n path: '',\n children: [\n {path: '', component: HeaderComponent, outlet: 'header'},\n {path: '', component: FooterComponent, outlet: 'footer'}\n // Routes that display a header and footer go here.\n ]\n },\n {\n path: '',\n children: [\n {\n path: '/frame',\n children: [{\n path: 'search',\n loadChildren: () => import('./search/search.module').then(module => module.SearchModule)\n }]\n }\n ]\n }\n ]\n }\n ]\n }\n];\n\n\napp.module.ts\n\nimport { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\n\nimport { AppRoutingModule } from './app-routing.module';\nimport { AppComponent } from './app.component';\n\n@NgModule({\n declarations: [\n AppComponent\n ],\n imports: [\n BrowserModule,\n AppRoutingModule\n ],\n providers: [],\n bootstrap: [AppComponent]\n})\nexport class AppModule { }\n\n\nWhen running npm start I get the error\n\n\n Cannot read property 'loadChildren' of undefined"
] | [
"mongodb",
".net-core",
"asp.net-core-webapi",
"mongodb-.net-driver"
] |
[
"Angular 2 Value Providers - Values set from API call at initialization",
"I need to provide a date format to our application. We use this to set the format for all display and input of dates.\n\nI need to provide this in numerous places to the application. However, the date varies depending on the client. We have an API call that provides a variety of settings (one of which is the date config) as a JSON object. \n\nI want to be able to provide an object representing the configuration options as a value via DI. There are lots of examples of providing values, but they are all static rather than dynamic.\n\nI want to do something like this in my DI composition root\n\nprovide('DateFormat', {\n useValue: 'dd/MM/yyyy' \n})\n\n\nHowever, I want 'dd/MM/yyyy' to come from settings at startup.\n\nI have tried providing it via services, but it is causing issues with race conditions in a few places (value not available when one service runs). Some of this could be solved by re-writing it using more observables, but it just makes the code more complex. So I want some way to provide the object via DI and have the values set before doing anything else.\n\nAny ideas how to achieve this?"
] | [
"dependency-injection",
"angular",
"angular2-services"
] |
[
"Technique for jquery change events and aurelia",
"I need to find a reliable solution to making the two frameworks play nicely.\n\nUsing materialize-css, their select element uses jquery to apply the value change. However that then does not trigger aurelia in seeing the change. Using the technique of...\n\n $(\"select\")\n .change((eventObject: JQueryEventObject) => {\n fireEvent(eventObject.target, \"change\");\n });\n\nI can fire an event aurelia sees, however, aurelia then cause the event to be triggered again while it's updating it's bindings and I end up in an infinite loop.... Stack Overflow :D\n\nWhats the most reliable way of getting the two to play together in this respect?"
] | [
"aurelia"
] |
[
"Visitor pattern (from bottom to top)",
"Please consider the (example) code below before I get to my specific question regarding visitor pattern in python:\n\nclass Node:\n def __init__(self):\n self.children = []\n def add(self, node):\n self.children.append(node)\n def check(self):\n print(\"Node\")\n return True\n def accept(self, visitor):\n visitor.visit(self)\n\nclass NodeA(Node):\n def check(self):\n print(\"NodeA\")\n return True\nclass NodeB(Node):\n def check(self):\n print(\"NodeB\")\n return True\n\n\nclass NodeA_A(NodeA):\n def check(self):\n print(\"NodeA_A\")\n return True\nclass NodeA_B(NodeA):\n def check(self):\n print(\"NodeA_B\")\n return True\n\nclass NodeA_A_A(NodeA_A):\n def check(self):\n print(\"NodeA_A_A\")\n return False\n\nclass NodeRunner:\n def visit(self, node):\n node.check()\n if len(node.children) > 0:\n for child in node.children:\n child.accept(self)\n\nif __name__ == \"__main__\":\n n = Node()\n n1 = NodeA()\n n2 = NodeB()\n n11 = NodeA_A()\n n12 = NodeA_B()\n n111 = NodeA_A_A()\n\n n.add(n1)\n n.add(n2)\n\n n1.add(n11)\n n1.add(n12)\n\n n11.add(n111)\n\n v = NodeRunner()\n v.visit(n)\n\n\nWhen I run it, it traverse all the nodes-classes iteratively and returns the following:\n\nNode\nNodeA\nNodeA_A\nNodeA_A_A\nNodeA_B\nNodeB\n\n\nThis is all fine but now to my question. You may have noticed that each check-method returns a Boolean (lets say this is a complicated method in reality). \n\nIn the example above every check-method inside Node classes return True except NodeA_A_A. I would like to store this somehow during visiting so I can fail all the base classes.\n\nThis is hard to explain let me illustrate:\n\n\nif NodeA_A_A returns False, then I would like to fail NodeA_A, NodeA and Node. regardless of what these classes return.\nif NodeB returns False, then I would like to fail Node. regardless of what other classes return.\n\n\nSo if a child-class is somewhere failing (check method returns False), I would like to fail all its base classes.\n\nDoes anyone have any ideas?"
] | [
"python",
"design-patterns",
"python-2.7",
"visitor-pattern"
] |
[
"UIAlertController error 'bounds' not found on object of type '__strong id'",
"I am trying to create an alert that when brought up will ask the user if they want to select a photo from their library or take a photo. I am working off of a template from the post UIPopover How do I make a popover with buttons like this?. The template is...\n\nUIAlertController * alertController = [UIAlertController alertControllerWithTitle: nil\n message: nil\n preferredStyle: UIAlertControllerStyleActionSheet];\n[alertController addAction: [UIAlertAction actionWithTitle: @\"Take Photo\" style: UIAlertActionStyleDefault handler:^(UIAlertAction *action) {\n // Handle Take Photo here\n}]];\n[alertController addAction: [UIAlertAction actionWithTitle: @\"Choose Existing Photo\" style: UIAlertActionStyleDefault handler:^(UIAlertAction *action) {\n // Handle Choose Existing Photo here\n}]];\n\nalertController.modalPresentationStyle = UIModalPresentationPopover;\n\nUIPopoverPresentationController * popover = alertController.popoverPresentationController;\npopover.permittedArrowDirections = UIPopoverArrowDirectionUp;\npopover.sourceView = sender;\npopover.sourceRect = sender.bounds;\n\n[self presentViewController: alertController animated: YES completion: nil];\n\n\nhowever at popover.sourceRect = sender.bounds; xcode gives me an error that states Property 'bounds' not found on object of type '__strong id'. What is this error saying and how is this fixed?"
] | [
"ios",
"objective-c",
"xcode",
"uialertcontroller"
] |
[
"JPA Mapping for lookup information from table",
"I would like to know how to map the following\n\nI have two Entity classes called Parts and PartType\n\nParts\n\n@Entity\n@Table(name = \"PARTS\")\npublic class Parts\n\n@Id\n@Column(name = \"PART_ID\")\nprivate Long partId;\n\n@Column(name = \"PART_NAME\")\nprivate String partName;\n\n@Column(name = \"PART_TYPE\")\nprivate String partType;\n\n// with getters and setters\n\n\nPartType\n\n@Entity\n@Table(name = \"PART_TYPE\")\npublic class PartType\n\n@Id\n@Column(name = \"PART_TYPE\")\nprivate String partType;\n\n@Column(name = \"PART_DESC\")\nprivate String partType;\n\n@Column(name = \"PART_OWNER\")\nprivate String partOwner;\n\n\n// with getters and setters\n\n\nIn database there is a relation between PART_TYPE of PARTS table and PART_TYPE of PART_TYPE table. It is linked with a foreign key from PARTS table to PART_TYPE, PART_TYPE is the primary key in PART_TYPE table.\n\nPART_TYPE is a look up table to get the information of a PART_TYPE.\n\nWhat I would like to know is if I would want to map JPA relationship, should I map it has OnetoOne mapping or ManytoOne mapping from Parts Entity to PartType Entity?\n\nI would want to acheive two things in my application in relation to this, one I would want to get PART_TYPE details like desc, owner etc as one row so that I can display in grid and when user would want to edit the grid information, I would want to display partType and partDesc as a combo drop down.\n\nI am getting into JPA and Hibernate, so any help on this is very much useful"
] | [
"hibernate",
"jpa",
"jpa-2.0"
] |
[
"Promises: return then() when action inside it is finished",
"I am using React-Redux-Express, and I'm trying to upload an image with express-fileupload. Here is my logic for uploading images in my Express server:\n\nIn my Express route I do this with Sequelize\n\nrouter.put('/:id', function(req, res, next) {\n models.Projects.update(\n {\n title: req.body.title,\n img: req.body.img,\n description: req.body.description,\n },\n {\n returning: true,\n plain: true,\n where: {\n id: req.params.id,\n },\n }\n )\n .then(() => { \n if (req.files) {\n req.files.imgFile.mv(toRelative(req.body.img), function(err) { \n if (err) {\n throw new Error('Image saving failed');\n }\n });\n }\n })\n .then(() => { \n models.Projects.findById(req.params.id).then((result) => {\n return res.send({\n Project: result,\n });\n });\n })\n .catch((error) => {\n return res.send(String(error));\n });\n});\n\n\nThe problem is that the last then is triggered before req.files.imgFile.mv method is finished moving the image, so the React input component can't find it in the frontend.\n\nDoes anyone know how can I create a promise inside the first then, so only when req.files.imgFile.mv is finished moving the image the second is triggered?\n\nThanks!"
] | [
"javascript",
"node.js",
"express",
"promise",
"sequelize.js"
] |
[
"Get a flatten JSON from an various Sails.js models associations",
"I have this hierarchy structure: Person < has a > Team < has a > Department\n\nand I want to extract the flatten record from a person like this:\n\n{ \n \"name\": \"Foo\",\n \"id\": 1,\n ...\n \"team\": {\n \"name\": \"MGMT\",\n \"id\": 1,\n \"department\": 1\n ...\n },\n \"department\": {\n \"name\": \"Top\",\n \"id\": 1,\n \"office\": 1\n ...\n }\n}\n\n\nThese are the models:\n\nPERSON\n\n// A person that belongs to a team\nmodule.exports = {\n\n attributes: {\n name: {\n type: 'string',\n required: true\n },\n\n //Assosiations \n team: {\n model: 'team'\n },\n department: {\n model: 'department',\n via: 'team.department'\n }, \n }\n};\n\n\nTEAM\n\n// A team with many persons and belongs to one department\nmodule.exports = {\n\n attributes: {\n name: {\n type: 'string',\n required: true\n },\n\n //Associations\n department: {\n model: 'department'\n },\n\n members: {\n collection: 'person',\n via: 'team'\n }\n }\n};\n\n\nDEPARTMENT\n\n// A department that has many teams\nmodule.exports = {\n\n attributes: {\n name: {\n type: 'string',\n required: true\n },\n\n teams: {\n collection: 'team',\n via: 'department'\n }\n }\n};\n\n\nI'm can't do it like this (yes, it has more levels): \n\nfunction (req, res) {\n\n Person.findById(1).exec(function (err, people) {\n Team.findById(people[0].team).exec(function (err, teams) {\n Department.findById(teams[0].department).exec(function (err, departments) {\n Office.findById(departments[0].office).exec(function (err, offices) {\n Company.findById(offices[0].company).exec(function (err, companies) {\n\n var composeRecord = Object.assign(\n people[0], {\n team: teams[0],\n department: departments[0],\n office: offices[0],\n company: companies[0],\n });\n\n res.send(composeRecord);\n\n })\n })\n })\n })\n }) \n }\n\n\nAny ideas how to do it better?"
] | [
"sails.js",
"waterline"
] |
[
"Append child element to all SVG nodes with the same class",
"I have the following code which generates some random images on an SVG canvas. \n\nWhat I want to do is use the code under the //this bit// comment to append an animate node to all the elements with a specific class. \n\nHowever, the code below does not work... and for the life of me I cant figure out why, could anyone point me in the right direction\n\nfunction createBackground(){\n var loopLimit = Math.floor((Math.random()*100)+1);\n\n for(var i=0; i<100; i++)\n {\n var jpgSelecter = Math.floor((Math.random()*10)+1);\n var thisItem = document.createElementNS( svgNS, \"image\" ); \n thisItem.setAttributeNS(null,\"id\",\"node_\" + Math.round(new Date().getTime() / 1000));\n thisItem.setAttributeNS(null,\"class\",\"node\" + jpgSelecter);\n thisItem.setAttributeNS(null,\"x\",(Math.random()*500)+1);\n thisItem.setAttributeNS(null,\"y\",(Math.random()*500)+1);\n thisItem.setAttributeNS(null,\"width\",(Math.random()*500)+1);\n thisItem.setAttributeNS(null,\"height\",(Math.random()*500)+1);\n thisItem.setAttributeNS(xlinkns,\"xlink:href\",\"images/blobs\" + jpgselecter + \".png\");\n\n document.getElementById(\"SVGcanvas\").appendChild(thisItem);\n }\n\n\n//This Bit//\n\n var animate = document.createElementNS( svgNS, \"animateTransform\" );\n ani.setAttributeNS(null,\"name\",\"transform\");\n ani.setAttributeNS(null,\"begin\",\"0\");\n ani.setAttributeNS(null,\"type\",\"rotate\");\n ani.setAttributeNS(null,\"from\", \"0 180 50\");\n ani.setAttributeNS(null,\"to\",\"360 180 50\");\n ani.setAttributeNS(null,\"dur\",\"4\");\n ani.setAttributeNS(null,\"repeatCount\",\"indefinite\");\n\n var tenner = document.getElementsByClassName(\"node_10\");\n for(i=0; i<tenner.length; i++)\n {\n alert(tenner[i]);\n tenner[i].appendChild(ani);\n }\n\n} \n\n\nUpdate\n\nI've edited my code, this doesn't throw up any errors however the animation node doesn't get appended."
] | [
"javascript",
"svg"
] |
[
"Passing a variable to a self invoking function",
"I have an AJAX request and in the success handler, to be able to grab the data anywhere I pass it to a function, called dataHandler. From there I handle what I need and end up with an array of items.\n\nfunction dataHandler() {\n var myArray = [\"21/06/2016\"];\n}\n\n\nI'm trying to pass what i've got in the dataHandler() function to another function that is self invoking but if I named the function like $(function myName(){} then in my first function did myName(myArray); I still can't access the data.\n\n$(function() {\n console.log(myArray);\n})\n\n\nHow can I pass a variable from a normal function to a self invoking function?"
] | [
"javascript",
"jquery"
] |
[
"Regarding Routing in mvc",
"I have a url like www.abc.com in mvc3 application, i set a default map.route like this \n\nroutes.MapRoute(\n \"Default\", // Route name\n \"{controller}/{action}/{id}\", // URL with parameters\n new { controller = \"UserLogOnPage\", action = \"LogOn\", id = UrlParameter.Optional } // Parameter defaults\n);\n\n\nnow what is happening when i type www.abc.com and enter it goes to Controller:UserLogOnPage Method:Logon and in browser url is also showing www.abc.com which is correct, but when enter url like www.abc.com/UserLogOnPage/Logon same method and controller ,i want url like www.abc.com not www.abc.com/UserLogOnPage/Logon how can i do this.\n\nThanks"
] | [
"asp.net-mvc",
"asp.net-mvc-4"
] |
[
"How get value from this code by using Selenium?",
"I want this value 201607000044 to string from this code - \n\n<SPAN id=ctl00_ctl00_ctl00_ctl00_ContentPlaceHolderCenter_ContentPlaceHolderBody_ContentPlaceHolderBody_ContentPlaceHolderBody_txtNumber class=inputBold style=\"WIDTH: 200px; DISPLAY: inline-block\">201607000044</SPAN>\n\n\nBecause this is not working -\n\nIWebElement notificationNumberElement = FindElementById(\"ctl00_ctl00_ctl00_ctl00_ContentPlaceHolderCenter_ContentPlaceHolderBody_ContentPlaceHolderBody_ContentPlaceHolderBody_txtNumber\");\n string notificationNumber = notificationNumberElement.GetAttribute(\"value\");"
] | [
"c#",
"asp.net",
"selenium",
"testing"
] |
[
"How to export a local function within an Express router.get() function?",
"I wish to export a local function using module.exports = { router, functionName } but I am struggling to do so at the moment.\nMy code is shown below - I want to know how to export the controller 'checkUserLoginCredentials'.\nrouter.get('/', async function checkUserLoginCredentials(req, res) {\n //Controller code handling user login\n});\n\nI wish to export the controller to be used in unit tests but as the controller is a local function I cannot simply place it in module.exports and then import it into my test file using const { checkUserLoginCredentials } = require('path') . Any help would be greatly appreciated thank you."
] | [
"javascript",
"node.js",
"express",
"controller",
"module.exports"
] |
[
"Access actions from within an route in Ember.js",
"I'm updating the following route:\n\nApp.SomeRoute = Ember.Route.extend({\n events: {\n getMore: function(){\n var controller = this.get('controller'),\n nextPage = controller.get('page') + 1,\n perPage = controller.get('perPage'),\n items;\n\n items = this.events.fetchPage(nextPage, perPage);\n controller.gotMore(items, nextPage);\n },\n\n fetchPage: function(page, perPage){\n . . . .\n }\n }\n});\n\n\nFor the most part, it works fine. However, the events syntax has been deprecated. Instead, we're suppose to use actions. Updating that works well enough, until I get to the line:\n\nitems = this.events.fetchPage(nextPage, perPage);\n\n\nThis throws the error:\n\nTypeError: this.events is null\n\n\nUnfortunately, I get the same error if I update the code to:\n\nitems = this.actions.fetchPage(nextPage, perPage);\n=> TypeError: this.actions is null\n\n\nHow can I access action methods from within the same route?"
] | [
"javascript",
"ember.js"
] |
[
"Help with Jquery code to vertically aligning DIV",
"I have everything set up on a jsFiddle page, please take a look at it here: http://jsfiddle.net/ryanjay/bq5eE/\n\nMy problem is, when you open the DIV (column), it aligns all the other closed divs to the bottom of it. Can someone help me by adding some jquery code to make it so when you open each DIV(column) the other divs stay aligned to the top. Perhaps it has something to do with margin-top, I am unsure. \n\nI am also using a slider that wraps around the columns, so floating them isn't an option.. they just wrap to the next line. They must have a display of inline-block.\n\nThanks\n\nHere is my HTML:\n\n<div class=\"column\">\n <div class=\"open\">\n open\n </div>\n <div class=\"close\">close</div>\n <div class=\"contentInner\">\n <div class=\"ProjectContainer\">\n Content goes here. \n </div>\n </div>\n</div>\n\n<div class=\"column\">\n <div class=\"open\">\n open\n </div>\n <div class=\"close\">close</div>\n <div class=\"contentInner\">\n <div class=\"ProjectContainer\">\n Content goes here. \n </div>\n </div>\n</div>\n\n\nHere is my Jquery: \n\n$(document).ready(function() {\n //Page Load\n $('.column').css({\n width: '200px',\n height: '200px'\n });\n // Open\n $('.open').click(function() {\n $(this).parent().animate({\n width: '400px',\n height: '520px',\n }, 500);\n $(this).hide();\n $(this).siblings('.close').show();\n $(this).siblings('.contentInner').fadeIn('slow', function() {\n $(this).show();\n });\n });\n\n // Close\n $('.close').click(function() {\n $(this).parent().animate({\n width: '200px',\n height: '200px'\n }, 500);\n $(this).siblings('.contentInner').fadeOut('100', function() {\n $(this).hide();\n });\n $(this).hide();\n $(this).siblings('.open').fadeIn('150', function() {\n $(this).show();\n });\n });\n\n});\n\n\nAnd my CSS:\n\n.column {\n position: relative;\n width: 200px;\n border-left: 1px solid #999;\n border-right: 1px solid #999;\n height: 520px;\n margin: 30px 30px 0px 0px;\n display: inline-block;\n text-align: left;\n}\n\n.open {\n position: absolute;\n margin: 0px 0px 0px 0px;\n cursor: pointer;\n}\n\n.close {\n position: absolute;\n margin: 0px 0px 0px 368px;\n cursor: pointer;\n display: none;\n}\n\n.contentInner {\n position: absolute;\n width: 380px;\n height: 400px;\n font: 12px Helvetica, Arial, Sans-Serif;\n font-weight: 200;\n margin: 20px 0px 0px 10px;\n display: none;\n white-space: normal;\n}\n\n\nYou can always see it on jsFiddle here: http://jsfiddle.net/ryanjay/bq5eE/\n\nThanks!"
] | [
"jquery",
"alignment"
] |
[
"Generate random numbers until every digit [0, 9] is generated",
"I want to make an experiment where I create a list of many lists of randomly generated sequences that all contain every digit 0 to 9 inclusive, that is, the generation function is to generate random numbers and place them in a list of integers while there is at least 1 digit not found in the list.\n\nThe intention for the experiment is to try to make some generalizations about things like expected number # of digits in such a function, how long can a sequence get(can my program loop indefinitely and never find that last digit?), and other interesting things(for me).\n\nI am using PERL for the experiment.\n\nThe idea seemed simple at first, I sat down, created a list, and figured I can just make a loop that runs an arbitrary amount of times (I decided to choose 100 times), which calls a function generate_sequence(input: none, output: list of numbers that contains at least 1 of every digit) and adds it to the list.\n\nI quickly realized that I struggle cleanly specifying what it means, pragmatically, to generate a list of numbers that contains one of every digit. \n\nMy original attempt was to make a list of digits(0..9), and as I generate numbers, I would search the list for that digit if it is in the list, and remove it. This way, it would generate numbers until the list of digits \"still needed\" is empty. This approach seems unappealing and can involve a lot of redundant tasks such as checking whether the digit generated is in the list of digits needed every single time a number is generated...\n\nIs there a more elegant solution to such a problem? I am really unhappy with the way I am approaching the function.\n\nIn general, I need a function F that accepts nothing, and returns a list of randomly generated numbers that contains every digit 1..9, that is, it stops as soon as every digit from 1 to 9 inclusive is generated.\n\nThanks ahead of time."
] | [
"perl",
"random",
"scripting"
] |
[
"get sub array key php",
"i have an array:\n\nArray\n( \n[47] => Array\n (\n [name] => 3543 good\n [price] => 100.0000\n [image] => data/hp_1.jpg\n [discount] => \n [stock_status] => \n [weight_class] => kg\n )\n\n[28] => Array\n (\n [name] => HTC Touch HD\n [price] => 100.0000\n [image] => data/htc_touch_hd_1.jpg\n [discount] => \n [stock_status] => \n [weight_class] => g\n )\n\n[41] => Array\n (\n [name] => iMac\n [price] => 100.0000\n [image] => data/imac_1.jpg\n [discount] => \n [stock_status] => \n [weight_class] => kg\n )\n\n[40] => Array\n (\n [name] => iPhone\n [price] => 101.0000\n [image] => data/iphone_1.jpg\n [discount] => \n [stock_status] => \n [weight_class] => kg\n )\n)\n\n\ni need the sub array key (47 ,28 etc) as it is my product id\n\nI'm running a foreach loop to get the details and assigning to a new array e.g. 'name' => $result['name'] but can't figure out how to target the product id."
] | [
"php",
"arrays",
"foreach"
] |
[
"C++ unable to properly use I/O",
"To begin with, I'm fairly new to C++. So I need to decide whether a given point is inside or outside a circle K.\n\n\n\nFor that reason I have written an implementation of Pythagoras'es theorem and simplified the process as much as possible:\n\n#include <iostream>\nusing namespace std;\n\nint main(){\n\n int x = 1;\n int y = 1;\n\n if (x*x+y*y<4){\n\n cout << \"Point is inside the circle\" << endl;\n\n } else {\n\n cout << \"Point is outside the circle\" << endl;\n\n }\n\n}\n\n\nSo what I want to do is make those variables a user supplied input. However, the following attempt:\n\ncout << \"Value for x: \" << x;\ncin >> x;\ncout << \"Value for y: \" << y;\ncin >> y;\n\n\noutputs the following (as per the first line): Value for x: 4273158 followed by my input."
] | [
"c++"
] |
[
"No such filter in ffmpeg",
"I am trying to create the slideshow with below command.\n\nHere is the command I have executed:\n\n ffmpeg\n-loop 1 -t 1 -i /sdcard/input0.png \n-loop 1 -t 1 -i /sdcard/input1.png \n-loop 1 -t 1 -i /sdcard/input2.png \n-loop 1 -t 1 -i /sdcard/input3.png \n-loop 1 -t 1 -i /sdcard/input4.png \n-filter_complex \n\"[0:v]trim=duration=15,fade=t=out:st=14.5:d=0.5[v0]; \n [1:v]trim=duration=15,fade=t=in:st=0:d=0.5,fade=t=out:st=14.5:d=0.5[v1]; \n [2:v]trim=duration=15,fade=t=in:st=0:d=0.5,fade=t=out:st=14.5:d=0.5[v2]; \n [3:v]trim=duration=15,fade=t=in:st=0:d=0.5,fade=t=out:st=14.5:d=0.5[v3]; \n [4:v]trim=duration=15,fade=t=in:st=0:d=0.5,fade=t=out:st=14.5:d=0.5[v4]; \n [v0][v1][v2][v3][v4]concat=n=5:v=1:a=0,format=yuv420p[v]\" -map \"[v]\" /sdcard/out.mp4\n\n\non execution of this command it gives error something like:\n\n onFailure: ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers\n built with gcc 4.8 (GCC)\n configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=\n libavutil 55. 17.103 / 55. 17.103\n libavcodec 57. 24.102 / 57. 24.102\n libavformat 57. 25.100 / 57. 25.100\n libavdevice 57. 0.101 / 57. 0.101\n libavfilter 6. 31.100 / 6. 31.100\n libswscale 4. 0.100 / 4. 0.100\n libswresample 2. 0.101 / 2. 0.101\n libpostproc 54. 0.100 / 54. 0.100\n[mjpeg @ 0x4362af10] Changing bps to 8\nInput #0, image2, from '/sdcard/img0001.jpg':\n Duration: 00:00:00.04, start: 0.000000, bitrate: 2410 kb/s\n Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 259x194 [SAR 1:1 DAR 259:194], 25 fps, 25 tbr, 25 tbn, 25 tbc\n[mjpeg @ 0x436300a0] Changing bps to 8\nInput #1, image2, from '/sdcard/img0002.jpg':\n Duration: 00:00:00.04, start: 0.000000, bitrate: 2053 kb/s\n Stream #1:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 290x174 [SAR 1:1 DAR 5:3], 25 fps, 25 tbr, 25 tbn, 25 tbc\n[mjpeg @ 0x436383a0] Changing bps to 8\nInput #2, image2, from '/sdcard/img0003.jpg':\n Duration: 00:00:00.04, start: 0.000000, bitrate: 3791 kb/s\n Stream #2:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 300x168 [SAR 1:1 DAR 25:14], 25 fps, 25 tbr, 25 tbn, 25 tbc\n[mjpeg @ 0x43648f50] Changing bps to 8\nInput #3, image2, from '/sdcard/img0004.jpg':\n Duration: 00:00:00.04, start: 0.000000, bitrate: 1796 kb/s\n Stream #3:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 259x194 [SAR 1:1 DAR 259:194], 25 fps, 25 tbr, 25 tbn, 25 tbc\n[mjpeg @ 0x437b4070] Changing bps to 8\nInput #4, image2, from '/sdcard/img0005.jpg':\n Duration: 00:00:00.04, start: 0.000000, bitrate: 1083 kb/s\n Stream #4:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 212x160 [SAR 1:1 DAR 53:40], 25 fps, 25 tbr, 25 tbn, 25 tbc\n[AVFilterGraph @ 0x4393c960] No such filter: '\"'\nError initializing complex filters.\nInvalid argument\n\n\nand i used this demo https://github.com/WritingMinds/ffmpeg-android-java"
] | [
"android",
"ffmpeg"
] |
[
"OnItemClickListener - open new window",
"How can i open new window (TextView) from ListView by setOnItemClickListener?\nI have tried it but it's failed.I have two Xml files (i don't know if i can have 2) and in second Xml file is that TextView. I am trying if i click on any item in ListView it will open new window with TextView.\n\nThere is my attempt:\n\n list.setOnItemClickListener(new OnItemClickListener() {\n\n @Override\n public void onItemClick(AdapterView<?> arg0, View view, int position,\n long id) {\n TextView message = (TextView)findViewById(R.id.message);\n Uri uriSMSURIs = Uri.parse(\"content://sms/inbox\");\n Cursor c = getContentResolver().query(uriSMSURIs, null, null, null, null);\n String bodys = c.getString(c.getColumnIndexOrThrow(\"body\")); \n setContentView(R.layout.text); ----> this is name of second Xml file \"Text.xml\"\n message.setText(bodys);\n\n }\n\n });"
] | [
"android"
] |
[
"iOS keyboard missing keys",
"Occasionally when a user pulls up our app and attempts to type in a text field, the keyboard looks like this. I have pulled the logs from the device and can't find anything unusual. The ipad is running 10.3.3. Does anyone know how to fix this?"
] | [
"ios",
"ipad"
] |
[
"R Shiny Change Column Names based on Input for a Custom Table Container for DT",
"I have a data table formatted in a specific manner where the column names are centered over two columns using a custom table container that is defined by sketch. The column names are listed as Store1 or Store2, but I wanted to be able to have the actual store names populate, which are dependent on what state is selected. \n\nIs it possible to have the column names update based on the selected state input? Or maybe there is a better way to do this entirely? \n\nBelow is my code:\n\n#Packages\nlibrary(reshape2)\nlibrary(shiny)\nlibrary(DT)\nlibrary(shinydashboard)\nlibrary(dplyr)\n\n#Data\ndata<-data.frame(\"State\"=c(\"AK\",\"AK\",\"AK\",\"AK\",\"AK\",\"AK\",\"AK\",\"AK\",\"AR\",\"AR\",\"AR\",\"AR\",\"AR\",\"AR\",\"AR\",\"AR\"),\n \"StoreRank\" = c(1,1,1,1,2,2,2,2,1,1,1,1,2,2,2,2),\n \"Year\" = c(2017,2018,2017,2018,2017,2018,2017,2018,2017,2018,2017,2018,2017,2018,2017,2018),\n \"Region\" = c(\"East\",\"East\",\"West\",\"West\",\"East\",\"East\",\"West\",\"West\",\"East\",\"East\",\"West\",\"West\",\"East\",\"East\",\"West\",\"West\"),\n \"Store\" = c(\"Ingles\",\"Ingles\",\"Ingles\",\"Ingles\",\"Safeway\",\"Safeway\",\"Safeway\",\"Safeway\",\"Albertsons\",\"Albertsons\",\"Albertsons\",\"Albertsons\",\"Safeway\",\"Safeway\",\"Safeway\",\"Safeway\"),\n \"Total\" = c(500000,520000,480000,485000,600000,600000,500000,515000,500100,520100,480100,485100,601010,601000,501000,515100))\n\n#Formatting data for Data table\nreform.data<-dcast(data, State+Region~StoreRank+Year, value.var = 'Total')\n\n#For selecting state inputs\nstate.list<-reform.data %>%\n select(State) %>%\n unique\n\n#List for state, store, and rank\nStore.Ranks<-data %>%\n select('State', 'Store', 'StoreRank') %>%\n unique()\n\n#Custom Table Container\nsketch = htmltools::withTags(table(\n class = 'display',\n thead(\n tr(\n th(rowspan = 2, 'Region'),\n th(colspan = 2, 'Store1', style=\"text-align:center\"), #Tried and failer to create a function with sketch and change Store1 to Store.Ranks$Store[Store.Ranks$State == input$selectstate & Store.Ranks$StoreRank == 1]\n th(colspan = 2, 'Store2', style=\"text-align:center\")\n ),\n tr(\n lapply(rep(c('2017 Total', '2018 Total'), 2), th)\n )\n )\n))\n\n\n\n#App. Code\nshinyApp (\n\n ui<-dashboardPage(\n dashboardHeader(),\n\n dashboardSidebar(width=200,\n sidebarMenu(id = \"tabs\", \n menuItem(text = \"State\", tabName=\"state\", icon=icon(\"chevron-right\")),\n conditionalPanel(condition = \"input.tabs == 'state' \",\n menuSubItem((selectInput(\"selectstate\", \"Select state\", \n choices = state.list))))\n )),\n dashboardBody(\n\n tabItem(tabName = 'Store',\n\n\n fluidRow(\n column(10,\n tabBox(width = 12,\n title = tagList(shiny::icon(\"gear\"), \"Stores\"),\n id = \"storedat\",\n tabPanel(\n title = \"Store Ranks\", \n textOutput(\"selected_state\"),\n DT::dataTableOutput(\"storetable\"))\n )\n ))\n ))\n\n ),\n\n server <- function(input, output) {\n output$storetable <- DT::renderDataTable({\n DT::datatable(reform.data[ ,c(2:6)] %>% \n dplyr::filter(reform.data$State == input$selectstate), \n rownames = FALSE,\n extensions = c('FixedColumns', \"FixedHeader\"),\n container = sketch)\n })\n }\n\n)"
] | [
"r",
"shiny",
"shinydashboard"
] |
[
"Trying to grab HTML-code from local file to my email sender",
"I have a code which loads list of email adresses into my email sender, and usually I send it with an HTML-code and plain text (Multipart) within the code, but I would like to grab the HTML code from a .txt / .html-file instead locally.\nThis way I can organize it better and there will be less code.\nI am trying the pd.read_html here, just like pd.read_excel works for the lists I'm uploading, but I can't get it to work.\nHere is the code:\nimport pandas as pd\nimport time\n\nfrom email.mime.multipart import MIMEMultipart\nfrom email.mime.text import MIMEText\nimport smtplib\n\nemail_list = pd.read_excel('/home/seniori/Documents/Folder/test.xlsx')\ntemplate = pd.read_html('/home/seniori/Documents/Folder/test.html')\n\n\nemails = email_list['EMAIL']\n\nmy_list = email_list['EMAIL'].tolist()\nprint(my_list)\nmsg = MIMEMultipart()\nmsg['From'] = "[email protected]"\n\nmsg['Subject'] = "Subject"\n\nmessage = template\n\n\nmessage2 = "plain text"\nmsg.attach(MIMEText(message,'html'))\nmsg.attach(MIMEText(message2,'plain'))\n\nHere is the error:\n>>> email_list = pd.read_excel('/home/seniori/Documents/Leadlists/UK/test.xlsx')\n>>> template = pd.read_html('/home/seniori/Documents/Leadlists/UK/test.html')\nTraceback (most recent call last):\n File "<stdin>", line 1, in <module>\n File "/home/seniori/anaconda3/lib/python3.8/site-packages/pandas/io/html.py", line 1085, in read_html\n return _parse(\n File "/home/seniori/anaconda3/lib/python3.8/site-packages/pandas/io/html.py", line 915, in _parse\n raise retained\n File "/home/seniori/anaconda3/lib/python3.8/site-packages/pandas/io/html.py", line 895, in _parse\n tables = p.parse_tables()\n File "/home/seniori/anaconda3/lib/python3.8/site-packages/pandas/io/html.py", line 213, in parse_tables\n tables = self._parse_tables(self._build_doc(), self.match, self.attrs)\n File "/home/seniori/anaconda3/lib/python3.8/site-packages/pandas/io/html.py", line 545, in _parse_tables\n raise ValueError("No tables found")\nValueError: No tables found\n\nWould really appreciate some help on this. Thank in advance!"
] | [
"python",
"html",
"pandas",
"email",
"smtplib"
] |
[
"iPad Safari ignores prime and double prime chars if using custom font",
"iPad Safari doesn't show feet (′ = \\u2032) and inch (″ = \\u2033) signs (prime and double prime, according to unicode specification) when using Anago font.\n\nAs I understand, this font doesn't contain corresponding symbols, but desktop browsers (including Safari on Mac) show them in default font. By some reason iPad behaves in the other way.\n\nAlso I checked the other chars not presented in the fiont (replaced latin ace via cyrillic асе), And they were shown using default font (see bellow).\n\nWhat's the problem with these two chars?\nHow I can force them shown in default font?\n\n<!doctype html>\n\n<meta charset=utf-8>\n\n<title>iOS Safari doesn't render feet and inches</title>\n\n<style>\n@font-face {\n font-family: \"Anago\";\n src: url(\"Positype - Anago-Book.otf\");\n font-weight: 300;\n}\n\nbody {\n font-family: Anago, sans-serif;\n font-weight: 300;\n font-size: 4em;\n}\n</style>\n\n<p>Just a test - latin</p>\n<p>Just а tеst - lаtin аnd сyrilliс</p>\n<p>5′ 9.7″</p>\n<p style=\"font-family: sans-serif\">5′ 9.7″</p>\n\n\nDesktop Chrome on Windows:\n\n\n\nDesktop Safari on Mac:\n\n\n\nSafari on iPad:\n\n\n\nOther iPad browsers behave like iPad Safiri.\n\nFontForge shows following for these chars:\n\n\n\nPS: Same question in Russian."
] | [
"css",
"ipad",
"fonts",
"safari",
"font-face"
] |
[
"OpenGL glColorPointer renders black",
"Here is the breakdown: I load a model from an obj file and store into buffers as follows :vbo for vertexes, ibo for indexes , vao for state and num_indices an int with total indices number. To get the model color I exported a separate off file and extracted color information per vertex and I have an array with 4 values for each vertex so the size of the array is vertexno*4. My draw function looks like this.\n\n glUniformMatrix4fv(location_model_matrix,1,false,glm::value_ptr(model_matrix));\n glUniformMatrix4fv(location_view_matrix,1,false,glm::value_ptr(view_matrix));\n glUniformMatrix4fv(location_projection_matrix,1,false,glm::value_ptr(projection_matrix));\n //glUniform4f(location_object_color,1,1,1,1);\n glBindVertexArray(mesh_vao);\n glEnableClientState( GL_COLOR_ARRAY );\n glEnableClientState( GL_VERTEX_ARRAY );\n glColorPointer( 4, GL_FLOAT, 0, colors );\n glDrawElements(GL_TRIANGLES,mesh_num_indices,GL_UNSIGNED_INT,0);\n\n\nAnd the model renders black. I also have some cubes drawn in the draw function which I color using glUniform4f(location_object_color,rgba) and if I uncomment then the loaded mesh will take the same color as the last drawn cube.\n\nIn my constructor I have something like this:\n\n glClearColor(0.5,0.5,0.5,1);\n glClearDepth(1); \n glEnable(GL_DEPTH_TEST);\n gl_program_shader = lab::loadShader(\"shadere\\\\shader_vertex.glsl\", \"shadere\\\\shader_fragment.glsl\");\n location_model_matrix = glGetUniformLocation(gl_program_shader, \"model_matrix\");\n location_view_matrix = glGetUniformLocation(gl_program_shader, \"view_matrix\");\n location_projection_matrix = glGetUniformLocation(gl_program_shader, \"projection_matrix\");\n location_object_color = glGetUniformLocation(gl_program_shader, \"object_color\");\n\n\nIf need be I can provide my shader_vertex and shader_fragment , I considered it to be a problem but im not so sure so if anyone knows why my model isn't being colored please throw a hand."
] | [
"visual-c++",
"opengl",
"vbo",
"vertex-shader"
] |
[
"timer, handler, runnable, im lost",
"The plan.....\n\nUser clicks start button--->tts says something (this works fine)----->Timer starts (this now crashes project)\n\nThe timer method.....\n\nTimer starts onTick----->When timer finishes tts says something------>Loop so timer starts again------>Process continues until cancelled.\n\nMy dilemma, the timer crashes the project. so a)The timer is written incorrectly, b) the method call is written incorrectly, or c) I need to go take 2 aspirin and watch a movie. Any help would be appreciated :)\n\nI'll post code in the comments. In having a problem posting here."
] | [
"timer",
"text-to-speech"
] |
[
"Avoid webfont download when it exists locally",
"How can I avoid dynamically loading a webfont (e.g. Mylius Modern) from a website when it already exists on the local machine?"
] | [
"html",
"css",
"webfonts"
] |
[
"Why the Xcode UI is blurred?",
"I installed xcode on my mac, the path is /Application/Xcode.app. When I open it, the UI is kinda blurred, as shown below.\nblurred UI when the path is /Application/Xcode.app\nHowever, when I renamed the app as Xcode12.app or any other name, the UI becomes normal and clear. As shown below\nnormal UI when the path is /Application/Xcode12.app\nI have tried totally uninstalling Xcode and reinstall it. However, the same issue exists. I have tried different versions, like 12.1, 12.3, 12.... and they are all the same.\nAny guys know how to solve it?? Thanks!!!"
] | [
"xcode"
] |
[
"Why is my Java split method causing an empty line to print?",
"I am working on a short assignment from school and for some reason, two delimiters right next to each other is causing an empty line to print. I would understand this if there was a space between them but there isn't. Am I missing something simple? I would like each token to print one line at a time without printing the ~.\n\npublic class SplitExample\n{\n public static void main(String[] args)\n {\n String asuURL = \"www.public.asu.edu/~JohnSmith/CSE205\";\n String[] words = new String[6];\n words = asuURL.split(\"[./~]\");\n for(int i = 0; i < words.length; i++)\n {\n System.out.println(words[i]);\n }\n }\n}//end SplitExample\n\n\nEdit: Desired output below\n\nwww\npublic\nasu\nedu\nJohnSmith\nCSE205"
] | [
"java",
"split",
"string",
"println"
] |
[
"How to import then build multiples local jars (~100) into a maven project",
"First of all, sorry if my question seems to be duplicated but I have thoroughly search during hours and hours a solution without any success...\n\nThis is my current context :\n\n\nI have developped a huge talend job which uses many others jobs\nI have built my talend job as a standalone jar. That resulted in a zip file containing a lot of others jars (around 100). All of those jars are needed for my talend job to work. Those are secondary jobs or libraries, etc.\nThen I have made a spring-boot java application (using maven...) that can run my talend job among others things. \nIn order to do that, I had to import every jars into my project => i.e build path. Those 100+ jars are all visible inside the \"referenced libraries\" folder.\nWhen I run my app through Eclipse, everything is working well but now what I need is to build this app as a jar, or something I can run on another machine/server.\n\n\nI don't know anything about maven, but if I understand well, I need to use the command maven-install in order to build my project... The problem is the command throw me errors because it doesn't find all my libraries.\n\nI found many solutions that says to create a local repository, to use maven-install for each jar, or maven-deploy for each jar, then add dependencies into my pom file for each jar... \n\nAs you could understand, that's not a good solution for me and my 100+ jars...\n\nI heard about nexus or something like that, but I am the only one person working on this project and this solution seems to be interresting when a whole team is working on the same project.\n\nSo, if any of you knows how I can manage that, I would be very grateful.\n\nThanks."
] | [
"eclipse",
"maven",
"spring-boot",
"talend"
] |
[
"p tag messing up layout in CSS",
"Cannot understand why the following is happening:\n\n\n\nJust adding a p tag inside a div causes it to drop down and I can't find a reason for or fix this behaviour:\n\n\n\nCode:\n\n\r\n\r\nhtml{\r\n box-sizing: border-box;\r\n}\r\n\r\n\r\n\r\n#BoxContainer{\r\n border: 5px solid black;\r\n box-sizing: border-box;\r\n}\r\n\r\n\r\n#Box1{\r\n background-color: red;\r\n display: inline-block;\r\n width: 100px;\r\n height: 100px;\r\n border: 1px solid black;\r\n margin: 10px;\r\n padding: 20px;\r\n text-align: center;\r\n}\r\n\r\n#Box2{\r\n background-color: blue;\r\n display: inline-block;\r\n width: 100px;\r\n height: 100px;\r\n border: 1px solid black;\r\n margin: 10px;\r\n padding: 20px;\r\n}\r\n\r\n#Box3{\r\n background-color: yellow;\r\n display: inline-block;\r\n width: 100px;\r\n height: 100px;\r\n border: 1px solid black;\r\n margin: 10px;\r\n padding: 20px;\r\n \r\n}\r\n\r\np{\r\n display: inline;\r\n margin: 0;\r\n}\r\n<html>\r\n <head>\r\n <meta charset=\"utf-8\">\r\n <meta name=\"description\" content=\"testSite\">\r\n <meta name=\"keywords\" content=\"Responsive Design\">\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\r\n <link rel=\"stylesheet\" href=\"css/style.css\" />\r\n </head>\r\n \r\n<body>\r\n<div id=\"BoxContainer\">\r\n \r\n <div id=\"Box1\"></div>\r\n <div id=\"Box2\"></div> \r\n <div id=\"Box3\"></div>\r\n \r\n</div>\r\n</body>\r\n</html>\r\n\r\n\r\n\n\nI've tried removing the margin from p and displaying as inline to no avail.\nDoes anyone have any idea why this is happening?"
] | [
"html",
"css",
"layout"
] |
[
"How do I use JPA to persist a Map (java.util.Map) object inside an entity and ensure the persistence cascades?",
"I have recently started playing around with the Play! Framework for Java, version 1.2.3 (the latest). While testing out the framework, I came across a strange problem when trying to persist a Map object inside a Hibernate entity called FooSystem. The Map object maps a long to a Hibernate entity I have called Foo, with the declaration Map<Long, Foo> fooMap;\n\nMy problem is as follows: The correct tables are created as I have annotated them. However, when the FooSystem object fs is persisted, the data in fs.fooMap is not!\n\nHere is the code I am using for the entities. First is Foo:\n\npackage models.test;\n\nimport javax.persistence.Entity;\nimport javax.persistence.ManyToOne;\nimport play.db.jpa.Model;\n\n@Entity\npublic class Foo extends Model\n{\n @ManyToOne\n private FooSystem foosystem;\n\n public Foo(FooSystem foosystem)\n {\n this.foosystem = foosystem;\n }\n}\n\n\nAnd here is FooSystem:\n\npackage models.test;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.persistence.CascadeType;\nimport javax.persistence.Entity;\nimport javax.persistence.JoinColumn;\nimport javax.persistence.JoinTable;\nimport javax.persistence.ManyToMany;\nimport play.db.jpa.Model;\n\n@Entity\npublic class FooSystem extends Model\n{\n @ManyToMany(cascade = {CascadeType.ALL, CascadeType.PERSIST})\n @JoinTable(\n name = \"fooMap\",\n joinColumns = @JoinColumn(name = \"foosystem\"),\n inverseJoinColumns = @JoinColumn(name = \"foo\")\n )\n private Map<Long, Foo> fooMap = new HashMap<Long, Foo>();\n\n public FooSystem()\n {\n Foo f1 = new Foo(this);\n Foo f2 = new Foo(this);\n fooMap.put(f1.getId(), f1);\n fooMap.put(f2.getId(), f2);\n }\n\n public Map<Long, Foo> getFooMap()\n {\n return fooMap;\n }\n}\n\n\nHere is the Controller class I am using to test my set-up:\n\npackage controllers;\n\nimport javax.persistence.EntityManager;\nimport models.test.FooSystem;\nimport play.db.jpa.JPA;\nimport play.mvc.Controller;\n\npublic class TestController extends Controller\n{\n public static void index() {\n EntityManager em = JPA.em();\n FooSystem fs = new FooSystem();\n em.persist(fs);\n render();\n }\n}\n\n\nThe Play! framework automatically created a transaction for the HTTP request. Although data is inserted into the foo and foosystem tables, nothing is ever inserted into the foomap table, which is the desired result. What can I do about this? What am I missing?"
] | [
"java",
"hibernate",
"jpa",
"map",
"playframework"
] |
[
"Apply function for all values of an array",
"I'm using a custom query with a multi-select parameter as Datasource in DataStudio.\nI'd like to use the query parameter array in the where clause such as\nSTARTS_WITH(stringField, @paramArray[1])\nAND STARTS_WITH(stringField, @paramArray[2])\nAND STARTS_WITH(stringField, @paramArray[3])\n…\n\nFor all elements of the @paramArray."
] | [
"google-bigquery",
"google-data-studio"
] |
[
"Laravel Registration Key with Validation",
"I'm currently trying to modify the base Laravel Authentication to include the use of a key created in the database, I've included another field named "key" which I've been able to get the registration to check via a model, the issue is that if the key is incorrectly input I haven't been able to let the user know the key is incorrect.\nCurrent RegistrationController.php\nprotected function validator(array $data)\n {\n return Validator::make($data, [\n 'name' => ['required', 'string', 'max:255'],\n 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],\n 'password' => ['required', 'string', 'min:8', 'confirmed'],\n 'key' => ['required'],\n ]);\n }\n /**\n * Handle a registration request for the application.\n *\n * @param \\Illuminate\\Http\\Request $request\n * @return \\Illuminate\\Http\\Response\n */\n public function register(Request $request)\n {\n $d = Key::where('key', $request->only(['key'])['key'])->first();\n\n if($d != null){\n\n $this->validator($request->all())->validate();\n\n event(new Registered($user = $this->create($request->all())));\n\n $this->guard()->login($user);\n\n if ($response = $this->registered($request, $user)) {\n return $response;\n }\n\n return $request->wantsJson()\n ? new Response('', 201)\n : redirect($this->redirectPath());\n\n }\n else{\n $this->validator($request->all())->validate();\n return view('auth.register')->withErrors(['key', 'This key was not found']);\n }\n }\n\nI've tried to modify the validate method to include same but when testing using same:12345 it looks for a variable called 12345 instead of checking if the key is the same as 12345, how do I change the validation to do what I've done in the register method to check the models instead."
] | [
"php",
"laravel"
] |
[
"How To Login on website? Password as value not accepted",
"I've looked at many examples on how to log in to a website using vb. But somehow it keeps saying the password is incorrect.\n\nLet me explain:\nI'm trying to log in to this website using vb. I have managed to fill in the username and the password using \n\nwb1.Document.GetElementById(\"Username\").SetAttribute(\"Value\", \"myusername\")\nwb1.Document.GetElementById(\"Password\").SetAttribute(\"Value\", \"mypassword\")\n\n\nI can see them being filled in, but upon clicking on the login button it says the password in incorrect. When I try to fill in the password by hand (username by program) and click the button it does work.\nThe difference between the two instances? When I do it manually the letters I type become dots. But when I do it via my program the letters do not change but remain letters. I think this is part of the problem, but I'm not entirely sure.\n\nI've tried to change other items as well such as OuterHTML from the element Password. I could see which items were adjusted when I manually entered the password. And then I used those values. This didn't work. But then again, it was hard to see what exactly changed, so maybe I missed something.\n\nOne thing I noticed while doing to was when I manually entered the password Value was changed to \"\". Should I put my password in a different attribute? I'm guessing the password should be send encoded to the server?\n\nThis is the code for the password field on the website\n\n<div class=\"jNiceInputWrapper jNiceSafari FieldPosition col2\">\n <div class=\"jNiceInputInner\">\n <input type=\"password\" name=\"Password\" id=\"Password\" class=\"jNiceInput\" placeholder=\"Wachtwoord\" onkeypress=\"return SubmitOnEnter(this,event)\" />\n </div>\n</div>\n\n\nI really hope someone can help me with this problem. I've been working on it all day and just can't figure it out. \n\nEDIT:\nThanks to Mr CoDeXeR I finally figured it out!\nThe code that solved the problem:\n\nwb1.Document.All(\"Username\").SetAttribute(\"value\", \"myusername\")\nwb1.Document.All(\"Password\").SetAttribute(\"value\", \"mypassword\")\n\nDim elements As HtmlElementCollection = (wb1.Document.All.GetElementsByName(\"Password\"))\nFor Each element As HtmlElement In elements\n element.InnerText = \"mypassword\"\nNext\n\n\nRemoving either the setattribute value or the innertext will lead to failure."
] | [
"vb.net",
"login",
"passwords"
] |
[
"Static in local scope",
"Just for learning purposes, I'm declaring a variable as local_persist(static) within a callback function. If I declare the variable as static directly, the address persists on every invocation and I get the correct behavior which is an alternating color. The problem arises when I use local_persist rather than static, then it doesn't persist the next time the function is called. Using VS2015 - MSVC:\n\n#include <windows.h>\n\n#define internal static;\n#define global_variable static;\n#define local_persist static;\n\nINT m_ClientWidth = 1600;\nINT m_ClientHeight = 900;\nDWORD m_WndStyle = WS_OVERLAPPEDWINDOW;\n\nHWND GetMainWindow(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);\nvoid Update(float dt);\nvoid Render(float dt);\n\nLRESULT CALLBACK MsgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)\n{\n switch (msg)\n {\n case WM_DESTROY:\n {\n PostQuitMessage(0);\n return 0;\n }\n\n case WM_PAINT:\n {\n PAINTSTRUCT Paint;\n HDC DeviceContext = BeginPaint(hwnd, &Paint);\n int X = Paint.rcPaint.left;\n int Y = Paint.rcPaint.top;\n int Height = Paint.rcPaint.bottom - Paint.rcPaint.top;\n int Width = Paint.rcPaint.right - Paint.rcPaint.left;\n local_persist DWORD Operation = WHITENESS;\n PatBlt(DeviceContext, X, Y, Width, Height, Operation);\n\n Operation = Operation == WHITENESS ? BLACKNESS : WHITENESS;\n EndPaint(hwnd, &Paint);\n }\n default:\n return DefWindowProc(hwnd, msg, wParam, lParam);\n } \n}\n\nint Run()\n{\n MSG msg = { 0 };\n while (true)\n {\n if (PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))\n {\n TranslateMessage(&msg);\n DispatchMessage(&msg);\n\n if(msg.message == WM_QUIT)\n {\n break;\n }\n }\n else\n {\n //Update\n Update(0.0f);\n //Render\n Render(0.0f);\n }\n }\n\n return static_cast<int>(msg.wParam);\n}\n\nvoid Update(float dt)\n{\n\n}\n\nvoid Render(float dt)\n{\n\n}\n\nint CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)\n{\n HWND mainWindow = GetMainWindow(hInstance, hPrevInstance, lpCmdLine, nCmdShow);\n\n if (mainWindow == NULL)\n {\n return 1;\n }\n\n ShowWindow(mainWindow, SW_SHOW);\n\n return Run();\n}\n\nHWND GetMainWindow(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)\n{\n //WNDCLASSEX\n WNDCLASSEX wcex;\n ZeroMemory(&wcex, sizeof(WNDCLASSEX));\n wcex.cbSize = sizeof(WNDCLASSEX);\n wcex.style = CS_HREDRAW | CS_VREDRAW;\n wcex.hInstance = hInstance;\n wcex.lpfnWndProc = MsgProc;\n wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);\n wcex.hCursor = LoadCursor(NULL, IDC_ARROW);\n wcex.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH);\n wcex.lpszMenuName = NULL;\n wcex.lpszClassName = \"MAINWINDCLASS\";\n wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);\n\n\n if (!RegisterClassEx(&wcex))\n {\n OutputDebugString(\"\\nFAILED TO REGISTER WINDOW CLASS\\n\");\n return NULL;\n }\n\n RECT r = { 0, 0, m_ClientWidth, m_ClientHeight };\n AdjustWindowRect(&r, m_WndStyle, FALSE);\n UINT width = r.right - r.left;\n UINT height = r.bottom - r.top;\n\n UINT x = GetSystemMetrics(SM_CXSCREEN) / 2 - width / 2;\n UINT y = GetSystemMetrics(SM_CYSCREEN) / 2 - height / 2;\n HWND m_hAppWnd = CreateWindow(wcex.lpszClassName, \"Test Application\", m_WndStyle, x, y, width, height, 0, 0, hInstance, 0);\n\n if (!m_hAppWnd)\n {\n OutputDebugString(\"\\nFAILED TO CREATE WINDOW\\n\");\n return NULL;\n }\n\n return m_hAppWnd;\n}"
] | [
"c",
"visual-c++",
"static"
] |
[
"Sort alphabetically when multiple queries?",
"I am having difficulty sorting my data results alphabetically when matching them with the User that has placed the item in their \"Locker\". \n\nI have two queries; the first one searches the database for all of the items that the user placed in their 'locker', and the second query pulls the details of the item and sorts them into a list by which brand the items are.\n\nI feel like there is a better way to do this rather than forcing the page to run the query once for each item, but am not sure the proper way to write out the mySQL in the most efficient way that works.\n\nI think the solution would be to pull all IDs as an array, then somehow search and sort all of their associated brands in the second query.\n\nI currently have:\n\n //$lockerid is pulled earlier in the code based on which locker number is associated with this user\n\n // Pull all of the items and their ids that are in this users locker\n $userlockerquery= mysql_query(\"SELECT DISTINCT item_id FROM lockers WHERE user_id = '$profile_userid' AND locker_id ='$lockerid' \");\n\n while($lockeritems=mysql_fetch_array($userlockerquery)){\n $indi_item=$lockeritems[item_id];\n $lockeritemdetails = mysql_query(\"SELECT DISTINCT brand FROM inventory WHERE id = '$indi_item' \");\n $brands=mysql_fetch_array($lockeritemdetails );\n $brandname=$brands[brand];\n echo '<div>'.$brandname.'</div>';\n }\n\n\nAlthough the results do show up with all of the brands, My problem seems to be that since the query is ran once for each items id, it cannot have the list results talk to each other, and thus cannot have them ordered by ASC alphabetically, since the query is ran once per each item. \n\nAlso because of this, the DISTINCT flag does not have any effect, since it is not matching against any other results.\n\nAs an example, my results would return in divs in order of ID instead of brand, and repeating:\n\nNike\nPuma\nPuma\nConverse\n\nRather than\n\nConverse\nNike \nPuma\n\nAdding the ORDER BY flag to the second query did not help, so I figured I would try to ask here for some ideas. Please let me know if any other details are needed!"
] | [
"php",
"mysql",
"database"
] |
[
"CSS3: Transforming ONLY during Transition",
"I know we can transform shape (e.g. circle to square) from one state (e.g. top: 0) to another state (e.g. top: 20px). But I'm not sure how we can keep the shape at both states intact (i.e. keeps it circled @ top: 0 and top: 20px), but ONLY during transition I want to transform its shape. An example of what I want to achieve is somewhat like this:"
] | [
"css",
"scale",
"transition",
"transformation"
] |
[
"Chromedriver: Support multiple versions in PyInstalled exe",
"I want to distribute my Chrome automation tool to some users, but unfortunately it seems every Chromedriver vesion only supports one Chrome version which is really bad.\n\nFor Firefox the geckodriver support multiple versions at once. But the requirement for this deployed tool is to use Chrome.\n\nSo I'm wondering what would be the best way to support not only the latest Chrome version, but also older versions and also the beta channel releases without bloating the .exe file to much.\n\nAnd the only solution I can see is to fetch the installed Chrome version and download the appropriate Chromedriver on the fly, is it?\n\nAny other ideas?\nIs there any way to check the installed Chrome version without accessing the Registry because the latter requires admin rights?\n\nThanks!"
] | [
"python",
"windows-installer",
"selenium-chromedriver",
"pyinstaller"
] |
[
"Parameter in XMLHTTP AJAX post request is being altered in translation",
"Just a quick one, I'm looking to send through a string in an XMLHttpRequest method and am having issues with data translating incorrectly in transit. Here's what I'm sending through:\n\n xmlhttp.open(\"POST\",\"create_table.php?\", true);\n xmlhttp.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\");\n xmlhttp.send(\"steamID=\"+steamID);\n\n\nsteamID at the time of being entered to the .send() method looks like this: 76561198000759657.\n\nWhen it comes back out in my php page it looks like this: 76561198000759660.\n\nFor varying steamID's regardless it always almost rounds up the end. Any idea how I can prevent this?\n\nAny help much appreciated."
] | [
"php",
"ajax",
"xmlhttprequest"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.