texts
list | tags
list |
---|---|
[
"Python 2.7: Error in cv2.stereoCalibrate(). Required argument 'distCoeffs1' (pos 5) not found",
"I was doing stereo camera calibration using Python 2.7 and OpenCV 3.3. The code I used is (I got it from Stereo Calibration Opencv Python and Disparity Map):\n\nimport numpy as np\nimport cv2\nimport glob\n\n# termination criteria\ncriteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)\n# prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0)\nobjp = np.zeros((6*7,3), np.float32)\nobjp[:,:2] = np.mgrid[0:7,0:6].T.reshape(-1,2)\n\n# Arrays to store object points and image points from all the images.\nobjpointsL = [] # 3d point in real world space\nimgpointsL = [] # 2d points in image plane.\nobjpointsR = []\nimgpointsR = []\n\nimages = glob.glob('left*.jpg')\n\nfor fname in images:\n img = cv2.imread(fname)\n grayL = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)\n\n # Find the chess board corners\n ret, cornersL = cv2.findChessboardCorners(grayL, (7,6),None)\n # If found, add object points, image points (after refining them)\n if ret == True:\n objpointsL.append(objp)\n\n cv2.cornerSubPix(grayL,cornersL,(11,11),(-1,-1),criteria)\n imgpointsL.append(cornersL)\n\nimages = glob.glob('right*.jpg')\n\nfor fname in images:\n img = cv2.imread(fname)\n grayR = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)\n\n # Find the chess board corners\n ret, cornersR = cv2.findChessboardCorners(grayR, (7,6),None)\n\n # If found, add object points, image points (after refining them)\n if ret == True:\n objpointsR.append(objp)\n\n cv2.cornerSubPix(grayR,cornersR,(11,11),(-1,-1),criteria)\n imgpointsR.append(cornersR)\n\n\nretval,cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F = cv2.stereoCalibrate(objpointsL, imgpointsL, imgpointsR, (640,480))\n\n\nBut I got error like:\n\nretval,cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F = cv2.stereoCalibrate(objpointsL, imgpointsL, imgpointsR, (640,480))\nTypeError: Required argument 'distCoeffs1' (pos 5) not found\n\n\nI have my code, left and rights images in the same folder. I have read other similar answers but they don't get this error. (Stereo Calibration Opencv Python and Disparity Map). I want to know why this error and how to solve this?\n\nThanks."
] | [
"python-2.7",
"opencv",
"stereo-3d"
] |
[
"Why are there two SDK packages for .NET Core 2.2 on MS website?",
"The website dotnet.microsoft.com is, as of today, offering two versions of SDKs for .NET Core 2.2. One has a small text next to it \"(compatible with VS2017)\".\n\nCan someone please explain why is the other one NOT compatible, or why does this separation exist in the first place? How are they different?"
] | [
".net-core",
"sdk"
] |
[
"TFS - How to work with multiple computers on same workspace without checking in my code everyday",
"I work both from the office and at home, using separate computers. Currently, to be able to continue coding from home, I need to check in all my code before leaving the office. Is there any way of making my workspace work completely online, so that I can continue my work from home without checking-in anything when I'm leaving the office? \n\nI'm currently trying a trick; mapping my workspace on a shared folder (network drive) which I can also access from home via VPN too. But it's taking too long to even download the latest version of the project. Even if this works, I don't think it will be an efficient way because of network speed limitations.\n\nIs there any solution for multiple computers, one user and one workspace?"
] | [
"tfs",
"version-control",
"collaboration"
] |
[
"what's the relationship between GtkTextIter and GtkTextMark?",
"The Devhelp says that GtkTextIter will be invalidated when the contents in GtkBuffer are changed and the GtkTextMark solve this problem. So how to insert GtkTextMark into buffer? and how to use it?"
] | [
"c",
"gtk",
"gtk3",
"gnome"
] |
[
"Conditionally Hiding Pricing; Need to Make Visible from Tag/Custom Taxonomy",
"Hide product pricing & add to cart button unless logged in\nSale items be visible, logged in or not, if visited from some kind of tag, category, or other taxonomy so that nobody sees the sales unless they are directed to them explicitly.\n\n\nExample: All product prices are hidden, except on URLs with the tag \"waffles-sale\". This is a simple example but I think that explains what I'm after with 2.\n\n\n\nI've accomplished 1. with a plugin, and more recently a short code; this works great:\n\nadd_action( 'init', 'bbloomer_hide_price_add_cart_not_logged_in' );\n\nfunction bbloomer_hide_price_add_cart_not_logged_in() { \nif ( ! is_user_logged_in() ) { \n remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );\n remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );\n remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );\n remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); \n add_action( 'woocommerce_single_product_summary', 'bbloomer_print_login_to_see', 31 );\n add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_print_login_to_see', 11 );\n}\n}\n\nfunction bbloomer_print_login_to_see() {\necho '<a href=\"' . get_permalink(wc_get_page_id('myaccount')) . '\">' . __('Please login for pricing.', 'theme_name') . '</a>';\n}\n\n\nBut this leaves me with two, which is making things visible conditionally. I am sorry if this is vague. I've scoured the web for answers but I'm coming up short. I feel like my vocabulary is holding me back; I don't know the words for the hooks or phrases that I'm describing. I would love to stop reinventing the wheel (I'm having to clone products/product categories to make only them visible from temporarily published pages for sales).\n\nCan anyone point me in the right direction? Is controlling product visibility in this way possible? I would greatly appreciate anyone's more experienced two cents or solution to this. Thank you."
] | [
"woocommerce",
"hook-woocommerce"
] |
[
"simple jQuery dynamic pagination",
"rather than downloading and using someone else's awesome plugin, I wanted to write my own pagination script.\n\nhere's what I have so far\n\nMy question is how would I do the sort function more efficiently? is there a way to identify based off of the var first that I declared and its id relative to the rows and determine something like #something5 is the fifth row, so iterate from the 6th row to the 11th row? instead of using the .next() functions as shown. \n\n <div id=\"rows\">\n <div class=\"row\" id=\"something1\">something1</div>\n <div class=\"row\" id=\"something2\">something2</div>\n <div class=\"row\" id=\"something3\">something3</div>\n <div class=\"row\" id=\"something4\">something4</div>\n <div class=\"row\" id=\"something5\">something5</div>\n <div class=\"row\" id=\"something6\">something6</div>\n <div class=\"row\" id=\"something7\">something7</div>\n <div class=\"row\" id=\"something8\">something8</div>\n <div class=\"row\" id=\"something9\">something9</div> \n <div class=\"row\" id=\"something10\">something10</div>\n <div class=\"row\" id=\"something11\">something11</div>\n <div class=\"row\" id=\"something12\">something12</div>\n </div>\n <a href=\"#\" id=\"prev\">prev</a>\n <a href=\"#\" id=\"next\">next</a>\n <br />\n <span id=\"total\"></span>\n\n var max = 5;\n\n function sort(x) {\n if (x == \"prev\") {\n var first = $('#rows .row:visible').first().attr('id');\n if (first != \"something5\") {\n $('#rows .row').hide();\n $('#'+first).prev('div').show();\n $('#'+first).prev('div').prev('div').show();\n $('#'+first).prev('div').prev('div').prev('div').show();\n $('#'+first).prev('div').prev('div').prev('div').prev('div').show();\n $('#'+first).prev('div').prev('div').prev('div').prev('div').prev('div').show();\n }\n } else {\n var last = $('#rows .row:visible').last().attr('id');\n $('#rows .row').hide();\n $('#'+last).next('div').show();\n $('#'+last).next('div').next('div').show();\n $('#'+last).next('div').next('div').next('div').show();\n $('#'+last).next('div').next('div').next('div').next('div').show();\n $('#'+last).next('div').next('div').next('div').next('div').next('div').show();\n }\n }\n\n $(document).ready(function() {\n var total = $('#rows .row').size();\n var pages = total / max;\n $(\"#total\").text(\"page \" + pages + \" of \" + total);\n\n $('#rows .row').hide(); \n\n for (i = 0; i < max; i++) {\n $('#rows .row').eq(i).css('display', 'block');\n }\n\n $('#prev').click(function() {\n sort(\"prev\");\n });\n\n $('#next').click(function() {\n sort(\"next\");\n }); \n });\n\n\nJsfiddle here http://jsfiddle.net/DcNLJ/"
] | [
"jquery"
] |
[
"Migrated wordpress site having problems with permalinks which gets rewritten after an interval",
"I migrated a wordpress website www.dot10tech.com which was initially hosted in a domain (coddets.com). I did a find-and-replace on the whole database and changed it to http://www.dot10tech.com. The site wouldnt load but I could get into wp-admin Dashboard. I followed a popular suggestion of \"changing the permalink structure and reverting it back\" and the site loaded. But after 5-10 mins the site showed \"Unable to serve this request\" and AGAIN I went to dashboard, did the permalinks...site was up...after 5-10 mins...the cycle continues...PLEASE help"
] | [
"wordpress",
"permalinks"
] |
[
"If condition A is matched, condition B needs to be matched in order to do action C",
"My question is:\n\nif (/* condition A */)\n{\n if(/* condition B */)\n {\n /* do action C */\n }\n else\n /* ... */\n}\nelse\n{\n /* do action C */\n}\n\n\nIs it possible to just write the code of action C one time instead of twice?\n\nHow to simplify it?"
] | [
"if-statement",
"language-agnostic",
"conditional-statements",
"boolean-logic"
] |
[
"Expressing assertions more naturally",
"Suppose I write a function\nf [x, y] = x + y\nf [x, y, z] = z - x - y\n\nThis is filled out by the compiler with an extra line saying something like\nf _ = error "pattern match failed"\n\nIf f is not exported, and I know it's only applied properly, and the function is performance-critical, I may want to avoid having an extra pattern in the production code. I could rewrite this rather unnaturally something like\nf l = assert (atLeastTwo l) $\n let (x,r1) = (unsafeHead l, unsafeTail l) in\n let (y,r2) = (unsafeHead r1, unsafeTail r1) in\n case r2 of\n [] -> x + y\n (z,r3) -> assert (r3 == []) $ z - x - y \n\nWhat I'd like to do is write the original function definition with an extra line:\nf _ = makeDemonsComeOutOfMyNose "This error is impossible."\n\nThe descriptively named magical function would be compiled as error when assertions or inferred safe Haskell are enabled, and marked as unreachable (rendering the pattern match unsafe) when assertions are disabled. Is there a way to do this, or something similar?\nEdit\nTo address jberryman's concerns about whether there is a real performance impact:\n\nThis is a hypothetical question. I suspect that in more complicated cases, where there are multiple "can't happen" cases, there is likely to be a performance benefit—at the least, error cases can use extra space in the instruction cache.\n\nEven if there isn't a real performance issue, I think there's also an expressive distinction between an assertion and an error. I suspect the most flexible assertion form is "this code should be unreachable", perhaps with an argument or three indicating how seriously the compiler should take that claim. Safety is relative—if a data structure invariant is broken and causes the program to leak confidential information, that's not necessarily any less serious than an invalid memory access. Note that, roughly speaking, assert p x = if p then x else makeDemonsFlyOutOfMyNose NO_REAL_DEMONS_PLEASE "assertion failed", but there's no way to define the demon function in terms of assert."
] | [
"haskell",
"pattern-matching",
"assertions"
] |
[
"Populating listview method not running",
"I'm trying to populate my ListView with an observable list but the code doesn't even seem to be running.\n\nI have a Controller class which controls all the fooddrink items\n\npackage sample;\n\nimport com.sun.javafx.collections.ObservableListWrapper;\nimport javafx.collections.FXCollections;\nimport javafx.collections.ObservableList;\n\nimport java.util.ArrayList;\n\npublic class FoodDrinkController {\n private ArrayList<FoodDrink> fullList = new ArrayList<>();\n\n //constructor with some stuff in it\n public FoodDrinkController(){\n FoodDrink cola = new FoodDrink(\"Coca Cola\", 2.99, Global.itemtype.DRINK);\n FoodDrink pepsi = new FoodDrink(\"Pepsi\", 2.99, Global.itemtype.DRINK);\n FoodDrink burger = new FoodDrink(\"burger\", 7.99, Global.itemtype.MAIN);\n\n fullList.add(cola);\n fullList.add(pepsi);\n fullList.add(burger);\n }\n\n public ObservableList<FoodDrink> filterByType(Global.itemtype itemtype){\n ArrayList<FoodDrink> subList = new ArrayList<>();\n for (FoodDrink listItem : fullList){\n if(listItem.getItemtype().equals(itemtype)){\n subList.add(listItem);\n }\n }\n return FXCollections.observableArrayList(subList);\n }\n\n //plain old main method\n public static void main(String[] args) {\n //SelectDrinkController fbtd = new SelectDrinkController();\n //System.out.println(fbtd.filterByType(\"DRINK\"));\n\n FoodDrinkController fdc = new FoodDrinkController();\n System.out.println(fdc.filterByType(Global.itemtype.DRINK));\n }\n}\n\n\nand a controller for the gui\n\npackage sample;\n\nimport javafx.application.Application;\nimport javafx.beans.Observable;\nimport javafx.collections.FXCollections;\nimport javafx.collections.ObservableArray;\nimport javafx.collections.ObservableList;\nimport javafx.fxml.FXML;\nimport javafx.scene.control.ListView;\nimport javafx.stage.Stage;\n\nimport java.net.URL;\nimport java.util.ResourceBundle;\n\npublic class SelectDrinkControllerGUI extends Application {\n\n private FoodDrinkController fdc = new FoodDrinkController();\n\n @FXML\n ListView lvDrinks = new ListView();\n\n @Override\n public void start(Stage stage) throws Exception {\n System.out.println(\"Hello\");\n }\n\n public void initialize(URL location, ResourceBundle resources) {\n\n ObservableList items = fdc.filterByType(Global.itemtype.DRINK);\n System.out.println(items);\n\n lvDrinks.getItems().addAll(items);\n }\n}\n\n\nSo when I run the program it just shows an empty ListView instead of the DRINK items I put into the controller."
] | [
"java",
"javafx"
] |
[
"Are class constructors void by default?",
"I have been reading on class constructors in C#. Examples are showing overloaded class contructors. And all of them do not have a void keyword and neither they have a return value..\n\ne.g. \n\npublic Class myClass\n{\n public myClass()\n {\n\n }\n\n public myClass(int id)\n {\n\n }\n//other class memeber go here...\n}\n\n\n1) So is it correct to say C# constructors are void by default?\n\n2) Does the same applies to Java as well?"
] | [
"c#",
"void",
"class-constructors"
] |
[
"Is there a way to change the text formatter at runtime using the entlib logging application block?",
"I have an application that logs to a rolling text file using the MS enterprise library 4.1 logging application block.\n\nIs it possible to have multiple text formatters and switch between them during runtime?"
] | [
"logging",
"enterprise-library"
] |
[
"How to import excel file.xls into asp.net",
"I am trying to read data from excel.\n\nif (fileext.Trim() == \".xls\")\n{\n connStr= \"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\" + filepath + \";Extended Properties=Excel 8.0;HDR=Yes;IMEX=2\";\n}\nelse if (dosyauzanti.Trim() == \".xlsx\")\n{\n connStr = \"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\" + filepath + \";Extended Properties=\\\"Excel 12.0;HDR=Yes;IMEX=2\\\"\";\n}\n\n\nI can read Excel 2007 files. but I get an error when I try to read Excel 2003 files. \n\n\n External table is not in the expected format."
] | [
"asp.net",
"excel"
] |
[
"Configuring Webstorm to work with Nodejs",
"I have a problem with webstorm. That is, it does not autocomplete all the time, I've managed my scopes well, so that is not the problem.\n\nThe thing is, whenever I try to access methods inside a nodejs app, the only completion I get is exports. So, I can get express.exports.static, but not express.static. How do I fix this?\n\nI am using Webstorm 7 EAP."
] | [
"webstorm"
] |
[
"Android: avoid webview refresh in tab fragment",
"I'm creating an app with 2 tabs, one of the tabs contains a WebView.\nThe problem is that every time I switch between tabs, the WebView is refreshed.\n\nMy structure is:\n\nI created actionbar and to tabs extends fragment\n\nMy tab2 class code:\n\npublic class CopyOfTab2 extends Fragment implements ActionBar.TabListener{\n\n private Fragment mFragment;\n private WebView mWebview ;\n private Bundle webViewBundle;\n\n @Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n getActivity().setContentView(R.layout.activity_tab2);\n }\n\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n Log.e(\"RH\", \"in OnCreateView\");\n View v = inflater.inflate(R.layout.activity_tab2, container, false);\n //ImageView imageView = (ImageView)v.findViewById(R.id.my_image);\n return v;\n } \n\n @Override\n public void onViewCreated(View view, Bundle savedInstanceState) {\n\n mWebview = (WebView)view.findViewById(R.id.GalleryWebView);\n //gallery.setAdapter(adapter);\n\n mWebview.getSettings().setJavaScriptEnabled(true); // enable javascript\n\n mWebview.setWebViewClient(new WebViewClient() {\n public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {\n Log.e(\"RH\",\"error in web rh\");\n //Toast.makeText(activity, description, Toast.LENGTH_SHORT).show();\n }\n });\n\n if (webViewBundle == null) {\n Log.e(\"RH\",\"webViewBundle null\");\n mWebview.loadUrl(\"http://www.google.com\"); \n } \n else {\n Log.e(\"RH\",\"webViewBundle not null\");\n mWebview.restoreState(webViewBundle); \n }\n\n super.onViewCreated(view, savedInstanceState);\n }\n\n public void onTabSelected(Tab tab, FragmentTransaction ft) {\n\n //switchContent(\"tab2\");\n\n // TODO Auto-generated method stub\n mFragment = new CopyOfTab2();\n // Attach fragment1.xml layout\n ft.add(android.R.id.content, mFragment);\n ft.attach(mFragment);\n\n }\n\n public void onTabUnselected(Tab tab, FragmentTransaction ft) {\n // TODO Auto-generated method stub\n // Remove fragment1.xml layout\n //ft.remove(mFragment);\n ft.hide(mFragment);\n }\n\n public void onTabReselected(Tab tab, FragmentTransaction ft) {\n // TODO Auto-generated method stub\n }\n}"
] | [
"android",
"android-webview"
] |
[
"What is a function with a class type called in C++?",
"I've been searching across the web but seen to not find the keyword. let's say I want to use the class type to create a method/function. Here is an easy example:\n\nstruct action{\n//constructor\naction(int n){\n}\n};\naction move(){\n}\n\n\nhere, I'm using the action class as the type of the function. Here are my questions: What is this called? How do I use the constructor of the class? what should I return in the function move? (it doesn't let me return this. error:[invalid use of 'this' outside of a non-static member function])"
] | [
"c++",
"class"
] |
[
"Type aliases in Avro?",
"Is it possible to create type aliases/synonyms in Avro (or approximate the same)?\n\nI would like to flag e.g. that a \"long\" is a time-in-ms-since-epoch, without having to rely on the implicit context.\n\nIn Haskell terms, it would be something like:\n\ntype EpochTime = Double\n\n\nIn Scala terms similar:\n\ntype Coordinates = Tuple2[Float, Float]\n\n\nIs there a similar way of doing this in Avro, or would I have to attach some additional metadata? This thread implies that I might have to use a record wrapper like so:\n\n{\"type\": \"record\", \"name\":\"epochTimeRecord\", \"fields\" : [\n {\"name\": \"epochTime\", \"type\": \"long\"}\n ]\n}"
] | [
"types",
"avro"
] |
[
"c program how to print a char array held by a structure variable?",
"How do I print the char array held in the struct variable char binary_filename? \n\nI tried:\n\nprintf(\"Binary file name is : %s \\n\", prv_instance_t.binary_filename);\n\n\nHowever, I get the error error: expected expression before ‘prv_instance_t’ \n\nHere is the struct definition.\n\n#define BINARY_FILE_NAME_MAXLEN 10 \n\ntypedef struct _prv_instance_\n{\n /*\n * The first two are mandatories and represent the pointer to the next instance and the ID of this one. The rest\n * is the instance scope user data (uint8_t power in this case)\n */\n struct _prv_instance_ * next; // matches lwm2m_list_t::next\n uint16_t shortID; // matches lwm2m_list_t::id\n uint8_t power;\n uint8_t reset;\n double dec;\n char binary_filename[BINARY_FILE_NAME_MAXLEN];\n} prv_instance_t;"
] | [
"c",
"arrays",
"struct",
"char"
] |
[
"My SKLabelNode doesn't change color",
"I have an SKLabelNode in my iOS app to display a player's score. I want to be able to change the color of it (for now, just to a standard cyan color). But I can't seem to figure out why it's not changing. I have another app where I've used this and had no issues at all.\n\nSKLabelNode *pScoreNode;\n\nNSString *playerScoreTracker;\n\n- (SKLabelNode *)playerScoreNode\n{\n pScoreNode = [SKLabelNode labelNodeWithFontNamed:@\"NEONCLUBMUSIC\"];\n\n playerScoreTracker = [NSString stringWithFormat:@\"POWER: %ld\",(long)player_score];\n\n pScoreNode.text = playerScoreTracker;\n pScoreNode.fontSize = 20;\n pScoreNode.position = CGPointMake(CGRectGetMidX(self.frame),inBoundsOffset/3);\n pScoreNode.color = [SKColor cyanColor];\n\n pScoreNode.name = @\"player1ScoreNode\";\n\n return pScoreNode;\n}\n\n\nThen later in the update, I update the string with the updated score on each update.\n\n-(void)update:(CFTimeInterval)currentTime {\n /* Called before each frame is rendered */\n\n pScoreNode.text = [NSString stringWithFormat:@\"POWER: %ld\",(long)player_score];\n\n\n}"
] | [
"ios",
"sprite-kit",
"uicolor"
] |
[
"Hyperledger Composer not working on Ubuntu 20.04",
"I'm trying to install and set up Hyperledger Composer and Playground on Ubuntu 20.04. While executing the following command\ncurl https://hyperledger.github.io/composer/install-hlfv1.sh | bash\nI found out, that the website is not reachable or rather existing.\nAny ideas? Is there a new website or a new link?"
] | [
"hyperledger",
"hyperledger-composer"
] |
[
"Getting Ruby on Rails environment working and installing sqlite3",
"Trying to upgrade to the latest version of Ruby on Rails. I got ruby and rails installed ok (I think).\n\nC:\\Users\\benjaminw>ruby --version\nruby 2.0.0p0 (2013-02-24) [x64-mingw32]\n\nC:\\Users\\benjaminw>rails -v\nRails 3.2.13\n\n\nI'm following an instructional guide out of a Ruby on Rails book but it's a little out of date. The next step says to download the sqlite3 db and extract the the files to the following folder C:/Ruby200/bin\n\nThen run the following command to make sure the db was installed correctly\n\nC:\\Users\\benjaminw>sqlite3 --version\n3.7.16 2013-03-18 11:39:23 66d5f2b76750f3520eb7a495f6247206758f5b90\n\n\nHere is where the problem arises. When I enter the next command I get an ERROR and it seems like it's important to setting up the environment properly. Does anyone know what the following means and how to fix it? Oh and I installed this version of the devkit on my windows 7 computer DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe.\n\nC:\\Users\\benjaminw>gem install sqlite3-ruby\nTemporarily enhancing PATH to include DevKit...\nBuilding native extensions. This could take a while...\nERROR: Error installing sqlite3-ruby:\n ERROR: Failed to build gem native extension.\n\nC:/Ruby200/bin/ruby.exe extconf.rb\nchecking for sqlite3.h... no\nsqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.\n*** extconf.rb failed ***\nCould not create Makefile due to some reason, probably lack of necessary\nlibraries and/or headers. Check the mkmf.log file for more details. You may\nneed configuration options.\n\nProvided configuration options:\n --with-opt-dir\n --without-opt-dir\n --with-opt-include\n --without-opt-include=${opt-dir}/include\n --with-opt-lib\n --without-opt-lib=${opt-dir}/lib\n --with-make-prog\n --without-make-prog\n --srcdir=.\n --curdir\n --ruby=C:/Ruby200/bin/ruby\n --with-sqlite3-dir\n --without-sqlite3-dir\n --with-sqlite3-include\n --without-sqlite3-include=${sqlite3-dir}/include\n --with-sqlite3-lib\n --without-sqlite3-lib=${sqlite3-dir}/\n --enable-local\n --disable-local\n\n\nGem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1\n.3.7 for inspection.\nResults logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/\ngem_make.out"
] | [
"ruby-on-rails",
"ruby-on-rails-3",
"sqlite",
"rubygems",
"ruby-on-rails-3.2"
] |
[
"Wikipedia image API search - contains total results + fileinfo",
"We want to build an image search based on Wikipedia Commons image database. I've experimented with different request formats but there seems to be no solution which fits 100% our needs. \n\nWhat we want to achieve:\n\n\nUser search f.e. \"Einstein\"\nWe show them \"808 results for Einstein found in Wikipedia\"\nShow them the first 10 results and allow a pagination\n\n\nI tried:\n\nhttps://commons.wikimedia.org/w/api.php?action=query&list=search&srsearch=%22Einstein%22&srnamespace=6\n\n\nwhich returns the totals results (1842)\n\n\"query\": {\n \"searchinfo\": {\n \"totalhits\": 1842\n },\n\n\nand the results like:\n\n{\n \"ns\": 6,\n \"title\": \"File:Albert Einstein Head.jpg\",\n \"snippet\": \"DescriptionAlbert <span class=\\\"searchmatch\\\">Einstein</span> Head.jpg English: Albert <span class=\\\"searchmatch\\\">Einstein</span> Fran\\u00e7ais\\u00a0: Portrait d'Albert <span class=\\\"searchmatch\\\">Einstein</span> Date Copyrighted 1947, copyright not renewed. <span class=\\\"searchmatch\\\">Einstein</span>'s estate\",\n \"size\": 968,\n \"wordcount\": 0,\n \"timestamp\": \"2016-01-01T01:57:15Z\"\n}\n\n\nBut this response is missing a downloadable URL. For example the one of \"File:Albert Einstein Head.jpg\" is https://upload.wikimedia.org/wikipedia/commons/d/d3/Albert_Einstein_Head.jpg\n\nI would need to set another request to get the correct URLs by:\n\nhttps://commons.wikimedia.org/w/api.php?action=query&titles=File:Albert Einstein Head.jpg|File:Einstein hair advice.jpg|File:Einstein - potpis.jpg&prop=imageinfo&iiprop=url\n\n\nIs there way to search for Wikipedia images which include their title, the URL to download and the total results (totalhits) in a single request?"
] | [
"wikipedia",
"wikipedia-api"
] |
[
"Compare and Swap Incorrect value",
"I have the following code for locking an object with a particular user ID\n\n public boolean acquireLock(Long id) {\n if (lock.compareAndSet(0L, id)) { \n return true ; \n }\n return false ; \n}\n\n\nI acquire it in the following way: \n\n while(!parent.acquireLock(id)){\n System.out.println(lock.get());\n if (count++>1000000) {\n System.out.println(id + \" Trying to acquire \" + lock.get());\n DebugHandler.createException(\"Error, deadlock\");\n\n }\n }\n\n\nRelease it as : \n\npublic boolean releaseLock(Long id) { \n\n if (lock.compareAndSet(id, 0)) {\n System.out.println(\"Releasing Lock for \" + id);\n return true ; \n }\n else { \n DebugHandler.createException(\"Lock not owned by current view. Thief\");\n return false ;\n }\n\n}\n\n\nAnd declare the lock object as:\n\n private volatile AtomicLong lo = new AtomicLong(0); \n\n\nexcept that I get the following odd behaviour and deadlock, which concludes with:\n\nId 45 trying to acquire 0\n\nAk, the value of the lock is systematically 0 but the compare and swap test fails, believing it isn't 0. (the counter to test for deadlock is reinitialised after I exit the loop)\n\nAny ideas?"
] | [
"java",
"concurrency",
"locking",
"atomic"
] |
[
"Is it preferred to access the first dimension first than to access the second dimension of a 2 dimension array?",
"Here is the code,\n\nint array[X][Y] = {0,};\n\n// 1 way to access the data\nfor (int x = 0; x < X; x++)\n for(int y = 0; y < Y; y++)\n array[x][y] = compute();\n\n// the other way to access the data\nfor (int y = 0; y < Y; y++)\n for (int x = 0; x < X; x++)\n array[x][y] = compute();\n\n\nIs it true that the first way is more efficient than the second one since the CPU cache(L1, L2?) optimization? In other words, whether sequential access pattern is preferred even for RAM?"
] | [
"c++",
"c"
] |
[
".keys() method not working on JSONObject eclipse",
"i am trying to use the .keys() method to get the name of JSON Object's \nthe code im using is;\n\nIterator<String> keys = JSONObject.keys();\n\n\n.keys() is underelined as red on eclipse, i dont know why, can any one help, thanks! - \n\n\n\nI have JSON simple as an external library and have imported it, not sure what else to do\n\nEDIT:\n\nHere is more code; \n\n JSONParser parser = new JSONParser();\n FileReader testfile = new FileReader(\"test2.txt\");\n Object obj = parser.parse(testfile); \n JSONObject jsonObject = (JSONObject) obj;\n JSONObject name = (JSONObject) jsonObject.get(\"txt\");\n String time = (String) name.get(\"name\");\n JSONObject example2 = (JSONObject) jsonObject.get(\"birth\");\n System.out.println(example2);\n\n\n\n Iterator keys = example2 .keys(); <-- where the red line shows up\n\n\nSecond edit:\nhere are my imports.\n\n import java.io.FileReader;\n import java.io.IOException;\n import java.io.InputStream;\nimport java.net.MalformedURLException;\nimport java.net.URL;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.nio.file.StandardCopyOption;\nimport java.text.DateFormat;\nimport java.text.SimpleDateFormat;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Iterator;\nimport java.util.Set;\nimport org.json.simple.JSONObject;\nimport org.json.simple.parser.JSONParser;\n import org.json.simple.parser.ParseException;"
] | [
"java",
"json"
] |
[
"check user rights to do something",
"i am creating user permissions on laravel. In my DB i have table with id/user_id/model/write/read/delete\n\nlast three permission is enum type: on and off.\n\nin my User model im wrote method to set:\n\nprotected $models = ['dashboard', 'preferences']; \n\npublic function setPermissions($input=false) \n {\n foreach($this->models as $model) {\n $read = (isset($input[$model]['read']) ? 'on' : 'off');\n $write = (isset($input[$model]['write']) ? 'on' : 'off');\n $delete = (isset($input[$model]['delete']) ? 'on' : 'off');\n\n $perms = Permissions::firstOrNew([\n 'user_id' => $this->id,\n 'model' => $model,\n ]);\n\n $perms->read = $read;\n $perms->write = $write;\n $perms->delete = $delete;\n $perms->save();\n }\n }\n\n\nin permission model im write:\n\n use Illuminate\\Database\\Eloquent\\SoftDeletingTrait;\n\nclass Permissions extends Eloquent {\n\n use SoftDeletingTrait;\n\n protected $table = 'user_permissions';\n protected $fillable = ['user_id', 'model', 'read', 'write', 'delete'];\n\n public function user() \n {\n return $this->belongsTo('User','user_id','id');\n }\n\n}\n\n\nok, i have the method how to set permission from setting form. Now i need to check the right if the user have permission write or read, delete and do somehting like this:\n\nif (Auth::user->hasRights('write', 'delete'))\n //do something\n\n\nPlease help me how to select from DB permissions and check user right with hasRight method. \n\ni think that need to check if user permissions from DB is in array. How this should look?\n\nand maybe can you tiny code of my setPermission method? thank u"
] | [
"php",
"laravel-4"
] |
[
"SSDT using multiple input fields in expression to create hyperlink",
"I am building an expression for a hyperlink in SSDT but I am trying to build it with 2 field inputs.\nHere is what I started with in the expression box and it works.\n="http://s1324.com/Report&Car=Toyota&Model=Celica"\nThen i substituted Celica for &Fields!Model.Value and that URL worked. (where Fields!Model.Value = Celica)\n="http://s1324.com/Report&Car=Toyota&Model="&Fields!Model.Value\nNow i am trying to also substitute the word Toyota for a Car value (where Fields!Car.Value = Toyota) but i cant seem to complete the entire correct url\n="http://s1324.com/Report&Car="&Fields!Car.Value"&Model="&Fields!Model.Value\nIs there a way to use 2 inputs to create a URL?\nThanks"
] | [
"html",
"url",
"reporting-services",
"sql-server-data-tools"
] |
[
"Applying Linear regression for quadratic function",
"I am new to machine learning. For a sample formula , y= 5 + 10(x^2), I generated x and y values and applied linear regression for it. The theta1 and theta2 values I received was for a straight line with large cost. How do I modify linear regression algorithm to get the exact values of theta1 = 5 and theta2 = 10?"
] | [
"machine-learning",
"linear-regression",
"non-linear-regression"
] |
[
"Hero image exclusively is being unresponsive",
"For some reason my hero image, and only my hero image isn't being responsive with the rest of the page.\n\nMy html is:\n\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=devicewidth, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"styles.css\">\n <title>prototype</title>\n </head>\n <header>\n<div class=\"hero\">\n <img src=\"images/hero.jpg\" alt=\"hero\">\n </div>\n\n\nAnd my css is for this is:\n\nheader {\n max-width: 1340px;\n padding: 0 15px;\n margin: 0 auto;\n}\n\n\nWhat should I do to make it responsive?"
] | [
"html",
"css"
] |
[
"Checkboard artifact appears and scrolling stops when changing value of combobox",
"Phone: Samsung Galaxy S \nFirmware: 2.3.5 \nBuild number: GINGERBREAD.UCKK4 Kernel: 2.6.35.7-I897UCKK4-CL614489\nBrowser: Standard Android Browser\n\n\nI have a simple html form that, once I change the value of a combobox, I can no longer scroll vertically and the form becomes unusable.\n\nIn addition, a strange black & white checkerboard pattern appears at the top and bottom of my form.\n\nHere is a video to demonstrate. It shows the form scrolling up and down normally. Then, I change the value and then the checkerboard pattern appears. \n\nNOTE: If I turn the display off, then turn it back on, the form returns to normal.\n\nIs there anything wrong in my html that would cause this:\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n <title>Paleo Meal</title>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\" />\n <link rel=\"stylesheet\" href=\n \"http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css\" type=\"text/css\" />\n <script src=\"http://code.jquery.com/jquery-1.8.2.min.js\" type=\"text/javascript\">\n</script>\n <script src=\"http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js\" type=\n \"text/javascript\">\n</script>\n</head>\n\n<body>\n <div id=\"fb-root\"></div>\n\n <div data-role=\"page\">\n <div data-role=\"header\">\n <h1>Paleo Meal</h1>\n </div>\n\n <div data-role=\"fieldcontain\">\n <div id=\"_addMealFrame\" data-role=\"collapsible\" data-mini=\"true\" data-theme=\"a\"\n data-collapsed=\"false\">\n <h3 data-theme=\"d\" id=\"_mealFrameText\">Meal Details</h3>\n\n <form action=\"\" method=\"post\" accept-charset=\"utf-8\" id=\"_profileForm\" data-ajax=\n \"false\" enctype=\"multipart/form-data\">\n <div data-role=\"fieldcontain\">\n <label for=\"_mealDate\">Date:</label><input type=\"text\" name=\"meal_date\"\n value=\"01/14/13\" id=\"_mealDate\" autocomplete=\"off\" />\n </div>\n\n <div data-role=\"fieldcontain\">\n <label for=\"_mealTime\" class=\"select\">Meal Time:</label><select name=\n \"meal_time\" id=\"_mealTime\">\n <option value=\"0\">\n 12 am\n </option>\n\n <option value=\"1\">\n 1 am\n </option>\n\n <option value=\"23\">\n 11pm\n </option>\n </select>\n </div>\n\n <div data-role=\"fieldcontain\">\n <label for=\"_mealType\" class=\"select\">Meal Type:</label><select name=\n \"meal_type_id\" id=\"_mealType\">\n <option value=\"1\">\n Breakfast\n </option>\n\n <option value=\"2\">\n Lunch\n </option>\n\n <option value=\"3\">\n Dinner\n </option>\n\n <option value=\"4\">\n Snack\n </option>\n\n <option value=\"5\">\n Other\n </option>\n </select>\n </div>\n\n <div data-role=\"fieldcontain\">\n <a href=\"\" id=\"_cancel\" data-ajax=\"false\" data-role=\"button\" data-inline=\n \"true\">Cancel</a><button name=\"\" type=\"submit\" id=\"_submit\" class=\n \"ui-btn-hidden\" value=\"Save\" aria-disabled=\"false\" data-inline=\"true\"\n data-theme=\"b\"></button>\n </div>\n </form>\n </div>\n </div>\n </div>\n</body>\n</html>"
] | [
"android",
"html",
"jquery-mobile"
] |
[
"How can I write derived Ruby classes that call a base class's method when they're defined?",
"Let's say I have this class:\n\nclass ComponentLibrary\n def self.register(klass); ...; end\nend\n\n\nAnd suppose I also have this base class:\n\nclass BaseComponent\n ComponentLibrary.register self\nend\n\n\nHow can I write derivative classes, with a minimum of repetition, that will register themselves with ComponentLibrary when they're defined? (In other words, I'd prefer not to keep writing ComponentLibrary.register self everywhere.)\n\nJust to be clear, I'm talking about writing other classes like:\n\nclass RedComponent < BaseComponent\n # ...\nend\n\nclass BlueComponent < BaseComponent\n # ...\nend\n\n\nbut I don't want to write ComponentLibrary.register self for each one."
] | [
"ruby",
"class"
] |
[
"label and Onehottencodeing in python using sklearn",
"I have created array from a dataframe :\n\nX = data.loc[:, ['a','b', 'c' , 'd', 'e' , 'f']].values\n\n\nNow, I would like to LableEnocde and OneHotEncode 'b', 'd', 'e' column which are type of object or string\n\nhow can I Labelcode and Onehotencode multiple columns here? \n\nNote: This is not dataframe and pd.get_dummies() is hanging the system"
] | [
"python-3.x",
"sklearn-pandas"
] |
[
"Amazon SES: Sending email Headers",
"I am using a Wrapper from http://sourceforge.net/projects/php-aws-ses/\n\nI am not able to send Email Headers with \n\nFrom: Name <[email protected]>\n\n\nIs there any way we can send headers using amazon ses. Any other PHP Wrapper you recommend which allows us to do that ?"
] | [
"email",
"amazon",
"amazon-ses"
] |
[
"How to get information from other pages in react native?",
"I'm starting on react native and I'm having a hard time, I would like to take the information from another page and show this data on this new page. For example I am creating an application for my college work, where it is about soccer players, and it has a screen that shows the list of these players, but I am creating a page with more details about the player clicked.\n\nBelow is the code I created that I can replicate the players.\n\nlistaIndex.js\n\n/* eslint-disable prettier/prettier */\nimport {Text, View,StyleSheet,Image} from 'react-native';\nimport React, {Component} from 'react';\n\nexport default class JogadoresLista extends Component {\n render(){\n return (\n <View style={styles.viewDentro}>\n <View style={styles.viewTop}>\n <Image source={this.props.imageUri} style={styles.imagem} />\n <View style={styles.viewBottom}>\n <Text style={styles.textoP}>{this.props.name}</Text>\n <Text style={styles.textoP}>{this.props.posicao}</Text>\n </View>\n </View>\n </View>\n ); \n}\n}\n\n\nBelow is the code I created that I can show the players.\n\nindex.js\n\nimport React from 'react';\nimport {Text, TouchableOpacity, View, ScrollView, StyleSheet, Image} from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport JogadoresLista from '../jogadores/listaIndex';\nimport logoG from '../../images/icon.png';\n\nexport default function Home({navigation}) { \n function navigateToPlayers(){\n navigation.navigate('Detalhes');\n }\n return (\n <SafeAreaView style={{flex:1}}>\n <View style={styles.home}>\n <ScrollView scrollEventThrottle={16}>\n <View style={styles.logoView}>\n <Image source={logoG} style={styles.imageLogo}/>\n <View>\n <Text style={styles.texto}>Principais Jogadores</Text>\n <Text style={styles.textoL}>GodoySoccer</Text>\n </View>\n </View>\n <ScrollView horizontal={false} showsHorizontalScrollIndicator={false}>\n <JogadoresLista\n imageUri={require('../../images/ronald-juv.jpg')}\n name=\"Cristiano Ronaldo\"\n posicao=\"Extremo Esquerdo\"/>\n <TouchableOpacity style={styles.botao} title=\"Detalhes\" onPress={(navigateToPlayers)}>\n <Text style={styles.textoB}>Detalhes</Text>\n </TouchableOpacity> \n </ScrollView>\n </ScrollView>\n </View>\n </SafeAreaView>\n );\n}\n\n\nBelow is the code I can't create to show the clicked player data \ndetalhesJogadores.js\n\n/* eslint-disable prettier/prettier */\nimport {Text, View, Image,StyleSheet} from 'react-native';\nimport React from 'react';\n\n\n\nexport default function DetalhesPlayers() { \n return (\n <View style={styles.viewDentro}>\n <View style={styles.viewTop}>\n {/* Player Name */}\n <Text>{this.props.name}</Text> \n {/* Player Position */}\n <Text style={styles.textoP}>{this.props.posicao}</Text>\n {/* Player Image */}\n <Image source={this.props.imageUri} style={styles.imagem} />\n </View>\n </View>\n ); \n}\n\n\nI would like some help to be able to solve this problem, because it is for my college work and I don't know where to start\n\nScreen showing players\nScreen showing player data"
] | [
"javascript",
"reactjs",
"react-native",
"react-props"
] |
[
"What's after Z in SQL_Latin1_General_CP1_CI_AS?",
"I am trying to prove a table design flaw in a production db, that a table must not have a clustered primary key on a column that can have a random data, in this case a code keyed in by end user.\n\nThough we know the solution is to make the PK as non-clustered, I still need to add rows to it for testing purpose on its replica. Therefore, I will need to know what would be the character I can use after 'Z' as a prefix.\n\nMore, the column is not a unicode, and it would be a mess to prefix my fake data with a series of Zs. The table is now having hundred-thousands rows, and each insertion is taking seconds."
] | [
"sql-server",
"database-design"
] |
[
"What can I safely remove in a python lib folder?",
"I am using:\n\nmkdir -p build/python/lib/python3.6/site-packages\npipenv run pip install -r requirements.txt --target build/python/lib/python3.6/site-packages\n\n\nto create a directory build with everything I need for my python project but I also need to save as much space as possible.\n\nWhat can I safely remove in order to save space?\n\nMaybe can I do find build -type d -iname \"*.dist-info\" -exec rm -R {} \\; ?\n\nCan I remove *.py if I leave *.pyc?\n\nThanks"
] | [
"python",
"pip",
"requirements",
"pyc"
] |
[
"How to validate operators with integers for a calculator program?",
"I'm trying to create a program that allows the user to input one of 4 operators (addition, subtraction, multiplication, or division) and then two numbers. The program then calculates the operation. I can't seem to validate the operators for the output, though. I'm trying with an if ... else statement now, but no luck. Any pointers here?\n\noperator = \"\"\nnumbers = []\ninputNumbers = [\"first number\", \"second number\"]\n\ndef userInput():\n try:\n operator = input(\"Please choose a valid operation (+, -, *, /): \")\n except:\n print(\"Please enter a valid operator.\")\n for inputNumber in inputNumbers:\n user_num_input = -1\n while user_num_input < 0:\n try:\n user_num_input = int(input(\"Type in {}: \".format(inputNumber)))\n except:\n user_num_input = -1\n print(\"Please enter a whole number.\")\n if user_num_input > -1:\n numbers.append(user_num_input)\nuserInput()\n\ndef addNumbers():\n add = numbers[0] + numbers[1]\n return add(numbers)\n\ndef subNumbers():\n sub = numbers[0] - numbers[1]\n return sub(numbers)\n\ndef mulNumbers():\n mul = numbers[0] * numbers[1]\n return mul(numbers)\n\ndef divNumbers():\n div = numbers[0] / numbers[1]\n return div(numbers)\n\ndef userOutput():\n if operator == \"+\":\n print(numbers[0], \"+\", numbers[1], \"=\", addNumbers())\n elif operator == \"-\":\n print(numbers[0], \"-\", numbers[1], \"=\", subNumbers())\n elif operator == \"*\":\n print(numbers[0], \"*\", numbers[1], \"=\", mulNumbers())\n elif operator == \"/\":\n print(numbers[0], \"/\", numbers[1], \"=\", divNumbers())\nuserOutput()"
] | [
"python",
"arrays",
"loops",
"validation"
] |
[
"spring - should every class in my project be a bean?",
"In my project there are several @repositories , @Services, @Controllers\n\nMy question is for the other 99% of the classes:\n\nShould i declare them as beans as well?\n\npros\\cons?\n\nthanks.."
] | [
"spring",
"javabeans"
] |
[
"Sort WooCommerce product category sub menu items by name ASC in Wordpress menu",
"I am adding in my main WordPress menu to WooCommerce product category menu items, the children subcategory terms as submenu items with the following code and it works.\n\nThe code:\nadd_filter("wp_get_nav_menu_items", function ($items, $menu, $args) {\n\n // don't add child categories in administration of menus\n if (is_admin()) {\n return $items;\n }\n foreach ($items as $index => $i) {\n\n if ("product_cat" !== $i->object) {\n continue;\n }\n $term_children = get_term_children($i->object_id, "product_cat");\n // add child categories\n foreach ($term_children as $index2 => $child_id) {\n $child = get_term($child_id);\n $url = get_term_link($child);\n $e = new \\stdClass();\n $e->title = $child->name;\n $e->url = $url;\n $e->menu_order = 500 * ($index + 1) + $index2;\n $e->post_type = "nav_menu_item";\n $e->post_status = "published";\n $e->post_parent = $i->ID;\n $e->menu_item_parent = $i->ID;\n $e->type = "custom";\n $e->object = "custom";\n $e->description = "";\n $e->object_id = 0;\n $e->db_id = 0;\n $e->ID = 0;\n $e->position = 0;\n $e->classes = array();\n $items[] = $e;\n }\n }\n\n return $items;\n\n}, 10, 3); \n\nBut I would like to sort that submenu items alphabetically in Ascending order and I didn't find a way to do it yet. How can I sort that submenu items by name (alphabetically) in Ascending order?"
] | [
"php",
"wordpress",
"woocommerce",
"submenu",
"taxonomy-terms"
] |
[
"Time Signature Meta Message in MIDI",
"I am working on a MIDI project using mido library in Python. I see in the manual a meta message for time signature with value: notated_32nd_notes_per_beat which has a default value of 8. \n\n<meta message time_signature numerator=4 denominator=4 clocks_per_click=24 notated_32nd_notes_per_beat=8 time=0>\n\n\nWhich makes sense. However, can I define it like:\n\n<meta message time_signature numerator=4 denominator=4 clocks_per_click=24 notated_32nd_notes_per_beat=32 time=0>\n\n\nDoes this increase the display resolution when shown in a score/typesetting software? What is the usage of this please?\n\ntime_signature (0x58) meta message in midi files"
] | [
"midi"
] |
[
"Dynamic WPF MVVM datagrid behaviour",
"if I have a collection of objects called FXRate objects, defined as\n\npublic class FXRate\n{\n public string CcyOne { get; set;}\n public string CcyTwo { get; set;}\n public decimal Rate { get; set;}\n}\n\n\nThat I want to display in a grid, I have tried binding the ItemsSource of a DataGrid to an ObservableCollection and I can render it as follows\n\nCcy one Ccy two Rate \nEUR GBP 1.2 \nEUR USD 1.5 \nGBP EUR 0.8\n\n\nEtc... This lets the user (using an editable column style) to update the rate, and this updates the underlying FXRate objects property. So once the user makes their changes, the visual changes reflect directly in the underlying FXRate objects, then they can save and it is simple to save all the values.\n\nHowever what I want is to render it as follows\n\n GBP EUR JPY\nGBP 1 1.2 13.1\nEUR 1.1 1 5.2\nJPY 0.15 0.23 1\n\n\nAnd to have the amount cells still editable and bound to the underlying objects, so the user can make a change in the GUI and have the relevant underlying FXRate object have its amount updated accordingly.\n\nCan anyone think of a way to accomplish this with MVVM?"
] | [
"c#",
"wpf",
"mvvm",
"datagrid"
] |
[
"What is unprotected instances in aws?",
"I just got a word in below link that aws have unprotected instance what is it mean in actualy?\n\nReference link - https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html"
] | [
"amazon-web-services"
] |
[
"how to write an excel formula in vba?",
"I'm new in vba. I have an excel formula that I want to write it as vba code. But I have a problem with that. I do not know how to do that. Can anybody help me?\nhere is the formula:\n\nIFERROR(LOOKUP(2^15,SEARCH(G$6:G$8,B6),G$6:G$8),\"\")\n\nActually I have some keywords in column G from sheet2 and I want to search them in column B from sheet1, which contains text. If there is any match I want that vba code returns the matched keyword in a column (for example D) in first sheet, if not leaves the corresponding cell empty.\n\nI do not know how to do that. Can anybody help me?"
] | [
"excel",
"vba"
] |
[
"One of RGB value is always 255 - ANDROID",
"I wrote a simple application that shows you RGB values of touched color from image.\nThe problem is, everytime i touch my image one of RGB values is 255.\nFor example. I should have values #F0F0F0 i have #FFF0F0 or #F0FFF0.\n\nHere's my code:\n\niv = (ImageView) findViewById(R.id.imageView1);\n mTextLog = (TextView) findViewById(R.id.textView3);\n iv.setOnTouchListener(new OnTouchListener() {\n\n int x = 0, y = 0;\n float fx, fy;\n public boolean onTouch(View v, MotionEvent event) {\n\n ImageView imageView = ((ImageView)v);\n Bitmap bitmap = ((BitmapDrawable)imageView.getDrawable()).getBitmap();\n v.getWidth();\n v.getHeight();\n bitmap.getWidth();\n bitmap.getHeight();\n fx = ((event.getX()/656)*960);\n fy = ((event.getY()/721)*1029);\n if(fx > 950) fx = 950;\n if(fy > 1000) fy = 1000;\n if(fx < 32) fx = 32;\n x = Math.round(fx);\n y = Math.round(fy);\n\n if(fx > 0 && fy > 0){\n\n int pixel = bitmap.getPixel(x, y);\n int redValue = Color.red(pixel);\n int blueValue = Color.blue(pixel);\n int greenValue = Color.green(pixel);\n if(redValue > 255) redValue = 255;\n if(redValue < 0) redValue = 0;\n if(greenValue > 255) greenValue = 255;\n if(greenValue < 0) greenValue = 0;\n if(blueValue > 255) blueValue = 255;\n if(blueValue < 0) blueValue = 0;\n\n br = (byte) redValue;\n bg = (byte) greenValue;\n bb = (byte) blueValue;\n\n tv2.setText(\"Red: \" + redValue + \" Green: \" + greenValue + \" Blue: \" + blueValue);\n RelativeLayout rl = (RelativeLayout) findViewById(R.id.idd);\n rl.setBackgroundColor(pixel);\n\n\nAnother problem is when I moving my finger on screen, chaning color on background is fine, but when i'm trying to send it to my microkontroler via bluetooth there's a problem.\nFe. if i touch black color two times, it sends first black, then blue. :O\n\nIt happens only when i return true from this onTouch method.\n\nI would be greatful for any help.\n\nAnd btw. sorry for my english."
] | [
"java",
"android",
"colors",
"bluetooth",
"rgb"
] |
[
"Css grid not wrapping",
"I've read lots of posts saying to use grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); to get it to wrap. I've tried that and it still doesn't warp. I want my left column to stay at max-content and not resize. I want my right column to wrap below column 1 when the content gets too small in column 2. \n\nThis is driving me crazy.\n\n\r\n\r\n.modal {\r\n padding: 20px;\r\n text-align: center;\r\n background-color: #9999;\r\n}\r\n\r\n.content {\r\n display: grid;\r\n justify-content: flex-start;\r\n grid-template-columns: minmax(max-content, auto) 1fr;\r\n align-items: flex-start;\r\n flex-wrap: wrap;\r\n max-width: 700px;\r\n margin: 0 auto;\r\n text-align: center;\r\n border: 1px solid white;\r\n}\r\n\r\n.message {\r\n text-align: left;\r\n border: 1px solid red;\r\n}\r\n \r\n.group {\r\n display: grid;\r\n grid-template-columns: repeat(auto-fit, minmax(60px, max-content));\r\n column-gap: 10px;\r\n row-gap: 10px;\r\n justify-content: center;\r\n}\r\n \r\n.link {\r\n background-color: green;\r\n display: block;\r\n}\r\n<div class=\"modal\">\r\n <div class=\"content\">\r\n\r\n <div class=\"message\">\r\n <h3>Some content to fill up the message?</h3>\r\n <p>\r\n <span>\r\n <a href=\"bla\">This is a dummy link?</a>\r\n </span>\r\n </p>\r\n </div>\r\n\r\n <div class=\"group\">\r\n <div>\r\n <a href=\"....\" class=\"link\">\r\n <p>link</p>\r\n </a>\r\n <a href=\"....\" class=\"link\">\r\n <p>link</p>\r\n </a>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n</div>"
] | [
"html",
"css",
"css-grid"
] |
[
"2-step verification in Coda",
"Does anyone know — do Panic Coda supports 2-step verification, just like one provided by Google? I need to use this to authenticate on FTP/SFTP with Google Authenticator."
] | [
"ftp",
"sftp",
"coda"
] |
[
"How to find outliers frames in multiindex Dataframe",
"The result should be a mi-dataframe that does not contain any outliers.The criterion is the standard deviation: np.abs(x-g_mean) <= 3*g_std\n\nMy attempt to identify the statistical outliers:\n\nimport pandas as pd\nimport numpy as np\n\n#create sample\narrays = [[1,1,1,2,2,2,3,3],\n [0,1,2,0,1,2,0,1]]\ntuples = list(zip(*arrays))\nindex = pd.MultiIndex.from_tuples(tuples, names=['ID', 'INDEX'])\ndf = pd.DataFrame(np.abs(np.random.randn(8, 2)), index=index, columns=['Ts','Tf'])\n\n#groupby index and learn from data\ng = df.groupby(level='INDEX')\ng_mean=g.mean()\ng_std = g.std()\n\n#groupby ID and look if some ID is an outlier\ng = df.groupby(level='ID')\ntest = g.apply(lambda x: True if np.abs(x-g_mean) <= 3*g_std else False)\n\n\nThe last line in my code does not work, because in the last group I compare two different forms of dataframes. Any suggsestions?"
] | [
"python",
"pandas",
"numpy"
] |
[
"html email with background-image style not shown",
"I am creating an email template which has to display images from external website. I had placed some <img> tags for rendering the images and there are some <td> tags with background-image property set in inline css of the elements.\n\nNow, when an email is received in outlook, the images are not displayed (this is expected as the images are not embedded). And I click the download images to see the images properly. The images in <IMG> tag are only shown and the background-image for the <TD> is not rendered.\n\nAny views on solving this problem?\n\nThanks!"
] | [
"email",
"html-email"
] |
[
"how to set Gitlab project default issues template using the API",
"Background\n\nI am enforcing an issue template so I can extract the business requirement(one-liner describing the issue for non-technical people) from an issue description\n\n\n\nProblem: Gitlab API doesn't have the description field\n\n\nAccording to Gitlab API documentation, there is nothing about the description field in the projects namespace parameters https://docs.gitlab.com/ce/api/projects.html#edit-project\n\nQuestion: How can I set a default issue template using the API?"
] | [
"gitlab",
"gitlab-ci"
] |
[
"Can we do something atomically with 2 or more lock-free containers without locking both?",
"I'm looking for Composable operations - it fairly easily to do using transactional memory. (Thanks to Ami Tavory) \n\nAnd it easily to do using locks (mutex/spinlock) - but it can lead to deadlocks - so lock-based algorithms composable only with manual tuning.\n\nLock-free algorithms do not have the problem of deadlocks, but it is not composable. Required to designed 2 or more containers as a single composed lock-free data structure.\n\nIs there any approach, helper-implementation or some lock-free algorithms - to atomically work with several lock-free containers to maintain consistency?\n\n\nTo check if if an item is in both containers at once\nTo move element from one container to another atomically\n\n\n...\n\nOr can RCU or hazard-pointers help to do this?\n\nAs known, we can use lock-free containers, which is difficult in its implementations, for example from Concurrent Data Structures (CDS) library: http://libcds.sourceforge.net/doc/cds-api/group__cds__nonintrusive__map.html\n\nAnd for example we can use lock-free ordered-map like SkipList CDS-lib\n\nBut even simple lock-free algorithm is not lock-free for any cases:\n\n\nIterators documentation-link\n\n\n\n You may iterate over skip-list set items only under RCU lock. Only in\n this case the iterator is thread-safe since while RCU is locked any\n set's item cannot be reclaimed. The requirement of RCU lock during\n iterating means that deletion of the elements (i.e. erase) is not\n possible.\n\n\n\n::contains(K const &key) - documentation-link\n\n\n\n The function applies RCU lock internally.\n\n\n\nTo ::get(K const &key) and update element which we got, we should use lock: documentation-link\n\n\nExample:\n\ntypedef cds::container::SkipListMap< cds::urcu::gc< cds::urcu::general_buffered<> >, int, foo, my_traits > skip_list;\nskip_list theList;\n// ...\ntypename skip_list::raw_ptr pVal;\n{\n // Lock RCU\n skip_list::rcu_lock lock;\n pVal = theList.get( 5 );\n if ( pVal ) {\n // Deal with pVal\n //...\n }\n}\n// You can manually release pVal after RCU-locked section\npVal.release();\n\n\nBut if we use 2 lock-free containers instead of 1, and if we use only methods wich is always lock-free, or one of it lock-free, then can we do it without locking both containers?\n\ntypedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_gpb;\ncds::container::SkipListMap< rcu_gpb, int, int > map_1;\ncds::container::SkipListMap< rcu_gpb, int, int > map_2;\n\n\nCan we atomically move 1 element from map_1 to map_2 without locking both containers - i.e. map_1.erase(K const &key) and map_2.insert(K const &key, V const &val) if we want to maintain atomicity and consistency: \n\n\nthat other threads do not see that there is no element in the first container, and he still had not appear in the second\nthat other threads do not see that there is element in the first container, and the same element already in the second\n\n\nCan we do something atomically with 2 or more lock-free containers without locking both - if we want to maintain atomicity and consistency?\n\nANSWER: We can't do any atomically operations with two or more lock-free containers at once without locks by using simply its usual functions. \n\nOnly if we do 1 simply operation provided by lock-free algorithm in containers-API then for 2 lock-free containers it is enough 1 lock, exclude 3 cases described above when even in lock-free containers uses locks.\n\nAlso \"but maybe something with a bunch of extra overhead\" if you made complicated custom improvements of lock-free algorithms then you can provide some composable, for example, as \"the two queues know about each other, and the code looking at them is carefully designed\" as Peter Cordes noted."
] | [
"c++",
"multithreading",
"concurrency",
"lock-free",
"libcds"
] |
[
"How to create a timezone/DST accurate date-time plus Unix epoch number?",
"For a database project, I want a two-field table consisting of the integer portion of a Unix epoch timestamp, and the corresponding human-readable date and time. (I only need 5-minute increments, and I want an integer, so I'm ignoring the decimal portion of the epochal float.)\n\nBeing a Python newbie, I am uncertain about the reliability of my methods: my approach currently is to use a time-tuple, which includes the timezone info. But time-tuple appears not to allow addition and subtraction, while datetime objects do. So I thrash around with some conversions. My first attempt:\n\nimport datetime\nimport time\nsp = '%m/%d/%Y %H:%M'\notime = datetime.datetime(2010, 3, 14, 0, 0, 0, 0)\nitime = int(round(time.mktime(otime.timetuple())))\nfor x in range(0, 50):\n print(str(itime)+ \", \" + str(time.strftime(sp, otime.timetuple())))\n otime = otime + datetime.timedelta(seconds=300)\n ttime = time.localtime(time.mktime(otime.timetuple()))\n otime = datetime.datetime.fromtimestamp(time.mktime(ttime))\n itime = int(round(time.mktime(ttime)))\n\n\nThis works, and traverses DST time changes correctly for my timezone.\n\nJust incrementing the Unix epoch seconds seems simpler, though:\n\nimport datetime\nimport time\n\nsp = '%m/%d/%Y %H:%M'\notime = datetime.datetime(2010, 3, 14, 0, 0, 0, 0)\nitime = int(round(time.mktime(otime.timetuple())))\nfor x in range(0, 50):\n print(str(itime)+ \", \" + str(time.strftime(sp, otime.timetuple())))\n itime = itime + 300\n otime = datetime.datetime.fromtimestamp(float(itime))\n\n\nBoth methods seem to give identical output in the ranges I've checked, for example the DST time-change in 2010:\n\n1268558100, 03/14/2010 01:15\n1268558400, 03/14/2010 01:20\n1268558700, 03/14/2010 01:25\n1268559000, 03/14/2010 01:30\n1268559300, 03/14/2010 01:35\n1268559600, 03/14/2010 01:40\n1268559900, 03/14/2010 01:45\n1268560200, 03/14/2010 01:50\n1268560500, 03/14/2010 01:55\n1268560800, 03/14/2010 03:00\n1268561100, 03/14/2010 03:05\n1268561400, 03/14/2010 03:10\n1268561700, 03/14/2010 03:15\n\n\nMy question: Is there a reason to use datetime.timedelta() instead of simply incrementing the Unix epoch integer by 300 seconds? Will that end up biting me unexpectedly? Is there a more elegant way to do this?"
] | [
"python"
] |
[
"Display Session timeout warning message before Session expires in ASP.NET Core",
"I can able to set the session end the below code.\n\nservices.AddSession(options => {\n options.IdleTimeout = TimeSpan.FromMinutes(2);\n });\n\nI need to extend the session after 20 minutes and if show the session time out warning message to the user and so the user can extend their time out from the application UI."
] | [
"asp.net-core",
"asp.net-core-mvc",
"session-timeout"
] |
[
"How do I use Reference Parameters in C++?",
"I am trying to understand how to use reference parameters. There are several examples in my text, however they are too complicated for me to understand why and how to use them.\n\nHow and why would you want to use a reference? What would happen if you didn't make the parameter a reference, but instead left the & off?\n\nFor example, what's the difference between these functions:\n\nint doSomething(int& a, int& b);\nint doSomething(int a, int b);\n\n\nI understand that reference variables are used in order to change a formal->reference, which then allows a two-way exchange of parameters. However, that is the extent of my knowledge, and a more concrete example would be of much help."
] | [
"c++",
"reference-parameters"
] |
[
"Insert image in textarea when button is pressed using javascript or jquery?",
"i have design one textarea and button in html. i want to insert image in textarea when button is pressed. how it is possible in javascript or jquery?"
] | [
"php",
"javascript",
"jquery"
] |
[
"Is there a way to use Sequelize with client-side storage like IndexedDB?",
"I'm pretty new to Node.js and Sequelize but I've built a couple web apps using Sequelize. I would like to post them publicly for demonstration purposes (not for practical use), and I don't want any database changes that a user makes to be saved permanently, so I'm thinking that I would like to have client-side data storage for the demo, which I understand is what IndexedDB is (though I haven't used it yet). However, it appears I would have to rewrite most of my code in order to have my app set up with IndexedDB. Is there a relatively simple way to keep most of my Sequelize-based code but use client-side storage instead of server-side storage? Or is this not really possible?\nThanks!"
] | [
"javascript",
"node.js",
"sequelize.js",
"indexeddb"
] |
[
"mysql join not working as expected",
"i want to select schedule of specific teacher for a given day .... statement should assume that a teacher may teach in elementary and high school\n\nhere is my statement\n\n `select \n class.name as subject_classmodel_name, \n teachers.name as subject_teachers_name, \n section.name as subject_section_name, \n day.name as day_name,\n time_format(time_range.time_start,'%H:%i') as time_time_start,\n time_format(time_range.time_end,'%H:%i') as time_time_end,\n sched.subject_ref, sched.time_ref, sched.day_ref\n from schedule sched\n join class_teachers_section\n join time_range\n join day\n join class\n join teachers\n join section\n where teachers.name = \"ronald manlapao\" and \n section.level = \"elementary\" and \n time_range.level = \"elementary\" and \n class_teachers_section.id = sched.subject_ref and \n class.id = class_teachers_section.class_ref and \n teachers.id = class_teachers_section.teachers_ref and \n section.id = class_teachers_section.section_ref and\n day.id = sched.day_ref\n order by time_range.time_start asc`\n\n\nclass_teachers_section (table) has tables class, teachers, section\nschedule (table) has tables class_teachers_section, day, time_range\n\noutput \n\n\n\nexpected result\n\nonly one row (last row) with time_start (14:00) time_end (15:00) should have data in columns subject_classmodel_name, subject_teachers_name, subject_section_name, subject_ref, time_ref and day_ref. the rest should be null\n\nIm using MYSQL 5.6."
] | [
"mysql",
"join"
] |
[
"Read Connection String From .INI File",
"I have a .ini file setup from which I read connection strings. I have a modeule to read the strings:\n\nOption Explicit\n\nPrivate Declare Function GetPrivateProfileString Lib \"kernel32\" _\n Alias \"GetPrivateProfileStringA\" (ByVal lpApplicationName As String, ByVal lpKeyName As Any _\n , ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long _\n , ByVal lpFileName As String) As Long\n\n\nPublic Const iniPath = \"\\DBSettings.INI\"\n\n\nPublic Sub Main()\nDim dbPath As String\nDim dbPath As String\ndbPath = GetSetting(\"DataBase\", \"DBPath\")\ndbPath= GetSetting(\"DataBase\", \"DBPath\")\nForm1.Show\n\n End Sub\n\n\nPrivate Function GetSetting(ByVal pHeading As String, ByVal pKey As String) As String\nConst cparmLen = 100\nDim sReturn As String * cparmLen\nDim sDefault As String * cparmLen\nDim aLength As Long\naLength = GetPrivateProfileString(pHeading, pKey _\n , sDefault, sReturn, cparmLen, App.Path & iniPath)\nGetSetting = Mid(sReturn, 1, aLength)\nEnd Function\n\n\nNow, I am trying to display the strings on click of a button:\n\nOption Explicit\n\nPublic Sub Command1_Click()\n\nMsgBox (dbPath)\nMsgBox (dbPath)\n\nEnd Sub\n\n\nHowever, it seems the form cannot see the variables in the module. How may I fix this?\nAny help would be appreciated."
] | [
"vb6"
] |
[
"Android: Can I directly link to the ratings tab of an app's page on Google Play",
"Can I directly link to the ratings tab of an app's page on Google Play?\n\nIf yes, what is the url?"
] | [
"android",
"hyperlink",
"google-play"
] |
[
"SQL what does & in where clause mean?",
"Is this code right:\n\n\"SELECT * FROM dataTable WHERE Datee Between '#\" & textStartDate.Text & \"# AND #\" & textEndDate.Text & \"#'\" \n\n\nWhat does that & mean and that # can someone tell me please\nI am using vb and acess"
] | [
"sql",
"vb.net",
"date",
"ms-access"
] |
[
"Title tag text shows up on image in chrome",
"I have a title tag around an image which is only supposed to show on hover. It works in IE but in chrome the title tag text is actually shown on the image as well as on hover. \n\nHere is my html snip for that section\n\n<img id=\"projects\" title=\"Some of My Projects.\" />\n\n\nThe image is in a table but I'm not sure if that is what would be affecting this. I do have a picture of what is happening but not enough reputation to post it in my question apparently.\n\nDoes anyone have any ideas?\n\nThanks!"
] | [
"html",
"google-chrome",
"tags"
] |
[
"Capture an argument passed to function in different JavaScript file using Jasmine",
"I have a JavaScript file main_one.js which requires another JavaScript file helper.js.\n\nhelper.js\n\nwarp = {\n postThisEvent: function(a) {\n // some operation on a\n }\n};\n\n\nmain_one.js\n\nvar Helper = require('path/helper.js');\n// some steps\nHelper.warp.postThisEvent(event);\n\n\nI want to capture event using Jasmine. How do I create my spy object for capturing event in postThisEvent()?"
] | [
"javascript",
"jasmine"
] |
[
"Performance of Resque jobs",
"My Resque job basically takes params hash and stores it into the DB. In the process it does several reads and writes.\n\nThese R/Ws take approx. 5ms in total on my local machine and a little bit more on Heroku (I guess it's because of the shared DB).\n\nHowever, the rate at which the queue is processed is very low / about 2-3 jobs per second. What could be causing this?\n\nThank you."
] | [
"heroku",
"resque"
] |
[
"C++: Adding automatically allocated objects to a std::vector",
"I wrote the following code:\n\n#include <iostream>\n#include <vector>\nusing namespace std;\n\nclass AClass\n{\n public:\n int data;\n\n AClass() \n { data = -333; cout << \"+ Creating default \" << data << endl; }\n\n AClass(const AClass &copy) \n { data = copy.data; cout << \"+ Creating copy of \" << data << endl; }\n\n AClass(int d) \n { data = d; cout << \"+ Creating \" << data << endl; }\n\n ~AClass() \n { cout << \"- Deleting \" << data << endl; }\n\n AClass& operator = (const AClass &a)\n { data = a.data; cout << \"= Calling operator=\" << endl; }\n};\n\nint main(void)\n{\n vector<AClass> v;\n\n for (int i = 3; i--; )\n v.push_back(AClass(i));\n\n vector<AClass>::iterator it = v.begin();\n while (it != v.end())\n cout << it->data << endl, it++;\n\n return 0;\n}\n\n\nAnd the output from the program is:\n\n+ Creating 2\n+ Creating copy of 2\n- Deleting 2\n+ Creating 1\n+ Creating copy of 1\n+ Creating copy of 2\n- Deleting 2\n- Deleting 1\n+ Creating 0\n+ Creating copy of 0\n+ Creating copy of 2\n+ Creating copy of 1\n- Deleting 2\n- Deleting 1\n- Deleting 0\n2\n1\n0\n- Deleting 2\n- Deleting 1\n- Deleting 0\n\n\nThen I changed the class to:\n\nclass AClass\n{\n public:\n int data;\n\n AClass(int d) \n { data = d; cout << \"+ Creating \" << data << endl; }\n\n ~AClass() \n { cout << \"- Deleting \" << data << endl; }\n};\n\n\nAnd the output becomes:\n\n+ Creating 2\n- Deleting 2\n+ Creating 1\n- Deleting 2\n- Deleting 1\n+ Creating 0\n- Deleting 2\n- Deleting 1\n- Deleting 0\n2\n1\n0\n- Deleting 2\n- Deleting 1\n- Deleting 0\n\n\nIt appears that vector is making copies of existing objects when new ones are added, but it seems like a lot of unnecessary allocation/deletion is taking place. Why is this? Also, why does the second version work when I haven't provided a copy constructor?"
] | [
"c++",
"object",
"stl",
"vector",
"allocation"
] |
[
"Update persistent object in Hibernate",
"I need to update an Object. I fetch it. The object is a Persistent Object. Now.. If I change any properties, because is a persistent (not detached) object, any varations is immediately saved? I need to call a function? Or when session is flushed, the modification are stored?"
] | [
"java",
"hibernate"
] |
[
"Why does the memory usage of a .NET application seem to drop when it is minimized?",
"For example, launch Paint.NET. Then have a look on its memory usage with Task Manager: on my computer, it uses 36Mb.\n\nThen minimize Paint.NET: now it takes only a few more than 1Mb.\n\nThis happens with every .NET Application. What happens when a .NET Application is minimized? Is a GC occurring?"
] | [
".net",
"memory",
"garbage-collection"
] |
[
"How can I omit capturing of a button/region using DirectShow APIs?",
"I am using \"Push Source Desktop\" filter for capturing screen in my application.\nI hide my application while recording is going on. Only a button for stopping the recording is visible on screen. \nThe button also gets recorded by the filter. During playback of the saved recording the button is visible along with rest of the screen region.\n\nIs there any way I can prevent the button from getting recorded ?\n\nMy aim is to record the screen without the button. I cannot hide the button as it required for stopping the recording of my application.\nI have tried to alter the alpha component of my button and make it semi-transparent. But still the filter captures the semi-transparent button.\n\nHow can I get the background region of the button and ignore the capturing of the button itself?"
] | [
"winapi",
"video",
"directshow",
"gdi"
] |
[
"How to count moved files with bash script?",
"My bash script moves screenshot files from desktop into newly created folder.\nI would like it to echo the number of the files moved after it finishes. \n\nI've tried with exit code, but it only shows an exit code for one command which is mv.\nIs there a way that I can see what is going under the hood of mv command, which in that case moves more than one file?\n\n#!/bin/bash\ndate=$(date +\"%d-%m-%y\")\nmkdir SCREENS/\"$date\"\nmv Screenshot*.png SCREENS/\"$date\"\n#echo $? - it gives only one exit code"
] | [
"bash"
] |
[
"Parse file in C to read char",
"Let's say i have a file filled with random characters with whitespaces and \\n included also random.\n\nI want to look for this groups of chars, example: UU, II, NJ, KU. So the purpose is to read the file, look for this kind of groups and say how many are they in the file.\n\nMy problem is whitespace and \\n, becase if i find one of these i should skip it and search again for the groups. I found a solution that could help me, the function strtok_r . \n\nhttp://www.codecogs.com/reference/computing/c/string.h/strtok.php?alias=strtok_r\n\ni think this will isolate full strings so i can read one at time.\n\nIs it a good solution or should take other approach?"
] | [
"c",
"file",
"parsing",
"strtok"
] |
[
"Saving cdrs manually using avp_db_query in Opensips",
"Is there a way to record cdrs manually using avp_db_query in opensips. I am using ACC table to record cdrs and than running procedure to transfer data to another table. But this put a lot of overhead on my DB due to too many calls. So is there any way that I can put directly cdrs in my actual table using AVP_DB_QUERY, I am doing for missing and not accepted calls but don't know how to do it for Answered calls."
] | [
"voip",
"telecommunication",
"opensips"
] |
[
"UPDATE with a SELECT to create a ranking (effiency)",
"I have a ranking that every X time has a balance added to the total points of each player, changing how they are ranked.\nI want my rank to be calculated at DB (MySQL), but I want it to be efficient, so first things first, here's the BalanceIn code:\n\nQ1:\n\nUPDATE playerscore\nSET points = points * 0.9 + GREATEST(-100, LEAST(100, balance)),\n balance = 0;\n\n\nOnce the points are updated for all them, I want to reorder the rank (only for ranked players), like so:\n\nQ2: \n\nSET @r = 0;\nUPDATE playerscore p\nINNER JOIN \n (SELECT @r:=@r+1 as new_rank, player_id\n FROM playerscore\n WHERE is_ranked = 1\n ORDER BY points DESC) s\nON p.player_id = s.player_id\nSET p.rank = s.new_rank\nWHERE is_ranked = 1;\n\n\nIt works, and solves my problem, but: is thisgoing to make 1 select, and from here update all values, or will it make a select for each playerscore row?\n\nIn pseudocode, that's what I DO NOT want:\n\nforeach PlayerScore p in playescore\n new = get_all_players_sorted\n update p.rank = new.new_rank where p.player_id = new.player_id\nendforeach\n\n\nAs it will be, for N players: N selects + N updates.\nI want it to be: 1 select + N updates (contained in a single update) like so:\n\nnew = get_all_players_sorted\nforeach PlayerScore p in playescore\n update p.rank = new.new_rank where p.player_id = new.player_id\nendforeach\n\n\nAm I doing it right with my query (Q2)??"
] | [
"mysql",
"sql",
"performance",
"sqlperformance"
] |
[
"Why isn't this android animation doing anything?",
"I'm trying to use the newer style of Android property animators (rather than the older view animations) to create an animation to shake a view horizontally.\n\nI've written the following XML animator in /res/animator/shake.xml\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<objectAnimator\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:propertyName=\"translationX\"\n android:duration=\"100\"\n android:valueFrom=\"0f\"\n android:valueTo=\"20f\"\n android:valueType=\"floatType\"\n android:interpolator=\"@android:anim/linear_interpolator\"\n android:repeatCount=\"7\"\n android:repeatMode=\"reverse\"/>\n\n\nI have created the following Kotlin extension method to play the animation on any view:\n\nfun View.shake() {\n AnimatorInflater.loadAnimator(context, R.animator.shake).apply {\n setTarget(this)\n start()\n }\n}\n\n\nWhen I call the animation however, nothing happens, and I'm not sure why."
] | [
"android",
"kotlin",
"android-animation",
"android-xml",
"objectanimator"
] |
[
"AWS API-Gateway Caching settings not visible in Console",
"following the AWS docs for enabling Caching for APIs in API-Gateway - I can not find any settings for Caching in there.\nIt seems that I have an old version of the Console, maybe?\nHere is what I see:"
] | [
"amazon-web-services",
"caching",
"aws-lambda",
"aws-api-gateway"
] |
[
"Created folders in SSIS packages in VS 2015",
"I have an SSIS project that I am working on with some team members. We have the project on Team Studio and expect the number of packages in it to grow massively. One of the key features we want is the ability to share data connections efficiently so it a server/ password etc changes then this is automatically brought into packages.\n\nIs there any way to create folders within SSIS packages folders to enable us to better manage this - marked with the red arrow in the picture? Or are we approaching this in the wrong way?"
] | [
"ssis",
"visual-studio-2015"
] |
[
"How can I listen for the start of a user drawing a polygon in Google Maps v3?",
"There's a polygoncomplete event that is fired, but I'm looking for a polygonstart event. Even an overlaystart event would work for me.\n\nWhen the user starts to draw a polygon, I want to remove any existing polygon on the map. Currently, I have that functionality implemented using the polygoncomplete event. It needs to happen at the start though.\n\nMy pseudocode thought is to...\n\n\nListen to click events on the map.\nonclick, check to see which drawing tool is selected (if that's possible).\nIf polygon tool selected, remove all previous polygons.\n\n\nThis would be much easier with a polygonstart event.\n\nHere is a similar question, but hiding and showing the drawing controls is not an option for this ui.\nGoogle Maps Drawing Manager limit to 1 polygon"
] | [
"javascript",
"google-maps",
"google-maps-api-3",
"drawing",
"polygon"
] |
[
"Spring-social-linkedin application token (without user authentication)",
"I'd like to be able to use spring-social-linkedin with an application token much like I can do with spring-social-facebook with workarounds (Use app access token with spring-social facebook to query public pages).\n\nMy application only needs to query public pages, so should not need to be authenticated against a specific user: for example I'd query a public company page http://www.linkedin.com/company/google\n\nI've been reading lots of documentation, but I'm a bit confused about where things are currently at. I don't think you can even instantiate a LinkedInTemplate any more with OAuth1 credentials via the constructor and the doco seems outdated (http://docs.spring.io/spring-social-linkedin/docs/1.0.x/reference/htmlsingle/#apis).\n\nDoes anyone know if LinkedIn has the capability of sever integration without the redirect_uri dance (obviously with only access to a subset of APIs that correlate to public info)?"
] | [
"spring",
"linkedin",
"spring-social",
"spring-social-linkedin"
] |
[
"Redis Node - Querying a list of 250k items of ~15 bytes takes at least 10 seconds",
"I'd like to query a whole list of 250k items of ~15 bytes each.\n\nEach item (some coordinates) is a 15 bytes string like that xxxxxx_xxxxxx_xxxxxx.\n\nI'm storing them using this function :\n\nfunction setLocation({id, lat, lng}) {\n const str = `${id}_${lat}_${lng}`\n\n client.lpush('locations', str, (err, status) => {\n console.log('pushed:', status)\n })\n}\n\n\nUsing nodejs, doing a lrange('locations', 0, -1) takes between 10 seconds and 15 seconds.\n\nSlowlog redis lab:\n\n\nI tried to use sets, same results.\n\nAccording to this post\n\nThis shouldn't take more than a few milliseconds.\n\nWhat am I doing wrong here ?\n\nUpdate:\nI'm using an instance on Redis lab"
] | [
"node.js",
"redis"
] |
[
"How to programatically create a Cloud Monitoring (Stackdriver) Workspace & add a project to it?",
"I want to programatically create a Cloud Monitoring (Stackdriver) workspace, and add projects to it. How do I do this with an API?"
] | [
"google-cloud-platform",
"google-cloud-stackdriver",
"google-cloud-monitoring"
] |
[
"Forward slash being appended to end of url on page load",
"So on my website, I have several pages of content. On one of the pages, a forward slash is appended to my address bar even if I point my browser to example.com/guides thus leaving me with example.com/guides/. To be clear, this page loads perfectly fine. When I point my address bar to example.com/about, it leaves the url as is and loads the page. When I visit example.com/about/ it loads the same page and the forward slash is left to be. Here is the code from how my server handles these get requests:\n\napp.get('/about', (req, res) => {\n res.sendFile(__dirname + '/views/about.html');\n});\napp.get('/guides', (req, res) => {\n res.sendFile(__dirname + '/views/guides.html');\n});\n\n\nAs you can see, both html files are rendered the exact same way. I have no JavaScript on either of the two pages, and I am not loading any external libraries on either of the pages. This guides page is the only one with this behavior. There are also no errors in the console or my server logs. Thank you in advance.\n\nEDIT:\nAfter examining the network page in my developer console, it returns 301 Moved Permanently (from disk cache) for the GET request status code."
] | [
"javascript",
"node.js",
"express"
] |
[
"PHPExcel - duplicateStyle() seems not to work / does nothing",
"Im making an export for my company which takes soma data, given through PHP, and outputs them to a excel spreadsheet.\n\nEverything works well, except for one little thing. Im conditionally formatting some cells to have a specific color. Neither I get an error, nor i get the right background color for the other cells, they just stay white.\n\nI'm using PHPExcel to create the output, the following is my Code:\n\n//just for information:\n// $spreadsheet = $objPHPExcel->getActiveSheet();\n\n//normal\n$conditionalStyleNormal = new PHPExcel_Style_Conditional();\n$conditionalStyleNormal->setConditionType(PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)\n ->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT)\n ->setText('Normal (Mittagspause)')\n ->getStyle()->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getEndColor()\n ->setARGB(PHPExcel_Style_Color::COLOR_LIGHTYELLOW);\n\n//apply style\n$conditionalStyles = $spreadsheet->getStyle('A5:A50')->getConditionalStyles();\narray_push($conditionalStyles, $conditionalStyleNormal);\n$spreadsheet->getStyle('A5:I50')->setConditionalStyles($conditionalStyles);\n\n//copy style to other cells (does not work)\n$spreadsheet->duplicateStyle($spreadsheet->getStyle('A5'), 'C5:I5');\n\n\nThe last line has no effect on the file.\n\nThe documentation of PHPExcel says:\n\n\n If you want to copy the ruleset to other cells, you can duplicate the style object:\n $objPHPExcel->getActiveSheet()->duplicateStyle($objPHPExcel->getActiveSheet()->getStyle('B2'), 'B3:B7');\n\n\nAm i overlooking something? Or is it just a bug? If so, is there a good workaround?\n\nCouldn't find a solution, just found out that the function had a misbehaviour in a earlier version. I'm working with PHPExcel 1.8.0.\n\nThanks in advance!"
] | [
"phpexcel"
] |
[
"How to replace a cell value - Apache POI",
"I am trying to replace a cell value using existing cell value from other sheets(in the same workbook)\n\nMy code:\n\npublic static void update_sheet(XSSFWorkbook w)\n {\n XSSFSheet sheet,sheet_overview;\n sheet_overview = w.getSheetAt(0);\n int lastRowNum,latest_partition_date;\n latest_partition_date = 3;\n XSSFRow row_old, row_new;\n XSSFCell cell_old, cell_new;\n\n\n for(int i=1;i<=10;i++)\n {\n sheet = w.getSheetAt(i);\n\n lastRowNum = sheet.getLastRowNum();\n\n row_old = sheet.getRow(lastRowNum);\n cell_old = row_old.getCell(0); //getting cell value from a sheet \n\n row_new = sheet_overview.getRow(latest_partition_date);\n cell_new = row_new.getCell(5);\n ***cell_new.setCellValue(cell_old)***;//trying to overwrite cellvalue\n\n latest_partition_date++;\n }\n\n }\n\n\nThe 'type' values I am trying to copy\n\n7/10/2017\n7/11/2017\n7/12/2017\n7/13/2017\n2017-07-14\n2017-07-15\n\n\nError\n\nException in thread \"main\" java.lang.Error: Unresolved compilation problem: \n The method setCellValue(boolean) in the type XSSFCell is not applicable for the arguments (XSSFCell)\n\nat Sample2.update_overview_sheet(Sample2.java:78)\nat Sample2.main(Sample2.java:26)\n\n\nAny help or suggestions is appreciated."
] | [
"java",
"apache-poi"
] |
[
"Open something like /dev/null as a FILE in C on MS Windows system?",
"Possible Duplicate:\n /dev/null in Windows? \n\n\n\n\nI have a complex code that encodes input file into output file. Usually its used just for that, but now i need to make another mode - i need to calculate something along the way of encoding and return that variable. I dont want the output file to remain on the disk, or even appear on the disk for that matter. Its irrelevant in this mode. \n\nAlterating the complex code to add cases like \"if we are in mode x then do not actually write to file\" is out of question. Its too complex.\n\nIs it possible to open something like the \"black hole\" that /dev/null on UNIX systems is as a FILE in C (on MS Windows PC)? Meaning that you have a legit FILE* pointer, can write there (fprintf) correctly, but when you close it, it vanishes with no more cleanup required?\n\nIf not - what choices i have save for changing my complex code or deleting the produced file after closing it?"
] | [
"c",
"windows",
"file"
] |
[
"How to select first in such sql code?",
"I have such sql:\n\nmysql_query(\"SELECT * \n FROM car \n LEFT JOIN client \n ON car.CodeClient = client.Code\n LEFT JOIN telephone \n ON car.CodeClient = telephone.CodeClient \n WHERE Marka Like '$Marka' \n and Model Like '%$Model%' \n and EngineVol Like '%$EngineVol%' \n and EngineType Like '%$EngineType%' \n and DateMade Like '%$DateMade%'\n \");\n\n\nAnd I need to select CodeClient and TelephoneNumber from telephone table, but select first entry for every Client, not all telephone, but first. Grouping is not the solving!"
] | [
"php",
"mysql",
"sql"
] |
[
"Rails adding a new link in the index page",
"i am trying to adding a new link to make a form for a join table, the link gives and error saying that no routes for that, i am using rails api\n\n<%= link_to(\"Add New Alarm/List\", {:action => 'new_alarm', :controller =>'alarms'}, :class => 'action new') %>\n\n\nany help please\nthanks in advance"
] | [
"ruby-on-rails",
"api",
"routes"
] |
[
"Connecting to a udp socket in Node.js",
"I'm writing a javascript/node.js program that receives the scores from a HL/Team Fortress 2 server, but I can't seem to receive the udp packets send by the game server. (I can receive udp packets transmitted by a UDP test tool)\nI have found a python library that works but it uses socket.connect() before receiving data from the server.\n\nPython snipplet (asyncore used):\n\nself.create_socket(socket.AF_INET, socket.SOCK_DGRAM)\nself.bind(('0.0.0.0', 17015))\nself.connect((IP of server, 27015))\n\ndata = self.recv(1400)\n\n\nBut in node.js I can't seem to connect to a remote address.\n\nMy code so far:\n\nvar dgram = require('dgram')\nvar server = dgram.createSocket(\"udp4\");\nserver.on('message', function (data, rinfo) {\n data = data.toString();\n if (data.startsWith('\\xff\\xff\\xff\\xff') && data.endsWith('\\n\\x00')) {\n console.log(data);\n Logparser(data);\n } else {\n console.log(data);\n }\n});\nserver.bind(17015);\n\n\nUDP packet captured with wireshark http://pastebin.com/W7i9CV2u"
] | [
"python",
"node.js",
"udp"
] |
[
"Select2, when no option matches, \"other\" should appear",
"With select2 dropdown, how do I get a default option to appear if no options match the user's typed input?\n\n$(\"something\").select2({\n formatNoMatches: function(term) {\n //return a search choice\n }\n});\n\n\nI haven't been able to find anything that really matches this desired functionality within the select2 documentation or Stack Overflow.\n\nEdit\nI'm getting closer with this\n\n$(\"something\").select2({\n formatNoMatches: function(term) {\n return \"<div class='select2-result-label'><span class='select2-match'></span>Other</div>\"\n }\n});\n\n\nBut this is pretty hacky off the bat, and also isn't clickable."
] | [
"javascript",
"jquery",
"jquery-select2"
] |
[
"How create dynamic tooltip for QGraphicsItem pyqt5",
"My override method toolTip() doesn't calls. How do i solve this?\n\nclass MyCls(QGraphicsEllipseItem):\n\n def __init__(self, x, y, r):\n super().__init__(x, y, r, r)\n self.setToolTip(\"Test\")\n\n def toolTip(self):\n return \"123\""
] | [
"python",
"tooltip",
"pyqt5"
] |
[
"ActiveSalesforce + Heroku + PostgreSQL + Rails 2.3.x",
"How to setup my Rails app so it will be able to use both Salesforce and PostgreSQL as a backend on Heroku. My current code is:\n\n#environment.rb \n...\nconfig.gem \"asf-soap-adapter\", :lib => 'asf-soap-adapter'\nconfig.database_configuration_file = File.join(RAILS_ROOT, 'config', 'salesforce.yml')\n\n\nsalesforce.yml contains config for both PostgreSQL and SF. This doesn't work because it replaces current Heroku database.yml, so I am not able to connect to DB.\n\nAny ideas how to solve this?"
] | [
"ruby-on-rails",
"postgresql",
"heroku",
"salesforce"
] |
[
"How to know system command is in use in php?",
"I have a HTML/PHP code as shown below in which on click of a button conversion of mp4 into mp3 starts happening. \n\nHTML/PHP Code:\n\n <?php foreach ($programs as $key => $program) { ?> \n <tr data-index=\"<?php echo $key; ?>\">\n <td><input type=\"submit\" id=\"go-btn\" name=\"go-button\" value=\"Go\" data-id=\"<?php echo $key; ?>\" ></input></td>\n </tr>\n <?php }?>\n\n\nPhp code (where mp4=>mp3 conversion happens):\n\n$f = $mp4_files[$_POST['id']];\n$parts = pathinfo($f); \nswitch ($parts['extension'])\n{ \ncase 'mp4' :\n$filePath = $src_dir . DS . $f;\nsystem('C:\\ffmpeg\\bin\\ffmpeg.exe -i ' . $filePath . ' -map 0:2 -ac 1 ' . $destination_dir . DS . $parts['filename'] . '.mp3', $result); \nbreak; \n}\n\n\nAs soon as the button is clicked from the HTML/PHP Code above, the text gets changed from Go to Converting in the UI because I have added JS/jQuery code in my codebase but this JS/jQuery code which I have added just change the text only. \n\nIt doesn't actually know that the Conversion is happening in the background. \n\nJS/jQuery code:\n\n$(\"input[name='go-button']\").click( function() {\n\n // Change the text of the button, and disable\n $(this).val(\"Converting\").attr(\"disabled\", \"true\");\n\n});\n\n\nProblem Statement:\n\nI am wondering what modification I need to do in the JS/jQuery code above so that UI actually knows that conversion is happening in the background. \n\nProbably, we need to add make establish some connection between JS/jQuery and php code above but I am not sure how we can do that."
] | [
"javascript",
"php",
"ajax",
"upload",
"progress-bar"
] |
[
"plot() function 'col=' argument does not work when rows shuffled in 'data='",
"I'm just noticing a rather strange phenomenon with the plot() function for making scatterplots via the formula notation.\n\nComparing the following two commands:\n\nplot(Sepal.Width ~ Sepal.Length, data=iris, col=Species)\nplot(Sepal.Width ~ Sepal.Length, data=iris[sample(1:nrow(iris)),], col=Species)\n\n\nI would expect the same plot since the second command simply shuffles up the rows prior to plotting. However, we see that the colors of the points are shuffled as well in the second line. Has anyone seen this before?"
] | [
"r"
] |
[
"PhoneGap BlackBerry App - SignatureTool.jar Freeze",
"I am using JDK 7.0, BlackBerry WebWorks SDK 2.3.1.5\n\nWhen I try to build and deploy the bb phonegap application in the command prompt using ant blackberry load-device, it does some compilation and launches the Signature tool, but within few seconds of launching, the signature tool stops responding. But it does send all signing requests to server and I get a bunch of emails from RIM confirming the success of signing requests. The tool doesn't respond at all and I have to kill the process.\n\nHas anyone else experienced same/similar issue? If not, can anyone give me some pointers to fix this issue?"
] | [
"cordova",
"blackberry-webworks"
] |
[
"get 'this' tab of content script (not selected, not active tab)?",
"There are quite some similar question but they all comes down to chrome.tabs.getSelected or chrome.tabs.query API which is not suitable in my case.\n\nBasically what I need to do is to get an id of the tab where the script is running from - so it's not necessarily an active or selected tab.\n\nAs per the doc:\n\n\n getCurrent chrome.tabs.getCurrent(function callback)\n \n Gets the tab that this script call is being made from. May be\n undefined if called from a non-tab context (for example: a background\n page or popup view).\n\n\nWhich implies that it should work from content script but chrome.tabs is undefined in content script. Why is it so? Is there any way to know this tab data (from where the content script is running and not from selected or active tab)?\n\nEven though the doc says the tabs permission is not mandatory for the most APIs I've anyway added it to the manifest with no luck:\n\n{\n \"manifest_version\": 2,\n \"name\": ...\n \"permissions\": [\n ...\n \"tabs\",\n ...\n}\n\n\nAny ideas are much appreciated\n\nThe use case for get current/this tab is that when the extension does its work it needs to reload a page where it's running from as part of the working flow and user can be on different tab or in different window. The extension's script still needs to get the correct tabId to keep working as expected."
] | [
"javascript",
"google-chrome-extension"
] |
[
"VS Code Java debugger freeezes at certain lines of code",
"I've been making a simple server that receives messages from multiple clients, then returns \"hello\" to the client. However, when I debug the program I run into issues, where some lines of code seem to freeze the debugger. This happens when I step through the program while debugging, and certain lines will cause me not to be able to continue stepping through the program. The \"Continue\", \"Step Over\", \"Step Into\", and \"Step Out\" can be clicked, but they don't advance the program.\n\nHere is just one of the problem code blocks:\n\nif(key.isReadable()){\n String message = readFromChannel(key);\n System.out.println(message); // Debugger always freezes here\n sendToChannel(key, \"hello\");\n}\n\n\nI have never seen System.out.println() block, and I am thoroughly confused as to why this line of code seems to freeze the program. \n\nAny help appreciated, as this is incredibly annoying.\n\nI am using VS Code on MacOS Catalina, v1.14.1"
] | [
"java",
"debugging",
"visual-studio-code"
] |
[
"IOS draggable objects not saving position",
"I currently have a view which contains a number of buttons and a single text field. The users can drag the buttons around, and when finished, interact with the text field. Dragging the buttons using UIPanGestureRecognizer seems to work, however once a user interacts with the text field, all of the buttons snap back to their original positions. \n\nI would like it so that after dragging a button, the button's new position is saved, or at least doesn't revert back to its original position when interacting with other objects in the same view.\n\nI have attached the code for my Gesture Recognizer:\n\n- (IBAction)handlePan:(UIPanGestureRecognizer *)recognizer {\n\nCGPoint translation = [recognizer translationInView:self.view];\nrecognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x,\n recognizer.view.center.y + translation.y);\n//[recognizer setTranslation:CGPointMake(0, 0) inView:self.view];\nUIButton *button = (UIButton*)recognizer.view;\nif (recognizer.state == UIGestureRecognizerStateEnded)\n{\n\n button.center = recognizer.view.center;\n [recognizer setTranslation:CGPointMake(0, 0) inView:self.view];\n\n}\n\n}\n\n\nThank you for any help."
] | [
"ios",
"position",
"uigesturerecognizer"
] |
[
"Cruisecontrol.net and msbuild - how do I build multiple solutions under one project?",
"So, my application consists of 33 projects where more than half have interdependencies. I am using CruiseControl.net 1.6. I can build a single csproj or sln fine, but when I add more tags, it bombs. How can I force build multiple csproj files?sdf\n\n <msbuild>\n <executable>c:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\MSBuild.exe</executable>\n <workingDirectory>C:\\Program Files\\CruiseControl.NET\\server\\MA_Release</workingDirectory>\n\n <projectFile>WorksFineWith1.sln</projectFile>\n <projectFile>ErrorsOutWithMoreThan1.sln</projectFile>\n\n <buildArgs>/noconsolelogger /p:Configuration=Debug</buildArgs>\n <logger>C:\\Program Files\\CruiseControl.NET\\server\\ThoughtWorks.CruiseControl.MSBuild.dll</logger>\n <timeout>900</timeout>\n </msbuild>\n\n\nHow can I build multiples with one force build?"
] | [
"msbuild",
"cruisecontrol.net"
] |
[
"Command.ExecuteNonQuery(); Error: Incorrect syntax near '='",
"My query is perfect (I have verified it in SQL Server Management Studio). My code is perfect, still I am getting this syntax error:\n\n\n Incorrect syntax near '='. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near '='.\n\n\npublic partial class Temporaryche : System.Web.UI.Page\n{\n protected void Page_Load(object sender, EventArgs e)\n {\n ddlTDept.Items.Clear();\n ddlTBranch.Items.Clear();\n\n string connectionString = GlobalVariables.databasePath;\n SqlConnection sqlCon = new SqlConnection(connectionString);\n string query = \"select fac.fac_name, dp.dp_name, br.br_name from STUDENT s, DIVISON dv, BRANCH br, DEPT dp, FACULTY fac, CLASS cls, DEGREE dg where dg.dg_id = cls.dg_id and cls.cls_id = s.cls_id and fac.fac_id = dp.fac_id and dp.dp_id = br.dp_id and br.br_id = dv.br_id and s.dv_id = dv.dv_id and s.prn_no = \" + txtSearch.Text;\n\n sqlCon.Open();\n SqlCommand cmd = new SqlCommand(query, sqlCon);\n SqlDataReader reader = cmd.ExecuteReader();\n\n string facultyName = reader.GetValue(0).ToString();\n string deptName = reader.GetValue(1).ToString();\n string branchName = reader.GetValue(2).ToString();\n\n ddlTFaculty.SelectedValue = facultyName;\n\n query = \"select dp_name from DEPT where fac_id=(select fac_id where fac_name='\" + facultyName + \"')\";\n cmd = new SqlCommand(query, sqlCon);\n reader = cmd.ExecuteReader();\n ddlTDept.Items.Clear();\n\n while (reader.Read())\n {\n ddlTDept.Items.Add(reader.GetValue(0).ToString());\n }\n\n ddlTDept.SelectedValue = deptName;\n sqlCon.Close();\n }\n}"
] | [
"c#",
"asp.net",
"sql-server-2008",
"executereader"
] |
[
"Only GET requests are returned in lighthouse devtools network records",
"I am trying to run certain audits on the network requests made by a web page during loading and below is my sample code for the audit. I am facing a problem that all the network records returned by the lighthouse are only for GET requests. Is there any way to get records for POST, PUT, etc\n\nsample code:\n\nclass NetworkAudit extends Audit {\n static get meta() {\n return {\n id: 'network-audit',\n title: 'Network analysis',\n failureTitle: 'Custom network stats failing',\n description: 'Custom network stats ',\n requiredArtifacts: ['devtoolsLogs'],\n };\n }\n\n static async audit(artifacts, context) {\n const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];\n\n const requests = await NetworkRecords.request(devtoolsLog, context);\n for(request of requests ){\n console.log(request.requestMethod)\n\n}"
] | [
"lighthouse"
] |
[
"Get file size without reading the file",
"Is there a way to get the size of a file in C without actually reading the file? I know about fseek but as that sets the 'cursor\" to the very end of the file, I'm guessing that does actually read through all of the file.\n\nAm I wrong making this conclusion? Is there a way to do it?"
] | [
"c",
"file",
"io"
] |
[
"Issue with infinite loop when reading from file",
"I am writing a program in C# to read from a file and output to a csv file all of the unique words and the number of occurrences in the file for each word. My issue is when I try to run my program, I never get out of my while loop that goes line by line.\n\npublic override List<WordEntry> GetWordCount()\n{\n List<WordEntry> words = new List<WordEntry>();\n WordEntry wordEntry = new WordEntry();\n //string[] tokens = null;\n string line, temp, getword;\n int count = 0, index = 0;\n long number;\n\n while ((line = input.ReadLine()) != null)\n {\n if (line == null)\n Debug.Write(\"shouldnt happen\");\n char[] delimit = { ' ', ',' };\n string[] tokens = line.Split(delimit);\n\n if (words.Count == 0)\n {\n wordEntry.Word = tokens[0];\n wordEntry.WordCount = 1;\n words.Add(wordEntry);\n }//end if\n\n for (int i = 0; i < tokens.Length; i++)\n {\n for (int j = 0; j < words.Count; j++)\n {\n if (tokens[i] == words[j].Word)\n {\n number = words[j].WordCount;\n number++;\n getword = words[j].Word;\n wordEntry.WordCount = number;\n wordEntry.Word = getword;\n words.RemoveAt(j);\n words.Insert(j, wordEntry);\n }//end if\n else\n {\n wordEntry.Word = tokens[i];\n wordEntry.WordCount = 1;\n words.Add(wordEntry);\n }//end else\n }//end for\n }//end for\n }//end while\n return words;\n}\n\n\nIt is getting stuck in the while loop as if it never reaches the end of the file. The file is 2.6 MB so it should be able to make it to the end."
] | [
"c#",
"list",
"streamreader"
] |
[
"Container similar to Android's ArrayMap in C++",
"Android provides an associative container named ArrayMap, which is implemented with two simple arrays. \n\nThis container is supposed to be somewhat slower than other data structures, especially when inserting data, but it is very memory-efficient.\n\nIs there such thing already implemented in C++?"
] | [
"android",
"c++",
"dictionary",
"stl",
"memory-efficient"
] |
[
"How to search facets using wildcard search",
"How to return all values starting with Ar* when we search for a facet\n\nxquery version \"1.0-ml\";\nimport module namespace search = \"http://marklogic.com/appservices/search\"\nat \"/MarkLogic/appservices/search/search.xqy\";\n\nlet $options := \n <options xmlns=\"http://marklogic.com/appservices/search\">\n <values name=\"entity\">\n <range type=\"xs:string\">\n <element ns=\"http://www.com/mynamespace\" name=\"country\" />\n </range>\n </values>\n <return-metrics>false</return-metrics>\n </options>\nreturn search:values(\"entity\", $options)"
] | [
"xquery",
"marklogic"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.