texts
sequence | tags
sequence |
---|---|
[
"Using And,Or in a sql for multiple results",
"I have a textbox and 3 dropdown boxes with an item that could be selected in each of the dropdowns. There are two filtering scenarios I want to be able to achieve. \n\n\nGetting a filtering result after typing a value in the textbox and select values in the next two textboxes leaving out the last one.\nGetting a filtering after typing a value in the textbox and select values in the other three dropdown boxes to filter out the result. My code below can only produce each of the results one at a time If I change the \"and\" to \"or\" and the \"or\"s to \"and\"s. Can anyone help with modification or new query to be able to achieve the two scenarios?\n\n\n\n\nCREATE PROC Spsearchproduct @searchWord1OnMasterPage NVARCHAR (50),\n @searchWord2OnMasterPage NVARCHAR (50),\n @searchWord3OnMasterPage NVARCHAR (50),\n @searchWord4OnMasterPage NVARCHAR (50)\nAS\n BEGIN\n SELECT product.NAME,\n price,\n seller,\n productstreetno.strno,\n productstreet.streetname\n FROM product\n INNER JOIN productstreetno\n ON product.streetnoid = productstreetno.idstreetno\n INNER JOIN productstreet\n ON product.streetid = productstreet.idstreet\n INNER JOIN productstate\n ON stateid = productstate.idstate\n INNER JOIN productcity\n ON cityid = productcity.idcity\n WHERE product.NAME LIKE '%' + @searchWord1OnMasterPage + '%'\n AND productstate.statename LIKE '%' + @searchWord2OnMasterPage + '%'\n AND ( ( productcity.cityname LIKE '%' + @searchWord3OnMasterPage + '%' )\n OR ( productstreet.streetname LIKE '%' + @searchWord4OnMasterPage + '%' )\n OR ( productstreet.streetname IS NULL ) )\n AND ( ( productcity.cityname LIKE '%' + @searchWord3OnMasterPage + '%' )\n OR ( productstreet.streetname LIKE '%' + @searchWord4OnMasterPage + '%' )\n OR ( productstreet.streetname IS NULL ) )\n END"
] | [
"sql-server",
"tsql",
"stored-procedures",
"where"
] |
[
"Problem with linking against libexpat in Boost Build - for building graphml",
"On my system, expat is located at\n\n\n/usr/include/expat.h\n/usr/include/expat_external.h\n/usr/lib/libexpat.1.5.0.dylib\n/usr/lib/libexpat.1.dylib\n/usr/lib/libexpat.dylib\n/usr/lib/libexpat.la\n\n\nSo I export the required variables for boost to build graphml \n\n\nexport EXPAT_INCLUDE=/usr/include\nexport EXPAT_LIBPATH=/usr/lib\n\n\nthen I run (where $DIR and $BOOST generate the paths I want the includes and libs to go)\n\n\n./configure --includedir=$DIR/$BOOST --libdir=$DIR/$BOOST/lib \\ \n --with-libraries=test,graph\n\n\nI get this error:\n\n\nld: library not found for -lexpat collect2: ld returned 1 exit status\n\n\nwhich boost says is caused by the line:\n\n\ng++ -dynamiclib -install_name \"libboost_graph-mt-1_35.dylib\" -L\"/usr/lib\" \n -o \"bin.v2/libs/graph/build/darwin/release/macosx-version-10.4/threading-multi/libboost_graph-mt-1_35.dylib\" \n \"bin.v2/libs/graph/build/darwin/release/macosx-version-10.4/threading-multi/read_graphviz_spirit.o\" \n \"bin.v2/libs/graph/build/darwin/release/macosx-version-10.4/threading-multi/graphml.o\" \n -lexpat -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -Wl,-dead_strip -no_dead_strip_inits_and_terms\n\n\nI don't get how it's not finding the expat library with -L\"/usr/lib\" and -lexpat as arguments? My understanding is that /usr/lib/libexpat.dylib is exactly referenced as -L\"/usr/lib\" and -lexpat.\n\nThe Jamfile for building graphml is here. If EXPAT_INCLUDE and EXPAT_LIBPATH aren't set then it warns you (lines 39-41 of jamfile) \n\n\n warning: Graph library does not contain optional GraphML reader.\n note: to enable GraphML support, set EXPAT_INCLUDE and\n note: directories containing the Expat headers and libraries, respectively."
] | [
"boost",
"boost-build",
"graphml"
] |
[
"Convert a Pandas DataFrame to a dictionary with values of same class together",
"I have a DataFrame with two columns. I want to convert this DataFrame to a python dictionary. I want the elements of first column be keys and the element of other column be values.\n item_cat_id item_id\n0 0 12\n1 2 11\n2 1 13\n3 3 20\n4 1 22\n5 1 19\n6 2 15\n7 0 25\n\nI want my output as dictionary:\n{'0': [12,25], '1': [13,22,19], '2': [11,15], '3' : [20]}"
] | [
"python",
"pandas",
"dataframe",
"dictionary"
] |
[
"Read-only input in Android Webkit not working",
"I have a text input field in my web page that I am using to collect a date (via the jQuery Tools .dateinput). The user does not need to be able to type into the field. A dialog box appears when the field is clicked on. This is a problem on my Motorola Droid, because I don't want the soft-keyboard to appear when the field is clicked.\n\nI have tried input.blur() on focus and also setting the field to disabled and readonly. Setting the field to disabled has undesired side effects. Setting the field to readonly works in everything but the Android browser. The browser seems to recognized the \"readonly\" attribute (or readOnly via javascript), BUT the field does not actually become readonly. When you click it, the soft keyboard still appears and allows you to change the field.\n\nI suppose that this is a bug in the Android browser. Can anyone come up with a clever alternative?"
] | [
"javascript",
"android",
"keyboard",
"webkit",
"readonly-attribute"
] |
[
"Testing for front or rear camera on an iPhone4",
"I wrote an application that sets some camera values (duration, quality, etc) using UIImagePickerController and it works fine. However, on an iPhone 4, I start with the front camera and if the user switches to the rear camera, the quality settings are lost. Is there a way that I can test if the user switches between the front and rear camera?\n\nBy using \n\nif (imagePicker.cameraDevice=UIImagePickerControllerCameraDeviceFront)\n\nit will tell me if the camera is set to the front camera but if the user switches cameras using the screen switcher, it won't return the camera value.\n\nAny help here would be greatly appreciated."
] | [
"camera",
"uiimagepickercontroller",
"iphone-4"
] |
[
"how to create PayPal pay buttons that pays multiple people",
"I want to create a set of buttons from a list of PayPal emails (sellers). And when the user clicks on the button he/she will be brought to a PayPal page to pay X amount of money to the seller and Y amount to one other person (me). Each button pays different amounts and different people. Is there a way to do this?"
] | [
"paypal"
] |
[
"Does max connection pool also limits max connections to database?",
"I am using hikari cp with spring boot app which has more that 1000 concurrent users.\nI have set the max pool size-\n\nspring.datasource.hikari.maximum-pool-size=300\n\n\nWhen i look at the processlist of mysql using \n\nshow processlist;\n\n\nIt shows max 300 which is equal to the pool size.It never increases than max pool.Is this intened?\nI thought pool size means connections maintained so that the connections can be reused when future requests to the database are required but when need comes more connections can be made.\n\nAlso when I am removing the max pool config ,I immediately get-\n\n\n HikariPool-0 - Connection is not available, request timed out after 30000ms.\n\n\nHow to resolve this problem.Thanks in advance."
] | [
"database",
"spring-boot",
"hikaricp"
] |
[
"How can I change a command in shell?",
"How can I do that when I write "mosquitto" in shell, it thinks that I wrote "mosquitto -c /etc/mosquitto/conf.d/mosquitto.conf"?\nI always have to use an option when I execute this command on shell (mosquitto), and I want to skip it. Mosquitto is a message broker, so it keeps listening. When I execute\nmosquitto -c /etc/mosquitto/conf.d/mosquitto.conf\n\nthe terminal look like this:\nmanuel@Manuel:~$ mosquitto -c /etc/mosquitto/conf.d/mosquitto.conf\n1602063783: mosquitto version 1.4.15 (build date Tue, 18 Jun 2019 11:42:22 -0300) starting\n1602063783: Using default config.\n1602063783: Opening ipv4 listen socket on port 1883.\n1602063783: Opening ipv6 listen socket on port 1883.\n\nand it doesn't end.\nSo I looked for a solution that was modifying the ".bashrc" file and adding a function like this:\n#Using mosquitto with local conf\nfunction mosquitto\n{\n mosquitto -c /etc/mosquitto/conf.d/mosquitto.conf $@ \n}\n\nBut with this function, the output doesnt show in shell. I also have tried to add ">&1" but it doesn't work, and I think that it's because the command doesn't end."
] | [
"bash",
"shell"
] |
[
"docker nginx ssl proxy pass to another container",
"I have a docker-compose file that right now runs two containers:\n\nversion: '3'\n\nservices:\n nginx-certbot-container:\n build: nginx-certbot\n restart: always\n links:\n - ghost-container:ghost-container\n ports:\n - 80:80\n - 443:443\n tty: true\n\n ghost-container:\n image: ghost\n restart: always\n ports:\n - 2368:2368\n\n\nI have four websites, l.com, t1.l.com, t2.l.com, t3.l.com, all with ssl certificates done by letsencrypt, and working by that on the URL I can see the green lock etc...\n\nfor t2.l.com, I would like that to be a blog from ghost, but with the following nginx conf, \n\nupstream ghost-container {\n server ghost-container:2368;\n}\n\nserver {\n server_name t2.l.com;\n\n location / {\n proxy_pass https://ghost-container;\n proxy_ssl_certificate /etc/letsencrypt/live/l.com/fullchain.pem;\n proxy_ssl_certificate_key /etc/letsencrypt/live/l.com/privkey.pem;\n proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\n proxy_ssl_ciphers \"ECDHE-ECD ... BC3-SHA:!DSS\";\n proxy_ssl_session_reuse on;\n }\n\n listen 443 ssl;\n ssl_certificate /etc/letsencrypt/live/l.com/fullchain.pem;\n ssl_certificate_key /etc/letsencrypt/live/l.com/privkey.pem;\n include /etc/letsencrypt/options-ssl-nginx.conf;\n}\n\nserver {\n listen 80;\n listen [::]:80;\n server_name t2.l.com;\n\n include /etc/nginx/snippets/letsencrypt.conf;\n\n location / {\n return 301 https://t2.l.com$request_uri;\n #proxy_pass http://ghost-container;\n }\n}\n\n\nIf I comment out the return 301, and just keep the proxy_pass, I get redirected to the ghost blog no problem, except its not via ssl, But if i comment out the proxy pass, like above, and return 301, the server returns a 502 bad gateway.\n\nIs there something I'm missing? from other peoples code it seems just having proxy certs is enough...\n\nEdit\n\nWell, I just did something that I was sure would not work, and set the proxy pass in the ssl part to http: instead of https:, and it all worked fine, so if anyone can explain the mechanics or logic behind why this is so, I would be very interested, it doesnt make sense in my mind."
] | [
"docker",
"ssl",
"nginx"
] |
[
"Specifying SQL variable to xquery exist method to check if value is in given set of values",
"I am trying to query an XML column to return all rows where an attribute is in a list of possible values.\n\nXQuery allows something like\n\nSELECT COUNT(*) \nFROM table\nWHERE xml_col.exist('//Field.[@name=(\"value1\",\"value2\",\"value3\")]') = 1\n\n\nwhich would return the number of records that have a Field with attribute @name set to either \"value1\", \"value2\" or \"value3\".\n\nWhat I'd like to do is write a concise query that could handle the set \"value1\", \"value2\", \"value3\" as an input parameter, e.g.\n\nDECLARE @list NVARCHAR(100)\n\nSET @list = '(\"value1\",\"value2\",\"value3\")'\n\nSELECT COUNT(*) \nFROM table\nWHERE xml_col.exist('//Field.[@name=sql:variable(\"@list\")]') = 1\n\n\nwhich, of course, is invalid. Any suggestions would be appreciated!"
] | [
"sql-server-2008",
"xquery",
"sqlxml"
] |
[
"LibGDX and Samsung SPen SDK",
"I have created a game using LibGDX and now want to use SPen SDK there. So, when I create SPenEventLibrary and set listener it stops working. I get reaction from onTouchFinger (I don't have the pen, that's why I use only this event), but when I try to propagate motion event to Stage's events such as touchDown and touchUp - it doesn't work!\n\nFirst of all I get view, because mSPenEventLibrary.setSPenTouchListener requires it:\n\nTearTissue.libGDXView = initializeForView(new TearTissue(), config);\n\n\nThen I extend Stage class:\n\nprotected SPenEventLibrary mSPenEventLibrary;\n\npublic class MyStage extends Stage{\n\n public MyStage(float width, float height, boolean keepAspectRatio, SpriteBatch batch){\n super(width, height, keepAspectRatio, batch);\n final Stage localStage = this;\n\n mSPenEventLibrary = new SPenEventLibrary();\n\n mSPenEventLibrary.setSPenTouchListener(TearTissue.libGDXView, new SPenTouchListener() {\n\n @Override\n public boolean onTouchPenEraser(View arg0, MotionEvent arg1) { \n return false;\n }\n\n @Override\n public boolean onTouchPen(View arg0, MotionEvent arg1) { \n return false;\n }\n\n @Override\n public boolean onTouchFinger(View arg0, MotionEvent arg1) { \n\n if(arg1.getAction()==MotionEvent.ACTION_DOWN){\n localStage.touchDown((int)(arg1.getX()), (int)(arg1.getY()), 0, 0); \n\n }\n if(arg1.getAction()==MotionEvent.ACTION_UP){ \n localStage.touchUp((int)(arg1.getX()), (int)(arg1.getY()), 0, 0);\n }\n return true;\n }\n\n @Override\n public void onTouchButtonUp(View arg0, MotionEvent arg1) { \n }\n\n @Override\n public void onTouchButtonDown(View arg0, MotionEvent arg1) {\n }\n });\n } \n //DO SOME STUFF, THAT'S WHY I OVERRIDE IT \n @Override\n public boolean touchDown(int screenX, int screenY, int pointer, int button) { \n return super.touchDown(screenX, screenY, pointer, button);\n }\n @Override\n public boolean touchDragged(int arg0, int arg1, int arg2) { \n return super.touchDragged(arg0, arg1, arg2);\n }\n @Override\n public boolean touchUp(int arg0, int arg1, int arg2, int arg3) { \n return super.touchUp(arg0, arg1, arg2, arg3);\n } \n}\n\n\nWhat am I doing wrong? Any help will be appreciated!"
] | [
"java",
"android",
"sdk",
"libgdx",
"samsung-mobile"
] |
[
"Read XML into DataTable. Need to match Schema",
"I am trying to read an XML file into a DataTable and I am having a hard time matching the schema, and converting it properly. This is what the XML could look like...\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<School>\n <Teacher>\n <Name>Teacher1</Name>\n <Student>\n <Student-Name>Student1</Student-Name>\n <Gender>M</Gender>\n <Address>Address1</Address>\n </Student>\n <Student>\n <Student-Name>Student2</Student-Name>\n <Gender>F</Gender>\n <Address>Address2</Address>\n </Student>\n </Teacher>\n <Teacher>\n <Name>Teacher2</Name>\n <Student>\n <Student-Name>Student3</Student-Name>\n <Gender>F</Gender>\n <Address>Address3</Address>\n </Student>\n </Teacher>\n</School>\n\n\nI need to add it to a DataTable so that it the table looks like this\n\nName Student-Name Gender Address \n----------------------------------------------------\nTeacher1 Student1 M Address1 \nTeacher1 Student2 F Address2 \nTeacher2 Student3 F Address3\n\nDataTable.ReadXML() --> wont allow me to read in this XML file. The error says that DataTable doesn't support schema inference \nDataSet.ReadXML() --> doesn't pick up on the schema and separates this into two tables the first being a Teacher Table and the second being a Student Table, even when it is set to Infer the schema.\n\nThe other problem is that I am doing this with several types of XML files. All of which have a different number of nodes nested within the student, and I need to make this generic so that it can read the XML regardless of the number of nodes.\n\nI am wondering if I need to set up an XmlReader to read this in, or if there is any settings on the DataSet.ReadXML()/DataTable.ReadXML() that I need to use. Thank You."
] | [
"c#",
"asp.net",
"xml"
] |
[
"Mysql - get the number of entries with a timestamp in the last week as a % of the total entires",
"I have a table with a timestamp col and around 100000 rows, how can I find the % of the total entries that have a timestamp in the last week? I can find the number of entries \n\nSELECT count(*) c FROM table t WHERE timestamp_col > DATE_SUB(now(), INTERVAL 1 WEEK)\n\n\nbut how would I then work that back to a % of the total rows? \n\nI can do this imperatively with 2 statements but am wondering if there is an SQL only solution?"
] | [
"mysql",
"sql"
] |
[
"How to blur a transparent texture in a glsl shader?",
"My setup:\n\nPing-ponging RGBA FBO's, and two shaders for blurring: a horizontal and a vertical one. Imagine I want to blur a red rectangle.\n\nThe blend function is as follows:\n\n_gl.blendEquationSeparate(_gl.FUNC_ADD, _gl.FUNC_ADD);\n_gl.blendFuncSeparate(_gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA, _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA);\n\n\nIn my blur shaders I add several fragments like this:\n\nvec4 color = texture2D(u_image, v_tex_coord + vec2(x, y) * u_amount) * weight;\n\n\nProblem:\n\nBlurring works fine on opaque textures, but as it mixes in more and more transparency, the colors become black, as if everything is mixed with a black background. My clear color is 0,0,0,0, so that makes sense.\n\nQuestion:\n\nHow do I get a blur effect that truly goes to transparent red, instead of a red mixed with more and more black as the alpha goes to zero?\n\nI basically want the same as when you blur something on a complete transparent background in Photoshop. Do I need premultiplied FBO's or do I need to handle the mixing of fragments in the shader differently?"
] | [
"glsl",
"webgl"
] |
[
"why isn't dynamically changing css style.left and style.top working",
"I am trying to move an image when the keys w, a, s, and d are pressed, but nothing is happening, and nothing is showing up in the console. Any help or suggestions would be greatly appreciated.\n\nvar moveBy = 10;\nfunction moveObj(name, xPix, yPix)\n{\n var obj = document.getElementById(name);\n var xp = parseInt(obj.style.left) + xPix;\n var yp = parseInt(obj.style.top) + yPix;\n obj.style.left = xp;\n obj.style.top = yp;\n}\n$(document).ready(function()\n{\n $('body').keydown(function(e)\n {\n if(e.keyCode == 68)\n {\n moveObj('player', moveBy, 0);\n }\n else if(e.keyCode == 65)\n {\n moveObj('player', -moveBy, 0);\n }\n else if(e.keyCode == 87)\n {\n moveObj('player', 0, -moveBy);\n }\n else if(e.keyCode == 83)\n {\n moveObj('player', 0, moveBy);\n }\n });\n});"
] | [
"javascript",
"jquery",
"html",
"css"
] |
[
"PowerShell add full path to filename and copy",
"How can I copy the folder names to the filenames during the copy. At the moment the script copies only files from the subdirectory without all folder and sub-foldername. However, I want which takes the absolute pathname while copying.\n\nHere an example:\nFolder1\n Subfolder1\n Subfolder2\n Subfolder3\n Subfolder4\n File1\nFolder2\n\nThen a copied file would be called so:\n\nFolder1_Subfolder1_Subfolder2_Subfolder3_Subfolder4_File.pdf\n\n Powershell code:\n Get-ChildItem –path C:\\12 -Recurse -Include \"*.???\" |\n Foreach-Object { copy-item -Path $_.fullname -Destination c:\\12 }"
] | [
"file",
"powershell",
"copy"
] |
[
"How to set default template for new \".R\" files in rstudio",
"Background:\nI like 'r'. I use Rstudio for it - it is a nice IDE. I use the revolution Analytics version of 'r', \"revolution R Open\". \n\nI find that I type the same stuff in the annotation and structured programming regularly, and I want to save myself the re-typing. \n\nQuestion:\nHow do I change the default file template so that the one I want, with some text already populated, comes up when I create a new blank R-script in Rstudio.\n\nClarifications: \n\n\nI am not looking for this to be a manual process where I open one file, renaming it to a proper directory, and then work on it. I am looking to change the default so that this happens automatically. \n\n\nPrevious approach:\n\n\ngoogle \nrstudio search (example)\nsearch on stack-overflow\npoking around rstudio menus/preferences\n\n\nThanks."
] | [
"r",
"rstudio",
"structured-programming"
] |
[
"How to retrieve Google profile picture from logged in user with ASP.Net Core Identity?",
"Ok... I'm currently using ASP.Net Core 1.1.2 with ASP.NET Core Identity 1.1.2. \n\nThe important part in Startup.cs looks like this:\n\n public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)\n {\n //...\n app.UseGoogleAuthentication(new GoogleOptions\n {\n AuthenticationScheme = \"Google\",\n SignInScheme = \"Identity.External\", // this is the name of the cookie middleware registered by UseIdentity()\n ClientId = Configuration[\"ExternalLoginProviders:Google:ClientId\"],\n ClientSecret = Configuration[\"ExternalLoginProviders:Google:ClientSecret\"]\n });\n }\n\n\nGoogleOptions comes with Microsoft.AspNetCore.Authentication.Google nuget package.\n\nThe callback function in AccountController.cs looks like this:\n\n [HttpGet]\n [AllowAnonymous]\n public async Task<IActionResult> ExternalLoginCallback(string returnUrl = null, string remoteError = null)\n {\n //... SignInManager<User> _signInManager; declared before\n ExternalLoginInfo info = await _signInManager.GetExternalLoginInfoAsync();\n SignInResult signInResult = await _signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false);\n string email = info.Principal.FindFirstValue(ClaimTypes.Email);\n string firstName = info.Principal.FindFirstValue(ClaimTypes.GivenName);\n string lastName = info.Principal.FindFirstValue(ClaimTypes.Surname);\n //\n }\n\n\nSo, everything works fine until this point. And here I'm stuck. I read a lot of articles about accesstokens and claims called pictureUrl and so on. But the Principal doesn't contain any of those.\n\nSo the question is: How to retrieve the profile image once in the ExternalLoginCallback function?"
] | [
"c#",
"asp.net-core",
"google-api",
"asp.net-identity",
"google-oauth"
] |
[
"Html table size column",
"I have a table but I don't know how to have control on the size of the first column. I would like the first column is 65% seconde 35\n\n\r\n\r\n<table width=\"\"193\"\" cellspacing=\"\"0\"\" cellpadding=\"\"0\"\">\r\n<tbody>\r\n<tr>\r\n<td valign=\"\"top\"\"><strong>Nutrition facts:</strong></td>\r\n<td valign=\"\"top\"\"><strong>100ml</strong></td>\r\n</tr><tr>\"&\"\r\n<td valign=\"\"top\"\"><strong>Calories:</strong></td>\r\n<td valign=\"\"top\"\">\"3g\"</td>\r\n</tr>\"&\"<tr>\r\n<td valign=\"\"top\"\"><strong>Carbohydrate:</strong></td>\r\n<td valign=\"\"top\"\">\"5g\"</td>\r\n</tr>\"&\"\r\n<tr>\r\n<td valign=\"\"top\"\">sugar:</td>\r\n<td valign=\"\"top\"\">\"4g\"</td>\r\n</tr>\"&\"\r\n<tr>\r\n<td valign=\"\"top\"\"><strong>Sodium:</strong></td>\r\n<td valign=\"\"top\"\">\"2g\"</td>\r\n</tr></tbody>\r\n</table>"
] | [
"html",
"html-table"
] |
[
"Anti-Captcha not working, validation happening before callback - Selenium",
"So, I'm trying to login in this website with Selenium:\nhttps://carrinho.pontofrio.com.br/Checkout?ReturnUrl=%2fSite%2fMeusPedidos.aspx#login\nAnd I'm using anti-captcha, here's my login code:\nmy_driver = webdriver.Chrome(executable_path=chrome_path)\nwait = WebDriverWait(my_driver, 20)\n\n\n#Realizar o Login\ndef login():\n my_driver.get(url)\n time.sleep(4)\n my_driver.find_element_by_id('Email').send_keys(usuario)\n my_driver.find_element_by_id('Senha').send_keys(senha)\n my_driver.find_element_by_id('Senha').send_keys(Keys.ENTER)\n time.sleep(1)\n solver = recaptchaV2Proxyless()\n solver.set_verbose(1)\n solver.set_key("")\n solver.set_website_url('https://carrinho.pontofrio.com.br/Checkout?ReturnUrl=%2fSite%2fMeusPedidos.aspx#login')\n solver.set_website_key("6LfeX6kZAAAAAIhuSyQ1XRwZdOS26O-r4UJbW3y1")\n # solver.set_data_s('"data-s" token from Google Search results "protection"')\n g_response = solver.solve_and_return_solution()\n if g_response != 0:\n print("g-response: " + g_response)\n else:\n print("task finished with error " + solver.error_code)\n time.sleep(1)\n my_driver.execute_script('document.getElementById("g-recaptcha-response").innerHTML = "%s"' % g_response)\n time.sleep(1)\n my_driver.execute_script(f"callbackCaptcha('{g_response}');")\nlogin()\n\nWebsite Key is correct, but the website is not accepting my Captcha responses.\nSo I've tried to check how the Login Process happens with the developer tools, and it goes like that:\nThe callback function happens after a function that I don't know what it that calls the website:\nhttps://www.google.com/recaptcha/api2/userverify?k=6LfeX6kZAAAAAIhuSyQ1XRwZdOS26O-r4UJbW3y1\nPost Method before callback method\nAnd I'm not being able to find a way to simulate this post method, since Selenium doesn't do post methods.\nIs there anyway that I can listen to all the Javascript events (the codes called) while running the page?\nAny help would be much appreciated, thanks!\nI was able to solve the validation thing, with the following code:\noptions.add_argument('--disable-blink-features=AutomationControlled')\n\nBut the Anti-Captcha is still giving me a wrong answer :("
] | [
"python",
"python-3.x",
"selenium",
"recaptcha",
"grecaptcha"
] |
[
"posting to friends wall using facebook javascript sdk",
"How can I post to a friends wall using the facebook javascript SDK?"
] | [
"facebook",
"facebook-javascript-sdk"
] |
[
"How to set default time zone in Java and control the way date are stored on DB?",
"I've the following problem, that showed up when I installed my webapp's war on a virtual linux server. Here it is: my server system time seems correct, in fact typing date on shell comes out with:\n\nMon Apr 11 11:47:30 CEST 2011\n\n\nwhich is my \"wall clock time\". Even mysql works fine, if I do select now(), I get:\n\nmysql> select now()\n -> ;\n+---------------------+\n| now() |\n+---------------------+\n| 2011-04-11 11:52:57 |\n+---------------------+\n1 row in set (0.01 sec)\n\n\nBut my application (Spring+hibernate on Java6 + tomcat 6) will save every date on DB with a GMT timezone (and the time is correctly offset with the difference from GMT, which is good). Now the problem is that I get all dates displayed with GMT, even if I do:\n\nstatic final DateFormat format = new SimpleDateFormat(\n \"dd/MM/yyyy 'alle' HH:mm\", Locale.ITALY);\n\n\nI don't get the hours correctly offset, but they remain in GMT and they display GMT if I put Z (that displays timezone) in the pattern. \n\nUnder Windows instead I had date values stored in my native timezone on mySQL. So on my windows machine where I develop I will have all the dates in CEST. This is annoying as I don't know how to predict the way the system will behave and I have to do boring tests and figure out how to change this.\n\nDo you have ever seen this problem? How to deal with it?"
] | [
"java",
"mysql",
"hibernate",
"time",
"timezone"
] |
[
"How to determine the content of an Office content type of an saved Document?",
"The documentation of getFileAsyc says it will always be in (.pptx or .docx) in Office Open XML (OOXML) \n\nSince Office 2016 this holds no longer true, if one saves the file in OpenDocument format (*.odt).\n\nHow will I get the information about the filetype? The name ends with *.odt, but in Word 2013 the name also ended with *.odt, but was transferred as *.docx\n\nExample:\n\nIn following case, the binary filecontent cannot be determined:\n\n\nCreate an empty file in Word\nInsert your TaskpaneApp\nSafe the file as *.odt to you PC in Word\ncall getFileAsync(Compressed), and \nget no docx but odt-content in Word 2016 with the name .odt\nget docx-content in Word 2013 with the name .odt \n\n\nFor Word 2013 I fixed the problem by adding .docx to the provided name. Exactly this fix causes the Problems with Word 2016, where the file is realy a *.odt"
] | [
"ms-word",
"ms-office",
"powerpoint",
"office-js"
] |
[
"UITableView SelectedRow Heighlighting",
"When user click the INR amount Remaining Row will be disable\n\n\nAgain when user click the USD Amount Row remaing rows should be Disable.\n\ni posted my trying code please help me.\n\nif([SelectedIndexPath containsIndex:indexPath.row])\n{\n NSString *StrCurrency=[CurrencyArray objectAtIndex:indexPath.row];\n NSLog(@\"%@\",StrCurrency);\n\n if ([StrCurrency isEqualToString:@\"USD\"]) {\n cell.HideView.hidden=NO;\n }\n else{\n cell.HideView.hidden=YES;\n }\n NSLog(@\"selected\");\n\n}\nelse\n{\n NSLog(@\"Unselected\");\n cell.HideView.hidden=YES;\n}"
] | [
"ios",
"objective-c",
"uitableview",
"tableviewcell"
] |
[
"Erlang build failure: error writing file",
"I am new to Erlang and am trying to build the Erlang package. I am using R13B version. Its an old version but am using it because it already used in a pre-existing project.\nI am getting the following err: \n...rlang/build/lib/hipe/rtl/../ebin/hipe_rtl.bea#: error writing file\n\nI searched the internet and potential reason was lack of permission. The directory it is writing to my home directory.\n\nCan someone please help me out here?"
] | [
"build",
"erlang"
] |
[
"How can i enable my animations when I press a button without that it wait the other animation? | Mecanim",
"I am learning how to use the mecanim. In the animator I have 3 animations (idle,Walk and Run) these animations works correctly but the problem is when I press the button W, for example, two seconds pass until the animation (walk) is enabled, because that animation (walk) wait until the other animation (idle) finish. I want the animations are activated when pressed the button. How can I do that?"
] | [
"animation",
"unity3d",
"unity3d-mecanim"
] |
[
"Detecting if a MouseEvent from onTouch is inside a circle drawn to the canvas of a custom view.",
"I'm trying to start with an android application and before that I have a need to do the following thing :\nI have a class extending from the View class and Implementing the View.onTouchListener interface. Now, I have drawn a circle in the onDraw() method so that the circle appears on the start of the application. Now, I would want to do something when the user touches(Actually clicks) the circle. So, the first thing I'm trying to do here is to display a toast msg on the touch of the circle. I tried using the following code but nothing happened. Pls help me find a solution.\n\nThis is the View class : \n\n package com.exam.trial;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.graphics.Color;\nimport android.graphics.Paint;\nimport android.view.MotionEvent;\nimport android.view.View;\nimport android.widget.Toast;\n\npublic class pad extends View implements View.OnTouchListener{\n\nPaint paint;\npublic pad(Context context) {\n super(context);\n // TODO Auto-generated constructor stub\n paint = new Paint();\n}\n\n\npublic boolean onTouch(View v, MotionEvent event) {\nswitch(event.getAction()){\n case MotionEvent.ACTION_DOWN: {\n if (event.getX()>70 && event.getX()<130 && event.getY()>70 && event.getY()<130)\n {\n Toast toast = Toast.makeText(getContext(), \"Works fine\", Toast.LENGTH_SHORT);\n toast.show();\n }\n return true;\n }\n\n}\nreturn false;\n}\n\n\n@Override\npublic void onDraw(Canvas canvas)\n{\n paint.setColor(Color.YELLOW);\n canvas.drawCircle(100, 100, 50, paint);\n}\n\n}\n\n\nAnd here is my starting activity : \n\npackage com.exam.trial;\n\nimport android.app.Activity;\nimport android.os.Bundle;\n\npublic class TrialActivity extends Activity {\n/** Called when the activity is first created. */\n@Override\npublic void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n pad p = new pad(this);\n\n setContentView(p);\n}\n}"
] | [
"android",
"ontouchlistener"
] |
[
"Web Services that connect to PostgreSql",
"I'm creating an iPhone app that has a DB in PostgreSql. I want to create web services that connect to the database and fetch the data in and out, like for example , I want to create a web service for the login screen of my iPhone app that would connect to the PostgreSql database and authenticate the user.\n\nHow do I go about with the web services part..?"
] | [
"asp.net",
"json",
"web-services",
"postgresql",
"json.net"
] |
[
"How to get the count of unread messages in React native with gifted chat library?",
"Am currently using react native gifted chat for the message/chat feature in my application.\nNow I want to show the unread messages for the user, does anyone have an idea about it or any suggestions to tackle this.\nAny help/Suggestion will be appreciated,\nThanks in advance.\nReact native gifted chat link"
] | [
"react-native",
"google-cloud-firestore",
"react-native-gifted-chat"
] |
[
"Camera intent to save new image or video",
"I'm making a gallery app, and there is a Cam button, but now it only allows the user to take a picture, the video record options is disabled... how can I allow the user to save a picture OR a video?"
] | [
"android"
] |
[
"How to fill the middle of two subplots in plot_ly in R to plot as a \"volume\" figure?",
"I am plotting two rasters using the plot_ly function as type = "surface" (code below).\nfig1 <- plot_ly(z = ~as.matrix(superficie),\n type = "surface",\n coloraxis = 'coloraxis')\n\n\nfig2 <- plot_ly(z = ~as.matrix(regolito),\n type = "surface",\n coloraxis = 'coloraxis')\n\nfig3 <- subplot(fig1, fig2)\n\nfig3 <- fig3 %>% layout(coloraxis=list(colorscale='Jet'),fill= "red",\n scene = list(xaxis = list(title = "x",showline=T),\n yaxis = list(title = "y"),\n zaxis = list(title = "z (meters)")))\n\nThe product image is below.\nplot the 2 images together using plot_ly()\nI want to connect these two figures' edges to plot the "volume" of these two images."
] | [
"r",
"plotly",
"r-plotly"
] |
[
"Google Apps Script - TypeError: Cannot read property 'length' of undefined",
"I have a Google Sheets script that is supposed to grab data from an API but I am getting the error \n\n\n TypeError: Cannot read property 'length' of undefined (line 5, file \"draftOrder\")\n\n\nHow can I fix this error? I haven't touched this script in years, so I'm not sure what broke.\n\n function draftOrder(ownerRange, numRounds) {\n var output = [];\n var owners = [];\n\n for (var i = 0; i < ownerRange.length; i++) {\n if (ownerRange[i][0] !== '') {\n owners.push(ownerRange[i][0]); \n }\n }\n\n for (var i = 0; i < numRounds; i++) {\n if (i % 2 == 0) {\n output = output.concat(owners);\n } else {\n output = output.concat([].concat(owners).reverse());\n }\n\n }\n return output;\n}\n\n\nThanks in advance for any help that you can provide. Cheers!"
] | [
"google-apps-script",
"google-sheets",
"typeerror"
] |
[
"Apache commons io Tailer : Handle log rotation",
"I am using Tailer to read lines from some log4j log file and write only certain lines into another destination file. \n\nNow I want to rotate the destination file everyday or at least want to delete some old data from the destination file. \n\nWhat is the best way to do this?"
] | [
"java",
"apache-commons",
"apache-commons-io"
] |
[
"How to remove sorting on ui-grid before reload another data set ui-grid",
"Im using ui-grid to load my data set. Here is my requirment;\n\nstep 01: I want to load dataset_01 (scope.gridOptions.data = res_01;).\n\nstep 02: I want to sort by First Name (Click by firstname column).\n\nstep 03: Click an external button and Reload ui-grid with an another data set (scope.gridOptions.data = res_02;).\n\nHere is my result:\n\n\n\nI dont want sort by First Name here for second dataset.\nI want data without sorting. How can I do it ?\n\nExpected result:\n\n\n\nSo I want to reload second data set without sorting (Means I want to remove first sorting before load second data set). how can I reset my ui-grid before load next data set (scope.gridOptions.data = res_01;). \n\nHow can I do it ?\n\nThank you. :)"
] | [
"javascript",
"angularjs",
"angular-ui",
"angular-ui-grid",
"ui-grid"
] |
[
"How to split read and write operations to endpoints provided by Postgresql cluster in Loopback 3?",
"This is actually confusing, I've googled almost everything. I've found here, on stackoverflow, how to have multiple data sources, but how to split READ and WRITE operations per data sources is nowhere to be found? I have AWS RDS aurora postgresql cluster in here and 2 endpoints available. One for write node and another one for read nodes, which will load balance between read replicas. \n\nApparently sending queries to different endpoints should be done in application level (which is strange). And I can't find how Postgresql Connector in Loopback could help in here. There's nothing even near in documentation about this quite usual use-case. Anyone could please provide a sample how this is done please?"
] | [
"node.js",
"loopbackjs"
] |
[
"Operand should contain 1 column(s) error",
"I have an sql query that was returning some incorrect results due to product id's being duplicated for linked products, so i added the following to the end of my query expecting it to only take the first instance of any product id:\n\nAND pc.products_id \nIN\n(SELECT\npc.products_id, MIN(categories_id)\nFROM\nzen_products_to_categories pc\nGROUP BY\npc.products_id)\n\n\nBut i get an Operand should contain 1 column(s) error when i run the process. I ran that query on it's own and it only gave me each product id once, so not sure why i get the error.\n\nThe full query i now have is:\n\nSELECT p.products_quantity, p.abebooks_status, \np.products_id AS id, \np.products_status AS prodStatus, \nFORMAT( IFNULL(s.specials_new_products_price, p.products_price),2) AS price, \npc.categories_id AS prodCatID, \nc.parent_id AS catParentID, \ncd.categories_name AS catName \nFROM \nzen_products p \nJOIN zen_products_description pd ON p.products_id=pd.products_id \nJOIN zen_products_to_categories pc ON p.products_id=pc.products_id \nJOIN zen_categories c ON pc.categories_id=c.categories_id \nJOIN zen_categories_description cd ON c.categories_id=cd.categories_id \nleft join zen_specials s on ( s.products_id = p.products_id AND ( (s.expires_date > CURRENT_DATE) OR (s.expires_date = 0) ) ) \nWHERE p.products_price > 0 and p.products_status = 1 \nAND pc.products_id \nIN \n(SELECT pc.products_id, MIN(categories_id) \nFROM zen_products_to_categories pc GROUP BY pc.products_id) \nORDER BY catName ASC \n\n\nCan anyone tell me why it doesn't work when i add the extra query because it's got me baffled"
] | [
"mysql",
"sql",
"operand",
"mysql-error-1241"
] |
[
"Why does @Storybook/react-native requires react-dom?",
"Why does @Storybook/react-native require react-dom? \n\nMy understanding of react-dom is that it is used for the browser. But, since React Native doesn't use a browser this is just a peerDependency that will never be used.\n\nWhen running a React Native app with remote debugging on, it will use Chrome as the running context and have a DOM available. Is this the reason for using it? \n\nMy package.json:\n\n\"dependencies\": {\n ...\n \"react\": \"16.3.1\",\n \"react-native\": \"0.55.4\",\n ...\n},\n\"devDependencies\": {\n ...\n \"@storybook/react-native\": \"4.1.1\",\n ...\n}\n\n\nI get these warnings when doing yarn install:\n\n warning \"@storybook/react-native > @storybook/[email protected]\" has unmet peer dependency \"react-dom@>=16.3.0\".\n warning \"@storybook/react-native > @storybook/[email protected]\" has unmet peer dependency \"react-dom@*\".\n warning \"@storybook/react-native > @storybook/ui > [email protected]\" has unmet peer dependency \"react-dom@^0.14.0 || ^15.0.0 || ^16\".\n warning \"@storybook/react-native > @storybook/ui > [email protected]\" has unmet peer dependency \"react-dom@^15.5.4 || ^16.0.0\".\n warning \"@storybook/react-native > @storybook/ui > react-treebeard > [email protected]\" has unmet peer dependency \"react-dom@^15.3.0 || ^16.0.0\"."
] | [
"javascript",
"reactjs",
"react-native",
"storybook"
] |
[
"Hold session in stateful EJB 3.1 bean?",
"I'm working on a Java webapp trying to combine the following technologies:\n\n\nJava EE 6\nCDI\nJSF 2\nEJB 3.1\nSpring Security\n\n\nI provide CDI-based backing beans (@ViewScoped, @Named) for my JSF pages.\n\nI use @Stateless EJB beans for the actual work to be done.\n\nI only need few session information like jSessionCookie (managed by container), internal username and some other internal IDs. Now, I wonder where to put this session information so that I can access it in the backing beans for JSF, but also provide it to the stateless EJBs? Should I use a @Stateful EJB session bean or should I create CDI-based POJO with @SessionScoped and @Named?\n\nAre there any best practices?"
] | [
"java",
"jakarta-ee",
"ejb",
"java-ee-6",
"ejb-3.1"
] |
[
"Sunspot not reading sunspot.yml when inside mountable engine",
"I am using the sunspot gem inside a mountable engine. I am creating an engine out of an existing Rails 3.2 app so I know that my setup works when in a standard rails app.\n\nBasically, I can't get Sunspot in development (when using spec/dummy - I know that it's normally used to for testing but everything else works just fine) to load the sunspot.yml file and find the running version of Solr.\n\nMy gemspec has:\n\ns.add_dependency 'sunspot_rails', '= 2.0.0.pre.120417'\ns.add_development_dependency 'sunspot_solr', '~> 1.3.3'\ns.add_development_dependency 'sunspot_test', '~> 0.4.0'\n\n\nMy mountable engine has a dummy rails app at spec/dummy for testing. My spec/dummy/config/sunspot.yml contains:\n\ndevelopment:\n solr:\n port: 8080\n path: /solr\n hostname: localhost\n\n\nWhen I run a rails console (from inside spec/dummy) with bundle exec rails console I get a normal rails console.\n\nRunning Sunspot.config produces:\n\n> Sunspot.config\n=> #<LightConfig::Configuration:0x007f864aeee8a0\n @properties=\n {:solr=>\n #<LightConfig::Configuration:0x007f864aeed0b8\n @properties=\n {:url=>\"http://127.0.0.1:8983/solr\",\n :read_timeout=>nil,\n :open_timeout=>nil}>,\n :master_solr=>\n #<LightConfig::Configuration:0x007f864aefb398 @properties={:url=>nil}>,\n :pagination=>\n #<LightConfig::Configuration:0x007f864af06ae0\n @properties={:default_per_page=>30}>,\n :indexing=>\n #<LightConfig::Configuration:0x007f864af0bf18\n @properties={:default_batch_size=>50}>}>\n\n\nClearly Sunspot isn't picking up my sunspot.yml file because the port is running on 8983 instead of 8080 where it's actually running.\n\nStarting the Solr server via bundle exec rake sunspot:solr:start (inside spec/dummy) or bundle exec rake app:sunspot:solr:start (from root of engine) starts the server correctly on port 8080 so I know that that is reading sunspot.yml\n\nThere are few other people with similar questions but I'm not using the sunspot_mongoid gem and feel like it's something to do with the fact it's running inside an engine.\n\nIf anyone could give me a hand it would be much appreciated!"
] | [
"ruby-on-rails",
"solr",
"sunspot",
"rails-engines"
] |
[
"Transform 2 way binding value in RxSwift",
"*I have a problem where i need to format the textfield from the view model and emit it to the view controller\n(my goal is to have a 2 way binding operation with transformation)\n\nConfirm Request View Controller\n\n\n\n@IBOutlet phonetextfield:UITextField!\n\nvar viewModel = confirmRequestViewModel()\n\n\n\noverride fun viewdidLoad(){\n \n super.viewdidLoad()\n ( phonetextfield.rx.text.orEmpty <-> viewModel.amountToDepositRelay)\n .disposed(by: disposeBag)\n}\n\n\nclass ConfirmRequestViewModel {\n\n\nlet phoneRelay = BehaviorRelay<String>(value:"")\n\ninit (){\n phoneRelay.subscribe(onNext:{\n **// do some logic\n then emit the value to the phone Relay**\n }\n }*\n\nthe subscribe func won't work obviously ,\ni found this solution but it's not convenient\nTextField text --> TextField Relay in VM\nTextField Relay in VM --> Formatted Relay in VM\nFormatted Relay in VM ---> TextField text"
] | [
"swift",
"rx-swift"
] |
[
"C# Check All from a CheckedListBox without showing the \"Check All\" entry",
"I have a small program that has several checkedboxlists in VS2010. I wanted to allow a user to select all in one of the lists and came up with this looping structure...\n\nprivate void CheckedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)\n {\n if (e.NewValue == CheckState.Checked)\n {\n Applications.Add(CheckedListBox1.Items[e.Index].ToString());\n }\n else if (e.NewValue == CheckState.Unchecked)\n {\n Applications.Remove(CheckedListBox1.Items[e.Index].ToString());\n } \n }\n\nprivate void CheckedListBox1_SelectedIndexChanged(object sender, EventArgs e)\n {\n\n if (CheckedListBox1.SelectedIndex == 0)\n {\n for (int i = 1; i < CheckedListBox1.Items.Count; i++)\n {\n CheckedListBox1.SetItemChecked(i, CheckedListBox1.GetItemChecked(0));\n }\n }\n else\n {\n if (!CheckedListBox1.GetItemChecked(CheckedListBox1.SelectedIndex))\n {\n CheckedListBox1.SetItemChecked(0, false);\n }\n }\n\n }\n\n\nThe problem is this also puts the \"Select All\" checkbox into the output. Is there a way I can tweak the loop to not include the first checkbox (which is the \"Select All\" Check) or should I be going about this a different way?"
] | [
"c#",
"loops",
"checkbox",
"checkedlistbox"
] |
[
"Invalid type for array subscript error",
"I'm getting an error with a piece of my code... In the following, \"vertices\" is defined as a vector of gVector3's, where gVector3 is a float array of length three (x,y,z coordinates of a point). The [] operator has been overloaded for the gVector3 class, so vertices[i][k] returns a float. \n\nI have an error in this line: (*result)[i+k] = vertices[i][k]. The full code as well as the error message is below. Any insights would be appreciated! \n\nfloat* Polygon::getVertices(){\n float* result = new float[vertices.size()*3];\n for (int i = 0; i < vertices.size(); i++){\n for (int k = 0; k < 3; k++){\n (*result)[i+k] = vertices[i][k]; // invalid types for array subscript\n }\n }\n return result;\n }"
] | [
"c++"
] |
[
"Asp.Net Gridview displaying data in both columns and rows",
"I am looking to display only 1 data field from the database table grid view in both columns and row wise rather than displaying all of them in rows.\n\nLiterally in data sense it looks like the following :\n\n Column1 Column2 Column3\n\n\nRow1 Data1 Data2 Data3\n\nRow2 Data4 Data5 Data6\n\nRow3 Data7 Data8 Data9\n\nTo be precise I want to display only the product's image from the database table ignoring the other fields so i just want the products image to appear in a table.\n\nThe actual output should like the image below \n![Products table][1]\n\nhttp://www.google.com.au/imgres?q=e+shop+in+table&um=1&hl=en&client=firefox-a&rls=org.mozilla:en-US:official&biw=1280&bih=921&tbm=isch&tbnid=x060V2C4fKhuCM:&imgrefurl=http://mixing-media.com/noticias/index&docid=p-enmrO8qB8a3M&w=499&h=486&ei=4MpeTrHoIunImAX0wqQF&zoom=1&iact=rc&dur=317&page=8&tbnh=136&tbnw=140&start=211&ndsp=31&ved=1t:429,r:21,s:211&tx=46&ty=54"
] | [
"asp.net",
"gridview"
] |
[
"filter query_posts using a meta_key that is an array",
"Inside one of my custom post types, I have a custom field that gets its values from another custom post type, and show them in a dropdown menu, something that's called a Relation Custom Field in PODS.\n\nWhen you select one of the items of the dropdown menu, then display it, it returns an array.\n\nWhat I need to do is to filter the posts inside this CPT through the value of one of the custom field array keys.\n\n$industry = get_post_meta(get_the_ID(), 'industry', true);\nvar_dump($industry);\n\n\nResult:\n\narray(37) {\n [\"ID\"]=>\n string(2) \"94\"\n [\"post_author\"]=>\n string(1) \"1\"\n [\"post_date\"]=>\n string(19) \"2014-05-20 18:30:28\"\n ...\n}\n\n\nI need to filter this post through the industry's ID value.\nWhat I've tried to do is to modify the $args of the query_posts():\n\n$args = array(\n 'post_type' => 'industries_contacts',\n 'meta_query' => array(\n array(\n 'key' => 'industry',\n 'value' => array('ID' => $industry_ID),\n 'compare' => '='\n )\n ),\n 'posts_per_page' => 10, \n 'paged' => get_query_var('paged'),\n);\nquery_posts($args);\n\n\nBut of course this failed to work, and gave me an error.\n\nPlease keep in mind that I want to use WordPress' pagination, so I can't run conditional statements inside the loop to remove the unwanted posts from the archive page."
] | [
"php",
"wordpress"
] |
[
"Mongoose creating a regular expression and searching in model for blog",
"I want to implement searching in my blog so far what I have done is created a blog having search form which takes a string as input and make get request.\n\nNow in that request I have a function which gets called for searching the string in my blog head or body.\n\nSo if a user types \"foo bar\" I get my results that have \"foo bar\" \n\nBut what I want is that this function searches for each space separated word and AND the result. i.e. search for \"foo\", search for \"bar\" and intersect the results to get\nposts having \"bar foo\", \"foo hello bar\", \"bar hello foo\"\n\nfunction(searchQuery, callback){\n var query = { \n $or:[\n { head: {$regex: searchQuery, $options: \"i\"} },\n { body: {$regex: searchQuery, $options: \"i\"} } \n ]\n };\n Post.find(query, {sort: { date: -1 }, page: i, limit: 5 }, callback);\n}\n\n\nthe url of get requests is as follows\n\nlocalhost:5000/blog/?searchQuery=FOO+BAR\n\n\nIf there is some other way around of doing this I am open to suggestions."
] | [
"node.js",
"regex",
"mongodb",
"mongoose"
] |
[
"Selecting column after groupby without using explicit column name",
"With the following dataset:\nimport pandas as pd\ndf = pd.DataFrame({'Date':['26-12-2018','26-12-2018','27-12-2018','27-12-2018','28-12-2018','28-12-2018'],\n 'In':['A','B','D','Z','Q','E'],\n 'Out' : ['Z', 'D', 'F', 'H', 'Z', 'A'],\n 'Score_in' : ['6', '2', '1', '0', '1', '3'], \n 'Score_out' : ['2','3','0', '1','1','3'],\n 'Place' : ['One','Two','Four', 'Two','Two','One']})\n\nI would like to code groupby rules on a generic form in order to try parameterizing subsets creation.\nFor instance, instead of the following:\ndf.groupby('In').Score_in.sum()\n\nI suppose my desired output would be something like #1 or #2 with df.columns[] or .iloc[:,[]] syntaxes like:\ndf.groupby(df.columns[1]).df.iloc[:,[3]].sum() #1\ndf.groupby(df.iloc[:,[0]]).df.iloc[:,[3]].sum() #2\n\nOf course, none of the above syntaxes works. Any help?"
] | [
"python",
"pandas",
"dataframe",
"functional-programming"
] |
[
"static constants class causing error when added static readonly property",
"public static class Constants\n{\n\n public const string Fields_Fax = \"FAX\";\n public const string Fields_DataProtectionPost = \"DATAPROTECTIONPOST\";\n public const string Fields_DataProtectionTel = \"DATAPROTECTIONMOBILE\"; \n public const int AddressBookID = 595204;\n\n public static readonly XName PersonXName = \"Person\";\n\n\nThis class is in a window service solution. The service was installed locally and was running using the values above.\n\nI took over the project and added some static readonly XName types of my own to this class.\nNow I get an error \"The type initializer for 'This.App' threw an exception\" when i use any property from that class.\n\nThere is only 1 project and I've recompiled solution and reinstalled the window service. Any idea what the problem is?\n\nThe exception is:\n\n\"The type initializer for 'Constants' threw an exception\"\n\n\n...the inner exception is:\n\n\"The ' ' character, hexadecimal value 0x20, cannot be included in a name.\"\n\n\n...I commented out my changes and it was reading correctly with no errors. So I added just 1 line which looks similar to the \"Person\" constant but caused it to fail:\n\npublic static readonly XName cor_Tel_GeneralXName = \"Tel General\";"
] | [
"c#",
"static",
"windows-services",
"constants",
"readonly"
] |
[
"Ignore `host not found` in upstream` error",
"I have the following configuration:\n\nserver {\n listen 80;\n server_name client.dev;\n\n location ~ /rest/ {\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $remote_addr;\n proxy_set_header Host $host;\n proxy_pass http://somedomain:8081;\n }\n\n\nhttp://somedomain:8081 is only accessible when I'm connected through VPN, however other configuration blocks are accessible when I'm not. When I start Nginx and I'm not connected through VPN it fails to start with the message host not found in upstreambecause it can't accesshttp://somedomain:8081`. Is there any way to ignore that error and start Nginx normally when I'm not connected through VPN?"
] | [
"nginx"
] |
[
"How to display a blog post based on it's ID with React?",
"In my News component I have an array of posts:\nconst cardInfo = [\n {\n id: 1,\n date: "12/07/2020",\n title: "Machine Learning",\n author: "Alex M.",\n text: "text1"\n },\n {\n id: 2,\n date: "12/07/2020",\n title: "AI",\n author: "Alex E.",\n text: "text2"\n }\n ]\n\nA renderCard function that renders the array:\nrenderCard = (card, index) => {\nreturn (\n <Row id={index}>\n <Col sm="10">\n <Card key={index}>\n <CardBody>\n <CardTitle tag="h5" className="mb-2 text-muted">\n {card.title}\n </CardTitle>\n <CardSubtitle tag="h6" className="mb-2 text-muted">\n Written on {card.date} by {card.author}\n </CardSubtitle>\n <CardText className="mb-2 text-muted">\n <ReadMoreReact\n text={card.text}\n readMoreText="Read more."\n min={160}\n ideal={200}\n />\n </CardText>\n <CardSubtitle tag="h6" className="mb-2 text-muted">\n Category: {card.category}\n </CardSubtitle>{" "}\n <Button>Read more.</Button>\n </CardBody>\n </Card>\n </Col>\n </Row>\n);\n};\n\nReturn statement that displays the array of posts and also titles of recent posts sorted by date:\nreturn (\n <div>\n <CareersHeader />\n <div className="news">\n <h1 className="news__title" id="news-title">\n Blog\n </h1>\n <div className="news__content">\n <div className="item1 news__posts">\n {cardInfo.map(this.renderCard)}\n </div>\n <div className="item2 news__recent_posts">\n <div>Recents Posts:</div>\n <div>\n {cardInfo\n .sort((a, b) => (a.date > b.date ? 1 : -1))\n .map((post, index) => (\n <button onClick={what to do} key={index}>\n {post.title}\n </button>\n ))}\n </div>\n </div>\n </div>\n </div>\n </div>\n);\n\nPost titles in recent posts list are buttons. When you click on a button, it should open that particular blog post. I have added in App.js this route:\n<Route exact path="/news/:id" component={BlogPostDetails} />\n\nBlogPostDetails component\nreturn (\n <div>\n <CareersHeader />\n <div className="news">\n <h1 className="news__title" id="news-title">\n Blog\n </h1>\n <div className="news__content">\n <div className="item1 news__posts">\n <p>Blog post</p>\n {cardInfo.map((card) => (\n <div key={card.id}>{renderCard}</div>\n ))}\n </div>\n </div>\n </div>\n </div>\n);\n\nHowever, I don't know how to match the id from URL with the id of the post title clicked.\nI have tried with useParams() hook, but I was getting errors that I couldn't resolve (invalid hook call). Also, I am wondering if I could just create a function that would be called on a button click, something like this:\nconst displayPost= (index) => {\n const url = "/news/" + index;\n window.open(url, "_top");\n};\n\nI'm sure there is quite simple way in React to do this, just that I'm still quite new and don't understand the lifecycle. Help appreciated."
] | [
"reactjs",
"react-router",
"react-dom"
] |
[
"mySQLdump from Linux machine to a mounted Windows folder on a remote server",
"I am trying to do a mysqldump from a local Linux machine to a Windows folder that has been mounted on the system. This is the command I am using in the terminal:\n\nmysqldump -u root -plinuxsux myDB -t LOG > /mounted folder/path/blah/myDB.sql\n\n\nI am getting the following error:\n\n/mounted folder/path/blah/myDB.sql: Permission denied\n\n\nI checked the permissions of the folder on the Windows side, and there is a specific user that I created called Sys003 that has full control of that folder.\n\nDo I need to put that user name (and password) into the command above to get it to work? And if so, how do I do that? Thanks."
] | [
"linux",
"windows",
"mount"
] |
[
"Adjust pie chart slice size by dragging the edge",
"I'm trying to adapt the growing pie demo on Raphaël's website to suit my own needs. http://raphaeljs.com/growing-pie.html\n\nThe demo is almost perfect as it is, but I would like the user to be able to drag the edges of the slices to adjust their size, instead of clicking on them. This would be not only more intuitive, but also allow for adjusting the size exactly, instead of the stepped approach in the demo.\n\nHow would I go about this? Thanks in advance."
] | [
"javascript",
"svg",
"raphael"
] |
[
"animate background image with background size - jsfiddle updated",
"I'm trying to animate a background of a div element and I've got it to animate from some one else's code. The problem is the background's css attribute is background-size:cover so it show a duplicate of that image in it's animation, how do I create an animation of horizontal and vertical position of an image and not have a duplicate image showing after the animation is done? Is there a piece of code that can make it work the way I want it to or is there a plugin that can do this that has a zoom effect for background-size, P.S the background has to be background-size:cover because of an elastic web design, here is the code. \n\njsfiddle\n\n$({temporary_x: 0, temporary_y: 0}).animate({temporary_x: -20, temporary_y: -20}, {\nduration: 350,\nstep: function() {\n var position = Math.round(this.temporary_x) + \"px \" + Math.round(this.temporary_y) + \"px\";\n $(\"#image\").css({\"background-position\": position, backgroundSize: 'auto !important'});\n }\n});"
] | [
"javascript",
"jquery",
"css"
] |
[
"Simplify Boolean (X + Y)(X' + Z) = XZ + X'Y",
"I am trying to solve this equation but I get z(x + y) + yx'. I am also wondering if this counts as the communicative boolean law ."
] | [
"boolean-logic"
] |
[
"Missing required metadata WP 8 app submission",
"I have this error displayed when trying to submit my app:\n\n\n\nThis error applies to all the languages I intend to support for my app apart from the default language(English) which was not listed among the error list.\n\nI have added all necessary metadata which I think only applies for the default language(English).\n\nHow do I make these metadata available for other languages my app support. In my .csproj file I this:\n\n<SupportedCultures>fr%3bar%3bzh-Hans%3bzh-Hant%3bhi%3bpt%3bru%3bes%3btr</SupportedCultures>"
] | [
"c#",
"visual-studio",
"windows-phone-7"
] |
[
"Count child DIVs + add class",
"I have the following bit of code to display thumbnails on a page:\n\n<div id=\"gallery\">\n <div class=\"thumbnail\">\n <img src=\"\" />\n </div>\n </div>\n\nThis will loop to show 15 .thumbnail DIVs.\n\nI would like to attach a class of \".last\" to the 5th DIV and the 10th DIV. And for the 11-15th DIVs a class of \".bottom-last\".\n\nI understand that this is the way to go: http://api.jquery.com/length/ but cannot figure out a way to get the count and then attached the class.\n\nAny pointers?\n\nThanks a lot"
] | [
"jquery",
"css"
] |
[
"TouchableHighlight in the rows of a SectionList/Flatlist not clickable while scrolling",
"We have a SectionList with rows that are wrapped with the TouchableHighlight tag. When the user scrolls he is not able to click on a row until the SectionList comes to a full stop. This leads to a UX feeling of a delayed click. We would like to make the TouchableHighlight clickable even while scrolling. Any option to get around this?\n\n<TouchableHighlight underlayColor={colors.rowClick}\n onPress={props.onPress}>\n <View style={styles.container}>\n ...\n </View>\n</TouchableHighlight>"
] | [
"react-native",
"react-native-flatlist",
"react-native-sectionlist"
] |
[
"Does mnesia handle paging?",
"I have a relatively large dataset (20GB) that I want to cache locally, but the machines it is running on only has about 8GB of RAM. Does mnesia in disc_copies mode support paging, or does the entire dataset have to fit in memory?"
] | [
"erlang",
"mnesia"
] |
[
"Convert a decimal into an alphabetic column id?",
"Working with some spreadsheet stuff, internally the columns are referred to by a simple decimal number (0 indexed), but for the output, I need it to be in the standard human readable format:\n\nA, B, C, .. Z, AA, AB, AC, .. AZ, BA ..\n\n\nI first thought \"easy! I'll just switch to base 26 and use [A-Z] instead of [0-9A-P]\", except that using this technique makes A => 0. B => 1. Therefore the sequence actually goes like this:\n\nA, B, .. Y, Z, BA, BB\n\n\nHow do you convert decimals to an excel-style column name?"
] | [
"algorithm"
] |
[
"Accessing SQLite PRAGMA User_version in Delphi",
"How do I access the result of\n\nPRAGMA User_version\n\n\nin Delphi using DbExpress components?\n\nMy code thus far:\n\nSQL_dataset1.CommandType:=ctQuery;\nSQL_dataset1.CommandText:='PRAGMA User_version';\nSQL_dataset1.Open;\n\nIf SQL_dataset1.IsEmpty=False then\nbegin\n SQL_dataset1.First;\n\n Result:=SQL_dataset1.FieldByName('User_version').AsInteger;\n ........\n\n\n... gives an error telling me that no field called User_version exists. \n\nAny help would be appreciated."
] | [
"sqlite",
"delphi",
"delphi-xe",
"dbexpress"
] |
[
"How to remove last N lines from txt file with Python?",
"I would like to know what is the fastest and more efficient way of deleting last N lines of a .txt file. \n\nI have been looking for different previous questions and I found that reading and copying lines again is one way.\n\nRemove lines from textfile with python\n\nNonetheless, I have been trying to look for other way such as skiprows or skipfooter on pandas and be able to save the outcome to other txt.\n\nAt the same time, I have seen threads about \"head\" and \"sed\" but not sure about their usage in Python. \n\nCould you, please, give advice on this topic?"
] | [
"python"
] |
[
"Login and XML Orbeon",
"I have two new questions:\n\n1) I configure the orbeon Form to restrict the access to users (with tomcat). This works good. But the Page for login is in english (I need view this page in Spanish) and the style from this page is bad. So, it's possible configure this page?\n\nI thinked update the orbeon-form-runner.jar, descompress and edit the login.xhtml and compress to new orbeon-form-runner.jar but i recibe a error when i start the orbeon:\n\nthis is the error:\n\nAt least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.\n\n\n2.- I try load data from XML to dinamic data dropdown. \n\nI followed the example in the documentation to orbeon, and work this action (Load States).\n\nBut i need load in the dropdown my data ¿Where do i start?¿What is the structure from file to load data from XML to DropDown?\n\nPD: I use Tomcat 7 and the orbeon run in Centos 6.5"
] | [
"xml",
"login",
"jar",
"tomcat7",
"orbeon"
] |
[
"how to hash a password laravel 5.2 model create",
"I'm creating admin user via model and it saving record successfully but password is not being hashed as follows:\n\n$request->password = bcrypt($request->input('password'));\n Admin::create($request->except('_token'));"
] | [
"laravel",
"laravel-5",
"laravel-5.2"
] |
[
"Flatlist not working inside TouchableWithoutFeedback",
"I have a component that dismisses the keyboard. I then wrap my entire component with this one so whenever I tap outside of the TextInput the keyboard gets dismissed . But the problem is that in my other component I have a Flatlist and it does not scroll at all with TouchableWithoutFeedback. Any recommendations will be appreciated because I have not found a solution yet for hours! Thank you!\nexport const DismissKeyboard: React.FC<{\n isKeyboardOpen?: boolean\n style?: ViewStyle\n}> = ({ children, style }) => (\n <TouchableWithoutFeedback onPress={Keyboard.dismiss}>\n <View style={style}>{children}</View>\n </TouchableWithoutFeedback>\n)\n\n<DissmissKeyboard>\n<FlatList \n...flatlist data\n />\n</DissmissKeyboard>"
] | [
"react-native",
"keyboard",
"flatlist"
] |
[
"Syntax Errors in Netbeans while using promises and node.js",
"I have a working node.js project with 4.5+ node.js and Q Promise. I am using netbeans to edit the project. However i am getting syntax error all over the project. How can i and from where can i add dependency/plugin in netbeans to avoid these syntax issues. \n\nHere is a sample"
] | [
"node.js",
"promise",
"netbeans-7"
] |
[
"AngularJS ng-change not firing after being compiled from within a directive",
"This is my directive:\n\ndirective('test', ['$compile', function ($compile) {\n return {\n restrict: 'A',\n link: function(scope, element, attrs) {\n element.attr('ng-change', \"someFunction()\"); // <--- Doesnt Work\n element.attr('ng-blur', \"someFunction()\"); // <--- Works\n element.removeAttr('test');\n $compile(element)(scope);\n }\n };\n }])\n\n\nMarup is this\n\n<input ng-model=\"foo\" test />\n\n\nNow, the blur handler is being invoked, while the change handler isn't. Why?"
] | [
"javascript",
"angularjs",
"angularjs-directive"
] |
[
".htaccess block all but my ip",
"I'm trying to do a quick htaccess to block all but my ip.\n\nI have this\n\n order deny, allow\n deny from all\n allow from \"MY IP\"\n\n\n\"MY IP\" is my ip\n\nI can't see if from my ip - is this the correct way to do this ?"
] | [
"html",
"apache",
".htaccess"
] |
[
"sql server matching field containing \"$$\" and \"%\"",
"One of my column in sql table contain values like\n\n$$ADC.ES%32,A\n\n\nHow can I match this in my select where clause?\n\nSelect .... From .... Where ColumnName = '$$ADC.ES%32,A'\n\n\nThanks"
] | [
"sql",
"where-clause",
"collate"
] |
[
"Parsing error: Unexpected token, expected \",\" in app.js file",
"i am having this "parsing error in my app.js file. I have tried looking for what could have caused the error but i can't seem to see anything.\nimport React, {useEffect, useState} from "react";\n\nimport Movie from './components/Movie';\n\nconst FEATURED_API ="https://api.themoviedb.org/3/discover/movie?sort_by=popularity.desc&api_key=04c35731a5ee918f014970082a0088b1&page=1";\nconst IMG_API = "https://image.tmdb.org/t/p/w1280";\nconst SEARCH_API = "https://api.themoviedb.org/3/search/movie?&api_key=04c35731a5ee918f014970082a0088b1&query=";\n\nfunction App() {\n const [ movies, setMovies ] = useState([]);\n\n useEffect(() => {\n fetch(FEATURED_API)\n .then((res) => res.json())\n .then((data) => {\n console.log(data);\n setMovies(data.results);\n });\n }, []);\n\n return <div>{movies.length > 0 && \n movies.map((movie) => <Movie />)}</div>;\n}\n\nexport default App;"
] | [
"reactjs"
] |
[
"Can't Manipulate data inserted from an ajax request in jQuery",
"After calling the server and turning the data it returns into a table. I insert it into the page using jQuery's .html() syntax. After that the data appears in the page but I can't manipulate it using jQuery.\n\nheres the code:\n\n<html>\n<head>\n <title>testJavaScript</title>\n\n <script type=\"text/javascript\" src=\"jquery-1.4.2.js\"></script>\n\n <script type=\"text/javascript\">\n\n function makeTable(data) {\n\n var htmlOut = \"<table id=\\\"AjaxTable\\\">\";\n\n for (x in data) {\n htmlOut += \"<tr>\";\n for (y in data[x]) {\n htmlOut += \"<td>\"+data[x][y]+\"</td>\";\n }\n htmlOut += \"</tr>\";\n }\n\n htmlOut += \"</table>\";\n\n return htmlOut;\n }\n\n function getValue() {\n return $(\"#MyText\").val()\n }\n\n $(document).ready(function () {\n\n $(\"img\").hover(function () { //This dosent work on the data returned from the server\n $(this).hide(1000)\n //$(this).css({'background-color': '#357EC7', 'border': '2px solid #2B60DE'});\n })\n\n $(\"#populateDrop\").click(function () {\n $.getJSON('http://127.0.0.1:5000/ajaxTest/json?num='+ getValue() +'&callback=?', function(data) {\n $(\".result\").html(makeTable(data.data));\n })\n\n })\n })\n </script>\n</head>\n\n<body>\n <img src=\"http://www.sharejs.com/code/windows/light-window/gallery/1-nature.jpg\" width=\"50\" height=\"50\" /></br>\n <form>\n <input id=\"MyText\" type=\"text\" value=\"15\" />\n </form>\n <a href=\"#\" id=\"populateDrop\">Populate!</a></br>\n <div class=\"result\"></div>\n</body>"
] | [
"javascript",
"jquery"
] |
[
"Linux system utilization import in PostgreSQL Database",
"I want to import the daily Linux system utilization file in PostgreSQL Database.\n\n# ls /var/log/sa\nsar -f sa13 >>/tmp/test_clean.csv\n\n\nI am able to generate a .csv file using above command, but this format is allowing me to import into PostgreSQL database.\n\nroot#> less /tmp/test_clean.csv\n<Linux redhat version> (servername) <date> _x86_64_ (2 CPU)\n\n12:00:01 AM CPU %user %nice %system %iowait %steal %idle\n12:10:01 AM all 0.10 0.00 0.05 0.02 0.00 99.83\n12:20:01 AM all 0.12 0.00 0.06 0.02 0.00 99.80\n12:30:01 AM all 0.08 0.00 0.05 0.02 0.00 99.85\n12:40:01 AM all 0.06 0.00 0.05 0.02 0.00 99.88\n12:50:01 AM all 0.07 0.00 0.05 0.02 0.00 99.86\n01:00:01 AM all 0.09 0.00 0.05 0.02 0.00 99.84\n01:10:01 AM all 0.07 0.00 0.05 0.02 0.00 99.86\n\n\nAny Solution..!!"
] | [
"linux",
"postgresql",
"redhat"
] |
[
"Fetch Selected Fields in WP_Query Class in WordPress",
"I want to fetch selected fields in WP_Query Class in WordPress.\nI didn't find any argument for the same.\n\nargs=array('tag' => $tagname,'showposts'=>$no_of_post,'caller_get_posts'=>1);\n$my_query = new WP_Query($args);\n\n\nI need only title and description of the post.\nHow to pass selected field in WP_Query function ?"
] | [
"wordpress"
] |
[
"Converting a JSON object with multiple lists as fields",
"I'm using jackson's ObjectMapper to convert JSON files into Java objects.\nHow do I convert a JSON object that has an array as one of its fields? Example below:\n\n{\n \"list\":[\n {\n \"value\":\"example\"\n },\n {\n \"value\":\"example2\"\n }\n ]\n}\n\n\nObjectMapper converts this into a LinkedHashMap with lines as the key and the value is an ArrayList with LinkedHashMaps, which have valueand example and so on. \n\nIs there a way to read this json as an Object with a field list that is a List/Array containing objects which would fit (in this case, a simple object with String value as a field)?"
] | [
"java",
"json",
"jackson"
] |
[
"Why are SQLite transactions bound to harddisk rotation?",
"There's a following statement in SQLite FAQ:\n\n\n A transaction normally requires two complete rotations of the disk platter, which on a 7200RPM disk drive limits you to about 60 transactions per second.\n\n\nAs I know there's a cache on the harddisk and there might be also an extra cache in the disk driver that abstract the operation that is perceived by the software from the actual operation against the disk platter. \n\nThen why and how exactly are transactions so strictly bound to disk platter rotation?"
] | [
"sqlite",
"transactions"
] |
[
"Add New value to XML via powershell",
"I have Googled how to do this and I am struggling to understand. I currently have this XML\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<gl:GLOBALLISTS Xmlns:gl=\"http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/globallists\">\n<GLOBALLIST name=\"ListOfVersions - PWCC\">\n<LISTITEM value=\"1.1.3.2705\" />\n<LISTITEM value=\"1.1.4.2801\" />\n<LISTITEM value=\"1.1.4.2802\" />\n<LISTITEM value=\"1.1.4.2803\" />\n<LISTITEM value=\"1.1.4.2804\" />\n<LISTITEM value=\"1.1.5.2901\" />\n<LISTITEM value=\"1.1.5.2902\" />\n<LISTITEM value=\"Unknown\" />\n</GLOBALLIST>\n</gl:GLOBALLISTS>\n\n\nIn a C:\\ drive location. I want to use PowerShell to add a new list item value using a $NewListItem. So I can specify this each time I need to. So the List would now include 1.1.5.2903 as an example.I have tried using other code provided on other site but to no luck.\n\nAny help would be much appricated"
] | [
"xml",
"powershell"
] |
[
"Html. Text input cuts first character \"j\"",
"I have a text input:\n\n<input type=\"text\" name=\"test1\" value=\"jj\" style=\"padding:0px;font-size:70px; font-family: 'Times New Roman'\">\n\n\nBut the first \"j\" character is not fully visible with Times New Roman font-family. What could be a problem?\n\n\n\nEDIT\n\nIn my case padding-left does not help. I add padding-left:30px and the result is:"
] | [
"html",
"css",
"text",
"input",
"fonts"
] |
[
"Jquery Ui Draggable updating diffrent css attributes",
"Hello friends i want to know if i can use jquery draggable plugin to update margin-left and margin-top property by default it updates left and top properties of css on drag event.\nplease help"
] | [
"php",
"jquery"
] |
[
"Ensuring select statements for one user are true for another when user updates?",
"How can I ensure that if user-a manually updates some of his information when user-b is accessing user-a's data, that user-b accessing the information gets the correct updated information and not the old stale data for user-a.\n\nI understand transaction are good and row level locking, I just want to make sure I am doing it correct!\n\nWhen updating user-a's information I am using,\n\n$dbc -> beginTransaction();\n$dbc -> query(\"SELECT id FROM accounts WHERE id = \" . $user['id'] . \" FOR UPDATE LIMIT 1\");\n$q = $dbc -> prepare(\"UPDATE accounts SET name = ?\");\n$q -> execute(array($_POST['name']));\n$dbc -> commit();\n\n\nUsing the above does this lock the user-a's data so that when user-b gets his data for user-a using,\n\n$q = $dbc -> (\"SELECT * FROM accounts WHERE id = ?\");\n$q -> execute(array($_GET['id']));\n\n\nHe will get the correct updated data? Or do I need to use a transaction when getting user-a's data for user-b??\n\nI am a little confused by all this locking and stuff, as you can probably tell?!?\n\nThanks"
] | [
"mysql",
"transactions",
"locking"
] |
[
"Replacing value in string depending on inner value",
"Im trying to make a template string that has place holders which are replaced by values from a database depending on their inner value. \nie, the template would look like this:\n\n\nNo: {Job_Number}\nCustomer: {Cust_Name}\nAction: {Action}\n\n\n\nThe template could be changed to anything, with any column value being inside the brackets.. \nI can not figure a elegant way to get the inner values and replace them with the values..."
] | [
"c#",
"winforms"
] |
[
"What event is triggered when a tab fragment is selected",
"I'm using tab fragments in an activity and the actionbar hosts the tabs. \nWhat I want to do is that whenever a fragment appears (or re-appears) in the view (selected by the user), I start doing something. I cannot use onResume of the fragment in this case, since all tabs are never really 'paused' when the user selects another tab, so onResume is not called\n\nI can use the two following events from the hosting activity, but I don't want them since I expect the fragment should know this logic on its own and do that task. Any idea? tks.\n\n @Override\n public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {\n // When the given tab is selected, switch to the corresponding page in the ViewPager.\n mViewPager.setCurrentItem(tab.getPosition());\n }\n\n @Override\n public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {\n }"
] | [
"android",
"android-tabs"
] |
[
"If statement in python working different just by changing position of condition",
"I just encountered a weird problem in python:\nbelow is an implemntation of the merge sort algorithm that gives me an index error if I try to run it.\ndef mergesort(s1,s2,S):\n i,j = 0,0\n while i+j < len(s1)+len(s2):\n if (i < len(s1) and s1[i] < s2[j]) or j == len(s2):\n S.append(s1[i])\n i += 1\n else:\n S.append(s2[j])\n j += 1\n return S\n\ns2 = [1,5,7]\ns1 = [2,3,4,6,8]\nS = []\nprint(mergesort(s1,s2,S))\n\nOutput of this program is :\nTraceback (most recent call last):\n File "new.py", line 15, in <module>\n print(mergesort(s1,s2,S))\n File "new.py", line 4, in mergesort\n if (i < len(s1) and s1[i] < s2[j]) or j == len(s2):\nIndexError: list index out of range\n\nand now just by typing j == len(s2) before, in the if statement, the program runs perfectly fine:\ndef mergesort(s1,s2,S):\n i,j = 0,0\n while i+j < len(s1)+len(s2):\n if j == len(s2) or (i < len(s1) and s1[i] < s2[j]):\n S.append(s1[i])\n i += 1\n else:\n S.append(s2[j])\n j += 1\n return S\n\ns2 = [1,5,7]\ns1 = [2,3,4,6,8]\nS = []\nprint(mergesort(s1,s2,S))\n\nOutput: [1, 2, 3, 4, 5, 6, 7, 8]\nThis is really surprising to me as both the programs are exactly the same but the former one gives me an error.\nFurthermore, the offending program runs fine in c++:\n#include <iostream>\n\nusing namespace std;\n\nint main() { \n int s1[10] = { 2, 3, 4, 6, 8 }, s2[10] = { 1, 5, 7 }, s[20], i = 0, j = 0, x = 0;\n while (i + j < 8) {\n if ((i < 5 && s1[i] < s2[j]) || j == 3) {\n s[x++] = s1[i];\n i++;\n } else {\n s[x++] = s2[j];\n j++;\n }\n }\n for (int i = 0; i < 8; i++) {\n cout << s[i];\n }\n return 0;\n}\n\nOutput: 12345678\nand why does the program that was giving me an error in python run perfectly fine in c++?\ndoes the if statement of python work differently than the if statement of c++?"
] | [
"python",
"c++",
"mergesort"
] |
[
"Unable to call stored procedure result list tables in another stored procedure mysql statement?",
"CODE START\nDROP PROCEDURE createTable2020;\nCREATE PROCEDURE createTable2020()\n\nCALL getTablesListNew(@a);\n\nSET @query = CONCAT('CREATE TABLE DB1.',@a,' AS SELECT * FROM DB2.',@a,' WHERE dateTimeCommon >= \n "2020-01-01 00:00:00" AND dateTimeCommon < "2021-01-01 00:00:00"');\n\nPREPARE stmt FROM @query;\n\nEXECUTE stmt;\n\n\nCALL createTable2020();\n\nCODE END\nError Code: 1064\nYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1\nCODE END"
] | [
"stored-procedures"
] |
[
"I got a C++ cygwin_exception and a stacktrace but I don't know what is going on",
"I tried to test my Data class which is supposed to read, write and print a 2d vector map.\n\nData.h:\n\n/* \n * File: Data.h\n * Author: Kevin\n *\n * Created on 04 October 2015, 19:54\n */\n\n#ifndef DATA_H\n#define DATA_H\n#include <fstream>\n#include <string>\n#include <vector>\nusing std::ifstream;\nusing std::ofstream;\nusing std::string;\nusing std::vector;\n\nclass Data {\n\npublic:\n Data();\n void readMap();\n void writeMap();\n void writePlayerData();\n void readPlayerData();\n void printMap();\nprivate:\n ifstream _input;\n ofstream _output;\n unsigned _ySize;\n unsigned _xSize;\n vector<vector<char> > map;\n};\n\n#endif /* DATA_H */\n\n\nData.cpp:\n\n/*\n* File: Data.cpp\n* Author: Kevin\n*\n* Created on 04 October 2015, 19:54\n*/\n#include <iostream>\n#include \"Data.h\"\n#include <fstream>\n#include <cstdlib>\n#include <cstdio>\nusing std::cout;\nusing std::endl;\nusing std::getline;\n\nData::Data() {\n _ySize = 0;\n _xSize = 0;\n}\n\nvoid Data::writeMap() {\n _output.open(\"map.txt\");\n _output << \"Test\" << endl;\n _output.close();\n}\n\nvoid Data::readMap() {\n string const fileName = \"map.txt\";\n string line;\n _input.open(\"map.txt\");\n if (_input.fail()) {\n perror(\"map.txt\");\n }\n unsigned y = 0;\n while (getline(_input, line)) {\n line = line.c_str();\n for (int i = 0; i < line.length(); i++) {\n map[y][i] = line[i];\n }\n }\n}\n\nvoid Data::printMap() {\n cout << \"Printing Map... \\n\" << map.size() << \"\\n\" << endl;\n for (int y = 0; y < _ySize; y++) {\n cout << map.size() << endl;\n for (int x = 0; x < _xSize; x++) {\n cout << map[y].size() << endl;\n cout << map[y][x] << endl;\n }\n\n }\n}\n\n\nUsing this main function:\n\n#include <iostream>\n\n#include \"Data.h\"\n\nint main() {\n Data dataTest;\n //dataTest.writeMap();\n dataTest.readMap();\n //dataTest.printMap();\n }\n\n\nAnd I got this error message (I'm using netbeans): \n\n2 [main] roguelike 9280 cygwin_exception::open_stackdumpfile: Dumping stack trace to roguelike.exe.stackdump\n\nRUN FAILED (exit value 35,584, total time: 1s)\n\n\nAnd in the file that contains the stacktrace is this:\n\nException: STATUS_ACCESS_VIOLATION at rip=001004024C0 rax=0000000000000000 rbx=0000000000000000 rcx=0000000000000000 rdx=0000000000000000 rsi=00000006000283D0 rdi=0000000000000000 r8\n=000000000000000A r9 =8080808080808080 r10=FEFEFEFEFEFEFEFF r11=0000000600042708 r12=0000000000000000 r13=0000000000000001 r14=000000000024CB63 r15=000000000024CB63 rbp=000000000024C5F0 rsp=000000000024C5F0 program=C:\\Users\\Kevin\\Documents\\NetBeansProjects\\Dev\\Roguelike\\dist\\Debug\\Cygwin_4.x-Windows\\roguelike.exe, pid 9280, thread main cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B Stack trace: Frame Function Args 0000024C5F0 001004024C0 (00000000000, 006000283D0, 00000000000, 00600042708) 0000024C680 001004012D6 (00000000001, 001802E3A40, 00000000000, 003FF0AB258) 0000024C6F0 001004016CE (00000000020, FF0700010302FF00, 0018004830F, 0000024D680) 0000024CBC0 00180048380 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 0018004607C (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 00180046114 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 001004018B1 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 00100401010 (00000000000, 00000000000, 00000000000, 00100401000) 00000000000 7FFD5D852D92 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 7FFD5F7D9F64 (00000000000, 00000000000, 00000000000, 00000000000) End of stack trace\n\n\nAnd I really can't figure out what's going on."
] | [
"c++",
"cygwin"
] |
[
"data transfering problem WCF",
"Why cant I send array with more than 3000 elements with size ~5 MB but with table with size 2500 elements there is no problem ?\n\n<binding name=\"testBinding\" maxBufferSize=\"100485760\" maxReceivedMessageSize=\"100485760\" maxBufferPoolSize=\"100485760\" closeTimeout=\"00:10:00\" openTimeout=\"00:10:00\" receiveTimeout=\"00:10:00\" sendTimeout=\"00:10:00\">\n <readerQuotas maxDepth=\"1000\" maxStringContentLength=\"100485760\" maxArrayLength=\"100485760\" maxBytesPerRead=\"100485760\" maxNameTableCharCount=\"100485760\" />\n </binding>\n\n\nChanging of any of this parameters doesnt give any good results"
] | [
".net",
"wcf"
] |
[
"GetProcAddress() not working on x64 Python",
"from ctypes import *\nkernel32 = windll.kernel32\nmsvcrt = cdll.msvcrt\n\ndef func_resolve(dll, function):\n handle = kernel32.GetModuleHandleA(dll)\n error = kernel32.GetLastError()\n print \"%d: %s\" % (error, FormatError(error))\n\n address = kernel32.GetProcAddress(handle, function)\n error = kernel32.GetLastError()\n print \"%d: %s\" % (error, FormatError(error))\n\n kernel32.CloseHandle(handle)\n return address\n\nmsvcrt.printf(\"printf\\n\")\nprintf_address = func_resolve(\"msvcrt\", \"printf\")\ngetmodulehandle_address = func_resolve(\"kernel32\", \"getmodulehandlea\")\n\n\nThis is x64 python. Just trying to get the address of some functions. I use printf there just to make sure that msvcrt is loaded. When I execute I get this:\n\n0: The operation completed successfully.\n126: The specified module could not be found.\n6: The handle is invalid.\n127: The specified procedure could not be found.\nprintf\n\n\nWhy I get a handle for msvcrt but not for kernel32? And since I have a proper handle, why GetProcessAdress() is failing for printf? If I execute this with x86 python it works for the printf (kernel32 still fails). Does this mean that ctypes is loading only 32 bit dlls? If so is there a way of loading 64 bit instead?"
] | [
"python-2.7",
"ctypes"
] |
[
"Authenticating Rails App w/ Soundcloud, Getting 401 Unauthorized Error: invalid_grant",
"Forgive me if this is a stupid question, novice programmer here. \n\nI am trying to use the Soundcloud API to authenticate users in my Rails 3.2.14 app. I'm using the code directly from the Soundcloud developer docs, like so:\n\nclient = Soundcloud.new(\n :client_id => 'MY_CLIENT_ID',\n :client_secret => 'MY_CLIENT_SECRET',\n :redirect_uri => 'http://localhost:3000/auth/soundcloud/callback'\n )\n\n# redirect user to authorize URL\nredirect_to client.authorize_url(:scope => 'non-expiring')\n\n\nAnd when I GET the callback URI:\n\nclient = Soundcloud.new(\n :client_id => 'MY_CLIENT_ID',\n :client_secret => 'MY_CLIENT_SECRET',\n :redirect_uri => 'http://localhost:3000/auth/soundcloud/callback'\n )\n\n# exchange authorization code for access token\ncode = params[:code]\naccess_token = client.exchange_token(:code => code)\n\n\nEverything works fine (I am taken to the Soundcloud page to give my app permissions) but when I am sent back to the callback URI I receive the following error:\n\nSoundCloud::ResponseError at /auth/soundcloud/callback\nHTTP status: 401 Unauthorized Error: invalid_grant\n\n\nI've obviously googled this and the only suggestion made was that my token is expiring. That doesn't make sense to me because I'm not reusing the access_token later, I'm just doing the initial authentication. Just in case I included the scope => non-expiring parameter when I redirected to Soundcloud, which made no difference.\n\nAny suggestions? Has anyone had success integrating Rails with Soundcloud recently? All of the resources I've found seem quite outdated."
] | [
"ruby-on-rails",
"authentication",
"soundcloud"
] |
[
"add a button in a tableview cell iphone",
"I have this problem ...\nI want to put my button in a cell of my table\nview .. I do this ..\n\nUIButton *dowMapBt = [UIButton buttonWithType:UIButtonTypeCustom];\n [dowMapBt setFrame:CGRectMake(0, 0, cell.frame.size.width, 70)];\n [dowMapBt setTitle:@\"Download Map\" forState:UIControlStateNormal];\n\n dowMapBt.titleLabel.font = [UIFont fontWithName:@\"HelveticaNeue-Bold\" size:20];\n\n [dowMapBt setBackgroundImage:[[UIImage imageNamed:@\"00670_btn_green_medium.png\"] stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0] forState:UIControlStateNormal];\n [dowMapBt addTarget:self action:@selector(ButtonPressed) forControlEvents:UIControlEventTouchUpInside];\n [cell.contentView addSubview:dowMapBt];\n\n\nbut I have a problem .. the button does not appear in all\ncell, but only in a half .. and not for the entire width of the cell ..."
] | [
"iphone",
"objective-c",
"uitableview",
"uibutton"
] |
[
"Splitting a string using specified delimiters, and replacing some portions",
"I have content like this Go to {#www.google.com##Google#}, and I want to use this as a clickable link, as shown below:\n\nGo to <a href=\"www.google.com\" title=\"Google\">Google</a>.\n\nmy try: var splCharData = splCharData.split(/[\\{#\\#}]/g);"
] | [
"javascript",
"html",
"regex"
] |
[
"How can I check if a device supports SMS?",
"I want to disable SMS features programmatically on tablets without SIM card slot.\n\nI have tried this:\n\nif (context.getSystemService(Context.TELEPHONY_SERVICE) != null)\n{\n // SMS features: enable\n}\nelse\n{\n // SMS features: disable\n}\n\n\nbut on my NVidia Shield Tablet K1 (without sim card slot) context.getSystemService(Context.TELEPHONY_SERVICE) returns something and it looks like I have telephony service.\n\nWhat is wrong with my code?"
] | [
"android",
"sms"
] |
[
"Unknown column 'password' in 'field list'",
"The code-\n$sql = 'INSERT INTO kiosk_registration ( kiosk_name, mini_info, grade, domain, phonenumber, password, referrer_id, kiosk_id, user_id)\n VALUES (\"'.$_POST[\"name\"].'\", \"'.$_POST[\"mini_info\"].'\", \"'.$_POST[\"grade\"].'\", \"'.$_POST[\"domain\"].'\", \"'.$_POST[\"phone_number\"].'\", \"'.$_POST[\"password\"].'\", \"'.$_POST[\"ref_id\"].'\", \"'.$kiosk_id.'\", \"'.$_SESSION['uid'].'\")';\n if (!mysql_query($sql,$con))\n {\n die('Error: ' . mysql_error());\n }\n\nThe error - Unknown column 'password' in 'field list'.\nAnd this started happening on its own. It used to work perfectly fine, but this error just started appearing suddenly. I have no clue as to what could be wrong.\n\n*Sorry guys, it was a small problem, i mixed up the files, I was updating and not inserting hence the error *"
] | [
"php",
"mysql"
] |
[
"sending packets over serial comms java",
"I'm writing a java application that communicates with an external device over a serial port.\n\nI think I can connect to the device & send/receive data ok (I don't have access to the device at the moment..I'm using an emulator)\n\nI just need some advice on how I should format the data I'm sending.\n\nThe spec says it should be sent in byte format..So if I have something like the following packet to send\n\nAA|0D|07|09|0A|0B|03|01|02|03|04|CSM|CSM\n\nis this the type of thing I should be doing\n\noutputStream.write((byte)0xAA);\noutputStream.write((byte)0x0D);\noutputStream.write((byte)0x07);\n\n\n...or am I way off?\n\nI'm sorry if this is really basic..I've never dealt with any of this type stuff before & I won't be getting my hands on the device for a few days."
] | [
"java",
"serial-port",
"communication",
"packet"
] |
[
"Phonegap splash screen not loading",
"I'm working on an application for Android using phonegap 3.5.0 - my testing device is a Samsung Galaxy Tab (GT-P5100) with Android 4.1.2 .\n\nHalf a year ago I did my first tests with phonegap. I remember the splashscreen loading at startup with the following line in the config.xml\n\n<gap:splash gap:platform=\"android\" src=\"res/screen/android/screen-xhdpi-portrait.png\" />\n\n\nNow with the hard- and software mentioned above it's not working anymore...\n\nI tried the following:\n\n<gap:splash gap:platform=\"android\" gap:qualifier=\"port-ldpi\" src=\"res/screen/android/screen-ldpi-portrait.png\" />\n<gap:splash gap:platform=\"android\" gap:qualifier=\"port-mdpi\" src=\"res/screen/android/screen-mdpi-portrait.png\" />\n<gap:splash gap:platform=\"android\" gap:qualifier=\"port-hdpi\" src=\"res/screen/android/screen-hdpi-portrait.png\" />\n<gap:splash gap:platform=\"android\" gap:qualifier=\"port-xhdpi\" src=\"res/screen/android/screen-xhdpi-portrait.png\" />\n<gap:splash gap:platform=\"android\" gap:density=\"ldpi\" src=\"res/screen/android/screen-ldpi-portrait.png\" />\n<gap:splash gap:platform=\"android\" gap:density=\"mdpi\" src=\"res/screen/android/screen-mdpi-portrait.png\" />\n<gap:splash gap:platform=\"android\" gap:density=\"hdpi\" src=\"res/screen/android/screen-hdpi-portrait.png\" />\n<gap:splash gap:platform=\"android\" gap:density=\"xhdpi\" src=\"res/screen/android/screen-xhdpi-portrait.png\" />\n<gap:splash gap:platform=\"android\" src=\"res/screen/android/screen-xhdpi-portrait.png\" />\n\n\nand of course:\n\n<gap:plugin name=\"org.apache.cordova.splashscreen\" />\n\n\nAny suggestions? Thanks!\n\nP.S.: Not working on Sony Xperiia Z1 Android 4.4.4, too."
] | [
"android",
"cordova",
"splash-screen"
] |
[
"raw folder is not recognized even though it has been created in the \"res\" folder",
"If I hover over the raw folder it says\n\n\"raw cannot be resolved or is not a field\""
] | [
"android",
"media"
] |
[
"Is that possible to add text below marker in google Map?",
"I'm developing an google map based android application. I need to draw the Address text on google map. Please refer the Image.\n\n\nI refered this link. But it provides to draw text on marker. I need to show the text below where the marker placed. Is that possible? Kindly help me."
] | [
"android",
"google-maps",
"google-maps-markers",
"marker"
] |
[
"Scaling by x and y force d3js trouble",
"I have trouble with scaling by x and y when drag any node. Does anyone have the same trouble?\n\nThere are lines which used for force: \n\nvar x = d3.scale.linear()\n .domain([0, defaultParams.maxX])\n .range([0, width]);\n\nvar y = d3.scale.linear()\n .domain([0, defaultParams.maxY])\n .range([height, 0]);\n\n\nvar force = d3.layout.force()\n .size([defaultParams.maxX, defaultParams.maxY])\n .charge(-400)\n .linkDistance(5)\n .on(\"tick\", tick);\n\n\nfunction tick() {\n link\n .attr(\"x1\", function(d) { return x(d.source.x); })\n .attr(\"y1\", function(d) { return y(d.source.y); })\n .attr(\"x2\", function(d) { return x(d.target.x); })\n .attr(\"y2\", function(d) { return y(d.target.y); });\n\n node\n .attr(\"transform\", function(d){ return \"translate(\" + x(d.x) + \",\" + y(d.y) + \")\"; })\n\n}\n\nfunction dragMove(d) {\n d3.select(this).attr(\"transform\", function(d){ return \"translate(\" + x(d.x) + \",\" + y(d.y) + \")\"; });\n}"
] | [
"d3.js"
] |
[
"How to make regex pattern for some scenarios",
"Am doing WordXml parsar using JAVA. \n\nAnd now i want to check (F(1) = 44) this type of pattern will be occured or not in a paragraph. \n\nNote: Inside of open close will have must integer value.\n\nFolloing pattern i will need to check. \n\n(text text (text) text)\n(F(1) = 44)\n(text text [text] text)\n[text text (text) text]\n\n\nBut, Clearly don't know how to make regex pattern for above the senarios.\n\nSo, Please suggest me. And anybody pls let me know."
] | [
"java",
"regex",
"parsing",
"pattern-matching",
"regex-group"
] |
[
"Bootstrap menu is open when page is loaded",
"I've implemented into my website the Bootstrap dropdown menu and the issue is that when I load the page, then as the default statue is popped up dropdown menu. I am struggling with how to have this dropdown menu hidden when the page is loaded as default.\n\nHere's the HTML structure:\n\n<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">Sign in</a>\n<div class=\"login_window dropdown-menu\">\n ...\n</div>\n\n\nSo, when I load the page, the window is displayed. When I click somewhere, then is hidden. When I click on it, then will be displayed again. That's ok.\n\nBut I am trying to have the window have hidden when I load the page. How to achieve that?\n\nThanks"
] | [
"javascript",
"jquery",
"html",
"css",
"twitter-bootstrap"
] |
[
"Could someone explain this python permutation code?",
"I've seen some postings of code for permutations on here but I haven't really been able to find a good step-by-step walk through of what is actually going on. If someone could just explain what is actually happening in each step of this code I would really appreciate it. I can't quite seem to wrap my head around it. The code I'm looking at is in Python and is from http://snippets.dzone.com/posts/show/753.\n\ndef all_perms(str):\n if len(str) <=1:\n yield str\n else:\n for perm in all_perms(str[1:]):\n for i in range(len(perm)+1):\n yield perm[:i] + str[0:1] + perm[i:]\n\n\nfor p in all_perms(['a','b','c']):\n print p"
] | [
"python",
"algorithm",
"permutation"
] |
[
"Calculate the neighbourhood inside or outside of a region",
"I have a problem in MATLAB as follows:\n\nSuppose I have a matrix like given below. What I want to do is calculate the average values of the pixels given in yellow. (ans is 108)\n\n\nThis will be calculated if the option given is outside.\n\nOn the other hand if the option is given as inside, then an operation as performed in the image.\n\n\n**I want to write an algorithm to find out the average value either inside or outside the region marked with zeros depending on the option manually set. **\n\n****4 neighbourhood** or 8 neighbourhood ** may be considered. I want to compute this in MATLAB. Can you guys help me ?"
] | [
"matlab",
"image-processing",
"nearest-neighbor",
"neighbours"
] |
[
"BroadcastReceiver inner class not trigger",
"I'm trying to make a Watch Dog function using an inner class broadcast receiver. On the parent class I registered the broadcast receiver inside the constructor, but the onReceive class is never trigger.\n\nHow can I solve this issue ? Thank you.\n\nWatchDog class:\n\npublic class WatchDog {\nprivate final String TAG = getClass().getSimpleName();\nprivate static final String RECEIVER_WATCHDOG = \"com.example.liviu.test_broadcastreceiver.receiver\";\nprivate final static String ACTION_WATCHDOG = \"com.example.liviu.test_broadcastreceiver.action.watchdog\";\nprivate final static int ID_WATCHDOG = 40856342;\nprivate final static int mTimeout = 1000;\n\npublic WatchDog (Context context) {\n Log.d(TAG, \":::::::::::: Watchdog CONSTRUCTOR\");\n IntentFilter intentFilter = new IntentFilter(RECEIVER_WATCHDOG);\n BroadcastReceiver receiver = new WatchDogReceiver();\n context.registerReceiver(receiver, intentFilter);\n setWatchdogTimer(context, true, mTimeout);\n}\n\nfinal class WatchDogReceiver extends BroadcastReceiver {\n\n @Override\n public void onReceive(Context context, Intent intent) {\n Log.d(TAG, \":::::::::::: Watchdog received - \");\n setWatchdogTimer(context, true, mTimeout);\n }\n}\n\npublic void setWatchdogTimer(Context context, boolean set, int timeout) {\n Log.d(TAG, \":::::::::::: Watchdog START\");\n Intent intent = new Intent(context, WatchDogReceiver.class);\n intent.setAction(ACTION_WATCHDOG);\n PendingIntent alarmIntent = PendingIntent.getBroadcast(context, ID_WATCHDOG, intent, PendingIntent.FLAG_UPDATE_CURRENT);\n AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n if (set) {\n alarmManager.set(AlarmManager.RTC, System.currentTimeMillis() + timeout, alarmIntent);\n } else {\n alarmManager.cancel(alarmIntent);\n }\n}\n\n\n}\n\nand MainActivity class:\n\npublic class MainActivity extends AppCompatActivity {\nprivate final String TAG = getClass().getSimpleName();\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n Log.d(TAG, \">>>>>>>>>>>> Activity START\");\n new WatchDog(getApplicationContext());\n}\n\n\n}\n\nLogcat is showing only:\n\n05-02 18:11:10.197 20415-20415/com.example.liviu.test_broadcastreceiver D/MainActivity: >>>>>>>>>>>> Activity START\n05-02 18:11:10.197 20415-20415/com.example.liviu.test_broadcastreceiver D/WatchDog: :::::::::::: Watchdog CONSTRUCTOR"
] | [
"java",
"android",
"broadcastreceiver",
"inner-classes"
] |
[
"Datetime difference in hours minutes and seconds moment.js in node js",
"I am new to nodeJs and using moment.js in my projects. I would like to calculate datetime difference resulting into hours minutes and seconds. I googled but did not got related solution.\n\nHere is the code and my effort on google. \n\nvar moment = require('moment');\n\nvar now = \"26/02/2014 10:31:30\";\nvar then = \"25/02/2014 10:20:30\";\n\nvar config = \"DD/MM/YYYY HH:mm:ss\";\n\nvar duration = moment.utc(moment(now, config).diff(moment(then,config))).format(\"HH:mm:ss\");\n\nconsole.log(duration);\n\n\nThis prints 00:11:00\nexpected result is 23:11:00\n\nany help would be appreciated and thanks in advance."
] | [
"javascript",
"node.js",
"momentjs"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.