texts
list | tags
list |
---|---|
[
"How to connect my Pre-signed URL bucket in s3 to cloud-front",
"I am having a pre-signed URL in s3 bucket,and I connected to cloud front in distribution but when I am browsing the URL it is showing the following error:\n\n`<Error> \n<Code>AccessDenied</Code> \n<Message>Request has expired</Message>\n <Expires>2019-04-01T15:53:17Z</Expires> \n<ServerTime>2019-04-01T16:49:14Z</ServerTime> <RequestId>8DCA892090B33291</RequestId>\n<HostId> 82J0WSeDVrCLyOtCfcouBFlTvJfmvEqRUM4y1LCBzE= </HostId> \n</Error>`"
]
| [
"amazon-web-services",
"amazon-s3",
"cloud",
"amazon-cloudfront"
]
|
[
"Lightbox2 adds an extra image at the end of full screen image set",
"I've just noticed that Lightbox2 (https://github.com/lokesh/lightbox2) is duplicating or adding extra images at the end of the full screen version of the image, everything else works fine. When viewing I click on the next image arrow for the next image and when I reach the last one (image_5.jpg) there shouldn't be any more "next" button/option, but there is and if I click it, it shows once again the last image.\n<div class="galleryContainer">\n <div class="gallery_image">\n <a class="example-image-link" href="./images/studio/image_1.jpg" data-lightbox="studio-set"><img class="studio-image" src="./images/studio/image_1.jpg" alt=""/>\n <a class="example-image-link" href="./images/studio/image_2.jpg" data-lightbox="studio-set"><img class="studio-image" src="./images/studio/image_2.jpg" alt=""/>\n <a class="example-image-link" href="./images/studio/image_3.jpg" data-lightbox="studio-set"><img class="studio-image" src="./images/studio/image_3.jpg" alt=""/>\n <a class="example-image-link" href="./images/studio/image_4.jpg" data-lightbox="studio-set"><img class="studio-image" src="./images/studio/image_4.jpg" alt=""/>\n <a class="example-image-link" href="./images/studio/image_5.jpg" data-lightbox="studio-set"><img class="studio-image" src="./images/studio/image_5.jpg" alt=""/>\n </div>\n\n<script src="./scripts/lightbox-plus-jquery.js"></script>"
]
| [
"html",
"jquery",
"css",
"lightbox2"
]
|
[
"Load Internal Assets from HTML File inside UIWebView",
"In my app built in Xcode 8.2 I have a controller with the web view where web view loads an internal HTML file like this:\n\n let htmlFile = Bundle.main.path(forResource: \"web/place-info\", ofType: \"html\")\n var htmlString = try? String(contentsOfFile: htmlFile!, encoding: String.Encoding.utf8)\n self.webView.loadHTMLString(htmlString!, baseURL: nil)\n\n\nThen I want to include some additional JavaScript and CSS into that HTML file but the file fails to load any. The including path seems to be either wrong or blocked.\n\n<link rel=\"stylesheet\" href=\"web/font-awesome/css/font-awesome.min.css\">\n\n\nWhat is more strange is that this image will never load inside place-info.html BODY tag:\n\n <img src=\"ic-user-profile.png\" />\n <img src=\"/ic-user-profile.png\" />\n <img src=\"img/ic-user-profile.png\" />\n <img src=\"/img/ic-user-profile.png\" />\n <img src=\"web/img/ic-user-profile.png\" />\n <img src=\"/web/img/ic-user-profile.png\" />\n <img src=\"Project-Name/web/img/ic-user-profile.png\" />\n <img src=\"/Project-Name/web/img/ic-user-profile.png\" />\n <img src=\"Project-Name/Project-Name/web/img/ic-user-profile.png\" />\n <img src=\"/Project-Name/Project-Name/web/img/ic-user-profile.png\" />\n\n\nAm I missing some special setting in Xcode 8.2? Note that in settings I already have App Transport Security Settings to be Allow Arbitrary Loads = YES"
]
| [
"ios",
"swift",
"uiwebview"
]
|
[
"Accesing a second tag with beatifoulsoup",
"I started working on some website scraping projects and I stumbled accros some difficulties selecting a second tag within the same parent tag. I've tried using google but i still couldn't cleary understand it.\n\nMy code looks like this:\n\nurl = 'url to site'\ncontent = requests.get(url).text\nsoup = BeautifulSoup(content, 'lxml')\n\ncar_add = soup.find('div', class_='offer-wrapper')\n\nad_title = car_add.find('h3', class_='lheight22 margintop5').a.strong.text\nad_price = car_add.find('p', class_='price').text\nad_location = car_add.find('td', class_='bottom-cell').div.p.small.span.text\nad_time_and_location = car_add.find('td', class_='bottom-cell').div.p\nprint(ad_time_and_location.prettify())\n\n\nThis prints out the following:\n\n<p class=\"lheight16\">\n <small class=\"breadcrumb x-normal\">\n <span>\n <i data-icon=\"location-filled\">\n </i>\n Otopeni\n </span>\n </small>\n <small class=\"breadcrumb x-normal\">\n <span>\n <i data-icon=\"clock\">\n </i>\n 09:25\n </span>\n </small>\n</p>\n\n\nWhat I want to do is access the string '09:25' but when I type:\n\nad_location = car_add.find('td', class_='bottom-cell').div.p.small.span.text\n\n\nThen it automatically defaults to the first text tag.\n\nI've tried using the select() method but it gave me an empty list. Could anyone help me with this ?\n\nThank you!"
]
| [
"python"
]
|
[
"How do I get Friday date if it is Monday today",
"I have .Net project for some reason i need to have date to be taken.\n\nI have done like \nvar date = DateTime.Today.AddDays(-1);\nwhich is giving me yesterday's date.\nbut if I run my application on Monday then I should get Friday date\n\nplease suggest me expression for this.\n\nfor example.\nif today is Monday and date is 21/12/2001 it should give me 19/12/2001 i.e Fridays date\nif today is Tuesday and date is21/12/2001 it should return me 20/12/2001 as normal"
]
| [
"c#",
"asp.net",
"c#-4.0"
]
|
[
"Getting Analytics on Syndicated / Offsite Pages",
"We produce content for pages outside of our domain. We'd like to be able to track metrics like hits, time on page, referrer, etc. etc. on these pages. We have looked at a lot of options including packaging our own js, using a simple tracking pixel, and even using something like Google Analytics and fudging it to work with our stuff.\n\nIn any case, curious as to what you all see as the best option for doing something like this.\n\nThanks!"
]
| [
"javascript",
"google-analytics",
"analytics",
"tracking"
]
|
[
"Why does my Panel cut the text strangely off?",
"I have the problem that the text inside my panel gets cut of strangely. The panel is located inside a textbox. But even if I replace the textbox by a flowlayoutpanel, I have the same issue.\n\nCode:\n\nList<string> list = datenbank.FerienAuswahl(monat, jahr);\n\n int i = 0;\n //Create Panel\n\n try\n {\n //Fill Panel\n do\n {\n Label panel = new Label();\n panel.Name = \"panel\" + i;\n panel.Height = 30;\n panel.Width = 400;\n panel.AutoSize = false;\n panel.TextAlign = ContentAlignment.MiddleCenter;\n panel.ForeColor = Color.Black;\n panel.Text = list[i];\n Label ferien = new Label();\n panel.Controls.Add(ferien);\n tbFerien.Controls.Add(panel);\n i++;\n } while (i < list.Count);\n }\n catch { }\n\n\nResult:\n\n\n\nI have already tried to change the width of the panel. But as result I only get a messed up alignment of the text.\nThe only settings of the textbox I have changed are these:\n\nMultiline: True\n\nTextAlign: Center\n\nSize: 359; 125\n\nDoes Someone know what else I could try ?"
]
| [
"c#",
"winforms",
"alignment",
"panel"
]
|
[
"Android SeekBar to control MediaPlayer progress",
"I have a SeekBar, it displays correctly MediaPlayer progress. However, I have troubles with seeking - if I seek scroll box somewhere it just returns on the position where audio file is playing. \n\npublic class EntityPageActivity extends Activity implements Runnable, OnClickListener, OnSeekBarChangeListener{\n private SeekBar seekBar;\n private Button startMedia;\n private Button pauseMedia;\n private MediaPlayer mp;\n\n @Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.entity_page); \n\n AudioControl(); \n\n }\n\n public void AudioControl(){\n seekBar = (SeekBar) findViewById(R.id.seekBar);\n startMedia = (Button) findViewById(R.id.play);\n pauseMedia = (Button) findViewById(R.id.pause);\n startMedia.setOnClickListener(this);\n pauseMedia.setOnClickListener(this); \n }\n\n public void run() {\n int currentPosition= 0;\n int total = mp.getDuration();\n while (mp!=null && currentPosition<total) {\n try {\n Thread.sleep(1000);\n currentPosition= mp.getCurrentPosition();\n } catch (InterruptedException e) {\n return;\n } catch (Exception e) {\n return;\n } \n seekBar.setProgress(currentPosition);\n }\n }\n\n public void onClick(View v) {\n if (v.equals(startMedia)) {\n if (mp != null && mp.isPlaying()) return;\n if(seekBar.getProgress() > 0) {\n mp.start();\n return;\n }\n mp = MediaPlayer.create(EntityPageActivity.this, R.raw.gl1);\n mp.start(); \n seekBar.setProgress(0);\n seekBar.setMax(mp.getDuration());\n new Thread(this).start();\n }\n\n if (v.equals(pauseMedia) && mp!=null) {\n mp.pause();\n } \n\n }\n\n public void onStartTrackingTouch(SeekBar seekBar) {\n }\n\n public void onStopTrackingTouch(SeekBar seekBar) {\n }\n\n public void onProgressChanged(SeekBar seekBar, int progress,\n boolean fromUser) {\n if(fromUser) mp.seekTo(progress);\n\n }\n}\n\n\nThus, onProgressChanged isn't enough to allow SeekBar to control MediaPlayer?\n\nWhat should I add/correct to allow seeking?\n\nThanks\n\nUPDATE\n\nI found out that onProgressChanged is never invoked by some reason. However I can't figure out why"
]
| [
"android",
"media-player",
"seekbar",
"seek"
]
|
[
"Simple calculator using command line with C++",
"I'm writing a project that we do simple calculator from command line. The users input in this format programname firstNumber operator secondNumber. Here what I got so far:\n\n#include <iostream>\n#include <fstream>\n#include <iomanip>\nusing namespace std;\n\nint main(int argc, char* argv[])\n{\n cout << fixed << setprecision(2);\n if (argc != 4)\n {\n cerr << \"Usage: \" << argv[0] << \" <number> <operator> <number>\" << endl;\n exit(0);\n }\n else\n {\n double firstNumber = atoi(argv[1]);\n char theOperator = argv[2][0];\n double secondNumber = atoi(argv[3]);\n switch (theOperator)\n {\n case'+':\n {\n cout << \"The answer is \" << firstNumber + secondNumber << endl;\n break;\n }\n case '-':\n {\n cout << \"The answer is \" << firstNumber - secondNumber << endl;\n break;\n }\n case '*':\n {\n cout << \"The answer is \" << firstNumber * secondNumber << endl;\n break;\n }\n case '/':\n {\n if (secondNumber == 0)\n {\n cout << \"Can not devide by a ZERO\" << endl;\n break;\n }\n else\n {\n cout << \"The answer is \" << firstNumber / secondNumber << endl;\n break;\n }\n }\n }\n }\n}\n\n\nI came up with a problem that my project does the calculation wrong for decimal numbers. For example, if I do 2.5 + 1.25, the result is 3. Can anyone please help me? I'm new to C++"
]
| [
"c++",
"command-line-arguments",
"calculator"
]
|
[
"Why does `mkdtemp()` fail when called in googletest?",
"I've created a small RAII class that creates a unique temporary directory and deletes it again upon destruction. On Linux, it uses mkdtemp() to achieve this:\n\n// temporaryDirectoryPath is an std::vector<char>\n// containing u8\"/tmp/nuclex-pixels-unittest-XXXXXX\"\n\n// Let mkdtemp() sort out a unique directory name for us (and create it!)\nconst char *directoryName = ::mkdtemp(&temporaryDirectoryPath[0]);\nif(directoryName == nullptr) {\n perror(\"mkdtemp() failed.\"); // DEBUGGING. REMOVE.\n throw std::runtime_error(\"mkdtemp() failed.\");\n}\n\n\nThis works just fine when run on its own: runnable code on ideone.com\n\n\n\nHowever, if I use that same code inside a GoogleTest 1.8.1 unit test declared like this:\n\nTEST(MyTestFixture, CanFlumbleTempDirectory) {\n TemporaryDirectoryScope temporaryDirectory;\n // Could call temporaryDirectory.GetPath() here...\n}\n\n\nIt fails:\n\nPassing the following to mkdtemp(): /tmp/nuclex-pixels-unittest-XXXXXX\nmkdtemp() failed.: Invalid argument\n\n\nHow can GoogleTest be interfering with mkdtemp()?"
]
| [
"c++",
"cross-platform",
"posix",
"googletest"
]
|
[
"MySQL and PHP issue with MySQL query",
"I'm currently having a problem getting a variable to display in a php echo statement, and I don't know whats going wrong. This is the line I'm concerned about:\n$query=\"select password from ouser where pkey=\".odb_get_pkey($user); \n\nIs there anything wrong with this line?\nHere is my code in context: \n\nfunction odb_get_pkey($username)\n{\n $db=odb_connect();\n echo \"Get the primary key\".oLF();\n $query=\"select pkey from ouser where username='$username'\";\n $pkey=odb_get_field($query,$db);\n echo $pkey.oLF();\n}\n\n\nfunction odb_get_password($user)\n{\n $db=odb_connect();\n echo \"Get the password\".oLF();\n $query=\"select password from ouser where pkey=\".odb_get_pkey($user);\n echo $query;\n $password=odb_get_field($query,$db);\n echo $password.oLF();\n}\n\n\nfunction odb_get_field($query,$db)\n{\n $result = mysqli_query($db,$query);\n $row = mysqli_fetch_row($result);\n return($row[0]);\n}\n\n\nCurrently I am just calling the odb_get_password function which will call the other two functions, and I just get the query select password from ouser where pkey=, and nothing after the equals sign. I don't know php or MySQL very well. Not sure what I'm doing wrong. Thank you for any help!!"
]
| [
"php",
"mysql"
]
|
[
"unable to install intel HAXM for windows 7",
"i want o install Intel HAXM. unable to install it. following error pop ups as shown in screen shot. \nI have turned on VT from bios.\nVT is turned on, is showing.\nStill i get this error. kindly check and reply."
]
| [
"virtual-machine",
"virtualization",
"intel",
"haxm"
]
|
[
"Loading the same XML data on all my PHP scripts",
"I'm currently working on a small-scale PHP website where all data are stored in one XML file and XSLT-transformed into HTML in a variety of ways. For the user, the data are read-only, but the XML file will sometimes be modified by the site administrator.\n\nFor the moment, each PHP script loads the data from the XML file into a DOMDocument object. This is done on every script at every request, but this is certainly not the best and fastest way.\n\nWhat approach would you suggest to reduce the overhead and have the XML data readily available without having to open the file each time, but taking into account the fact that the XML file can be modified?"
]
| [
"php",
"xml"
]
|
[
"How to I split date and time that are on the same column and store them in an ArrayList?",
"I'm creating a data visualisation program using 'JFreeChart' and i'm having trouble reading data from a CSV file using BufferedReader. In the CSV file I have the date and time stored in the same column. I know that I have to use the \" \" function to separate them but I can't figure out how to go around doing so.\n\nI have tried looking everywhere but I can't put my finger on it. I need to be pushed onto the right track.\n\n//This is part of my Data Class\n\nprivate int millis;\n private int stamp;\n private int light; \n private double temp;\n private double vcc;\n private Time theTime;\n private Date theDate;\n\n\n//This is part of another class\n\npublic class CSVreader {\n\n private List<Data> dataList = new ArrayList<Data>();\n private String path;\n\n public List<Data> getDataList() {\n return dataList;\n }\n public String getPath() {\n return path;\n }\n public void setPath(String path) {\n this.path = path;\n }\n\n public void readCSV() throws IOException{ \n\n BufferedReader in = new BufferedReader (new FileReader(path));\n\n String line = in.readLine();\n\n while(line != null) {\n\n Data d = new Data();\n\n String[] splits = line.split(\",\");\n\n int millis = Integer.parseInt(splits[0]);\n int stamp = Integer.parseInt(splits[1]);\n int light = Integer.parseInt(splits[2]);\n double temp = Double.parseDouble(splits[3]);\n double vcc = Double.parseDouble(splits[4]);\n\n d.setMillis(millis);\n d.setStamp(stamp);\n d.setLight(light);\n d.setTemp(temp);\n d.setVcc(vcc);\n\n dataList.add(d);\n\n }\n\n }\n\n}\n\n\nThe end result should be that all the data will be on an arraylist and I can bring up those results and from the List I can create a graph using JFreeChart."
]
| [
"java",
"csv",
"arraylist",
"bufferedreader"
]
|
[
"Vue2: How to work with JSONP?",
"I am trying to set up a callback with JSONP but I am unsure how to set it up correctly in Vue. Can someone provide a little guidance? \n\nMy current test gets me back the data as 'undefined'. How can I get my post title to appear? \n\nHere's how I have it set up.\n\nJSFIDDLE: https://jsfiddle.net/doss1/z2m1hukL/\n\nMy Vue instance:\n\nvar vm = new Vue({\n el: '#app',\n data: {\n thePosts: []\n },\n created: function(){\n $.getScript('https://demo.wp-api.org/?rest_route=/wp/v2/posts&_jsonp=receiveData')\n .done(receiveData())\n .fail(function(){\n console.log('there was an error.');\n })\n }\n});\n\n\nMy JSONP callback function is linked as a <script>in the HEAD and contains the\nfollowing:\n\nfunction receiveData( data ) {\n // Do something with the data here.\n // For demonstration purposes, we'll simply log it.\n console.log( data );\n this.thePosts = data;\n}\n\n\nView/HTML:\n\n<div id=\"app\" style=\"margin-top: 5em;\">\n\n <article v-for=\"post in thePosts\">\n <h2 v-html=\"post.title.rendered\"></h2>\n </article>\n\n</div>"
]
| [
"javascript",
"vuejs2"
]
|
[
"Radion button as image does not uncheck upon clicking other radio button",
"I want to simply uncheck radio button upon clicking the other one in the list. (that's how radio is supposed to work ?)\n\nHere's my code:\n\n<div class=\"row\">\n <div class=\"col-sm-2\">\n <label>Payment methods:</label>\n <input type=\"radio\" name=\"pp\" id=\"pp\" checked>\n <label for=\"pp\">\n <img src=\"../img/pp-icon.png\">\n <div>Paypal</div>\n </label>\n </div>\n <div class=\"col-sm-2\">\n <label style=\"visibility: hidden;\">Payment methods:</label>\n <input type=\"radio\" name=\"skrill\" id=\"skrill\">\n <label for=\"skrill\">\n <img src=\"../img/skrill-icon.png\">\n <div>Skrill</div>\n </label>\n </div>\n</div>\n\n\nCSS: \n\ninput[type=radio]{ /* HIDE RADIO */\n visibility: hidden; /* Makes input not-clickable */\n position: absolute; /* Remove input from document flow */\n}\ninput[type=radio] + label>img{ /* IMAGE STYLES */\n border-radius: 50%;\n border: 1px solid #fff;\n padding: 20px;\n width: 100px;\n cursor: pointer;\n transition: 0.2s linear;\n}\ninput[type=radio]:checked + label>img{ /* (RADIO CHECKED) IMAGE STYLES */\n background-color: rgba(255, 255, 255, 0.8);\n}\n\n\nPROBLEM DEMO: https://jsfiddle.net/gsda8s6r/ (radio buttons not hidden)\n\nLive photo:\n\n\nThanks for your help!"
]
| [
"html",
"css"
]
|
[
"Boost C++ VS 2010 _ITERATOR_DEBUG_LEVEL",
"I am using the following command to build the Boost libraries:\n\nC:\\Code\\Libraries\\boost_1_51_0>bjam toolset=msvc-10.0 variant=debug,release threading=multi link=static define=\"_ITERATOR_DEBUG_LEVEL=0\"\n\nBut the debug libraries still show _ITERATOR_DEBUG_LEVEL=2 in the dumpbin tool (output of dumpbin tool is shown below). How can I build a debug version of Boost libs with _ITERATOR_DEBUG_LEVEL=0?\n\nOutput of the dumpbin tool:\n\nDump of file C:\\code\\Libraries\\boost_1_51_0\\stage\\lib\\libboost_chrono-vc100-mt-gd-1_51.lib\n\nFile Type: LIBRARY\n\nLinker Directives\n\n/FAILIFMISMATCH:\"_MSC_VER=1600\"\n\n/FAILIFMISMATCH:\"_ITERATOR_DEBUG_LEVEL=2\"\n\n/DEFAULTLIB:\"msvcprtd\"\n\n/DEFAULTLIB:\"uuid.lib\"\n\n/DEFAULTLIB:\"uuid.lib\"\n\n/DEFAULTLIB:\"MSVCRTD\"\n\n/DEFAULTLIB:\"OLDNAMES\""
]
| [
"c++",
"visual-studio-2010",
"boost"
]
|
[
"mysql stored procedure slow may need prepared statement",
"Data comes in via a zip file in a group of csv files which are used to populate holding tables. Some can include new data or updates of existing entries. The holding tables are used for intermediate processing then are used for import to the working tables.\n\nIn an effort to speed up the process I have been writing stored procedures to update the working tables. On my laptop one such file with only 730 records is taking about a minute to do its stuff.\n\nI did consider making the 'insert ... on duplicate key update' into a prepared statement inside the SP but some of the other tables have many more fields and I could find no good guide on how to write such a complex one.\n\nHere is my stored procedure:\n\nDROP PROCEDURE IF EXISTS impLuRacodes;\nDELIMITER $$\nCREATE DEFINER=`root`@`localhost` PROCEDURE impLuRacodes() \nBEGIN\nDECLARE done INT DEFAULT 0;\nDECLARE v_ATID varchar(10);\nDECLARE v_Code varchar(10);\nDECLARE v_IssType varchar(10);\nDECLARE v_Category varchar(10);\nDECLARE v_CNumber int(4);\nDECLARE v_CDesc varchar(255);\nDECLARE v_ColCode varchar(6);\nDECLARE v_LLike int(3);\nDECLARE v_LifeS int(3);\nDECLARE v_PropS int(3);\nDECLARE v_BusS int(3);\nDECLARE c_1 CURSOR FOR \n SELECT `ATID`, `Code`, `IssType`, `Category`, `CNumber`, `CDesc`, `ColCode`, `LLike`, `LifeS`, `PropS`, `BusS` \n FROM lu_racodes_temp;\nDECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1;\nOPEN c_1;\nREPEAT\n FETCH c_1 INTO v_ATID, v_Code, v_IssType, v_Category, v_CNumber, \n v_CDesc, v_ColCode, v_LLike, v_LifeS, v_PropS, v_BusS;\n INSERT INTO lu_racodes (ATID, `Code`, IssType, Category, CNumber, \n CDesc, ColCode, LLike, LifeS, PropS, BusS) \n VALUES(v_ATID, v_Code, v_IssType, v_Category, v_CNumber, v_CDesc, \n v_ColCode, v_LLike, v_LifeS, v_PropS, v_BusS) \n ON DUPLICATE KEY UPDATE \n ATID= v_ATID, `Code`= v_Code, IssType= v_IssType, Category= v_Category, \n CNumber= v_CNumber, CDesc= v_CDesc, ColCode= v_ColCode, LLike=v_LLike, \n LifeS= v_LifeS, PropS= v_PropS, BusS= v_BusS;\nUNTIL done END REPEAT; \nCLOSE c_1;\nEND $$\n\n\nAlternatively, is it possible to put the Select inside the 'Insert ... On Duplicate Key' instead of using a cursor - again something I have had no joy in finding a clear answer to.\n\nThanks to the guidance I rewrote the code to put the select inside and execution time dropped to 0.156 seconds for a first population. I was concerned about the syntax of the update section with the reference to VALUES as it was a Select statement bringing in the data but changing a couple of rows in the source table did get updated and still with only a 0.235 second time. So here is the code:\n\nDROP PROCEDURE IF EXISTS impLuRacodes;\nDELIMITER $$\nCREATE DEFINER=`root`@`localhost` PROCEDURE impLuRacodes() \nBEGIN\nINSERT INTO lu_racodes (`ATID`, `Code`, `IssType`, `Category`, `CNumber`, `CDesc`, `ColCode`, `LLike`, `LifeS`, `PropS`, `BusS`) SELECT `ATID`, `Code`, `IssType`, `Category`, `CNumber`, `CDesc`, `ColCode`, `LLike`, `LifeS`, `PropS`, `BusS` FROM lu_racodes_temp ON DUPLICATE KEY UPDATE `ATID`= VALUES(`ATID`), `Code`= VALUES(`Code`), `IssType`= VALUES(`IssType`), `Category`= VALUES(`Category`), `CNumber`= VALUES(`CNumber`), `CDesc`= VALUES(`CDesc`), `ColCode`= VALUES(`ColCode`), `LLike`= VALUES(`LLike`), `LifeS`= VALUES(`LifeS`), `PropS`= VALUES(`PropS`), `BusS`= VALUES(`BusS`);\nEND\n$$\nDELIMITER ;"
]
| [
"mysql",
"stored-procedures",
"prepared-statement",
"insert-update"
]
|
[
"web browser developer tools",
"I have a question. Not sure im even allowed to post it here but in new and i guess I'll find out. I was on my email and i for some reason felt as tho is go into the dev tools on my web brower even tho i have no idea how to use them. I began looking around and then came the the network part of it where i was seeing some website pop up i then decided to type one in to the web browser on new tap and when i did it cam back just black. And the site at the top was long like the one i typed init was only ssl.gstatic.com. the full URL i typed looked like this. https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif?zx=wgd121l02lwv. There are lots more of these kind of URLs coming in."
]
| [
"web-services",
"web",
"developer-tools"
]
|
[
"vue-router details not defined",
"I have a Click here for more Details button but it doesn't load the Details.vue on the click so it doesn't show more information on the page. But I get this error Property or method "Details" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.\nArticleListItem.vue\n<template>\n <div>\n <div class="card-body"> \n <h6 class="card-text">{{ result.title }}</h6>\n <p class="card-subtitle mb-2 text-muted"\n >{{ result.publisher }} | {{ result.journal }} | {{ result.year }}</p>\n <a :href="'https://test.org/api/articles?docid=' + result._gddid" target="_blank">\n <i class="fa fa-download" alt="Download"> </i>\n </a>\n <router-link dark :to="{name: 'Details', params: {id: result._gddid}}">\n Click here for more Details\n </router-link>\n <router-view></router-view>\n </div>\n </div>\n</template>\n\n<script>\nexport default {\n name: 'ArticleListItem',\n props: ['result'], \n}\n</script>\n\nDetails.vue\n<template>\n <div class="Details">\n <div class="container">\n <div class="row">\n <div class="col-md-12" v-for="result in results" :key="result._gddid"> \n <div v-if="id == result._gddid">\n <h1>{{results.title}}</h1>\n </div>\n </div> \n </div>\n </div> \n </div> \n</template>\n<script>\n export default {\n name: 'Details',\n computed: { results(){ return this.$parent.$data.results } }\n \n};\n</script>\n\nmain.js\n import Vue from 'vue' import App from './App.vue' import VueRouter from 'vue-router'; import moment from 'moment'\n\nVue.config.productionTip = false\n\nVue.filter('formatDate', function (value) {\n if (!value) return ''\n return moment(value.toString()).format('MM/DD/YYYY hh:mm')\n})\n\nVue.use(VueRouter)\n\nimport Details from './components/Details';\n\nconst router = new VueRouter({\n mode: 'history',\n routes: [\n {\n path: '/Details/:id',\n name: 'Details',\n component: Details\n }\n ]\n})\n\n\nnew Vue({\n router,\n render: h => h(App),\n}).$mount('#app')"
]
| [
"json",
"api",
"vue.js",
"vue-router"
]
|
[
"More variation in line types in R (add dots, plusses...)",
"I'm plotting several regression lines in one graph in R. I use the lty= setting in abline() to distinguish them. However, I find this quite unsatisfying once I have more than three lines: all the line types look too similar. (My graph needs to be black/white. )\n\nI was sure there must be a way of combining symbols and lines in R (to have a dashed line with no symbols, one with crosses, etc.), but could not figure it out, at least for abline(). I'm basically thinking combining the symbols in pch with line types or more interesting lines like here.\n\n\nIs there a way to create new line types? (like for pch, where one\ncan just type in characters)?\nAre there other ways to make lines more easily distinguishable? \nOr do I have to switch to ggplot, or other packages?\n\n\nThis question goes into defining the details of line types, but did not really help me here...\n\nThanks!"
]
| [
"r",
"plot",
"graph",
"linear-regression"
]
|
[
"Many frame in java - trying to open a new window when I click on a button",
"I'm trying to open a new window when I click on a button. In this new window there is a form. The form contains information which is used to create a JScrollPane in the first window. I'd like to create the JScrollPane when the user completes all the element in the form. I tried with Thread but this does not work.\n\nThis is my code :\n\nf(e.getSource() == menuAjoutern){\n JScrollPane scrollpane;\n nomniveaux++;\n\n Frame p = new Frame();\n p.setContentPane(new PanelInfoCrea());\n p.setVisible(true);\n\n /*Thread t = new Thread(new Runnable() {\n\n @Override\n public void run() {\n Frame p = new Frame();\n p.setContentPane(new PanelInfoCrea());\n p.setVisible(true);\n\n }\n });\n t.start();\n\n\n Frame.creation = true;\n while(Frame.creation) {\n try {\n System.out.println(\"oui\");\n Thread.sleep(1);\n } catch (InterruptedException e1) {\n // TODO Auto-generated catch block\n e1.printStackTrace();\n }\n }*/\n scrollpane = new JScrollPane(Frame.p.getListeNiveau().get(Frame.p.getListeNiveau().size()-1).dessinerPlateauCreation(this.getWidth(), this.getHeight(), hauteur));\n pane.add(\"niveau \"+nomniveaux ,scrollpane);\n }\n\n\nHere I try to wait that boolean is false for create the JScrollPane. The boolean change state when second window is close. Do you have any ideas?"
]
| [
"java",
"swing",
"frame"
]
|
[
"Calling a function inside JSX",
"What is the difference between calling functions in JSX in the following alternative ways (using React Hooks here). For function equals:\n\nconst equals = () => {\n //Actual code instructs things to do here\n}\n\n\nAlternatives:\n\n<button id=\"equals\" onClick={() => equals()}>=</button>\n\n\nand \n\n<button id=\"equals\" onClick={equals}>=</button>\n\n\nand\n\n<button id=\"equals\" onClick={equals()}>=</button>"
]
| [
"reactjs",
"react-hooks"
]
|
[
"Updating radio button method from textchangedevent",
"Is it possible to call a radiobutton checked method from a textChanged method for a textbox? I have a group of radio buttons, and when one is selected, it calls the radiobutton_Checked method. This does a calculation and saves the result to a variable called angle_Offset. \n\nI have a textbox whose text is databound to a variable called Heading. This is used in the calculation done in the radiobutton_Checked method. \n\nRight now, the calculation is done whenever a radio button is selected. If I change the text in the textbox, I have to click another radio button to have it update the angle_Offset calculation, but I'm trying to make it so the calculation is done when the text changes without having to select a new radio button (use the current one).\n\nHere's the xaml:\n\n<TextBox x:Name=\"Rotate\" Text=\"{Binding ElementName=this, Path=Heading}\" TextChanged=\"textChangedEventHandler\" />\n\n<RadioButton Content=\"0°\" Tag=\"0\" GroupName=\"display\" Checked=\"radiobutton_Checked\"/>\n<RadioButton Content=\"90°\" Tag=\"1\" GroupName=\"display\" Checked=\"radiobutton_Checked\"/>\n<RadioButton Content=\"180°\" Tag=\"2\" GroupName=\"display\" Checked=\"radiobutton_Checked\"/>\n<RadioButton Content=\"270°\" Tag=\"3\" GroupName=\"display\" Checked=\"radiobutton_Checked\"/>\n\n\nHere's the code behind:\n\n private int Heading\n {\n get { return (int)GetValue(update_Heading); }\n set { SetValue(update_Heading, value); }\n }\n\n public static readonly DependencyProperty update_Heading = DependencyProperty.Register(\"Heading\", typeof(int), typeof(MainWindow), new PropertyMetadata(null));\n\n public void radiobutton_Checked(object sender, RoutedEventArgs e)\n {\n var rb = (RadioButton)sender;\n var tag = Convert.ToInt32(rb.Tag);\n angle_Offset = (degrees_90 * tag) - Heading;\n }\n\n private void textChangedEventHandler(object sender, TextChangedEventArgs args)\n {\n //not sure how to call radiobutton_Checked from here\n }\n\n\nI'm trying to figure out a way to call the radiobutton_Checked method from the textChangedEventHandler, so that the calculation for angle_Offest (found in the radio checked method) using the \"Heading\" variable is updated. I can't just call it since they have different parameters."
]
| [
"c#",
"wpf",
"radio-button",
"checked",
"textchanged"
]
|
[
"Fan working overtime on ubuntu 20.04 (asus gl533)",
"After a ubuntu 20.04 installation, the fan on my notebook is turning at 2500rpm+ even when idle.\nI've managed to install lm-sensors. The output of "sensors" is :\nasus-isa-0000\nAdapter: ISA adapter\ncpu_fan: 2600 RPM\n\nBAT0-acpi-0\nAdapter: ACPI interface\nin0: 16.29 V \ncurr1: 0.00 A \n\niwlwifi_1-virtual-0\nAdapter: Virtual device\ntemp1: +47.0°C \n\npch_skylake-virtual-0\nAdapter: Virtual device\ntemp1: +51.5°C \n\ncoretemp-isa-0000\nAdapter: ISA adapter\nPackage id 0: +56.0°C (high = +100.0°C, crit = +100.0°C)\nCore 0: +52.0°C (high = +100.0°C, crit = +100.0°C)\nCore 1: +55.0°C (high = +100.0°C, crit = +100.0°C)\nCore 2: +49.0°C (high = +100.0°C, crit = +100.0°C)\nCore 3: +50.0°C (high = +100.0°C, crit = +100.0°C)\n\nacpitz-acpi-0\nAdapter: ACPI interface\ntemp1: +54.0°C (crit = +98.0°C)\n\nI've tried using I8KMON (though it seems to be more for Dell computers) to control fan speeds. The output of "i8kmon" is:\nreading system config file\ni8kmon\nconfig(0) = {1 -} -1 50 -1 50\nconfig(1) = {2 -} 40 60 40 60\nconfig(2) = {3 -} 50 80 55 80\nconfig(3) = {2 2} 70 128 75 128\nconfig(acpi) = acpi\nconfig(auto) = 1\nconfig(daemon) = 0\nconfig(i8kfan) = /usr/bin/i8kfan\nconfig(sysconfig) = /etc/i8kmon.conf\nconfig(t_high) = 80\nconfig(timeout) = 20\nconfig(use_conf) = 1\nconfig(userconfig) = ~/.i8kmon\nconfig(verbose) = 1\nstatus(ac) = 0\nstatus(acpi_timer) = 0\nstatus(leftspeed) = 0 -1 -1 -1\nstatus(lspeed) = 0\nstatus(lstate) = -2\nstatus(lstuck) = 0\nstatus(nfans) = 2\nstatus(rightspeed) = 0 -1 -1 -1\nstatus(rspeed) = 0\nstatus(rstate) = -2\nstatus(rstuck) = 0\nstatus(state) = 0\nstatus(t_high) = 0\nstatus(t_low) = 0\nstatus(temp) = 0\n/usr/bin/i8kfan 1 -\n1612290737 acpi: Battery 0: Full, 100%\ntemp, left fan state, right fan state, ac state: -1 -1 -1 0\ntemp, left fan state, right fan state, ac state: -1 -1 -1 0\ntemp, left fan state, right fan state, ac state: -1 -1 -1 0\n\nThe states are all "-1" indicating the configuration isn't working.\nI've looked for alternatives but I can't seem to find a good solution. Any ideas?"
]
| [
"ubuntu",
"hardware",
"asus",
"lm-sensors"
]
|
[
"Dropdown select option shows price?",
"Maybe I didn't constructed my question very good but I am trying to add to an HTML page a drop down menu and when an option is selected it should display some price and everything is fine by now, but when I add multiple dropdowns the price is showed only in the first div and I would like to make it show different price for each dropdown.\n\nJS :\n\nfunction changeddl($this){\n $(\"#divprice\").text($this.value>0?(\"Price: \" + $this.value + \" $\"):\"\");\n};\n\n\nHTML :\n\n<select id=\"bedrooms\" onchange=\"changeddl(this)\">\n <option>Size</option>\n <option value=\"160\">90 x 50 | 4,75 kg.</option>\n <option value=\"240\">100 х 200 | 7,35 kg.</option>\n</select>\n<div id=\"divprice\" class=\"price-style\"></div>\n\n\nThis works fine but when I add one more:\n\n<select id=\"bedrooms\" onchange=\"changeddl(this)\">\n <option>Size</option>\n <option value=\"160\">90 x 50 | 4,75 kg.</option>\n <option value=\"240\">100 х 200 | 7,35 kg.</option>\n </select>\n <div id=\"divprice\" class=\"price-style\"></div>\n\n\nThe price is showing in the first div and nothing appears to this one.\nI can't figure out what should I change to make it work proper..."
]
| [
"javascript",
"jquery",
"html"
]
|
[
"how to query posts by category in django in function based view",
"I have a Post and Category model. Here I want to list posts By category. Category name will be title of the page and post with same category will be rendered under this.\nAnd I have no idea of how to do this.\n\n\n This is my model \n\n\nfrom django.db import models\nfrom django.utils import timezone\nfrom slugger import AutoSlugField\nfrom django.contrib.auth.models import User\nfrom django.urls import reverse\n# Create your models here.\n\ndef upload_location(instance, filename):\n return \"%s/%s\" %(instance.slug, filename)\n\nclass Category(models.Model):\n title = models.CharField(max_length= 60)\n slug = AutoSlugField(populate_from='title')\n parent = models.ForeignKey('self',blank=True, null=True ,related_name='children',on_delete=models.CASCADE)\n updated = models.DateTimeField(auto_now=True, auto_now_add=False)\n timestamp = models.DateTimeField(auto_now=False, auto_now_add=True)\n\n class Meta:\n verbose_name_plural = 'categories'\n def __unicode__(self):\n return self.title\n\n def __str__(self):\n return self.title\n\n\n\nclass Post(models.Model):\n title = models.CharField(max_length=120)\n slug = AutoSlugField(populate_from='title')\n image = models.ImageField(\n upload_to=upload_location,\n null=True, \n blank=True,\n )\n category = models.ForeignKey(Category, on_delete=models.CASCADE)\n content = models.TextField()\n date_posted = models.DateTimeField(default=timezone.now)\n author = models.ForeignKey(User, on_delete=models.CASCADE)\n\n\n def __str__(self):\n return self.title\n\n\n def get_absolute_url(self, slug=None):\n return reverse(\"posts-detail\", kwargs={\"slug\": self.slug})\n\n\n\n post/view.py\n\n\ndef posts_list(request):\n post = Post.objects.all()\n category = Category.objects.all()\n context = {\n 'post': post,\n 'category': category,\n 'title': 'Post list'\n }\n return render(request, 'posts/home.html', context)"
]
| [
"python",
"django"
]
|
[
"How to display 404 page if a back-end GET request to an API fails because user doesn't exists? Separated front-end and back-end",
"I have an application that uses JavaScript with Vue.js for the front-end and PHP with Laravel for the back-end.\n\nRight now, when I make a GET request from my front-end to my back-end on URL /getSummoner/{summonerName}, I make another GET request from my back-end to a third party API in order to get the details for a user with a certain summoner name like this:\n\npublic function getSummoner($summonerName){\n\n $summoner = Summoner::where('summoner_name', $summonerName)->first();\n\n if ($summoner === null) {\n $apiKey = env(\"RIOT_API_KEY\");\n $region = env(\"EUW\");\n\n $getSummonerInfo = file_get_contents($region . \"/lol/summoner/v4/summoners/by-name/\" . $summonerName . \"?api_key=\" . $apiKey);\n $summonerInfo = json_decode($getSummonerInfo);\n\n $summoner = new Summoner();\n $summoner->summoner_name = $summonerName;\n $summoner->summoner_info = json_encode($summonerInfo);\n\n $summoner->save();\n } else {\n $summonerInfo = json_decode($summoner->summoner_info);\n }\n\n return response()->json([\n 'summonerInfo' => $summonerInfo,\n ], 201);\n\n}\n\n\nAnd then I return a JSON response to my front-end with the summoner info. This all works fine and dandy as long as a user with that summoner name exists. If he doesn't exists, the GET request fails so the rest of my function fails and in return I get an error on my front-end.\n\nSo I am wondering what am I supposed to do to get a 404 page on the front-end if my back-end GET request doesn't go through? Both on the front and back-end. I assume I need to return some sort of response from the back-end and then based on that response do something on the front-end?\n\nHere's my front-end:\n\n<template>\n <div>{{ summonerInfo }}</div>\n</template>\n\n<script>\nimport axios from 'axios'\nimport router from '../router'\n\nexport default {\n data(){\n return {\n summoner: this.$route.params.summonerName,\n summonerInfo: '',\n }\n },\n methods: {\n user(action){\n let trimmedSummoner = this.summoner.replace(/\\s+/g, '');\n axios.get('/' + action + 'Summoner/' + trimmedSummoner)\n .then((response) => {\n this.summonerInfo = response.data.summonerInfo\n })\n .catch(function (error) {\n console.log(error);\n })\n }\n },\n watch:{\n $route (to, from){\n this.summoner = this.$route.params.summonerName\n this.user('get')\n }\n },\n mounted(){\n this.user('get')\n }\n}\n</script>"
]
| [
"javascript",
"php",
"laravel",
"vue.js",
"vuejs2"
]
|
[
"Unable to send powershell email using php script to outlook using iis windows server 2012",
"Error -:\n\n\n New-Object : Retrieving the COM class factory for component with CLSID\n {0006F03A-0000-0000-C000-000000000046} failed due to the following\n error: 80010001 Call was rejected by callee. (Exception from HRESULT:\n 0x80010001 (RPC_E_CALL_REJECTED)). At D:\\get-process.ps1:5 char:12 +\n $Outlook = New-Object -ComObject Outlook.Application +\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo :\n ResourceUnavailable: (:) [New-Object], COMExcept ion +\n FullyQualifiedErrorId :\n NoCOMClassIdentified,Microsoft.PowerShell.Comman ds.NewObjectCommand\n You cannot call a method on a null-valued expression. At\n D:\\get-process.ps1:6 char:1 + $Mail = $Outlook.CreateItem(0) +\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:)\n [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull The\n property 'To' cannot be found on this object. Verify that the property\n exists and can be set. At D:\\get-process.ps1:8 char:1 + $Mail.To =\n \"$username\" + ~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo :\n InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId :\n PropertyNotFound The property 'Subject' cannot be found on this\n object. Verify that the property exists and can be set. At\n D:\\get-process.ps1:9 char:1 + $Mail.Subject = \"New Leave Request\" +\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation:\n (:) [], RuntimeException + FullyQualifiedErrorId : PropertyNotFound\n The property 'Body' cannot be found on this object. Verify that the\n property exists and can be set. At D:\\get-process.ps1:10 char:1 +\n $Mail.Body = \"$username\" + ~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo :\n InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId :\n PropertyNotFound You cannot call a method on a null-valued expression.\n At D:\\get-process.ps1:12 char:1 + $Mail.Send() + ~~~~~~~~~~~~ +\n CategoryInfo : InvalidOperation: (:) [], RuntimeException +\n FullyQualifiedErrorId : InvokeMethodOnNull Hello\n [email protected]\n\n\nget-process.php -:\n\n<?php\n\n $username = \"[email protected]\";\n\n $psScriptPath = \"D:\\\\get-process.ps1\";\n\n $query = shell_exec(\"powershell -command $psScriptPath -username '$username'< NUL\");\n echo $query;\n\n?>\n\n\nget-process.ps1 -:\n\nparam(\n[string]$username\n)\n\n$Outlook = New-Object -ComObject Outlook.Application\n$Mail = $Outlook.CreateItem(0)\n\n$Mail.To = \"$username\"\n$Mail.Subject = \"New Leave Request\"\n$Mail.Body = \"$username\"\n\n$Mail.Send()\n\nWrite-Output \"Hello $username <br />\"\n\n\nget-process.php is the php that is present in root folder wwwroot of IIS Windows Server 2012 and from which the PowerShell script get-process.ps1 is triggered. Get-process.ps1 contains script for sending the mail"
]
| [
"php",
"powershell",
"iis",
"outlook",
"windows-server-2012"
]
|
[
"pass a javascript variable to a servlet using ajax",
"I have a frameId varibale that I recovered from my javascript code and I want to pass on to my servlet, I use ajax for that but it did not work:\n\nhere is my javascript method:\n\nfunction createYTEvent(frameID,j) {\n return function (event) {\n var player = playerArray[frameID];\n var duration=player.getDuration();\n\nif(!videoArray[j].valide){\n if (event.data == YT.PlayerState.PAUSED) {\n if(((player.getCurrentTime()*100)/duration)>2){\n videoArray[j].valide=true;\n $.ajax({\n type: 'GET',\n url: 'localhost:8080/favoris',\n data: frameID\n });\n }\n }\n if (event.data == YT.PlayerState.ENDED) {\n videoArray[j].valide=true;\n alert(\"frame id\"+frameID + \"valide= \"+ videoArray[j].valide);\n }\n }\n }\n}\n\n\nand here is my servlet: favoris.java\n\n@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n PrintWriter out = response.getWriter();\n\n String n1 = request.getParameter(\"frameID\");\n out.println(n1);\n\n\n } \n\n\ncan you help me..."
]
| [
"java",
"javascript",
"ajax",
"servlets"
]
|
[
"Jquery Solution for Equal Height on Varied Class in CMS",
"sorry to ask but looked everywhere for an \"equal height\" content solution. So far all options using Jquery (or script) rely on there being the same \"class\" assigned to target. For example, as in the below which demonstrates using '.someclass': \n\n\r\n\r\n$(document).ready(function(){ \r\n var biggestHeight = 0; \r\n $('.someclass').each(function(){ \r\n if($(this).height() > biggestHeight){ \r\n biggestHeight = $(this).height(); \r\n } \r\n }); \r\n $('.someclass').height(biggestHeight); \r\n}); \r\n\r\n\r\n\n\nThe problem is I'm working in a platform environment (square space) where there's numerous classes and no single .class over-arching that can be applied to the various module (block) type elements that can be added. In that environment, text blocks (.sqs-block-content) differs from image blocks (.sqs-block-image) and ongoing.... \n\nI'm not able to write my own \"classes\" then just apply some script and need help finding the classes to select and a script to make text modules equal image modules. And not script savvy enough to write it. Can anyone assist? \n\nBasically looking to target a text block on the page and fix it to the height of an image block next to it so that these are the SAME height.\n\nHere's an actual page view showing text next to images which you can run inspection on and see what I mean. It's a trial/demo example so you may see a captcha first... > https://goo.gl/WksRqG\n\nI'd be willing to pay for the help -- just can't seem to get this.... All solutions ultimately require either the same class assigned, or, the ability to wrap them in a custom div which I can't actually specify in the environment.\n\nThanks in advance for any help/walk through."
]
| [
"javascript",
"jquery",
"css"
]
|
[
"What is an efficient way to broadcast a value to all the threads after using blockReduce from Cuda Unbound?",
"let column_mean_partial = blockReducer.Reduce(temp_storage, acc, fun a b -> a + b) / (float32 num_rows)\n\nif threadIdx.x = 0 then \n means.[col] <- column_mean_partial\n column_mean_shared := column_mean_partial\n\n__syncthreads()\n\nlet column_mean = !column_mean_shared\n\n\nThe above code snippet calculates the mean of every column of a 2d matrix. As only thread 0 of a block has the full value I store it to shared memory column_mean_shared, use __syncthreads() and then broadcast it to all the threads in a block as I need them to have that value in order to calculate the variance.\n\nWould there be a better way to broadcast the value or is the above efficient enough already?"
]
| [
"cuda",
"aleagpu"
]
|
[
"React check how many times a component re-renders",
"I'm working on something and a piece of my code is a bit slow, what I think happens is that the component re-render too many times for no reason.\nIs there any way to check how many times a component re-renders in react(or react-native for the matter)?\nWhat i've tried to do is put a console.log after the render method and count how many there are but i'm not sure if that would work.\nThanks in advance!"
]
| [
"reactjs",
"react-native"
]
|
[
"Routes in Laravel Bagisto",
"I had a problem with this weird framework over here.\nI created a theme, installed it, re-design the default template and then whenever I wanna swap to another route that is created in the core of Bagisto, the page refresh like if it's gonna another page but even if the title swaps and the url too the index page is loaded again.\nThis is what Laravel shows for the index route:\nAnd this is what Laravel shows for another route (For example customer / register)\n\nEven if the route is different they load the same view for every route and if I put a default theme it actually change like it should be."
]
| [
"laravel",
"routes"
]
|
[
"confused how to use opentables in yql",
"i am trying to get access to whitepages using YQL. Unfortunately i don't have much experience with opentables.\n\nI was directed to the whitepages xml file at: \nhttp://github.com/spullara/yql-tables/blob/c63212b2ac9db6feb77ae3cecace51ed52e08c01/whitepages/whitepages.search.xml\n\nDoes anyone know how to use this table to extract meaningful information using YQL?\n\nSpecifically, I'm not sure how to make a query in YQL using this table to search for a person's name.\n\nHelp?"
]
| [
"yql"
]
|
[
"Print data through Spark SQL taking long time",
"I have 3 text files in hdfs which I am reading using spark sql and registering them as table. After that I am doing almost 5-6 operations - including joins , group by etc.. And this whole process is taking hardly 6-7 secs. ( Source File size - 3 GB with almost 20 million rows ). \nAs a final step of my computation, I am expecting only 1 record in my final rdd - named as acctNPIScr in below code snippet. \n\nMy question here is that when I am trying to print this rdd either by registering as table and printing records from table or by this method - acctNPIScr.map(t => \"Score: \" + t(1)).collect().foreach(println). It is taking very long time - almost 1.5 minute to print 1 record. \n\nCan someone pls help me if I am doing something wrong in printing. What is the best way to print final result from schemardd. \n\n..... \nval acctNPIScr = sqlContext.sql(\"\"SELECT party_id, sum(npi_int)/sum(device_priority_new) as npi_score FROM AcctNPIScoreTemp group by party_id \") \nacctNPIScr.registerTempTable(\"AcctNPIScore\") \n\nval endtime = System.currentTimeMillis() \nlogger.info(\"Total sql Time :\" + (endtime - st)) // this time is hardly 5 secs \n\nprintln(\"start printing\") \n\nval result = sqlContext.sql(\"SELECT * FROM AcctNPIScore\").collect().foreach(println) \n\n//acctNPIScr.map(t => \"Score: \" + t(1)).collect().foreach(println) \n\nlogger.info(\"Total printing Time :\" + (System.currentTimeMillis() - endtime)) // print one record is taking almost 1.5 minute"
]
| [
"sql",
"apache-spark"
]
|
[
"How to store class with sub class by Google Cloud Datastore JSON API?",
"For storing into GCD, I want to use Google Cloud Datastore JSON API but I couldn't write correct Json request body for object with another class member. Consider I have 2 classes :\n\npublic class Foo {\n private String id;\n private Bar bar;\n // getter and setter...\n}\n\npublic class Bar {\n private String name;\n private String pass;\n // getter and setter...\n}\n\n\nThen I create an object of Foo class that contain an object of Bar class.\nSo I want to insert this object to Cloud Datastore. I wrote this request body :\n\n{\n \"transaction\":\"some bytes\",\n \"mutation\":{\n \"insert\":[\n {\n \"key\":{\n \"partitionId\":{\n \"datasetId\":\"s~my-dataset-id\"\n },\n \"path\":[\n {\n \"kind\":\"Foo\",\n \"name\":\"id\"\n }\n ]\n },\n \"properties\":{\n \"bar\":{\n \"entityValue\":{\n \"name\":{\n \"stringValue\":\"Jack\"\n },\n \"pass\":{\n \"stringValue\":\"1234\"\n }\n },\n \"indexed\":false\n },\n \"id\":{\n \"stringValue\":\"id\"\n }\n }\n }\n ]\n }\n}\n\n\nThen all fields except bar will save to cloud datastore. I used \"entityValue\" but it seems that I should include the entire entity structure (thanks Adam for mention it). But I don't need it as another entity and obviously I shouldn't use \"entityValue\".\nSo how should I change the request body to insert such an object?\n\nBy the way, I can insert a Bar object (but not Foo) by following request :\n\n {\n \"transaction\":\"some bytes\",\n \"mutation\":{\n \"insert\":[\n {\n \"key\":{\n \"partitionId\":{\n \"datasetId\":\"s~my-project-id\"\n },\n \"path\":[\n {\n \"kind\":\"Bar\",\n \"name\":\"John\"\n }\n ]\n },\n \"properties\":{\n \"pass\":{\n \"stringValue\":\"1234\"\n },\n \"name\":{\n \"stringValue\":\"John\"\n }\n }\n }\n ]\n }\n}\n\n\nThis is the related link : Related link"
]
| [
"java",
"json",
"google-cloud-datastore"
]
|
[
"dojox.grid.DataGrid populated from Servlet",
"I'd like to hava a Dojo dojox.grid.DataGrid with its data from a servlet.\n\nProblem: The data returned from the servlet does not get displayed, just the message \"Sorry, an error has occured\".\n\nIf I just place the JSON string into the HTML, it works. ARRRRGGH.\n\nCan anyone please help me!\n\nThanks\nJeff Porter\n\nServlet code...\n\npublic void doGet(HttpServletRequest req, HttpServletResponse resp) {\n res.setContentType(\"json\");\n PrintWriter pw = new PrintWriter(res.getOutputStream());\n if (response != null) pw.println(\"[{'batchId':'2001','batchRef':'146'}]\");\n pw.close();\n}\n\n\nHtmL code...\n\n <div id=\"gridDD\" dojoType=\"dojox.grid.DataGrid\" \n jsId=\"gridDD\" style=\"height: 600x; width: 100%;\" \n store=\"ddInfo\" structure=\"layoutHtmlTableDDDeltaSets\">\n </div> \n\n var rawdataDDInfo = \"\"; // empty at start\n ddInfo = new dojo.data.ItemFileWriteStore({\n data: {\n identifier: 'batchId',\n label: 'batchId',\n items: rawdataDDInfo\n }\n });\n <script>\n function doSelectBatchsAfterDate() {\n var xhrArgs = {\n url: \"../secure/jsonServlet\",\n handleAs: \"json\",\n preventCache: true,\n load: function(data) {\n var xx =dojo.toJson(data);\n var ddInfoX = new dojo.data.ItemFileWriteStore({data: xx});\n dijit.byId('gridDD').setStore(ddInfoX);\n },\n error: function(error) {\n alert(\"error:\" + error);\n }\n }\n\n //Call the asynchronous xhrGet\n var deferred = dojo.xhrGet(xhrArgs);\n }\n </script>\n<img src=\"go.gif\" onclick=\"doSelectBatchsAfterDate();\"/>"
]
| [
"dojo",
"dojox.grid.datagrid"
]
|
[
"Change the color of a 3D image pixel and save it",
"I have a 3D array. I want to change some pixel color of this 3D image.\nI want to change the pixel color for a given condition that is if my mask pixel for a fixed 3D co-ordinate is not equal 0 then I want to change my 3D array pixel to red color. Finally, I want to save this into a nifty format or .nii.gz format. I write some code this way, but this code gives me an error\n x, y, z=volume.shape\n for i in range (0, x):\n for j in range (0, y):\n for k in range (0, z):\n if(detections[i,j,k] !=0 ):\n volume[i ,j, k]=(255, 0, 0)\n ni_img = nib.Nifti1Image(output, volume.affine)\n nib.save(ni_img, '/content/SpineFinder-master/3d_path/output.nii.gz')\n\n\n\nValueError: setting an array element with a sequence volume[i, j, k]=(255, 0, 0)"
]
| [
"python",
"3d",
"pixel"
]
|
[
"cv2.imshow() is opening multiple window in a loop",
"when I am running this simple code in my notebook with opencv-python version v4.3.0. Then my screen is filled with windows as shown in image.\n# importing the required modules \n \n\nimport cv2 \n \n\nimport numpy as np \n \n \n\n# capturing from the first camera attached \n \n\ncap = cv2.VideoCapture(0) \n \n \n\n# will continue to capture until 'q' key is pressed \n \n\n \n\nwhile True: \n ret, frame = cap.read() \n \n # Capturing in grayscale \n gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) \n \n cv2.imshow('frame', frame) \n cv2.imshow('gray', gray) \n \n # Program will terminate when 'q' key is pressed \n if cv2.waitKey(1) & 0xFF == ord('q'): \n break\n \n \n\n# Releasing all the resources \ncap.release() \ncv2.destroyAllWindows()"
]
| [
"python",
"cv2",
"opencv-python"
]
|
[
"Does QMap support custom comparator functions?",
"I couldn't find a way to set a custom comparator function for QMap, like I can for std::map (the typename _Compare = std::less<_Key> part of its template arguments).\n\nDoes QMap have a way to set one?"
]
| [
"c++",
"qt",
"qmap"
]
|
[
"Java: How does passing uninstantiated object references work?",
"Here's an example of what I mean. \n\nIf I have a binary tree insert method that accepts a node, and I pass it parent.child (which is uninstantiated) what exactly is being passed?\n\nSince Java is pass by value it must be passing a copy of the reference but without any object to point to what will happen? Does that mean I'm passing an empty reference that has no relevance to the parent node?\n\nUnfortunately I don't have any code since this was actually a question that was passed onto me and I couldn't quite put it together. My solution was to pass a parent node which is already instantiated and then instantiate parent.child"
]
| [
"java",
"tree",
"binary-tree",
"pass-by-value"
]
|
[
"Proper way of handling errors and sending JSON back for API",
"I am new to js/node/express, and I have been working on this application where I have the following code to handle user registration: \n\nconst Account = require('../models/Account.js')\n\nmodule.exports = {\n // TODO: Check why Postman hangs on POST request for this\n async register (req, res, next) {\n if (req.body.email && req.body.password) {\n var newAccount = new Account()\n newAccount.email = req.body.email\n newAccount.password = newAccount.generateHash(req.body.password)\n\n const account = Account.create({email: newAccount.email, password: newAccount.password}, function (err, res) {\n if (err) {\n console.log('could not insert. Check error.')\n // CANT CALL res.status(400).send({ error: 'email already exists'})\n res.status(500)\n return next(err)\n }\n res.status(400).send({\n error: 'exists'\n })\n })\n console.log(`inserted account ${newAccount.email}`)\n res.send(account.toJSON())\n }\n }\n}\n\n\nI read this post about how to properly send JSON data back in order to build a proper REST API but ran into some issues. \n\nWhen I do the call to res.status(400) I get an error that res.status is not a function. Is that because res is not available in that if statement? If it isn't how then, do I properly send a 400 (or any error status) in a case like this? \n\nI want to be able to send an error message if the saving into my mongo db fails, or send back the created user if the insertion was successful. \n\nIf there is anything out there that I can read Id love to read some of that as well."
]
| [
"json",
"node.js",
"mongodb",
"express"
]
|
[
"block suite 'verify' in 'kitchen test'",
"I'm running 2 different recipes from 2 suites, and both suites have same name so that these recipes would run on same machine. But the problem is, once the test kitchen run with first recipe, it starts to 'verify' the suite, which i don't want to do. I want to run the 'verify' once the both recipes are executed from different chef-client run. Is it possible to block the test-kitchen from doing 'verify' in 'kitchen test'?"
]
| [
"chef-infra",
"test-kitchen"
]
|
[
"Once again, how to get nested loops to work in python",
"Can someone help me with this nested loop? it has the same problem as Loops not working - Strings (Python) but now it is in a csv class that doesn't have a csv.readline() function. \n\nimport csv\nimport sys, re\nimport codecs\nreload(sys)\nsys.setdefaultencoding('utf-8')\n\nreader = csv.reader(open(\"reference.txt\"), delimiter = \"\\t\")\nreader2 = csv.reader(open(\"current.txt\"), delimiter = \"\\t\")\n\nfor line in reader:\n for line2 in reader2:\n if line[0] == line2[1]:\n print line2[0] + '\\t' + line[0]\n print line[1]\n else:\n print line[0]\n print line[1]\n\n\nThe purpose of this code is to check the lines in a reference text (i.e. reader2) that coincide with the current textfile (i.e. reader). And then print the serial number that is in the reference.txt\n\nreference.txt looks like this (the space between the serial no. and sentence is a tab):\n\nS00001LP this is a nested problem\nS00002LP that cannot be solved\nS00003LP and it's pissing me off\nS00004LP badly\n\n\ncurrent.txt looks like this(the space between the 1st and 2nd sentence is a ):\n\nthis is a nested problem wakaraa pii ney bay tam\nand i really can't solve it shuu ipp faa luiip\nso i come to seek help from stackoverflow lakjsd sdiiije\nseriously it is crazy because such foo bar bar foo\nproblems don't happen in other languages whaloemver ahjd\nand it's pissing me off gaga ooo mama\nbadly wahahahah\n\n\nthe required output will look something like this:\n\nS00001LP this is a nested problem wakaraa pii ney bay tam\nand i really can't solve it shuu ipp faa luiip\nso i come to seek help from stackoverflow lakjsd sdiiije\nseriously it is crazy because such foo bar bar foo\nproblems don't happen in other languages whaloemver ahjd\nS00003LP and it's pissing me off gaga ooo mama\nS00004LP badly wahahahah"
]
| [
"python",
"loops"
]
|
[
"Get active directory user attributes in Framework 4.5",
"I have a code which is getting users from a specific group.\n\n PrincipalContext ctx = new PrincipalContext(ContextType.Domain, domainName);\n GroupPrincipal grp = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, groupName);\n\n if (grp != null)\n {\n foreach (Principal p in grp.GetMembers(true))\n {\n Console.WriteLine(p.Name);\n }\n }\n\n\nThe problem is that i am not able to get users Mobile phone, Home phone, Department, Country. Has someone any ideas how it can be done using this method ?"
]
| [
"c#",
"userprincipal"
]
|
[
"accesing filestream denied for SharpZipLib for Unity3d iOS",
"i am trying to unpack a .zip file but when i try to copy the zip stream to the file i get:\n\nUnauthorizedAccessException: Access to the path \"/var/mobile/Applications/7209CA86-E88D-4BAC-B285-2912B982E8C0/Documents/Inbox/Book.txt\" is denied.\n at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 \n at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) [0x00000] in <filename unknown>:0 \n at System.IO.File.Create (System.String path, Int32 bufferSize) [0x00000] in <filename unknown>:0 \n at System.IO.File.Create (System.String path) [0x00000] in <filename unknown>:0 \n\n\nBook.txt is a file of the .zip file.\n\nHere is the code where the problem appears:\n\nusing (FileStream streamWriter = File.Create(fullZipToPath)) {\n StreamUtils.Copy(zipStream, streamWriter, buffer);\n }\n\n\nThe code works well on OS X but on iOS i can't get it fixed. What is the problem?"
]
| [
"ios",
".net",
"unity3d",
"filestream",
"sharpziplib"
]
|
[
"Resolving dependencies in ServiceRoute with Unity on an ASP.NET MVC project",
"I have a WCF service that I expose via REST using ServiceRoute in an ASP.NET MVC project: \n\nroutes.Add(new ServiceRoute(\"Rest\", new WebServiceHostFactory(), typeof(ServeiInventaris)));\n\n\nIn my controllers, I use Unity to resolve dependencies. Is there a way to integrate Unity with ServiceRoute to let it resolve my dependencies (the dependencies of the REST service)?"
]
| [
"wcf",
"asp.net-mvc-3",
"rest"
]
|
[
"Pandas getting values from Pivot table",
"I am trying to sort by the 'acct' and group by the 'month'.\n\ndataframe is this:\n\n acct month value\n\n14 84 2014-09-30 393641\n15 84 2014-10-31 393283\n16 84 2014-11-30 383293\n....\n35 85 2014-10-31 291629\n36 85 2014-11-30 289544\n\n\nI do a pivot table\n\ndf2 = df.pivot_table ( index = ['month'], columns = \"acct\" )\n\n\nThis is the results:\n\n value \nacct 84 85\nmonth \n2014-09-30 393641.0 0.0\n2014-10-31 393283.0 291629.0\n2014-11-30 383293.0 289544.0\n\n\nWhat is the best way to get values from the pivot?\nI need to loop trough the 'value' to extract the data created for each account.\n\nThanks.\n\nThis is what worked for me to extract the data:\n\nvar = [ ]\nfor column in df2.columns.values:\n var.append ( df2 [ column ].tolist () )"
]
| [
"pandas"
]
|
[
"Efficiency of images vs XML drawable",
"In Android which would be more preferable for an application's backgrounds / wallpapers: images created with your favorite vector-art application or defining the backgrounds in XML.\nThe majority of these backgrounds will be gradient-based (also keeping in-mind that Android often recalculates the gradient and you get the effect that the gradient is moving). I read this and didn't get what i wanted \n\nhttp://developer.android.com/guide/topics/resources/drawable-resource.html\n\nAiden"
]
| [
"android",
"xml",
"image",
"android-drawable"
]
|
[
"jQuery does not send Cookie to server",
"Cross-domain problem. From HTTP to same domain HTTPS.\n\nServer requires X-Requested-With header so I set it in jQuery ajax options:\n\n'headers': {'X-Requested-With': 'XMLHttpRequest'}\n\n\njQuery sends OPTION then:\n\nOPTIONS /my/test/ HTTP/1.1\nHost: www.my.dev\nOrigin: http://www.my.dev\nAccess-Control-Request-Method: POST\nAccess-Control-Request-Headers: x-requested-with\n\n\nServer responds:\n\nHTTP/1.1 200 OK\nAccess-Control-Allow-Origin: *\nAccess-Control-Allow-Methods: GET, POST\nAccess-Control-Allow-Headers: x-requested-with\nAccess-Control-Allow-Credentials: true\n\n\nThen jQuery sends \"actual\" request:\n\nPOST /my/test/ HTTP/1.1\nHost: www.test.dev\nX-Requested-With: XMLHttpRequest\nOrigin: http://www.test.dev\n\n\nCookie header is missing!\n\nServer responds with:\n\nHTTP/1.1 403 Forbidden\nContent-Type: application/json\nSet-Cookie: SESSID=3tg8svt3lrv97v155uv2kqr3o2; expires=Sat, 25-Apr-2015 17:35:13 GMT; Max-Age=259200; path=/\n\n\nAdding \n\n 'xhrFields': {\n 'withCredentials': true\n },\n 'crossDomain': {\n 'crossDomain': true\n },\n\n\nto jQuery ajax options results in jQuery not sending actual request at all, only OPTIONS.\n\nHow to send cookie?\nCould at least someone confirm that cookies are sent in similar setup?"
]
| [
"javascript",
"jquery",
"ajax",
"cross-domain",
"cors"
]
|
[
"Fastest way to return multiple match values in Excel",
"I'm trying to see if there's a macro that can speed up a multiple match formula I'm using in a file. \n\nThe formula is:\n\n\n =IFERROR(INDEX(Data!$D:$D,SMALL(IF('Department 1'!$A$1=Data!$B:$B,ROW(Data!$B:$B)-MIN(ROW(Data!$B:$B))+1,\"\"), ROW(Data!A1))),\"Enter New Client Name\")\n\n\nIn a workbook, There's three worksheets: Data, Department 1, and Department 2.\n\nIn the \"Data\" worksheet, Column B has a list of all the departments (i.e. Department 1 and Department 2) and Column C has a list of Clients that belong to each department.\n\nThe Department 1 and Department 2 worksheets have the exact match formula that's looking up the list of clients based on its department name.\n\nThis formula is runs pretty slow even if I'm just looking up 10 clients so I'm wondering if it's possible to speed it up using a macro?\n\nI checked this website and found something that was able to look up 40,000 entries instantly (see below), but it's only running the macro on one worksheet. The real workbook I'm working in has over 30 different departments and I need the formula to run on all 30 worksheets so that the list of clients is unique to the department.\n\nI apologize in advance if the instructions are not as clear, I was hoping I could upload a sample file, but since I'm new here I didn't see an option to upload. Any help is greatly appreciated!\n\nPrivate Sub Worksheet_Change(ByVal Target As Range)\n\n Dim wb As Workbook\n Dim ws1 As Worksheet\n Dim ws2 As Worksheet\n Dim vLoookupVal As Variant\n Dim vValues As Variant\n Dim aResults() As Variant\n Dim lResultCount As Long\n Dim i As Long\n Dim lIndex As Long\n\n Set wb = ActiveWorkbook\n Set ws1 = Me 'This is the sheet that contains the lookup value\n Set ws2 = wb.Sheets(\"Sheet2\") 'This is the sheet that contains the table of values\n\n Application.EnableEvents = False\n\n If Not Intersect(Target, ws1.Range(\"A1\")) Is Nothing Then\n ws1.Columns(\"B\").ClearContents 'Clear previous results\n vLoookupVal = Intersect(Target, ws1.Range(\"A1\")).Value\n lResultCount = WorksheetFunction.CountIf(ws2.Columns(\"A\"), Target.Value)\n If lResultCount = 0 Then\n MsgBox \"No matches found for [\" & vLoookupVal & \"]\", , \"No Matches\"\n Else\n ReDim aResults(1 To lResultCount, 1 To 1)\n lIndex = 0\n vValues = ws2.Range(\"A1:B\" & ws2.Cells(ws2.Rows.Count, \"A\").End(xlUp).Row).Value\n For i = LBound(vValues, 1) To UBound(vValues, 1)\n If vValues(i, 1) = vLoookupVal Then\n lIndex = lIndex + 1\n aResults(lIndex, 1) = vValues(i, 2)\n End If\n Next i\n ws1.Range(\"B1\").Resize(lResultCount).Value = aResults\n End If\n End If\n\n Application.EnableEvents = True\n\nEnd Sub"
]
| [
"vba",
"excel"
]
|
[
"mysql find rows with fractional part of number",
"Using the MySQL command prompt, I want to SELECT all rows conataining a specific fractional part of number.\n\nI have a field of type FLOAT called priority & I want to find all rows where the priority is X.2 where X can be any whole number.\n\nIs there a way to use the MOD or FLOOR function to extract the \".2\" in a query?\n\nI've tried:\n\nSELECT * from table\nWHERE priority-FLOOR(priority) = .2 *(note the decimal point before the 2)*\n\n\nbut it returns empty set when I know there are at least 100 rows containing a priority of X.2\n\nThanks"
]
| [
"mysql",
"floor"
]
|
[
"npm install not compiling forked material-ui src into lib folder",
"I am using material-ui in my app. I forked material ui and rolled back to pervious version and made some changes there, now I want to use the forked repo in my project so I used the following steps to install module from here:\n\n\nGo to fork's page\nGo to commits\nOn the right side of the commit you want to use click Browse code\nOn the browse code page right-click on Download ZIP button (or whatever it is that you are seeing) and copy . It should be something like this \n\n\n\n https://github.com/SoftwareMarbles/express-jsend/archive/fdd4089087d916fa6e3b5abaa1ff9dd9ea96df8d.zip\n\n\n\nEdit that URL replacing archive with tarball and removing the .zip extension. You should end up with something like \n\n\n\n https://github.com/SoftwareMarbles/express-jsend/tarball/fdd4089087d916fa6e3b5abaa1ff9dd9ea96df8d\n\n\n\nPaste that into your package.json instead of the version. Like this:\n\n\n\"express-jsend\": \"url/from/step/5\"\n\nnpm install runs successfully without giving any errors but it does not compile the js files in src and put them in lib folder as compare to when i run npm install with following code in my package.json\n\n\"material-ui\": \"0.14.4\"\n\nSo my question:\n\nWhy is npm not compiling the src files and putting them in lib folder?"
]
| [
"git",
"npm",
"npm-install",
"git-fork"
]
|
[
"How i extract text from a model dialog in selenium?",
"I'm trying to scrape data from \"https://free-proxy-list.net/\" to simply extract data by clicking on \"Get raw list\" which opens up a model box inside a website and from that, you can easily copy that or extract that data. So I tried to extract that text using normally\n\ndriver.find_element_by_xpath().text\n\n\nbut it showed me an error\n\nElementNotVisibleException: Message: element not interactable\n\n\nI followed this answer https://stackoverflow.com/a/54618973/8197487\nto overcome this problem \n\nWebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id=\"list\"]/div/div[1]/ul/li[6]/a'))).click()\n\np=WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH,'//*[@id=\"raw\"]/div/div/div[2]/textarea'))).text\n\n\nAfter using the above code no error raises but I get no text.\n\nis there any other way or I'm doing something wrong."
]
| [
"python",
"python-3.x",
"selenium",
"web-scraping"
]
|
[
"vb.net implement strategy pattern with different interface",
"is it possible to implement strategy pattern with different parameters in VB.net?\nFor example I have the following code:\n\nPublic Interface InterfaceDataManipulation\nSub updateMyData()\nEnd Interface\n\n\nHow to implemente updateMyData in the class that implements above interface class with different parameter, for example in class x :\n\nPublic Class X\nImplements InterfaceDataManipulation\nPublic Sub updateMyData(ByVal x as String)\n Console.Writeline(x)\nEnd Sub\nEnd Class\n\n\nBut the IDE raises an error \"class x must implement updateMyData on interface InterfaceDataManipulation\""
]
| [
"vb.net",
"design-patterns",
"strategy-pattern"
]
|
[
"datetime select with -15 minute interval showing wrong result",
"For a room reservation page I'm making a query for entries among 3 tables. Datetime values are in one table, another table keeps the info if the room key has been checked out. And another table keeps the reservation information. If current time has past start of reservation time at least 15 minutes and the key has not been checked out, the entry should get deleted. Problem is, it deletes also future reservations, where the start time of the reservation has not past yet. My query looks like this.\n\nSELECT dt.field_reservation_datetime_value\n , dt.entity_id\n , co.field_reservation_checked_out_value\n , co.entity_id\n , res.reservation_id \n FROM field_data_field_reservation_datetime dt \n JOIN field_data_field_reservation_checked_out co \n ON co.entity_id = dt.entity_id \n JOIN studyroom_reservation res \n ON res.reservation_id = co.entity_id \n WHERE co.field_reservation_checked_out_value = 0 \n AND DATE (dt.field_reservation_datetime_value) <= NOW() - INTERVAL 15 MINUTE\n\n\nRight now it is 9:52am, this shouldn't be showing up for the next 2 hours and 38 minutes. What I get is this:\n\n\n\nAny idea what I may doing wrong?\n\nedit: table alias added and screenshot"
]
| [
"mysql",
"datetime",
"intervals"
]
|
[
"How to start mySQL server detached in OS X at system startup?",
"I know I could start the server with\n\nmysqld_safe\n\n\nHow can I start it detached and every time the system starts?\n\nIn which initialization file, ~/.bash_profile, /etc/profile or other, is good to put the server start command?"
]
| [
"mysql",
"macos",
"shell"
]
|
[
"Different results for pow on x86 and x64",
"I am wondering why I am observering different results when using pow on x86 and x64 respectively. In our application we control the floating point rounding mode, which has worked fine on both Windows and Linux 32 bit.\n\n#include <cmath>\n#include <cstdio>\n#include <cfloat>\n\nvoid checkEqual(double expected, double observed) { \n if (expected == observed) {\n printf(\"Expected %.23f, got %.23f\\n\", expected, observed);\n }\n else {\n printf(\"ERROR: Expected %.23f, got %.23f\\n\", expected, observed);\n }\n}\n\nint main(int argc, char **argv) { \n unsigned ret, tmp;\n _controlfp_s(&ret, 0, 0);\n _controlfp_s(&tmp, RC_DOWN, MCW_RC);\n\n checkEqual(2048.0, pow(2.0, 11.0));\n checkEqual(0.125, pow(2.0, -3.0));\n\n return 0; \n}\n\n\nCompiling and running with Visual Studio 2015 (2012 gives the same result) gives me the following output\n\nx86:\n\nExpected 2048.00000000000000000000000, got 2048.00000000000000000000000\nExpected 0.12500000000000000000000, got 0.12500000000000000000000\n\n\nx64:\n\nERROR: Expected 2048.00000000000000000000000, got 2047.99999999999977262632456\nERROR: Expected 0.12500000000000000000000, got 0.12499999999999998612221\n\n\nCan anyone explain the differences? I know that inherently, floating point calculations are not exact, but for these specific values, I would expect the function to produce the same result regardless of rounding mode.\n\n\n\nI investigated this some more and found that the real issue is not how pow is implemented but rather that x86 and x64 hardware are different as Hans Passant suggested."
]
| [
"c++",
"visual-studio"
]
|
[
"NSNotification not working from another class",
"Part of an app I'm working on involves putting a blank screen over the current content if the user becomes inactive. As such after x seconds a blank page view controller is opened:\n\n(From within ViewController.m and triggered by detecting an NSNotification from ScreenBlank.m)\n\nUIPageViewController *blankPage = [self.storyboard instantiateViewControllerWithIdentifier:@\"BlankPageViewController\"];\n[self presentViewController:blankPage animated:YES completion:nil];\n\n\nThis blank screen is then removed when a user touches the screen (And thus confirms their activity), like so:\n\n(From inside the touchesBegan callback of ViewController.m)\n\n[self dismissViewControllerAnimated:YES completion:nil];\n\n\nThe problem I'm having, is that I now want to trigger removing this screen blanking elsewhere, such as when the user logs out. This is done by removing a card from a plugged in card-reader, and means that it is called from a separate class (And one that is instantiated from within ActionMgr.m).\n\nThe class in question (CardWatcher) is created like so:\n\nCardWatcher *newInstance = [[CardWatcher alloc] init];\n[newInstance StartCardChecker];\n\n\nAnd that instance of CardWatcher issues a notification when the card is removed, like so:\n\n[[NSNotificationCenter defaultCenter] postNotificationName:@\"logout\" object:nil];\n\n\nThis notification is then listened for in ViewController, and on being triggered, executes EXACTLY the same code as is used to blank the screenearlier:\n\n[self dismissViewControllerAnimated:YES completion:nil];\n\n\nBy using logging, I have determined that the notification is being received fine, and is executing the dismissViewControllerAnimated code, but for some reason, said code is not actually dismissing the view controller.\n\nThe only reason I can think of, is that it is (In the long run) called form within an instance of a class, but even then it's being passed via an NSNotification, and so in my eyes its source should be irrelevant?\n\nAny help would be much appreciated!"
]
| [
"ios",
"objective-c",
"xcode"
]
|
[
"How do I escape closing '/' in HTML tags in JSON with Python?",
"Note: This question is very close to Embedding JSON objects in script tags, but the responses to that question provides what I already know (that in JSON / == \\/). I want to know how to do that escaping.\n\nThe HTML spec prohibits closed HTML tags anywhere within a <script> element. So, this causes parse errors:\n\n<script>\nvar assets = [{\n \"asset_created\": null, \n \"asset_id\": \"575155948f7d4c4ebccb02d4e8f84d2f\", \n \"body\": \"<script></script>\"\n}];\n</script>\n\n\nIn my case, I'm generating the invalid situation by rendering a JSON string inside a Django template, i.e.:\n\n<script>\nvar assets = {{ json_string }};\n</script>\n\n\nI know that JSON parses \\/ the same as /, so if I can just escape my closing HTML tags in the JSON string, I'll be good. But, I'm not sure of the best way to do this.\n\nMy naive approach would just be this:\n\njson_string = '[{\"asset_created\": null, \"asset_id\": \"575155948f7d4c4ebccb02d4e8f84d2f\", \"body\": \"<script></script>\"}]'\nescaped_json_string = json_string.replace('</', r'<\\/')\n\n\nIs there a better way? Or any gotchas that I'm overlooking?"
]
| [
"python",
"html",
"django",
"escaping"
]
|
[
"Update a column of a row on an insert trigger, the trigger is in the same table of which row is being edited",
"I have generated 2 Tables:\n\nAssociates: (Associate_ID, Name(Varchar) Number(Varchar) )\nAssociate_Number: (AssociateNumberId, Number(Varchar) )\n\n\nI want to Increment the value of Number column in Associate_Number Table.\nI want to update the Number column in the Associates Table with the incremented value of Number in the Associate_Number table.\n\nI am using an after insert trigger in the Associates table to achieve it.\n\nUPDATE Ascociate_Number SET Number = (NUMBER + 1) WHERE AssociateNumberID = 1;\n\nUPDATE Ascociates SET NEW.Number = (SELECT Number FROM Associate_Number WHERE AssociteNumberID = 1) WHERE AssociateNumberID = 1;\n\nERROR CODE 1442 occurs while executing this statement i know that using an auto increment column can do this but i want to do it in this manner.\n\nPlease help.\n\nThank you for taking time to read."
]
| [
"mysql",
"triggers",
"phpmyadmin"
]
|
[
"How to modify the elements of an anonymous list within a for loop?",
"Is it possible to loop over a list that I define within the for statement and modify the original elements of that list or do I need a name / handle for that list to access its values by an index? I am aware of the alternatives that exist for lists with a variable name.\n\nThe following code does not alter a, b and c.\n\n# in each iteration, this assigns item to the value behind a, b, or c\nfor item in [a, b, c]: \n # this reassigns item to a new value, but there is no reference to a, b, or c \n # (which I would like to have).\n item = some_function(item) \n\n\nSimplified example (realistic example at the end):\n\na = 1\nb = 3\nc = 7\n\nfor item in [a, b, c]:\n item = item + 1\n\nprint(\"a: {}; b: {}; c: {}\".format(a,b,c))\n\n\nOutput:\n\na: 1; b: 3; c: 7\n\n\nDesired output:\n\na: 2; b: 4; c: 8\n\n\nIn my actual use case, a, b and c are numpy arrays and I want to clip their values like this:\n\nfor gradient in [a, b, c]:\n gradient = np.clip(gradient, -max_value, max_value)\n\n\nConclusion / Answer\n\nThanks to the valuable input from bruno desthuilliers, I can now answer this question myself and add some explanations:\n\n\nThe assignment operator only reassigns the loop variable to some new value and that does not alter the elements in the original list. There is a great article on how names / variables and assignments work in Python and I can strongly recommend it: Facts and myths about Python names and values.\nIn order to modify the original items in the list (either have them point to some new data or modify their data), one must either rely on methods that operate on the data in-place or hope for specific methods provided by the type of entry in the list (see this helpful example from cricket_007).\nIn my specific use case, I found the final solution in an optional out argument of the numpy.clip method:\n\nfor gradient in [a, b, c]:\n np.clip(gradient, -max_value, max_value, out=gradient)\n\n\nHowever, the provided answers below, based on map() or list comprehension, are more universal.\n\n\nThank you very much for your help."
]
| [
"python"
]
|
[
"How to overlay a bitmap over another",
"I have tried the solution suggested here Android: How to overlay-a-bitmap/draw-over a bitmap?. I seems to work but I obtained a slightly disoriented image from it.\n\nbefore-overlay\n\nafter-overlay\n\n\n\n\nI have set my edit icon to toggle between start and stop drawing on canvas. When the user stops drawing, I retrieve the canvas bitmap and the imageView and overlay canvas bitmap on the imageView.\nAs can be seen from the screenshots, the imageView is the laptop image and canvas bitmap is the up arrow I drew.\nHere is my overlay function.\n\nprivate Bitmap overlay(Bitmap bmp1, Bitmap bmp2) {\n Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig());\n Canvas canvas = new Canvas(bmOverlay);\n canvas.drawBitmap(bmp1, new Matrix(), null);\n canvas.drawBitmap(bmp2, new Matrix(), null);\n return bmOverlay;\n }\n\n\nI am new to android and would appreciate some help in this regard.\nThanks!"
]
| [
"android",
"android-canvas",
"android-bitmap"
]
|
[
"I need to ask my web site's user a Yes/ No question. in javaScript",
"I need to ask my web site's user a Yes/ No question. Currently I use JavaScript's confirm() function.\nThe return value is true (OK) or false (CANCEL).\nThe word CANCEL is misleading. I want to have the buttons say Yes/ No instead.\nHow can I do it? i m using php..Code should run on both IE & Firefox"
]
| [
"javascript",
"dialog"
]
|
[
"Is it safe to \"initialize\" an object of type T with *this = T() in a constructor of T?",
"Is the constructor Year() safe in this case ?\n\nstruct Year {\n int year;\n Year(int y) : year(y) {}\n Year() { *this = Year(1970); } // *this = this->operator=(Year(1970));\n};\n\nYear y;\n\n\nI think yes, because year has already been initialized with int() once the execution flows reaches the constructor body. Are there other problems to consider?\n\nDon't consider other cases in which the same trick might cause troubles."
]
| [
"c++"
]
|
[
"Apply Javascript to certain html list ul's only",
"so I have the code below and I dont want it to be applied to all ul's, just the ones in a certain div. How can I do that? (The line I am talking about is the one where it says: carousel = $(\"ul\");)\n\nvar carousel;\n$(document).ready(function () {\n carousel = $(\"ul\");\n carousel.itemslide(\n {\n\n start: 1,\n swipe_out: true,\n }\n\n\n );\n});"
]
| [
"javascript",
"html",
"html-lists"
]
|
[
"Reading UTF-8 .properties files in Java 1.5?",
"I have a project where everything is in UTF-8. I was using the Properties.load(Reader) method to read properties files in this encoding. But now, I need to make the project compatible with Java 1.5, and the mentioned method doesn't exist in Java 1.5. There is only a load method that takes an InputStream as a parameter, which is assumed to be in ISO-8859-1.\n\nIs there any simple way to make my project 1.5-compatible without having to change all the .properties files to ISO-8859-1? I don't really want to have a mix of encodings in my project (encodings are already a time sink one at a time, let alone when you mix them) or change all my project to ISO-8859-1.\n\nWith \"a simple way\" I mean \"without creating a custom Properties class from scratch\"."
]
| [
"java",
"file",
"utf-8",
"properties"
]
|
[
"Spring - changing Content-type HTTP header",
"I am communicating with a JSON API using Robospice. This is how I set the headers for a POST request:\n\nmHttpHeaders = new HttpHeaders();\nmHttpHeaders.add(\"Content-Type\", \"application/json\");\nLog.d(Global.TAG, mHttpHeaders.toString());\n\n\nThe problem is that I get a header which looks like that: {Content-Type=[application/json]} where I need to send Content-Type:application/json (which seems to be the only header that my server accepts). I can't find any way to change it (tried with both add() and setContentType() methods), how do I do that?"
]
| [
"java",
"android",
"json",
"spring"
]
|
[
"Python: Override default SIGTERM handler",
"I am sending SIGTERM signal to my server via start-stop-daemon. As expected the server shuts down when signal is received. Now I want to halt my server for 10 sec after receiving SIGTERM and then shut it down. To achieve this I wrote\n\ndef sigterm_handler(signum):\n time.sleep(10)\n sys.exit(0) \n\nClass server(object):\n .\n .\n\n def __call__()\n signal.signal(signal.SIGTERM, sigterm_handler)\n #some code\n\n .\n .\n\n\nNow the server never waits for 10 secs after receiving signal. As soon as the signal is send, it shuts down (checked in loggers). \n\nAlso the following message halts for 10 secs on my terminal. \n\n* Stopping Server:\n\n\nI think my code is not able to tell python that the signal is being handled and so, the default handler is also being called along with my handler. Any idea what needs to be done?"
]
| [
"python",
"signals",
"sigterm"
]
|
[
"How to remove splash screen at all, so that game loads at once ? Cocos2d + SpriteBuilder",
"I have my problem still unsolved Splash screen is landscape although the whole game is in the portrait mode. SpriteBuilder + cocos2d , so I see only one way. \n\nHow to remove splash screen at all, so that game loads at once ?"
]
| [
"objective-c",
"xcode",
"cocos2d-iphone",
"splash-screen",
"spritebuilder"
]
|
[
"How to set color on string",
"I want to set color just on \"read more\" string :\n\n holder.Title.setText(current.getTitle());\n holder.Description.setText(start+\"....\"+\"read more\");\n holder.Date.setText(current.getPubDate());\n\n\nI have tried to use html.fromhtml but it is not working with me !!!"
]
| [
"android",
"android-studio"
]
|
[
"How can I update constraints of the content of StackView? Will I have to Unembed first?",
"I have added four labels in an StackView. And now I want to provide them specific constraints via Storyboards. I tried but I was not able to make any change but when I first Unembed the Stackview, and set the constraints like Height and Width and then Added them in Stackview, their constraints preserved. So my question is can we update the constraints of the content of StackView without unembeding?"
]
| [
"ios",
"autolayout",
"storyboard",
"ios9",
"uistackview"
]
|
[
"Interprocess communication in Python",
"What is a good way to communicate between two separate Python runtimes? Thing's I've tried:\n\n\nreading/writing on named pipes e.g. os.mkfifo (feels hacky)\ndbus services (worked on desktop, but too heavyweight for headless)\nsockets (seems too low-level, surely there's a higher level module to use?)\n\n\nMy basic requirement is to be able to run python listen.py and have that process just doing it's thing there, like a daemon, able to receive messages from python client.py --bar. The client call should just send a message to the existing process and terminate, with return code 0 for success or nonzero for failure (i.e. some two-way communication will be required)"
]
| [
"python",
"sockets",
"pipe",
"ipc"
]
|
[
"how to grow admob income",
"I'm developping an App by my own (android only) and after 1 month on google play i grew the daily active users base from 100 to around 300 users.\n\nThe user avarage engagement kept around 15 minutes/day (those data come from firebase dashboard)\n\nBut on last days my admob revenue reduced to lower than half\n\nI have 2 adunits in this app: 1 for a banner, 1 for video reward\n\nDuring the whole month the banner got around 0.25 and video reward around 1.90USD RPM\n\nall this changed to 0.11 and 1.11USD RPM respectivelly\n\nAlthough the user growing happened slowly during the month... the admob revenue dropped at once, from one day to another\n\n\nThere was absolutelly no change in app that could explain this, the only thing that happened was I added some in-app products (and made few sales) and I connected the admob app with the play store link (I still dont know what is the point of that the only change i saw was the admob page now shows the icon of my app)\n\nI sent some support requests to several google products all of them came with very stupid and generic responses most of all suggesting i should run an ad campaing to grow my user base\n\nI was able to grew the user base during the month thanks to an ad campaing (ran out of google companies)\n\nI made one spreadsheet with data from admob and firebase if someone can look the data and give me some insights\n\nhttps://www.dropbox.com/s/ta8m2kfyxs0wcbx/problema.xlsx?dl=0\n\nI really need help, on top of my mind the only thing I can think about this problem is like google has some kind of \"special support\" to micro apps in order to motivate them keep developing, once i reached the score to be classified as \"small app\" google removed any benefit or even injected some dificulties in order to force me use their services to keep growing"
]
| [
"android",
"admob",
"google-admob"
]
|
[
"How to calculate the amount of overlap between images?",
"How to calculate the amount of overlap between images? I'm stitching two images and I need to know the minimum overlap that is enough to stitch the two images I need to calculate the overlap between images. I use the Python language."
]
| [
"python",
"arrays",
"image-processing"
]
|
[
"Reading files from ZIP without extracting to disk",
"Is it possible to open a ZIP file on a server, read a file from its content and display it / send it to a client directly without extracting it to disk first ? I am talking about pdf's and images. Haven't found any hints in the php sites."
]
| [
"php",
"zip"
]
|
[
"OCaml parser for :: case",
"I'm having trouble with associativity. For some reason my = operator has higher precedence than my :: operator \n\nSo for instance, if I have \n\n\n \"1::[] = []\"\n\n\nin as a string, I would get \n\n\n 1 = []::[]\n\n\nas my expression instead of\n\n\n [1] = []\n\n\nIf my string is \"1::2::[] = []\"\n\nI thought I it would parse it into exp1 EQ exp2, then from then on it will parse exp1 and exp2. But it is parsing as exp1 COLONCOLON exp2 instead \n\n.\n.\n.\n\n%nonassoc LET FUN IF\n%left OR\n%left AND\n%left EQ NE LT LE\n%right SEMI COLONCOLON\n%left PLUS MINUS\n%left MUL DIV\n%left APP\n\n.\n.\n.\n\nexp4:\n | exp4 EQ exp9 { Bin ($1,Eq,$3) }\n | exp4 NE exp9 { Bin ($1,Ne,$3) }\n | exp4 LT exp9 { Bin ($1,Lt,$3) }\n | exp4 LE exp9 { Bin ($1,Le,$3) }\n | exp9 { $1 }\n\nexp9:\n | exp COLONCOLON exp9 { Bin ($1,Cons,$3) }\n | inner { $1 }\n\n.\n.\n."
]
| [
"ocaml",
"yacc",
"ocamlyacc"
]
|
[
"How to use the find -exec command to create background processes and wait for them?",
"I have a main bash script which is supposed to start another bash script with different inputs as background processes and then wait for it. For this I'm using find dir_path -exec bash -c '. another_batchscript.sh {} $0' ${second_input} \\; (similar to here), and then I have a wait command in my main script. The problem is that this script is almost immediately finished.\nI thought about it and realized that when I execute sleep 10 & from the command line, I can find the job with executing the jobs command. But when I execute bash -c 'sleep 10 &' then jobs won't find it. This is probably why the wait command doesn't block in my main bash script.\nWhy does this happen and how do I have to change my command in the main batch script to solve my problem?"
]
| [
"bash",
"find",
"exec",
"background-process"
]
|
[
"Correct way of adding EmbedBlock into StreamField via code?",
"I have a Page model with a StreamField:\nfrom wagtail.core.fields import StreamField\nfrom wagtail.embeds.blocks import EmbedBlock\n\nclass SomeModel(Page):\n stream_field = StreamField(\n [\n ("embed", EmbedBlock()),\n ]\n )\n\nI would like to create a new SomeModel instance via code and populate the stream_field with an embed value. E.g.\nfrom wagtail.embeds.blocks import EmbedValue\n\nsome_model_instance = SomeModel()\n\nembed_url = "https://youtube.com/something"\n\nembed_value = EmbedValue(embed_url)\n\nembed_block = ("embed", embed_value)\n\nsome_model_instance.stream_field.append(embed_block)\n\nsome_model_instance.save()\n\nThe above code pattern works without error, but when I view the content in the Wagtail Admin UI the field is empty (as if nothing was provided).\nHow can I add content to a Wagtail StreamField EmbedBlock via code?"
]
| [
"wagtail",
"wagtail-streamfield"
]
|
[
"iframe overlapping Jquery fancybox",
"I am displaying image pop-up using Jquery fancybox and in the webpage there is an VIMEO video embedded using iframe. The image get display correctly in most of the browser but when I test in iPhone 4 and Samsung Galaxy S2, the video overlays the pop-up image.\n\nI tried with \"wmode=transperant\".\n\nI search a lot in google but no proper answer. Please help."
]
| [
"jquery",
"iframe",
"mobile",
"fancybox"
]
|
[
"Is there any difference, whether a struct declared in the 'extern \"C\"' block or not?",
"Let's say, I have the header file:\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct S\n{\n int i;\n double d;\n // etc\n};\n\n// Or start the 'extern \"C\"' block here?..\n\nvoid f(A* a);\n\n#ifdef __cplusplus\n}\n#endif\n\n\nIt should be used by C/C++ sources.\n\nMy question is: if I carry the struct A declaration out of the extern \"C\", whether this code will be compatible with a library which was built with the struct A declared as extern \"C\"?\n\nThat is, we built a library with the header as it is presented above, then we moved the extern \"C\" to the position marked by the corresponding comment line and, finally, we are trying to build a C++ application using the resulting header.\n\nIf all of this will be successful? In other words, if the extern \"C\" influence on a struct declaration?\n\nWhether it depends what language (C/C++) the library is written on?"
]
| [
"c++",
"c"
]
|
[
"How to find field's value whose equal any value in array",
"I have an array whose contain some ID : \n\n[\"4007fa1c-4e27-4d2e-9429-f3631171760c\",\n\"a21649a3-1a64-45cf-b92a-e899a7ef4742\",\n\"1903a571-b166-4f93-9c1c-93dc66067a49\", \n\"2845d278-5ec4-45e9-ab9c-999178332c73\",\n\"4e3ed481-a3d9-4689-8873-5c912668b26f\",\n\"390e89fd-d680-4264-8806-8295b361d2f1\"]\n\n\nI would like thanks to this array, find all the posts having for \"OriginID\", one of the Ids present in the table.\n\nI've started something like that, but I don't know how to complete to make work this code.\n\ncurs, _ = r.Table(\"posts\").\n Filter(r.Row.Field(\"Validated\").Eq(false)).\nFilter(func(customer r.Term) interface{}{\n for _, id := range listOriginID {\n //I don't know how to finish\n }\n})\n\n\nThank you for your help"
]
| [
"go",
"rethinkdb"
]
|
[
"Matplotlib: How to combine scatter and line plot to one legend entry",
"I draw my data points with ax.scatter() and connect the data points with a fit using ax.plot(). \n\nHow do I create a common entry in the legend that combines the marker for the data point with the line of the fit? I want to get a legend entry as I would get it for ax.plot(x, y, '-o', label = 'abc').\n\nI have created the following minimal example:\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nx_scatter = np.linspace(0,10,10)\nx_line = np.linspace(0,10,100)\n\nfig, ax = plt.subplots()\n\nfor i in range(5):\n ax.scatter(x_scatter, np.sin(x_scatter) + i, label = i)\n ax.plot(x_line, np.sin(x_line)+i)\n\nplt.legend(loc='best')\nplt.show()"
]
| [
"python",
"matplotlib",
"legend"
]
|
[
"Create Source Control System on NAS Drive",
"i'd like to create a source control system running on a NAS Drive. As a Windows User, I've never been able to get Microsoft Visual Source Safe to work on previous NAS Drives, as internally most of them seem to use Linux rather than Windows. I always got a security denied error message.\n\nShould most NAS Drives be able to host a source control system. I'm presuming that possiblly i should have tried to install subversion rather than visual source safe?\nOr ideally i'd like to use Microsoft Team Foundation Server. \n\nShould i be looking for a NAS Drive with NTFS? Is there any that someone can recommend?\nAlso will there be a performance issue?\n\nregards\n\nKojo"
]
| [
"visual-studio-2010",
"svn",
"tfs",
"visual-sourcesafe",
"nas"
]
|
[
"How to use ssml tags in textToSpeech for iOS and Android?",
"I use @ionic-native/text-to-speech for text to speech in my app. Ionic uses this plugin: https://github.com/vilic/cordova-plugin-tts\n\nI want to use ssml tags in my text:\n\nconst options: any = {\n text: '<speak>I like <sub alias=\"pizza\">rotten eggs</sub></speak>',\n locale: 'en-US',\n rate: 1.0\n};\n\nthis.tts.speak(options)\n.then(() => {\n // do anything\n})\n.catch((error: any) => {\n // do anything\n});\n\n\n.\n\nThe problem:\n\nWith Google's text to speech it ignores the ssml tags. So, it speaks: \n\n\n I like rotten eggs.\n\n\nText to speech on iOS reads out everything: \n\n\n < speak >I like < sub alias=\"pizza\" >rotten eggs< /sub>< /speak>\n\n\nDoes someone know what do I have to change to get a correct pronounciation?"
]
| [
"android",
"ios",
"text-to-speech",
"google-text-to-speech"
]
|
[
"Crash while attempting to remove title bar",
"I have issues removing title bar, my app crashes on a Samsung Galaxy Ace Plus S7500. I tied different ways:\n\nFrom code\n\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n\n\nFrom xml\n\n android:theme=\"@android:style/Theme.NoTitleBar.Fullscreen\"\n\n\nMy device is running API 10."
]
| [
"java",
"android"
]
|
[
"Installing Docker into Vagrant VM failed",
"I'm using Vagrant and Docker and this problem occurred while i vagrant up my machine, it works fine before:\n\n==> default: Running provisioner: docker...\n default: Installing Docker (latest) onto machine...\nThe following SSH command responded with a non-zero exit status.\nVagrant assumes that this means the command failed!\n\ncurl -sSL https://get.docker.io/gpg | apt-key add -\n\nStdout from the command:\n\nStderr from the command:\n\nstdin: is not a tty\ncurl: (35) Unknown SSL protocol error in connection to get.docker.io:443\ngpg: no valid OpenPGP data found.\n\n\ndo you have any idea what caused this problem? or how to fix it?"
]
| [
"ssh",
"docker",
"vagrant"
]
|
[
"router_1.provideRouter is not a function when trying to run Angular2/NodeJS app",
"I have created a simple NodeJS/Angular2 application which is encountering the following error when I try and access the entry point page for the application:\n\nrouter_1.provideRouter is not a function\n\n\nI am unsure as to what this error means and have no idea where to start. Does anyone have any insight or idea as to why this may be happening? Here is my package.json file (as I am thinking it may be something to do with one of the Angular packages)\n\n{\n \"name\": \"udemy-nodejs-angular2\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"scripts\": {\n \"start\": \"concurrently tsc -w && nodemon ./bin/www\",\n \"vendor\": \"gulp vendor\",\n \"gulp\": \"npm run vendor && gulp\",\n \"postinstall\": \"typings install\",\n \"typings\": \"typings\"\n },\n \"dependencies\": {\n \"@angular/common\": \"^2.0.0-rc.2\",\n \"@angular/compiler\": \"^2.0.0-rc.2\",\n \"@angular/core\": \"^2.0.0-rc.2\",\n \"@angular/http\": \"2.0.0-rc.2\",\n \"@angular/platform-browser\": \"^2.0.0-rc.2\",\n \"@angular/platform-browser-dynamic\": \"^2.0.0-rc.2\",\n \"@angular/router\": \"3.0.0-beta.2\",\n \"@angular/upgrade\": \"2.0.0-rc.2\",\n \"body-parser\": \"~1.13.2\",\n \"cookie-parser\": \"~1.3.5\",\n \"debug\": \"~2.2.0\",\n \"es6-shim\": \"^0.35.0\",\n \"express\": \"~4.13.1\",\n \"hbs\": \"~3.1.0\",\n \"morgan\": \"~1.6.1\",\n \"reflect-metadata\": \"^0.1.3\",\n \"rxjs\": \"^5.0.0-beta.6\",\n \"serve-favicon\": \"~2.3.0\",\n \"systemjs\": \"0.19.27\",\n \"zone.js\": \"^0.6.12\"\n },\n \"devDependencies\": {\n \"concurrently\": \"^2.2.0\",\n \"gulp\": \"^3.9.0\",\n \"gulp-sourcemaps\": \"^1.6.0\",\n \"gulp-typescript\": \"^2.10.0\",\n \"nodemon\": \"^1.9.2\",\n \"typings\": \"^0.8.1\"\n }\n}\n\n\nand my SystemJS config:\n\n// map tells the System loader where to look for things\nvar map = {\n 'app': 'js/app', // 'dist',\n 'rxjs': 'js/vendor/rxjs',\n '@angular': 'js/vendor/@angular'\n};\n\n// packages tells the System loader how to load when no filename and/or no extension\nvar packages = {\n 'app': {main: 'boot.js', defaultExtension: 'js'},\n 'rxjs': {defaultExtension: 'js'}\n};\n\nvar packageNames = [\n '@angular/common',\n '@angular/compiler',\n '@angular/core',\n '@angular/http',\n '@angular/platform-browser',\n '@angular/platform-browser-dynamic',\n '@angular/router',\n '@angular/testing',\n '@angular/upgrade'\n];\n\n// add package entries for angular packages in the form '@angular/common': { main: 'index.js', defaultExtension: 'js' }\npackageNames.forEach(function (pkgName) {\n packages[pkgName] = {main: 'index.js', defaultExtension: 'js'};\n});\n\nvar config = {\n map: map,\n packages: packages\n};\n\nSystem.config(config);\n\n\nHere are the places I am using the router functionality:\n\napp.routes.ts\n\nimport {provideRouter, RouterConfig} from '@angular/router';\n\nimport {LoginComponent} from \"./components/login/login.component\";\nimport {DashboardComponent} from \"./components/dashboard/dashboard.component\";\n\n\nexport const routes: RouterConfig = [\n { path: 'login', component: LoginComponent },\n { path: 'dashboard', component: DashboardComponent }\n];\n\nexport const APP_ROUTER_PROVIDERS = [\n provideRouter(routes)\n];\n\n\nboot.ts:\n\nimport {bootstrap} from '@angular/platform-browser-dynamic';\n\nimport {AppComponent} from \"./app.component\";\n\nimport { APP_ROUTER_PROVIDERS } from './app.routes';\n\nbootstrap(AppComponent, [\n APP_ROUTER_PROVIDERS\n])\n.catch(err => console.error(err));\n\n\napp.component.ts\n\nimport { Component } from '@angular/core';\nimport { ROUTER_DIRECTIVES } from '@angular/router';\n\n@Component({\n moduleId: module.id,\n selector: 'my-app',\n templateUrl: 'app.template.html',\n directives: [\n ROUTER_DIRECTIVES\n ]\n})\n\nexport class AppComponent {\n\n}\n\n\nThanks"
]
| [
"node.js",
"typescript",
"angular"
]
|
[
"php 5.6.11 xampp xml worse formatted",
"Today, I work with Zend 6.3 community edition. This version include PHP Version 5.5.7.\nI use php and mySQL to load data inside Adobe Air application by httpService with e4x result.\nAs I work with french language I had to manage characters with french accent.\nToday, I use this function \n\nfunction htmlPHP54($string) {\n return htmlspecialchars($string, ENT_QUOTES,'ISO-8859-1'); \n}\n\n\nTherefore each time I need to generate my xml file, I do something like that:\n\n$return = \"<rootsPHP>\";\n$return.=\"<name>\".htmlPHP54($row_recordset['name']).\"</name >\";\n\n$return. = \"</rootsPHP>\";\n\n\nThis method works well with Zend 6.3 and PHP 5.5.7\n\nBut today with Xammp (php 5.6.1), an error appears:\n\n\n Error #1088: The markup in the document following the root element must be ... in the document follwing the root element must be well-formed”.\n\n\nIn fact when I try to open result file inside browser, the same error appear.\n\nSo I need help to solve that. What parameter must be changed inside php.ini or my.cnf?"
]
| [
"php",
"xml",
"actionscript-3",
"e4x"
]
|
[
"Are data properties dangerous?",
"Use the following simple example:\n\nvar MyObject = {\n name: '',\n object_id: '',\n awesomeFunction: function() { console.log('awesome'); }\n};\n\n\nNow, this is fine until I think about prototypal inheritance. Say i now want to inherit from this object:\n\n var child_object = Object.create(MyObject);\n\n\nThis instantly causes problems because the child object has not specified the name and object_id properties which will therefore be taken from the parent object (prototype). And there is no native way to enforce that child objects are created with their own versions of these, right?\n\nIs this understanding correct?\n\nIf so, am i thinking about inheritance in javascript incorrectly?\n\nShould objects be treated as containers for functions instead?"
]
| [
"javascript",
"inheritance",
"prototypal-inheritance"
]
|
[
"Snap to nearest street",
"You guys have been helping out solving some of my problems with a Google Map lately, and thank you for that.\n\nI am almost done with this - only one problem is left. When I place the first marker on the map, it snaps to the nearest street (which is fine!) but when I drag the first marker to another place, directions suddenly mess up. And the markers get mixes.\n\nYou can see an example on http://dev.korebogen.dk/gmap/ \n\nI need to make it possible to move the first marker (still snapping) and when I place the second marker, the directions first load. But in order to make the first marker snap again, I have to load the directions. \n\nI hope some of you have a solution. Thanks in advance."
]
| [
"google-maps",
"driving-directions"
]
|
[
"MSSQL CTE tree with filter how to?",
"There's a table that describes object hierarchy and their type:\n\nDECLARE @TTable TABLE\n(\n ID int\n ,Higher int -- for some reason this is how ID_PARENT named\n ,[Type] int\n)\n\n\nI need to select a subtree with branches only containing nodes of certain [Type]. Since I'm a beginner at SQL generally and CTE I did this by first finding all the branches that contain objects of certain type from bottom to top:\n\n;WITH c\nAS\n(\nSELECT \n ID\n ,Higher\n ,[Type]\nFROM\n dbo.EnObj\nWHERE Type = 40\n\nUNION ALL\n\nSELECT\n t.ID\n ,t.Higher\n ,t.Type\nFROM\n dbo.EnObj T\nINNER JOIN c ON t.ID = c.Higher\n)\n\n\nThen chose unique records into a table variable:\n\nINSERT @TTable\nSELECT DISTINCT\nc.ID\n,c.Higher\n,c.Type\n,c.Name\n,c.Voltage\nFROM c\n\n\nAnd then built an hierarchy by CTE with sorting from top to bottom:\n\n;WITH CTE AS (\n SELECT\n ID\n ,Higher\n ,[Type]\n,CAST(ID AS VARCHAR(128)) AS Sort\nFROM \n @TTable\nWHERE\n Higher IS NULL\nUNION ALL\nSELECT\n N.ID\n ,N.Higher\n ,N.[Type]\n ,CAST(P.Sort + '/' + CAST(N.ID AS VARCHAR) AS VARCHAR(128))\nFROM \n @TTable N\nINNER JOIN CTE AS P ON P.ID = N.Higher\n)\nSELECT \n ID\n ,Higher\n ,[Type]\n ,Sort\nFROM CTE \nORDER BY Sort\n\n\nIt works, but I wonder if there's a way to optimize this query, like using one CTE instead of two or have a filter in CTE."
]
| [
"sql-server",
"filter",
"tree",
"common-table-expression"
]
|
[
"Is there a Kotlin equivalent `object` in Swift?",
"In Kotlin we can compose a Singleton object using\nobject MySingleton {\n // Some static variable.\n}\n\nwithout need to have a class and control its constructor to be private etc.\nI try to search if there's equivalent Object in Swift language I can leverage, or I need to do my own Singleton class instance (e.g. private init() and static)?"
]
| [
"swift",
"kotlin"
]
|
[
"Updating your edmx to reflect changes made in your db (.net linq-to-entities)",
"So I have my edmx made. \nThen I change my database a little bit, changing a column to from being a NOT NULL to allowing NULL.\nI go into my edmx, right click and choose \"Update Model from Database\"\n\n\nNow I go into my program and it hasnt actually updated... I can't put a null in the column. What do I have to do to update the edmx properly? Thank you."
]
| [
"linq",
"entity-framework",
".net-3.5",
"linq-to-entities"
]
|
[
"How to map a Gmail label into iOS Mail inbox",
"The label:important on Gmail works pretty well for me. I have multiple Gmail accounts and wish only to see the label:important in the main unified iOS Mail.app inbox. Is there any way to do this? I don't see other email services replicating the ability of labeling important messages well.\nI do have a unified email inbox via smartfolders on macOS Mail.app, but there's no direct way to export this to the iOS Mail.app. You can use smart inboxes in iOS, but there's no way to feed these into a unified inbox."
]
| [
"ios",
"email",
"gmail-imap"
]
|
[
"JavaScript conversion to Float32Array and back for WebGL readPixels",
"I am storing id (which is a value comprised in 24bit-range) into an Float32Array(3) for latter retrieval in WebGL:\n\nvar r = 0, \n g = 0, \n b = id;\nif (b >= 65536) { \n r = ~~(b / 65536);\n b -= r * 65536; \n}\nif (b >= 256) { \n g = ~~(b / 256); \n b -= g * 256;\n}\nvar fa = new Float32Array([r/255, g/255, b/255]);\n\n\nFor the sake of completeness, here is how i am using that value:\n\ngl.uniform3fv(uniforms['u_id'], fa);\n\n\n...and this is how i get my id back from WebGLRenderingContext.readPixels():\n\nvar result = new Uint8Array(4);\ngl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, result);\nvar id = result[0] << 16 | result[1] << 8 | result[2];\n\n\nWhich is the correct way to split that value into my Float32Array? I strongly believe that such task could be accomplished in a more efficient and elegant way (actually, what i am doing is working but is really hurting my eyes)."
]
| [
"javascript",
"bit-manipulation",
"bit-shift",
"typed-arrays"
]
|
[
"Set tabSelectedTextColor for TabLayout using selector",
"Following codes work because I added the tabSelectedTextColor attribute directly and selected text color will be white.\n\n<android.support.design.widget.TabLayout\n ...\n app:tabSelectedTextColor=\"@color/white\"\n app:tabTextColor=\"@color/tab_layout\"/>\n\n\nBut following codes don't work and I don't know why, maybe it is a bug!\n\n<android.support.design.widget.TabLayout\n ...\n app:tabTextColor=\"@color/tab_layout\"/>\n\n\n@color/tab_layout\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <!-- Selected state defined so it's better to use it -->\n <item android:color=\"@color/white\" android:state_selected=\"true\"/>\n <item android:color=\"@color/white\" android:state_focused=\"true\"/>\n <item android:color=\"@color/white\" android:state_pressed=\"true\"/>\n <item android:color=\"#CCFFFFFF\"/>\n</selector>\n\n\nNote: #CCFFFFFF color works so it means, the view gets the tabTextColor attribute value correctly but doesn't recognize the android:state_selected item. I tested all rational states but nothing worked.\n\nTabLayout.class\n\nFollowing codes copied from TabLayout.class and everything is clear. Don't you think getting selected text color from the selector is better way? If it is, please report it.\n\nif(a.hasValue(styleable.TabLayout_tabSelectedTextColor)) {\n int selected = a.getColor(styleable.TabLayout_tabSelectedTextColor, 0);\n this.mTabTextColors = createColorStateList(this.mTabTextColors.getDefaultColor(), selected);\n}"
]
| [
"android",
"android-selector"
]
|
[
"Visual Studio 2013 crash on first launch",
"I installed VS2015 then I uninstalled it and re-intalled vs2013. I have tried all solutions:\n\n\nOpened the program in safe mode\nReset settings\nRe-installed the program\n\n\nPlease assist, I need to work in VS2013."
]
| [
"visual-studio",
"visual-studio-2013"
]
|
[
"tt_news - where is the register \"newsMoreLink\" be defined?",
"The extension tt_news is very useful for me but there is this little thingy called \"register:newsMoreLink\". This register does contain the singlePid of the contentelement (defined a single view page) and the uid of the newsarticle from the news extension. \n\nThis is the typoscript section of the \"new ts\" of the extension tt_news\nAs you can see there is \"append.data = register:newsMoreLink\"...\n\nplugin.tt_news {\ndisplayLatest {\nsubheader_stdWrap {\n# the \"more\" link is directly appended to the subheader\n append = TEXT\n append.data = register:newsMoreLink\n append.wrap = <span class=\"news-list-morelink\">|</span>\n # display the \"more\" link only if the field bodytext contains something\n append.if.isTrue.field = bodytext\n outerWrap = <p>|</p>\n}\n}\n}\n\n\nWhat is \"register:newsMoreLink\"? Is this like a function or something? I do not know. But \"register:newsMoreLink\" produces a strange link if I use this on \"append.data\". It produces are \"More >\" link. The \"More >\" link after a news article teaser looks like this: \n\n\n http://192.168.1.29/website/index.php?id=474&tx_ttnews%5Btt_news%5D=24&cHash=95d80a09fb9cbade7e934cda5e14e00a\n\n\n474 is the \"singlePid\" (this is what it calls in the database\n24 is the \"uid\" of the news article (the ones you create with the tt_news plugin in the backend)\n\nMy question is: Where is the \"register:newsMoreLink\" defined? Is it defined generally or do I miss a fact of Typo3..? How can I add an anchor link at the end of this \"More >\" href? Like: \n\n\n http://192.168.1.29/website/index.php?id=474&tx_ttnews%5Btt_news%5D=24&cHash=95d80a09fb9cbade7e934cda5e14e00a#myAnchor1"
]
| [
"function",
"typo3",
"typoscript",
"tt-news"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.