texts
sequence
tags
sequence
[ "Combine queries to multiple tables having the same columns in to one query", "I have 6 tables. All of them can have millions and millions of lines of data. All of the tables have object_id, changer_id, date_created columns.\n\nI need to make a query on all of the tables\n\nSELECT object_id\nFROM table#\nWHERE changer_id=someId\nAND date_created > dateA\nAND dateCreated < dateB\n\n\nor its grails equivalent\n\ntable#.createQuery().list{\n projections{property('object_id')}\n eq('changer_id', someId)\n ge('dateCreated' dateA)\n le('dateCreated', dateB)\n}\n\n\nSame query will be made on all of the 6 tables, and then the results are combined and all duplicates are removed.\n\nIm not using between because dateB might not always exist so it would be ommited.\n\nIs there a way to combine this query into single query over 6 tables or any other way to make it faster than 6 separate queryes?" ]
[ "postgresql", "grails" ]
[ "How can I build variants of an executable with one makefile?", "I have one set of source files from which I need to generate multiple variants of an executable. For example I need to generate app1.elf, app2.elf, app3.elf from the same main.c and comm.c. The difference between each of the apps is a node address, a parameter that is passed down in the invocation of gcc. i.e.:\n\ngcc -DNODE=1 -oapp1.elf main.c \ngcc -DNODE=2 -oapp2.elf main.c \ngcc -DNODE=3 -oapp3.elf main.c \n\n\nLet's assume that I have the following files: \n\n\nsrc/main.c\nsrc/comm.c\n\n\nWhen I run the Makefile as so:\n\n\n make all_nodes\n\n\nmake only builds app1.elf with the following output:\n\n\n Built app1\n Built app2\n Built app3 \n\n\nFAIL!\nThe output seems to suggest that it worked, however it only generates one executable, namely app1.elf. Anybody care to point out what I'm doing wrong? \n\nTo further explain my Makefile, I've created a cleanobjs target to clean out the objects in the ./obj subdirectory. This is my attempt at having 'make' rebuild the obj files with the new node address, but it fails. Am I using 'make' in a way it wasn't intended to be used? I know I can also create a batch file to run make (something I've done sucessfully) but I'd like to know what I'm doing wrong. My Makefile is below:\n\nobj/%.o: src/%.c\n gcc -DNODE=$(NODE) -o$@ $<\n\napp.elf : ./obj/main.o ./obj/comm.o\n gcc -oapp$(NODE).elf main.o comm.o\n\nnode1 : NODE=1\nnode1 : cleanobj app.elf\n @echo 'Built app1'\n\nnode2 : NODE=2\nnode2 : cleanobj app.elf\n @echo 'Built app2'\n\nnode3 : NODE=3\nnode3 : cleanobj app.elf\n @echo 'Built app3'\n\nall_nodes : node1 node2 node3\n\ncleanobj :\n rm -rf obj/main.o obj/comm.o\n\n.PHONY : cleanobj" ]
[ "c++", "c", "makefile" ]
[ "Simple Rock Paper Scissors fix need assistance", "i have began python this year and am creating a simple Rock Paper Scissors game with integrated score keeper. The program is causing an undesirable loop (repeating the main menu portion.) i am 98% sure this is caused by an improper indentation somewhere in the loop but i am just stumped. run the code and see if you can find my mistake. thank you!!!\n\n import random as rand\n\ncomputer_score = 0\nuser_score = 0\nprint(\"\"\"\n==========================\nRock, Paper, or Scissors?\n==========================\n\"\"\")\n\n# while loop to perform finite loop as long as specific perameters are met\nwhile True:\n option = [\"Rock\", \"Paper\", \"Scissors\"]\n a = rand.choice(option)\n user_input = input(\"\"\"Choose one:\n 1) Rock\n 2) Paper\n 3) Scissors\n\n press 'Q' to quit game\n\n Enter your option: \"\"\")\n\n# line 28,29) to make sure user_input string is a digit and to convert string to an integer\n# line 30) since indexing always starts at 0, if user inputs \"rock (1)\"...\n# [user_input - 1] will make sure \"Rock\" is selected in list(option[0])\n# line 30,31) if user_input is the same as random choice (a): user/computer_score will not change\n if user_input.isdigit == True:\n user_input = int(user_input)\n if option[user_input - 1] == a:\n computer_score, user_score = computer_score, user_score\n print(\"its a tie!\")\n print(\"computer: \", a, \"user: \", user_input)\n print(\"computer score: \", computer_score,\n \" user score: \", user_score)\n print(\"\\n\")\n\n # line 39,40,41)if user_input is rock and random choice (a) is paper: computer_score will add 1\n elif option[user_input - 1] == \"Rock\":\n if a == \"Paper\":\n computer_score = computer_score + 1\n print(\"computer wins!\")\n print(\"computer: \", a, \"user: \", user_input)\n print(\"computer score: \", computer_score,\n \" user score: \", user_score)\n print(\"\\n\")\n\n elif a == \"Scissors\":\n user_score = user_score + 1\n print(\"you win!\")\n print(\"computer: \", a, \"user: \", user_input)\n print(\"computer score: \", computer_score,\n \" user score: \", user_score)\n print(\"\\n\")\n\n elif option[user_input - 1] == \"Paper\":\n if a == \"Rock\":\n user_score = user_score + 1\n print(\"you win!\")\n print(\"computer: \", a, \"user: \", user_input)\n print(\"computer scoore: \", computer_score,\n \" user score: \", user_score)\n print(\"\\n\")\n elif a == \"Scissors\":\n computer_score = computer_score + 1\n print(\"computer wins\")\n print(\"computer: \", a, \"user: \", user_input)\n print(\"computer_score: \", computer_score,\n \" user score: \", user_score)\n print(\"\\n\")\n\n elif option[user_input - 1] == \"Scissors\":\n if a == \"Rock\":\n computer_score = computer_score + 1\n print(\"computer wins\")\n print(\"computer: \", a, \"user: \", user_input)\n print(\"computer score: \", computer_score,\n \" user score: \", user_score)\n print(\"\\n\")\n elif a == \"Paper\":\n user_score = user_score + 1\n print(\"You win!\")\n print(\"computer: \", a, \"user: \", user_input)\n print(\"computer score: \", computer_score,\n \" user score: \", user_score)\n print(\"\\n\")\n\n\n elif user_input.isdigit() == False:\n if str(user_input) == \"q\" or \"Q\":\n print(\"final score: \\n\")\n print(\"computer score: \", computer_score,\n \" user score: \", user_score)\n else:\n print(\"invalid input\")" ]
[ "python" ]
[ "Deleting DataGridView row with DataTable as datasource", "I am making a WinForm app and setting a DataGridView's data source as a DataTable. I want to know how to implement delete row correctly when user deletes a row in DataGridView.\nFind where the user clicked in the DataGridView, find the corresponding data in DataTable, delete the row in DataTable first and reload the DataGridView with the updated DataTable.\nWould this be the correct approach?" ]
[ "c#", "datatable", "datagridview" ]
[ "Metal equivalent to OpenGL mix", "I'm trying to understand what is the equivalent of mix OpenGL function in metal. This is the OpenGL code I'm trying to convert:\n\nfloat udRoundBox( vec2 p, vec2 b, float r )\n{\n return length(max(abs(p)-b+r,0.0))-r;\n}\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n // setup\n float t = 0.2 + 0.2 * sin(mod(iTime, 2.0 * PI) - 0.5 * PI);\n float iRadius = min(iResolution.x, iResolution.y) * (0.05 + t);\n vec2 halfRes = 0.5 * iResolution.xy;\n\n // compute box\n float b = udRoundBox( fragCoord.xy - halfRes, halfRes, iRadius );\n\n // colorize (red / black )\n vec3 c = mix( vec3(1.0,0.0,0.0), vec3(0.0,0.0,0.0), smoothstep(0.0,1.0,b) );\n\n fragColor = vec4( c, 1.0 );\n} \n\n\nI was able to convert part of it so far:\n\nfloat udRoundBox( float2 p, float2 b, float r )\n{\n return length(max(abs(p)-b+r,0.0))-r;\n}\n\nfloat4 cornerRadius(sampler_h src) {\n\n float2 greenCoord = src.coord(); // this is alreay in relative coords; no need to devide by image size\n\n float t = 0.5;\n float iRadius = min(greenCoord.x, greenCoord.y) * (t);\n float2 halfRes = float2(greenCoord.x * 0.5, greenCoord.y * 0.5);\n\n float b = udRoundBox( float2(greenCoord.x - halfRes.x, greenCoord.y - halfRes.y), halfRes, iRadius );\n\n float3 c = mix(float3(1.0,0.0,0.0), float3(0.0,0.0,0.0), smoothstep(0.0,1.0,b) );\n\n return float4(c, 1.0);\n}\n\n\nBut it's producing green screen. I'm trying to achieve corner radius on a video like so:" ]
[ "ios", "swift", "shader", "metal" ]
[ "jQuery using .html & then window.scrollTo", "I'm doing the following:\n\nFirst, inject HTML into the page (a lot) which then increases the window scrollbar:\n\n$(\"#XXXX\").html(\"LOTS OF HTML\").show();\n\n\nThen i want to scroll down to the end of the page:\n\nwindow.scrollTo(0,$(document).height());\n\n\nProblem is the page never scrolls down. I did some console.logging and the scrollTo is running before the HTML from the inject html() is run. I tried this in the JS which injects the HTML, I then tried doing the scroll inside the HTML inject but that made no difference.\n\nAny ideas?" ]
[ "jquery" ]
[ "New Relic Application concept", "I have New Relic installed in a VPS. I have a \"default\" PHP Application and New Relic is getting data from it, but what server name is it getting from? The VPS contains some subdomains, and the server appears as \"domain.com\" (so I guess it is getting data from this server name). But I want to get data from \"subdomain.domain.com\". How can I achieve it?\n\nEdit:\n\nFollowing @Taibhse link (http://docs.newrelic.com/docs/agents/php-agent/configuration/php-directory-ini-settings#api-calls) I tried:\n\n1. Change Apache2 configuration:\n\nInside <Directory ...>:\n\n<IfModule php5_module>\n php_value newrelic.appname \"myDomain.com\"\n</IfModule>\n\n\nAlso tried without <IfModule ...>, but nothing seemed to change.\n\n2. Using API:\n\nThen, I've tried adding:\n\nif (extension_loaded('newrelic')) {\n newrelic_set_appname($name);\n}\n\n\nto the index.php file of one domain.\nAnd also without if (extension_loaded('newrelic')), but nothing changed again.\nIt seems like it's getting data from all VirtualHost." ]
[ "php", "newrelic" ]
[ "Crosstab function and Dates PostgreSQL", "I had to create a cross tab table from a Query where dates will be changed into column names. These order dates can be increase or decrease as per the dates passed in the query. The order date is in Unix format which is changed into normal format.\n\nQuery is following:\n\nSelect cd.cust_id\n , od.order_id\n , od.order_size\n , (TIMESTAMP 'epoch' + od.order_date * INTERVAL '1 second')::Date As order_date\nFrom consumer_details cd,\n consumer_order od,\nWhere cd.cust_id = od.cust_id\n And od.order_date Between 1469212200 And 1469212600\nOrder By od.order_id, od.order_date\n\n\nTable as follows:\n\n cust_id | order_id | order_size | order_date \n-----------|----------------|---------------|--------------\n 210721008 | 0437756 | 4323 | 2016-07-22 \n 210721008 | 0437756 | 4586 | 2016-09-24 \n 210721019 | 10749881 | 0 | 2016-07-28 \n 210721019 | 10749881 | 0 | 2016-07-28 \n 210721033 | 13639 | 2286145 | 2016-09-06 \n 210721033 | 13639 | 2300040 | 2016-10-03 \n\n\nResult will be:\n\n cust_id | order_id | 2016-07-22 | 2016-09-24 | 2016-07-28 | 2016-09-06 | 2016-10-03 \n-----------|----------------|---------------|---------------|---------------|---------------|---------------\n 210721008 | 0437756 | 4323 | 4586 | | | \n 210721019 | 10749881 | | | 0 | | \n 210721033 | 13639 | | | | 2286145 | 2300040" ]
[ "postgresql", "crosstab" ]
[ "Select everything after a common deliminator in Presto", "I have a column where i want to take just the numbers.\n\nHowever, the data is stored like this:\n\n\nI want to have just the numbers to be outputted in the same column. Is there a way of doing this?" ]
[ "presto" ]
[ "PostgreSQL - Count Number of Classes that uses Lecture Theaters", "I have a set of distinct Lecture Theatres in a University with id (e.g. ABC1) and name (e.g. Theatre A). I want to count the number of distinct classes that uses each Lecture Theatre and rank the Lecture Theatres based on the number of classes num (most classes, rank 1 etc). Is it clear or do I need to clarify?\n\n\nid | name | num | rank \n-----------------------------\nABC1 | Theatre A | 42 | 1\nABC5 | Theatre E | 37 | 2\nABC7 | Theatre G | 25 | 3\nABC2 | Theatre B | 25 | 4\nABC3 | Theatre C | 10 | 5\nABC4 | Theatre D | 9 | 6\nABC6 | Theatre F | 0 | 7\n\n\nSo far I have managed to get the following:\n\nid | name \n------------------\nABC1 | Theatre A \nABC2 | Theatre B \nABC3 | Theatre C \nABC4 | Theatre D \nABC5 | Theatre E \nABC6 | Theatre F \nABC7 | Theatre G \n\n\nusing the following code:\n\ncreate or replace view Lecture_theatres\nAS\nSELECT distinct r.id, r.name\nFROM Rooms r\n JOIN Room_types t ON (r.rtype=t.id)\n FULL JOIN Classes c ON (c.room = r.id)\nWHERE\nt.description='Lecture Theatre'\nGROUP BY\nr.id,r.name\n;\n\n\nI tried to calculate num by adding count(c.id) to:\n\nSELECT distinct r.id, r.name, count(c.id)\n\n\nHowever, this seems to return the amount of times a specific class uses any Room, not the specific Lecture Theatre. I'm not sure if I am providing enough information to be able to solve this, but please comment if something is missing!" ]
[ "sql", "postgresql" ]
[ "Calling a macro from another workbook causes macros get skipped", "I'm trying to perform the below operation from a workbook (Say A.xlsm):\n\n\nOpening another workbook (say B.xlsb)\nCalling a macro in B.xlsb from A.xlsm\nSave the workbook B.xlsb\nClose the workbook B.xlsb\n\n\nBelow is the code in A.xlsm:\n\nWorkbooks.Open(Filename:=B.xlsb).RunAutoMacros Which:=xlAutoOpen\nWorkbooks(B.xlsb).Activate\nWindows(B.xlsb).Activate\nApplication.Run (B.xlsb& \"!MyMacro\")\n\n\nAbove all works fine, but a macro (Initialize, which is for initializing the ribbon object) gets skipped in B.xlsm which is should get called at the time of loading of the workbook B.xlsb. When I open it manually and then Save and close.\n\nI see the macros Workbook_Open, Workbook_Activate and Initialize (this is configured in an XML to be called at the loading time) gets called in sequence.\nBut the same when I do from VBA then Workbook_Open and Workbook_Activate are called but Initialize gets skipped." ]
[ "vba", "excel" ]
[ "How to reduce the tab bar height and display in bottom", "can anybody tell how to reduce the height of tab bar and display tab bar in bottom\n\nThanks" ]
[ "android" ]
[ "Print japanese with jQuery", "I'm trying to print some Japanese to a page dynamically using jQuery, and it display nothing recognizable. I don't know what went wrong, I reduced the code to the most straight-forward, and it doesn't fix it. Or maybe it's just me being thick.\n\nI use:\n\n$('body').append('<p>日本語</p>');\n\n\nWhich should work, right?\n\nAnd I get:\n\n日本語\n\n\nHuh?" ]
[ "javascript", "jquery", "unicode", "character-encoding" ]
[ "Department X person is controlled by Department Y person", "I have 3 tables Employee, Project and Workson, Sample data is:\nEmployee:\nSocialSecurityNo Department_No\n\n121212 1\n456789 2\n666666 2\n444444 2\n\nWorkson\nESSn Projectno\n\n121212 5000\n456789 1000\n456789 2000\n666666 1000\n666666 2000\n666666 3000\n666666 4000\n666666 5000\n666666 6000\n\nProject:\nProjectNumber Dnum\n\n1000 5\n2000 5\n3000 5\n4000 4\n5000 1\n6000 4\n\nI have to check that Employee with SocialSecurityNo x is selected for Dno y but he is working on a project assigned for department z.\nI have written a query for it, My query is working finding all the SSn which are working are selected for department x and working for department x, I am trying to do the opposite, but when I apply NOT IN on a subquery then it also give me those social security numbers which have no data in the workson table\nBelow is my query:\nSelect E.SocialSecurityNo FROM EMPLOYEE E WHERE E.SocialSecurityNo NOT IN \n\n(Select E.SocialSecurityNo From \n\nEMPLOYEE E Join WORKSON W ON E.SocialSecurityNo=W.ESSn \n\nJoin PROJECT P ON E.Department_No=P.Dnum \n\nWhere W.ProjectNumber=P.Projectno);" ]
[ "mysql", "sql", "subquery", "notin" ]
[ "Obtain a unique ID from a different dataframe", "I have this dataframe:\n\nFirst.Name Last.Name Country Unit Hospital\n John Mars UK Sales South\n John Mars UK Sales South\n John Mars UK Sales South\n Lisa Smith USA HHRR North\n Lisa Smith USA HHRR North\n\n\nand this other:\n\nFirst.Name Last.Name ID\n John Valjean 1254\n Peter Smith 1255\n Frank Mars 1256\n Marie Valjean 1257\n Lisa Smith 1258\n John Mars 1259\n\n\nand I would like to merge them or paste them together to have:\n\n\nI tried with x = merge(df1, df2, by.y=c('Last.Name','First.Name') but it doesnt seem to work. also with x = df1[c(df1$Last.Name, df1$First.Name) %in% c(df2$Last.Name, df2$First.Name),] and it also doesnt work." ]
[ "r" ]
[ "How to call variable from function and echo it allready in echo", "I have a code made by me, and a \"Time ago\" code made by another coder...\n\nProblem pic:\n\n\n\nSo my code grabs timestamp from database:\n\n echo \"<h1> User hash: \" . $link . \"</h1><br>\n <table border='1' width=100% BORDERCOLOR=LIME bgcolor='#000000'>\n <tr>\n <th>IP</th>\n <th>Time</th>\n <th>Browser</th>\n <th>More info</th>\n </tr>\";\n include 'timeago.php';\nwhile($row = mysql_fetch_array($retval, MYSQL_NUM))\n{\n$time_ago = \"{$row[1]}\";\n\n echo \"\n <tr>\n <td align='center'>{$row[0]}</td>\n <td align='center'>\" .time_stamp($time_ago). \"</td>\n <td align='center'>{$row[3]}</td>\n <td align='center'><a href='http://whatismyipaddress.com/ip/{$row[0]}' target='_blank'> More info here </a></td>\n </tr>\"; \n\n}\necho \"</table>\";\n\n\nbut as you see times are not in tables, and I don't know how to fix it.\n\nI used this code to convert:\n\n <?php\n//Php Time_Ago Script v1.0.0\n//Scripted by D.Harish Kumar@TYSON567\nfunction time_stamp($time_ago)\n{\n$cur_time=time();\n$time_elapsed = $cur_time - $time_ago;\n$seconds = $time_elapsed ;\n$minutes = round($time_elapsed / 60 );\n$hours = round($time_elapsed / 3600);\n$days = round($time_elapsed / 86400 );\n$weeks = round($time_elapsed / 604800);\n$months = round($time_elapsed / 2600640 );\n$years = round($time_elapsed / 31207680 );\n// Seconds\nif($seconds <= 60)\n{\necho \"$seconds seconds ago\";\n}\n//Minutes\nelse if($minutes <=60)\n{\nif($minutes==1)\n{\necho \"one minute ago\";\n}\nelse\n{\necho \"$minutes minutes ago\";\n}\n}\n//Hours\nelse if($hours <=24)\n{\nif($hours==1)\n{\necho \"an hour ago\";\n}\nelse\n{\necho \"$hours hours ago\";\n}\n}\n//Days\nelse if($days <= 7)\n{\nif($days==1)\n{\necho \"yesterday\";\n}\nelse\n{\necho \"$days days ago\";\n}\n}\n//Weeks\nelse if($weeks <= 4.3)\n{\nif($weeks==1)\n{\necho \"a week ago\";\n}\nelse\n{\necho \"$weeks weeks ago\";\n}\n}\n//Months\nelse if($months <=12)\n{\nif($months==1)\n{\necho \"a month ago\";\n}\nelse\n{\necho \"$months months ago\";\n}\n}\n//Years\nelse\n{\nif($years==1)\n{\necho \"one year ago\";\n}\nelse\n{\necho \"$years years ago\";\n}\n}\n}\n?>\n\n\nI just need to echo converted time to table." ]
[ "php", "mysql", "time", "html-table", "converter" ]
[ "The resource .css was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an", "I got this message -\n"The resource .css was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate as value and it is preloaded intentionally"\nin the terminal after adding the option "--headless" and "--window-size" in my python code, I am using chrome, please help me to resolve this Here is the image" ]
[ "python-3.x", "automation", "selenium-chromedriver" ]
[ "AFNetworking failure block", "i'm using afnetworking 2.0 to show youtube videos.\nWhen i have a connection error, i open an alert view and i'd like stop the request if i click \"ok\".\n\nAlert view is showed correctly but when i click \"ok\" the request isn't stopped and i see activity indicator. \n\nHow can i stop the request?\n\nThis is the code below:\n\n-(void)loadData {\n\nNSString *urlAsString = @\"https://gdata.youtube.com/feeds/api/videos?q=wankel&v=2&max-results=50&alt=jsonc\";\n\nUIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] init];\nactivityIndicator.color = [UIColor blackColor];\nactivityIndicator.backgroundColor = [UIColor blackColor];\n[activityIndicator startAnimating];\n[self.view addSubview:activityIndicator];\nactivityIndicator.center = CGPointMake(self.view.bounds.size.width / 2, self.view.bounds.size.height / 2 );\n\nNSURL *url = [NSURL URLWithString:urlAsString];\nNSURLRequest *request = [NSURLRequest requestWithURL:url];\nAFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];\noperation.responseSerializer = [AFJSONResponseSerializer serializer];\n[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {\n\n self.moviesArray = [responseObject valueForKeyPath:@\"data.items\"];\n NSLog(@\"%@\", moviesArray);\n\n self.thumbnailsArray = [responseObject valueForKeyPath:@\"data.items.thumbnail\"];\n\n self.moviesDetailArray = [responseObject valueForKeyPath:@\"data.items\"];\n\n [activityIndicator setHidden:YES];\n [activityIndicator stopAnimating];\n\n\n [self.collectionView reloadData];\n\n} failure:^(AFHTTPRequestOperation *operation, NSError *error) {\n NSLog(@\"Error: %@\", error);\n UIAlertView *alertView =[[UIAlertView alloc] initWithTitle:@\"Error\" message:[NSString stringWithFormat:@\"%@\", error.localizedDescription] delegate:self cancelButtonTitle:@\"OK\" otherButtonTitles:@\"Try again\", nil];\n [activityIndicator setHidden:YES];\n [activityIndicator stopAnimating]; \n [alertView show]; \n }];\n\n[operation start];\n}" ]
[ "ios", "afnetworking-2" ]
[ "UICollectionViewFlowLayout minimumInteritemSpacing bug?", "After much fiddling I'm beginning to suspect that there's a bug in the spacing code of the UICollectionViewFlowLayout. \n\nThe problem is simple enough: I have five buttons I want to show on screen and I want the spacing between buttons to be 1 pt(2 pixels on retina display). To achieve this I have set the minimumInteritemSpacing to 1.0 and the cell width to 159.5 pt such that two cells will add up to 319 pt leaving a single point for the space. The problem appears when I want the third button to be the full width of the view because the flow layout causes the spacing to be 0.5 pt despite having been told to keep a minimum of 1.0. (see screenshot 1)\n\n\n\nThe code for setting up the spacing happens in \n\n-(void)viewDidLoad\n{\n UICollectionViewFlowLayout *flowLayout = (UICollectionViewFlowLayout *)[[self collectionView] collectionViewLayout];\n [flowLayout setMinimumInteritemSpacing:1.0];\n [flowLayout setMinimumLineSpacing:1.0]; \n}\n\n\nand the sizing of the cells in\n\n- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath\n{\n if (indexPath.row == 2) {\n return CGSizeMake(320 ,151);\n }\n return CGSizeMake(159.5, 151);\n}\n\n\nIf, on the other hand, I don't make the third button full width the spacing behaves as expected though it shouldn't affect the inter item spacing of a different row. (screenshot 2)\n\n\n\nIt should be noted that the CollectionView, CollectionViewCell and UILabel are set up in the storyboard and that I've already made sure the frame of the label visible in the screenshots is less than the cell's width and I have also tried removing the label altogether but with the same result.\n\nI can't see why this is happening unless it is a bug in the flow layout code and I was looking for a sanity check here before submitting this as a bug." ]
[ "ios", "uicollectionviewlayout" ]
[ "Read csv files in subfolder", "I store data in csv format and put them in \"Datasets\" folder. I would like to read data just using their name like this: CSV.read(\"name_of_data.csv\") without telling Julia the full path like: CSV.read(\"Datasets/name_of_data.csv\"). \n\nI tried to use push!(LOAD_PATH,\"Datasets\") but it didn't work.\n\nThank you." ]
[ "julia" ]
[ "unable to retrieve data from mysql to my webpage", "I want to create an automatic cms in my website using php and mysql\ni.e. I would just feed data to mysql table and it will generate result.\nso my code is:\n\n<!DOCTYPE html> \n<html> \n<head> \n <?php \n include 'head.php';\n include 'conct.php';\n ?> \n <title>GIZMOMANIACS|DOWNLOADS</title> \n</head>\n<body> \n <div id=\"container\" style=\"width:100%;height:100%;clear:both\">\n <div id=\"header\" style=\"background-color:#FFFFFF;\"> \n <div class=\"head\" style=\"clear:both\">\n <a href= \"http://gizmomaniacs.site88.net\">\n <img src=\"/GM%203D.gif\" width= \"200\" height=\"100\" alt='gizmomaniacs logo'></a></div> \n <h1 style=\"margin-bottom:0; float:right\"><font id=\"gmfont\">GIZMOMANIACS</font></h1>\n </div> \n <div id=\"menu\" style=\"clear:both;background-color:#0762AE\">\n <?php include 'head.html'; ?></div> <div class=\"content\" > \n <?php include 'search.php'; ?> \n<ul>\n<?php\n $sql = \"SELECT * from downloads\";\n $result = mysql_query($sql);\n if($result==false){\n $view = \"error\";\n $error = \"Could not retrieve values\";\n }\n else {\n $dload = $GET_['downloadname'];\n $imagelink = $GET_['imagelink'];\n $title = $GET_['title'];\n while ($row = mysql_fetch_array($result)) \n {\n echo \"<li><a class =\\\"alldld\\\" href=\\\"$dload\\\" title=\\\"$title\\\"><img class=\\\"downloads\\\" src =\\\"$imagelink\\\"/>$title</a><br></li>\";\n }\n }\n?>\n</ul>\n </div> \n <div class=\"social\"> \n<?php \n include 'social.php'; \n?></div> \n</div> \n</body> \n</html>\n\n\neverything is gong well but three thing are not happening they are:\n\n\na href atrribute not retreiving from db\na title atrribute not retreiving from db\nimg src atrribute not retreiving from db\n\n\nin the actual source it is showing\n\n<a class =\"alldld\" href=\"\" title=\"\"><img class=\"downloads\" src =\"\"/></a><br></li> \n\n<li><a class =\"alldld\" href=\"\" title=\"\"><img class=\"downloads\" src =\"\"/></a>\n\n\nthe src href title attribute are blank\n\nso what to do?" ]
[ "php", "html", "sql" ]
[ "Hide implementation modules and submodules in package", "I want to package my code to expose only the main functions. My directory is like this:\n\n./\n setup.py\n my_module/\n __init__.py\n public_functions.py\n internal_modules/\n __init__.py\n A.py\n B.py\n other_modules.py/\n __init__.py\n C.py\n\n\nIn public_functions I do import some operations from internal_modules.A but NOT from internal_modules.B, and both A.py and B.py uses some functions from C.py.\n\nMy setup.py is as follows:\n\nfrom setuptools import setup\n\nsetup(name='my_module',\n version='0.1',\n description='my_awesome_module',\n author='Me',\n author_email='[email protected]',\n license='MIT',\n packages=['my_module'],\n zip_safe=False)\n\n\nI want to install it with pip, but I want not to let any of my internal_modules visible from my package once it is installed.\n\nI could install it properly but when I do \n\nfrom my_module import public_module\n\n\nit throws ImportError: no module named internal_modules.A in public_module.py's first line.\n\nI know I can fix it if I add my_module.internal_modules to my setup.py declaration as another package, but this will let my internal_modules public with A.py and B.py visible from installed package.\n\nI found a similar question here but it's not working for me" ]
[ "python", "python-2.7", "module", "pip", "packages" ]
[ "Prevent re sizing on mobile device postback", "Ran into a bit of an issue with a site I'm currently working on. It isn't breaking anything but I would like to create a better experience for my users. What I'm attempting to do is pertain the zoom levels of the mobile device on postback. To give better context, I have a calculator that needs to do a postback and every time it reloads the page, current zoom levels get reset to default. Sadly, the original site was built for desktops but many of our sales reps are using phones/tablets to access it. One plus to this however, is that all of them are supplied with android tablets. No need for apple support so if a solution would not work for an apple device it isn't a big deal. \n\nI know that you can prevent page zooming using meta tags, but is there a way to make the zoom levels persist over postback? If there are any ways to handle this using javascript, html, or asp.net any help would be greatly appreciated. \n\nEdit: Found a post here talking about detecting zoom levels. May be able to use this in a viewstate variable to reset zoom on postback. Will update if solution is found.\n\nThanks guys" ]
[ "javascript", "android", "html", "asp.net" ]
[ "Menu as prism regions + themes problem", "I am using a Menu control as a region. It works fine, however when I add a theme to my application (Added a resource-dictionary to my App.xaml) normal menus have the theme, but the views inside my region (which are menu-items) don't have this theme.\n\nWhat might be the reason behind it? Anybody has an idea for a work-around?\n\nAlex." ]
[ "wpf", "prism" ]
[ "How to add Foreign key in My Sql from phpmyadmin?", "I am totally new to php and mysql.\nI have already one table in mysql .now i want to add foreign key.\nhow to alter table and add foreign key using phphmyadmin?" ]
[ "php", "mysql", "phpmyadmin" ]
[ "standard_init_linux.go:211: exec user process caused \"no such file or directory\"", "I am building the docker image of my project using the Dockerfile provided with it but docker container is always remains in restarting state. Below is the container log which I see:-\nstandard_init_linux.go:211: exec user process caused \"no such file or directory\"\nCan some one prove me with the possible solution to it and also tell what's the root cause of this issue." ]
[ "docker", "docker-compose", "dockerfile" ]
[ "Jquery, get value of multidimentional array key", "I've got an html form (I cannot edit) with no ID and a name attribute like this:\n\nname=\"metadata[team-member][42][name]\"\n\nI need to do two things.\n\n\nDetect if and instance of metadata[team-member] is ever changed or updated.\nget the INT held in teh second array level if so.\n\n\nHere's what I've got so far:\n\n$('[name=\"metadata[team-member]\"]').on('change', function() {\n alert('woo');\n});\n\n\nAnd that doesn't even detect the field being changed.\nFor reference, this is a list of members name, email and status. so that other fields wil be:\nname=\"metadata[team-member][42][email] etc... But I don't care about that, I just need the INT." ]
[ "jquery", "multidimensional-array", "onchange" ]
[ "Hosting the WCF Service in windows service", "How to host the WCF service in windows service?\n\nThanks\nSekar" ]
[ "wcf", "service" ]
[ "sending html mail if app allows", "I want to send a html mail from my application.\nI know that not all mail clients allow html tags.\nBut I found the constant Intent.EXTRA_HTML_TEXT in the API (http://developer.android.com/reference/android/content/Intent.html#EXTRA_HTML_TEXT).\n\nMy code looks like this, but it shows always just the text and not the html formatted text whatever mail client I use:\n\n Intent intent = new Intent(Intent.ACTION_SEND);\n intent.putExtra(Intent.EXTRA_SUBJECT, subject);\n intent.putExtra(Intent.EXTRA_TEXT, \"Hello World\");\n intent.putExtra(Intent.EXTRA_HTML_TEXT, \"<html><body><h1>Hello World</h1></body><html>\");\n\n intent.setType(\"text/html\"); // intent.setType(\"plain/text\");\n\n startActivity(Intent.createChooser(intent, \"Choose Email Client:\"));\n\n\nSo where is the mistake?" ]
[ "android", "email", "sendmail", "html-email" ]
[ "How can I initialize an equation in matlab that has an arbitrary number of variables?", "For example f(x) = x1.^2+.....xn.^2. The function takes an input n for how many different variables are in the equation. I then need to be able to use this equation to find a local minimum on some interval using newtons method." ]
[ "matlab" ]
[ "How to open the csv file with proper length in xl", "Using VB.Net\n\nBelow code is working fine for creating a csv file. \n\nWhen i open the csv file in xls or xlsx, some of the columns are collapsed, i need to expand manually to see the full details of the each column. I want to create a csv file with wraptext or length of the data \n\nCode\n\nSub SetDataTable_To_CSV(ByVal dtable As DataTable, ByVal path_filename As String, ByVal sep_char As String)\n\n Dim streamWriter As System.IO.StreamWriter\n Try\n streamWriter = New System.IO.StreamWriter(path_filename)\n\n Dim _sep As String = \"\"\n Dim builder As New System.Text.StringBuilder\n For Each col As DataColumn In dtable.Columns\n builder.Append(_sep).Append(col.ColumnName)\n _sep = sep_char\n Next\n streamWriter.WriteLine(builder.ToString())\n For Each row As DataRow In dtable.Rows\n _sep = \"\"\n builder = New System.Text.StringBuilder\n\n For Each col As DataColumn In dtable.Columns\n builder.Append(_sep).Append(row(col.ColumnName))\n _sep = sep_char\n Next\n streamWriter.WriteLine(builder.ToString())\n Next\n Catch ex As Exception\n Finally\n If Not streamWriter Is Nothing Then streamWriter.Close()\n End Try\n End Sub\n\n\nFor Example\n\nIn csv file \n\n12345,987665544433\n\n\nSame File when i open in xl\n\n12345,1.02141E+15\n\n\nExpected Output\n\nin xl file also\n\n12345,987665544433\n\n\nHow to achieve this. Need code help" ]
[ "vb.net", "csv" ]
[ "Why the legend moves when I save the fig?", "I would like to save a figure. I defined the legend as below:\nhandles, labels = ax.get_legend_handles_labels()\nfig.legend(handles, labels, ncol=1, fontsize='10', title='Nbr of \\n countries:', bbox_to_anchor=(0.83, 0.4))\n\nYou can see below what is displayed on my notebook:\n\nThen, I try to save the fig:\nfig.savefig(os.path.join(path_img, 'Fig1.png'), dpi=600)\nfig.savefig(os.path.join(path_img, 'Fig1.pdf'))\n\nBoth the pdf and png appear with a legend which has moved:\n\nI wonder if anyone knows why this is happening?" ]
[ "python", "jupyter-notebook" ]
[ "Why does the value of a local variable sometimes persist after the function ends?", "I have been trying to grasp how local variables inside functions are deallocated once the function execution finishes as the stack frame for that function call is "popped off" the stack.\nI wrote some code to test this:\nint* func1(void){\n int a = 10; \n return &a; \n}\nint main(void){\n int* h = func1(); \n printf("%d \\n", *h); \n\n return 0; \n}\n\nAnd this resulted in a "segmentation fault.. ", which I expected as that memory at &a is now free.\nWhat I find confusing however is when I create a pointer inside func1 that points to "a" and returns that pointer, the value of "a" seems to persist after.\nHere is the code for this:\nint* func1(void){\n int a = 10; \n int* b = &a;\n return b; \n}\n\n\nint main(void){\n int* h = func1(); \n printf("%d \\n", *h); \n\n return 0; \n}\n\nThe output I got for this code was "10".\nWhy does this code make "a"'s value persist??" ]
[ "c", "pointers", "stack" ]
[ "Couchbase JSON structure model", "I want to work with couchbase json-document oriented.\nBut I don't know what's the best way to store and structure data and retrieve it later.\n\nIs there somehow any tutorial to get started (the learing resources on couchbase.com did not help)?\n\nI'm using PHP to access to couchbase.\nI've got the following sample:\n\n(new document)\nuser1\n{\n\"uid\":1,\n\"name\":\"marius\"\n}\n\n(new document)\nplanet1\n{\n\"pid\":1,\n\"user_uid\":1,\n\"name\":\"earth\"\n}\n\n(new document)\nuser2\n{\n\"uid\":2,\n\"name\":\"anyone\"\n}\n\n(new document)\nplanet2\n{\n\"pid\":2,\n\"user_uid\":2,\n\"name\":\"saturn\"\n}\n\n\nNow what would be the smartest way to set (insert) these documents into the database and how can I get (select) the documents by selection.\n\nTo say it in SQL I want to -> SELECT * FROM user,planet WHERE user.uid=1 AND planet.user_uid=1" ]
[ "php", "database", "json", "couchbase" ]
[ "Azure SDK 2.2 Installation issue", "I have Visual Studio Ultimate 2013 Installed and I'm trying to install the Azure 2.2 SDK using the Web Platform Installer 4.6.\n\nIt seems to be stuck on: \"Installing Windows Azure Emulator - 2.2 [2 out of 16]\"\n\nI tried uninstalling everything and then doing a manual installation, and the manual installation of the emulator is stuck on \"Removing backup files\".\n\nSuggestions?" ]
[ "windows", "azure", "cloud" ]
[ "How to use the OCR (TesseractOCR) php library", "I had clone git library of OCR using this link .\n\ngit clone git://github.com/thiagoalessio/tesseract-ocr-for-php.git\n\n\nthen simply i include the required file by following this example \n\nhere is the example code which i m trying to run \n\nrequire_once './src/TesseractOCR.php';\n$tesseract = new TesseractOCR('text.png');\n$text = $tesseract->recognize();\necho \"The recognized text is:\", $text;\n\n\nBut always it fires a fatal Error \n\n\n Fatal error: Uncaught Error: Call to undefined method TesseractOCR::recognize()\n\n\nEdit I tried to use run() instead of recognize()\n\nrequire_once './src/TesseractOCR.php';\n$tesseract = new TesseractOCR('text.png');\n$text = $tesseract->run();\nvar_dump($text);\necho PHP_EOL, \"The recognized text is:\", $text, PHP_EOL;\n\n\nThen result is : string(0) \"\" The recognized text is:\n\nI had tried my best to find some appropriate solution but failed to find some authentic solution" ]
[ "php", "ocr" ]
[ "How do i generate query url for Amazon SQS", "I'm going to write a program can post and read messages from SQS with authentication and I've read the document from here\nLink: Query Request Authentication\n\nI have successfully written the process which post a message to specified queue follow by the document. But I always get 403 error when I try to receive message from queue. And I found the signature string rules are different for POST and GET methods.\n\nthe signature string is:\n\nGET\\n\nsqs.us-east-1.amazonaws.com\\n\n/<My Account Id>/<Queue Name>\\n\nAWSAccessKeyId=<My Access Key>\n&Action=ReceiveMessage\n&MaxNumberOfMessages=10\n&VisibilityTimeout=600\n&AttributeName=All\n&Expires=2012-04-01T11%3A29%3A24Z\n&SignatureMethod=HmacSHA1\n&SignatureVersion=2\n&Version=2011-10-01\n\n\nand the url is\n\nhttps://sqs.us-east-1.amazonaws.com/<My Account Id>/<Queue Name>?\nAction=ReceiveMessage\n&MaxNumberOfMessages=10\n&VisibilityTimeout=600&AttributeName=All\n&Version=2011-10-01\n&Expires=2012-04-01T11%3A29%3A24Z\n&Signature=<BASE64 encoded HmacSHA1 digist with signature string and my security key>\n&SignatureVersion=2\n&SignatureMethod=HmacSHA1\n&AWSAccessKeyId=<My Access Key>\n\n\nAnd I always get the 403 forbidden error:\n\n<ErrorResponse xmlns=\"http://queue.amazonaws.com/doc/2011-10-01/\">\n <Error>\n <Type>Sender</Type> \n <Code>SignatureDoesNotMatch</Code>\n <Message>\n The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.\n </Message>\n <Detail/>\n </Error>\n <RequestId>16f6e910-62e6-4259-8c09-0358b84cbe60</RequestId>\n</ErrorResponse>\n\n\nIs there anyone can tell me how can I deal with it? Thanks a lot" ]
[ "amazon-web-services", "amazon-sqs" ]
[ "Using facet_grid to plot multiple spatial polygons with common polygon as overlay", "I want to plot spatial data from a SpatialPolygonDataframe. More specifically I want to plot single spatial features in single subplots using facet_grid() of ggplot2. In addition I'd like to plot a common spatial polygon as overlay in each of the facets.\n\nHere an example using a spatial dataset of the USA and its single states. Each state (of the subset) should be displayed in a single facet) while the outline of the USA (provided in another spatial dataset) should be plotted as overlay in each facet. With my current attempt, also the USA outline is split (based on ID) and spread across the facets:\n\nlibrary(sf)\nlibrary(ggplot2)\n\nusa <- as(st_as_sf(maps::map(database=\"usa\",fill=T, plot =FALSE)),\"Spatial\")\nusa_states <- as(st_as_sf(maps::map(database=\"state\",fill=T, plot =FALSE)),\"Spatial\")\nusa_states <- usa_states[c(1:5),]\n\nggplot(data=usa_states)+\n geom_polygon(data=usa, aes(x = long, y = lat,group=id), \n size = 1, colour = \"red\",fill=NA)+\n geom_polygon(data=usa_states, aes(x = long, y = lat,group=id), \n size = 0.3, fill = \"green\",color=\"black\",alpha=0.2)+\n facet_grid(facets= id ~.)\n\n\nHow can I specify that fact_grid only considers 'id' of the usa_states dataset and does not split up the usa outline?" ]
[ "ggplot2", "sf", "facet-grid" ]
[ "UnicodeDecodeError when trying to save an Excel File with Python xlwt", "I'm running a Python script that writes HTML code found using BeautifulSoup into multiple rows of an Excel spreadsheet column.\n\n[...]\n\nCol_HTML = 19\nw_sheet.write(row_index, Col_HTML, str(HTML_Code))\nwb.save(output)\n\n\nWhen trying to save the file, I get the following error message:\n\nTraceback (most recent call last):\n File \"C:\\Users\\[..]\\src\\MYCODE.py\", line 201, in <module>\n wb.save(output)\n File \"C:\\Python27\\lib\\site-packages\\xlwt-0.7.5-py2.7.egg\\xlwt\\Workbook.py\", line 662, in save\n doc.save(filename, self.get_biff_data())\n File \"C:\\Python27\\lib\\site-packages\\xlwt-0.7.5-py2.7.egg\\xlwt\\Workbook.py\", line 637, in get_biff_data\n shared_str_table = self.__sst_rec()\n File \"C:\\Python27\\lib\\site-packages\\xlwt-0.7.5-py2.7.egg\\xlwt\\Workbook.py\", line 599, in __sst_rec\n return self.__sst.get_biff_record()\n File \"C:\\Python27\\lib\\site-packages\\xlwt-0.7.5-py2.7.egg\\xlwt\\BIFFRecords.py\", line 76, in get_biff_record\n self._add_to_sst(s)\n File \"C:\\Python27\\lib\\site-packages\\xlwt-0.7.5-py2.7.egg\\xlwt\\BIFFRecords.py\", line 91, in _add_to_sst\n u_str = upack2(s, self.encoding)\n File \"C:\\Python27\\lib\\site-packages\\xlwt-0.7.5-py2.7.egg\\xlwt\\UnicodeUtils.py\", line 50, in upack2\n us = unicode(s, encoding)\nUnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 5181: ordinal not in range(128)\n\n\nI've successfully written Python script in the past to write into worksheets. It's the first time I try to write a string of HTML into cells and I'm wondering what is causing the error and how I could fix it." ]
[ "python", "excel", "unicode", "ascii", "xlwt" ]
[ "Jquery Validation (first character cannot be 0 or symbols)", "I am using Jquery Validation.\n\nCurrently, I have a textfield. How can I prompt an alert when user type in 0 or any other symbols as the first character in the field?\n\n $.validator.addMethod(\n \"regex\",\n function(value, element, regexp) {\n var re = new RegExp(regexp);\n return this.optional(element) || re.test(value);\n },\n \"Please check your input.\"\n );\n $(\"#Textbox\").rules(\"add\", { regex: \"^[a-zA-Z'.\\\\s]{1,40}$\" })" ]
[ "javascript", "jquery", "jquery-plugins" ]
[ "enumerateObjectsUsingBlock in Swift", "I am trying to iterate through an array using enumerateObjectsUsingBlock to fetch data.\nHow to use enumerateObjectsUsingBlock in Swift ? Please help me with an example." ]
[ "swift" ]
[ "Allow limited access to secured resources via spring web security", "Some advice needed \n\nI use spring web security e.g. \n\n @Override\npublic void configure(HttpSecurity http) throws Exception {\n http\n .headers().frameOptions().disable()\n .and()\n .authorizeRequests()\n .antMatchers(\"/app/profile-info\").permitAll()\n .antMatchers(\"/app/**\").authenticated()\n .antMatchers(\"/management/health\").permitAll();\n\n}\n\n\nTo access the API 'app' you have to be authenticated. However I want to allow anyone to use the app api for a period of time e.g. they can use the api 3 times per day after which they need to sign up for the service \n\nI have looked into several solutions e.g. using ip and storing the amount of times they have used the API\n\nI was wondering is there a mechanism in spring security to achieve the above? I have been unable to find anything" ]
[ "spring-security" ]
[ "select2 delay not working", "I am using below code to initialise select2 on a select box. But the delay is not working, requests are going to server immediately.\n\n$(\".multi_select\").select2({\n multiple: true,\n allowClear: true,\n minimumInputLength: 2,\n delay: 5000,\n ajax: {\n url: \"/search.json\",\n dataType: 'json'\n }\n });\n\n\nAnother problem I am facing is, I am getting abort error on fast typing, that means previous requests are not getting aborted. Yesterday when I added above code, without delay, it was working fine without 'abort' error. Today, it gives abort error, with and without delay along with failure of delay.\n\nI am using v4.0.3 and there is no change in project since yesterday so I don't understand that what happened suddenly." ]
[ "jquery", "ajax", "jquery-select2" ]
[ "What is the workaround for OCaml: exception Invalid_argument(\"Random.int\")?", "I have this bit of code:\n\nlet rec random_list = function\n | 0 -> []\n | n -> ( Random.int max_int ) :: ( random_list (n-1) )\n\n\nIt compiles okay, but when I execute it, this error shows up:\n\nexception Invalid_argument(\"Random.int\")\n\n\nWhat is the workaround for this issue ?" ]
[ "random", "int", "arguments", "ocaml" ]
[ "Android rotate pixel in bitmap but the bitmap is turn to white/mising", "I have a fingerprint image as a bitmap and then i rotate the pixel with this code :\n\npublic Bitmap rotateImage(Bitmap rotateBmp)\n{\n double radians=Math.toRadians(90);\n double cos, sin;\n cos=Math.cos(radians);\n sin=Math.sin(radians);\n boolean rotatePix[][]=new boolean[width][height];\n\n for(int i=0;i<width;++i)\n {\n for(int j=0;j<height;++j)\n {\n int centerX=core.x, centerY=core.y;\n int m=i - centerX;\n int n=j - centerY;\n int k=(int)(m * cos + n * sin);\n int l=(int)(n * cos - m * sin);\n\n k+=centerX;\n l+=centerY;\n\n\n\n if(!((k<0)||(k>width-1)||(k<0)||(k>height-1)))\n {\n try\n {\n rotatePix[k][l]=binaryMap[i][j];\n }\n catch(Exception e)\n {\n Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();\n }\n }\n }\n }\n\n for(int i=0;i<width;++i)\n {\n for(int j=0;j<height;++j)\n {\n if(rotatePix[i][j]==true)\n {\n rotateBmp.setPixel(i, j, Color.BLACK);\n }\n else\n {\n rotateBmp.setPixel(i, j, Color.WHITE);\n }\n }\n }\n\n return rotateBmp;\n //}\n}\n\n\nbut then when I check the result, the black pixel become less then before, I guess it turns to white because when I check the calculation in the X and Y coordinate, many of them has same X and Y new coordinate and maybe it change the black pixel to white. Please tell me how to rotate the pixel in an angle but with same color with before. I attach the result here for you to look. Many thanks for your help..." ]
[ "java", "android", "bitmap" ]
[ "Best Silverlight controls for creating a console", "I'm developing a Silverlight application where I want to simulate a console. There are a lot of ways to represent this - StackPannels, grid of TextBoxes, etc - and I was wondering what the bets fit would be?\n\nRequirements:\n\n\nDisplay an 80x20 grid that scales based on parent size\nBe able to update an individual cell's character\nBe able to set a cell's forground and background color" ]
[ "c#", ".net", "vb.net", "silverlight" ]
[ "Custom TableViewCells on a UIViewController?", "I am trying to display a custom TableView on a UIViewController but am getting an error \"UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:\"\n\nI had connected the TableView to datasource and delegate. \n\nAny suggestion to go about implementing so or do I need a UITableViewController?\n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\nstatic NSString *CellIdentifier = @\"CustomCell\";\n\nCustomCell *cell = (CustomCell *)\n [tableView dequeueReusableCellWithIdentifier:CellIdentifier];\nif (cell == nil) {\n NSArray *topLevelObjects = [[NSBundle mainBundle]\n loadNibNamed:@\"CustomCell\"\n owner:nil options:nil];\n for (id currentObjects in topLevelObjects){\n if ([currentObjects isKindOfClass:[UITableView class]]){\n cell = (CustomCell *) currentObjects;\n break;\n }\n } \n}\n//---set the text to display for the cell---\ncell.cellNameLabel.text = @\"This is name\";\ncell.cellValueLabel.text = @\"This is Value\";\nreturn cell;" ]
[ "iphone", "xcode", "uiviewcontroller", "tableview" ]
[ "Iterating over all unsigned integers in a for loop", "Let's say I want to iterate over all integers in a for loop. For the sake of discussion, assume I am calling some unknown function f(unsigned x) for each integer:\n\nfor (unsigned i = 0; i < UINT_MAX; i++) {\n f(i);\n}\n\n\nOf course, the above fails to iterate over all integers, because it misses one: UINT_MAX. Changing the condition to i <= UINT_MAX just results in an infinite loop, because that's a tautology. \n\nYou can do it with a do-while loop, but you lose all the niceties of the for syntax.\n\nCan I have my cake (for loops) and eat it too (iterate over all integers)?" ]
[ "c", "loops", "for-loop", "syntax" ]
[ "How to start a python script after etcd is running in a single docker container?", "I have built a docker file composed by python2.7-alpine and etcd (https://hub.docker.com/r/elcolio/etcd/), I'm trying to run a python script right after the etcd is running (from the same container), however I get connection error because the etcd has not up yet. Any suggestions? (I tried to make another CMD after last CMD and also to put the exec command into the run.sh)\n\nFROM python:2.7-alpine\n\nRUN pip install python-etcd\n\n# Create script directory\nRUN mkdir -p /usr/src/app\nWORKDIR /usr/src/app\n\nCOPY ./scripts /usr/src/app\n\n## install etcd\n\nRUN apk add --update ca-certificates openssl tar && \\\n wget https://github.com/coreos/etcd/releases/download/v2.0.10/etcd-v2.0.10-linux-amd64.tar.gz && \\\n tar xzvf etcd-v2.0.10-linux-amd64.tar.gz && \\\n mv etcd-v2.0.10-linux-amd64/etcd* /bin/ && \\\n apk del --purge tar openssl && \\\n rm -Rf etcd-v2.0.10-linux-amd64* /var/cache/apk/*\nVOLUME /data\nEXPOSE 2379 2380 4001 7001\nADD run.sh /bin/run.sh\nCMD [\"/bin/run.sh\"]\n\n\n\n 2017-03-19T14:47:20.291046586Z etcd.EtcdConnectionFailed: Connection\n to etcd failed due to\n MaxRetryError(\"HTTPConnectionPool(host='127.0.0.1', port=2379): Max\n retries exceeded with url: /v2/keys/mq/username (Caused by\n NewConnectionError(': Failed to establish a new connection: [Errno 111]\n Connection refused',))\",)" ]
[ "python", "docker", "docker-compose", "dockerfile", "etcd" ]
[ "How to change all empty strings to null when parsing JSON to a JToken", "In C#, using JSON.Net and without using custom classes, how would I convert empty strings to nulls? such that:\n\n{\"employees\":[\n {\"firstname\":\"\", \"lastname\":\"Doe\"},\n {\"firstname\":\"Anna\", \"lastname\":\"\"},\n {\"firstname\":\"\", \"lastname\":\"Jones\"} \n]}\n\n\nbecomes\n\n{\"employees\":[\n {\"firstname\":null, \"lastname\":\"Doe\"},\n {\"firstname\":\"Anna\", \"lastname\":null},\n {\"firstname\":null, \"lastname\":\"Jones\"} \n]}" ]
[ "c#", "json" ]
[ "loop through jquery array using the index to return the value", "I have the below jquery array being returned by a PHP server.\nif I alert the array with alert(data) it outputs:\n\nArray\n(\n [0] => Array\n (\n [firstname] => john\n [lastname] => paul\n [id] => 123 \n )\n [1] => Array\n (\n [firstname] => adam\n [lastname] => james\n [id] => 343 \n )\n)\n\n\nI have tried using:\n var i;\n for (i = 0; i < result.length; ++i) {\n alert(result[i]);\n }\n\nThis returns a single character. I need the entire value to be alerted.\n\nfor example: John then paul then 123 then adam... etc etc\n\nThanks as always," ]
[ "jquery", "loops", "for-loop" ]
[ "My Zoho form embedded on my Wix site returns the user to an I frame", "I use the free wix web builder which only allows me to embed my Zoho generated form in an HTML Element. Thus when the user submits the form instead him being redirected to the "Thanks for Contacting us" landing page that I created it embeds that page within an I frame.\nCan anyone advise how I can modify the code just to g straight to the landing page complete with its own header and footer.\nThanks\nSteve" ]
[ "iframe", "velo" ]
[ "NVD3 Library - Line and Bar Chart - Bar chart doesn't load until window resize", "I'm trying to create a line and bar chart using the NVD3 javascript library. I have an interesting problem where the lines load perfectly fine, but the bars are omitted on initial page load. But, once I resize the window or do an inspect element n the chart, the bar chart loads.\n\nHere is my code: \n\n// raw @timeline is just JSON\n// This is a rails app\nvar timeline = <%=raw @timeline %> \n var chart_concurrent_users_data = [\n {\n values: timeline.map(function(d) { return {x: d[0], y: d[1] } }),\n key: 'Concurrent Users',\n color: '#C0C0C0',\n yAxis: 2,\n bar: true\n },\n {\n values: timeline.map(function(d) { return {x: d[0], y: d[2] } }),\n key: 'User Joins',\n color: '#5cb85c',\n yAxis: 1\n },\n {\n values: timeline.map(function(d) { return {x: d[0], y: d[3] } }),\n key: 'User Leaves',\n color: '#006699',\n yAxis: 1\n }\n ];\n // User Chart / Leave / Joins\n nv.addGraph(function() {\n var chart_users = nv.models.linePlusBarChart()\n .margin({top: 30, right: 80, bottom: 50, left: 80})\n .color(d3.scale.category10().range());\n\n // FULL Graph\n chart_users.xAxis.tickFormat(function(d) {\n return d ? d3.time.format('%H:%M%')(new Date(d)) : '';\n });\n\n chart_users.xAxis.axisLabel('Time');\n\n chart_users.y2Axis\n .axisLabel('Users joining / leaving')\n .tickFormat(d3.format(',.'));\n\n chart_users.y1Axis\n .axisLabel('Concurrent Users')\n .tickFormat(d3.format(',.'));\n\n chart_users.bars.forceY([0]);\n\n chart_users.lines.forceY([0]);\n\n d3.select('#chart_users svg')\n .datum(chart_concurrent_users_data)\n .call(chart_users);\n\n nv.utils.windowResize(chart_users.update);\n\n return chart_users;\n });\n\n\nI've tested this in both chrome and firefox.\n\nHere are some images of the problem.\n\nOn initial load:\n\n\n\nAfter resize:\n\n\n\nNote I can also resize it back to full screen and the bar chart is still present. Any ideas are greatly appreciated." ]
[ "javascript", "css", "charts", "nvd3.js" ]
[ "copy and pasting multiple rows using some condition", "I have to write a macro to conditionally copy certain rows. If user enters some number in any empty cell, say A55, this number will be matched to column A (or A1) if the number is found in A1, then the whole row should be selected. And if the number is found in multiple places in column A then it should copy all the rows and paste them in new worksheet say sheet2. \n\nHere is my code which only accesses all the rows in which A55 number is found and I'm not sure how to copy selected rows:\n\ncopyandpaste() \n Dim x As String \n Dim matched As Integer \n Range(\"A1\").Select \n x = Worksheets(\"Sheet1\").Range(\"A55\") \n matched = 0 \n Do Until IsEmpty(ActiveCell) \n If ActiveCell.Value = x Then \n matched = matched + 1 \n End If \n ActiveCell.Offset(1, 0).Select \n Loop \n MsgBox \"Total number of matches are : \" & matched \nEnd Sub" ]
[ "excel", "row", "vba" ]
[ "Texture in LWJGL not displaying", "I am trying to display a png as a texture in Eclipse using the LWJGL library. I made sure to bind the texture and to set the coordinates BEFORE drawing the vertexes, but the image still isn't displaying. What could be the problem?\n\npackage javagame;\n\nimport static org.lwjgl.opengl.GL11.*;\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.IOException;\n\nimport org.lwjgl.LWJGLException;\nimport org.lwjgl.opengl.Display;\nimport org.lwjgl.opengl.DisplayMode;\nimport org.lwjgl.opengl.GL11;\nimport org.lwjgl.util.Color;\nimport org.newdawn.slick.opengl.Texture;\nimport org.newdawn.slick.opengl.TextureLoader;\nimport org.newdawn.slick.util.ResourceLoader;\n\n@SuppressWarnings(\"unused\")\npublic class ImageLWJGL {\n public static Texture p;\n\n public static void main(String[] args) {\n createDisplay();\n createGL();\n\n render();\n\n cleanUp();\n\n }\n\n private static void createDisplay(){ \n try {\n Display.setDisplayMode(new DisplayMode(800,600));\n Display.create();\n Display.setVSyncEnabled(true);\n\n } catch (LWJGLException e) {\n e.printStackTrace();\n }\n }\n\n public static void createGL(){\n glMatrixMode(GL_PROJECTION);\n glLoadIdentity(); \n glOrtho(0, Display.getWidth(), 0, Display.getHeight(), -1, 1); \n\n glMatrixMode(GL_MODELVIEW); \n\n glClearColor(0,0,0,1); \n glDisable(GL_DEPTH_TEST);\n glEnable(GL_TEXTURE_2D);\n\n }\n\n\n private static void render(){\n while(!Display.isCloseRequested()){\n\n try {\n p = TextureLoader.getTexture(\"PNG\", \n new FileInputStream(new File(\"res/wood.png\")));\n } catch (IOException e) {\n\n e.printStackTrace();\n }\n\n\n\n glClear(GL_COLOR_BUFFER_BIT);\n glLoadIdentity();\n\n glColor3f(0.25f,0.75f,0.5f); \n\n\n p.bind();\n\n glBegin(GL_QUADS);\n\n glTexCoord2f(0,0);\n glVertex2f(0,0); // (origin, origin)\n\n glTexCoord2f(0,1);\n glVertex2f(0,p.getHeight()); // (origin, y-axis)-height\n\n glTexCoord2f(1,1);\n glVertex2f(p.getWidth(),p.getHeight()); // (x-axis, y-axis)\n\n glTexCoord2f(1,0);\n glVertex2f(p.getWidth(),0); // (x-axis, origin)-width\n\n\n glEnd();\n\n Display.update();\n }\n\n }\n\n\n\n\nprivate static void cleanUp(){\n Display.destroy();\n\n}\n\n\n}" ]
[ "java", "2d", "png", "textures", "lwjgl" ]
[ "jquery-ui, Foundation, and Rails 3.1 not playing well together", "I have a Rails 3.1 app that uses the foundation-rails gem and the jquery-rails gem and everything seems to be working. I tried to add the jquery-ui-rails gem to the mix and ran bundle install and everything looks good. Here is the relevant part of my gemfile:\n\n# Bundle edge Rails instead:\n# gem 'rails', :git => 'git://github.com/rails/rails.git'\n\ngem 'sqlite3'\ngem 'mysql2'\ngem 'devise'\ngem 'omniauth'\ngem 'omniauth-facebook', '1.4.0'\ngem 'omniauth-google-oauth2'\ngem 'jquery-rails'\n\ngem 'json'\n\n# Gems used only for assets and not required\n# in production environments by default.\ngroup :assets do\n gem 'sass-rails', '~> 3.1.4'\n gem 'coffee-rails', '~> 3.1.1'\n gem 'uglifier', '>= 1.0.3'\n gem 'foundation-rails'\n gem 'jquery-ui-rails'\nend\n\n\nHere is application.js:\n\n//= require jquery\n//= require jquery_ujs\n//= require jquery.ui.all\n//= require foundation\n//= require_tree .\n\n$(function(){ $(document).foundation(); });\n\n\nHere is application.css:\n\n/*\n * This is a manifest file that'll automatically include all the stylesheets available in this directory\n * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at\n * the top of the compiled file, but it's generally better to create a new file per style scope.\n *= require_self\n *= require foundation_and_overrides\n\n *= require_tree . \n*/\n\n/*\n *= require jquery.ui.all\n */\n\n\nI have a page that includes the following code:\n\n <ul id='sortable_list'>\n <% @list.items.each do |item| %>\n <li><%=item.name%></li>\n <%end%>\n </ul>\n\n </div>\n</div>\n\n<script>\n\n $(function() {\n $( \"#sortable_list\" ).sortable();\n $( \"#sortable_list\" ).disableSelection();\n });\n</script>\n\n\nThe list is not sortable when the page loads and I get a \"Uncaught ReferenceError: $ is not defined\". I'm at my wits end - help, please!" ]
[ "ruby-on-rails", "jquery-ui", "ruby-on-rails-3.1", "zurb-foundation" ]
[ "Split fix monthly value to days and countries based on revenue shares", "DB-Fiddle:\nCREATE TABLE sales (\n id int auto_increment primary key,\n country VARCHAR(255),\n sales_date DATE,\n sales_volume INT,\n fix_costs INT\n);\n\nINSERT INTO sales\n(country, sales_date, sales_volume, fix_costs\n)\nVALUES \n\n("DE", "2020-12-01", "500", "0"),\n("NL", "2020-12-01", "320", "0"),\n("FR", "2020-12-01", "350", "0"),\n\n("DE", "2020-12-02", "700", "0"),\n("NL", "2020-12-02", "420", "0"),\n("FR", "2020-12-02", "180", "0"),\n\n("DE", "2020-12-03", "0", "0"),\n("NL", "2020-12-03", "0", "0"),\n("FR", "2020-12-03", "0", "0"),\n\n("None", "2020-12-31", "0", "2000");\n\nExpected Result:\nsales_date | country | sales_volume | fix_costs\n-------------|--------------|------------------|------------------------------------------\n2020-12-01 | DE | 500 | 37.95 (=2000/31 = 64.5 * 0.59)\n2020-12-01 | FR | 350 | 26.57 (=2000/31 = 64.5 * 0.41)\n2020-12-01 | NL | 320 | 0.00\n-------------|--------------|------------------|------------------------------------------\n2020-12-02 | DE | 700 | 51.32 (=2000/31 = 64.5 * 0.8) \n2020-12-02 | FR | 180 | 13.20 (=2000/31 = 64.5 * 0.2) \n2020-12-02 | NL | 420 | 0.00\n-------------|--------------|------------------|------------------------------------------ \n2020-12-03 | DE | 0 | 32.26 (=2000/31 = 64.5 * 0.5) \n2020-12-03 | FR | 0 | 32.26 (=2000/31 = 64.5 * 0.5) \n2020-12-03 | NL | 0 | 0.00\n-------------|--------------|------------------|-------------------------------------------\n\n\nIn the result above I want to split a fix_cost value per month (in this case 2000) to the country DE and FR per day based on the daily sales_volume in each of the selected countries. So far I have used the solution from this question which worked perfectly:\nSELECT\n sales_date, \n country, \n SUM(sales_volume),\n (CASE WHEN country <> 'NL'\n THEN SUM(SUM(fix_costs)) over(partition BY year(sales_date), month(sales_date))\n / day(last_day(sales_date)) \n * SUM(sales_volume)\n / SUM(CASE WHEN country <> 'NL' THEN SUM(sales_volume) ELSE 0 END) over(partition BY sales_date)\n END) AS fix_cost_per_day\nFROM sales\nGROUP BY 1,2;\n\n\nHowever, as you can see in the data on 2020-12-03 there are no sales at all. \nTherefore, the query above is not able to split the daily fix_costs to each country on this day. \nTo solve this issue I want to modify the query so in case there is a day without a sales_volume the values should be split 50/50.\nHow do I have to modify the query to achieve this?" ]
[ "mysql", "sql" ]
[ "Why do I have to run \"webpack\" command again n again?", "I am working with a React project. Every time I make any change in any of the .js files, I have to run the \"webpack\" command in the terminal again to get the changes reflect on browser. Is there any way so that I cannot have to run the \"webpack\" command again n again. \n\nwebpack.config.js\n\nvar path = require('path');\nvar webpack = require('webpack');\n\nmodule.exports = {\n devServer: {\n inline: true,\n contentBase: './src',\n port: 3000\n },\n devtool: 'cheap-module-eval-source-map',\n entry: './dev/js/index.js',\n module: {\n loaders: [\n {\n test: /\\.js$/,\n loaders: ['babel'],\n exclude: /node_modules/\n },\n {\n test: /\\.scss/,\n loader: 'style-loader!css-loader!sass-loader'\n }\n ]\n },\n output: {\n path: 'src',\n filename: 'js/bundle.min.js'\n },\n plugins: [\n new webpack.optimize.OccurrenceOrderPlugin()\n ]\n};" ]
[ "node.js", "reactjs", "webpack", "webpack-dev-server" ]
[ "Defining a C array where every element is the same memory location", "In C (or C++), is it possible to create an array a (or something that \"looks like\" an array), such that a[0], a[1], etc., all point to the same memory location? So if you do\n\na[0] = 0.0f;\na[1] += 1.0f;\n\n\nthen a[0] will be equal to 1.0f, because it's the same memory location as a[1].\n\nI do have a reason for wanting to do this. It probably isn't a good reason. Therefore, please treat this question as if it were asked purely out of curiosity.\n\nI should have said: I want to do this without overloading the [] operator. The reason for this has to do with avoiding a dynamic dispatch. (I already told you my reason for wanting to do this is probably not a good one. There's no need to tell me I shouldn't want to do it. I already know this.)" ]
[ "c++", "c", "arrays" ]
[ "most optimal sql query for a simple table design", "I'm trying to come up with the most optimal query to solve this problem.\n\nI have simple table made up of columns name(string) and organization_id(int). This table contains a list of names that belong to one or more organizations.\n\nHow can I get a list of all the names that belong to the organizations that both \"Jim\" and \"Andy\" belong to?\n\nExample:\n\n- John,1\n- Jim,1\n- Jim,2\n- Andy,2\n- Carl,2\n- Jim,3\n- Carl,3\n- Andy,4\n- John,4\n- Jim,5\n- Randy,5\n- Andy,5\n\n\nSo the query should return to me Jim,2|Andy,2|Carl,2|Jim,5|Randy,5|Andy,5 as both Jim and Andy belong to organizations 2 and 5.\n\nAny ideas?" ]
[ "sql", "database", "oracle" ]
[ "Cannot figure out Crashlytics report", "Basically I have this displayed in my Crashlytics report.\nThis error crashes the app.\nIt doesn't show any line of code I written and Google search doesn't help either.\n\nBelow are screenshots.\nBoth are showing the same thing just different ways of showing data.\n\nhttp://postimg.org/image/4k9hb3sbx/\n\nhttp://postimg.org/image/c2xgd2lqv/\n\nUPDATE:\n\nfound that this was related to this bug here NSRangeException on iOS 8" ]
[ "ios", "debugging", "crashlytics" ]
[ "Vagrant fails to provision docker container", "My Vagrantfile:\n\nVagrant.require_version \">= 1.6.0\"\nVAGRANTFILE_API_VERSION = \"2\"\nENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker'\n\nVagrant.configure(2) do |config|\n\nconfig.vm.provision :chef_solo do |chef|\n chef.add_recipe \"tomcat\"\nend\nconfig.vm.provider \"docker\" do |docker|\n docker.create_args = [\"-d\"]\n docker.has_ssh = true\nend\nconfig.ssh.port = 22\nconfig.ssh.username = \"root\"\nconfig.ssh.password = \"password\"\n\nend\n\n\nand Dockerfile:\n\nFROM precise-prepared\n##ADD SCRIPTS IN DOCKER IMAGE\nADD ssh.sh /ssh.sh\nRUN chmod +x /ssh.sh\nRUN echo \"root:password\" | chpasswd\nEXPOSE 22\n##START ssh services during startup\nCMD [\"/ssh.sh\"]\n\n\nprecise-prepared is just a slightly modified ubuntu:12.04 docker image.\n\nWhen I'm running vagrant up command it fails with the following error:\n\n\n Vagrant attempted to execute the capability 'chef_install' on the\n detect guest OS 'linux', but the guest doesn't support that\n capability. This capability is required for your configuration of\n Vagrant. Please either reconfigure Vagrant to avoid this capability or\n fix the issue by creating the capability.\n\n\nIs it vagrant's docker provider doesn't support provisioning with chef or I am missing something?\n\nThanks" ]
[ "vagrant", "vagrant-plugin" ]
[ "Qt error: LNK1120: 1 unresolved externals main.obj:-1: error: LNK2019 Run Qmake", "I can not figure out why I am getting the errors:\nmain.obj:-1: error: LNK2019: unresolved external symbol \"public: __thiscall Standbywindow::Standbywindow(void)\" (??0Standbywindow@@QAE@XZ) referenced in function _main\nand\ndebug\\pointer_test.exe:-1: error: LNK1120: 1 unresolved externals\n\nMain.cpp\n\n #include <QCoreApplication>\n #include <QDebug>\n #include \"standby.h\"\n\n Standbywindow *standby_window;\n\n int main(int argc, char *argv[])\n {\n QCoreApplication a(argc, argv);\n standby_window = new Standbywindow;\n return a.exec();\n }\n\n\nstandby.h\n\n #ifndef STANDBY_H\n #define STANDBY_H\n #include <QDebug>\n class Standbywindow{\n public:\n Standbywindow();\n };\n\n #endif // STANDBY_H\n\n\nstandby.cpp\n\n#include \"standby.h\"\nStandbywindow::Standbywindow(){\n}\n\n\npointer_test.pro\n\n #-------------------------------------------------\n #\n # Project created by QtCreator 2015-05-10T11:08:06\n #\n #-------------------------------------------------\n\n QT += core\n\n QT -= gui\n\n TARGET = pointer_test\n CONFIG += console\n CONFIG -= app_bundle\n\n TEMPLATE = app\n\n\n SOURCES += main.cpp \\\n standby.cpp\n\n HEADERS += \\\n standby.h\n\n\ncompile output\n\n09:08:23: Running steps for project pointer_test...\n09:08:23: Configuration unchanged, skipping qmake step.\n09:08:23: Starting: \"C:\\Qt\\Tools\\QtCreator\\bin\\jom.exe\" \nC:\\Qt\\Tools\\QtCreator\\bin\\jom.exe -f Makefile.Debug \ncl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fddebug\\pointer_test.pdb -DUNICODE -DWIN32 -DQT_CORE_LIB -I\"..\\pointer_test\" - I\".\" -I\"C:\\Qt\\5.4\\msvc2010_opengl\\include\" -I\"C:\\Qt\\5.4\\msvc2010_opengl\\include\\QtCore\" -I\"debug\" -I\"C:\\Qt\\5.4\\msvc2010_opengl\\mkspecs\\win32-msvc2010\" -Fodebug\\ @C:\\Users\\Mike\\AppData\\Local\\Temp\\main.obj.10328.16.jom\n main.cpp\n echo 1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ \"debug\\\\pointer_test.exe.embed.manifest\">debug\\pointer_test.exe_manifest.rc\n if not exist debug\\pointer_test.exe if exist debug\\pointer_test.exe.embed.manifest del debug\\pointer_test.exe.embed.manifest\n if exist debug\\pointer_test.exe.embed.manifest copy /Y debug\\pointer_test.exe.embed.manifest debug\\pointer_test.exe_manifest.bak\n link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE \"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'\" /MANIFEST /MANIFESTFILE:debug\\pointer_test.exe.embed.manifest /OUT:debug\\pointer_test.exe @C:\\Users\\Mike\\AppData\\Local\\Temp\\pointer_test.exe.10328.2250.jom\n main.obj : error LNK2019: unresolved external symbol \"public: __thiscall Standbywindow::Standbywindow(void)\" (??0Standbywindow@@QAE@XZ) referenced in function _main\n debug\\pointer_test.exe : fatal error LNK1120: 1 unresolved externals\n jom: C:\\Users\\Mike\\Documents\\QT\\build-pointer_test- Desktop_Qt_5_4_1_MSVC2010_OpenGL_32bit-Debug\\Makefile.Debug [debug\\pointer_test.exe] Error 1120\n jom: C:\\Users\\Mike\\Documents\\QT\\build-pointer_test- Desktop_Qt_5_4_1_MSVC2010_OpenGL_32bit-Debug\\Makefile [debug] Error 2\n 09:08:26: The process \"C:\\Qt\\Tools\\QtCreator\\bin\\jom.exe\" exited with code 2.\n Error while building/deploying project pointer_test (kit: Desktop Qt 5.4.1 MSVC2010 OpenGL 32bit)\n When executing step \"Make\"\n 09:08:26: Elapsed time: 00:03." ]
[ "c++", "qt" ]
[ "Why concatenate features in machine learning?", "I am learning Microsoft ML framework and confused why features need to be concatenated. In Iris flower example from Microsoft here:\nhttps://docs.microsoft.com/en-us/dotnet/machine-learning/tutorials/iris-clustering\n\n... features are concatenated:\n\nstring featuresColumnName = \"Features\";\nvar pipeline = mlContext.Transforms\n .Concatenate(featuresColumnName, \"SepalLength\", \"SepalWidth\", \"PetalLength\", \"PetalWidth\")\n ...\n\n\nAre multiple features treated as a single feature in order to do calculations like linear regression? If so, how is this accurate? What is happening behind the scenes?" ]
[ "machine-learning" ]
[ "How to call button's onclick before textarea's onFocusOut?", "So I have this td-element which contains textarea and button. When the textarea is focused the button shows and otherwise stays hidden. \n\nThe problem is when I press the button, which is supposed to remove the parent of the td-element, I lose focus of textarea and the button is hid before the button's onclick eventhandler fires.\n\nHere are the elements:\n\n<td>\n <textarea oninput='textHeight(this)' onfocus='onFocus(this)' onfocusout='onFocusOut(this)'></textarea>\n <button onclick='deleteNote(this)'>X</button>\n</td>\n\n\nJavaScript:\n\nonFocus = (textarea) => {\n textarea.parentElement.querySelector(\"button\").style.display = \"inline\";\n}\nonFocusOut = (textarea) => {\n textarea.parentElement.querySelector(\"button\").style.display = \"none\";\n}\ndeleteNote = (btn) => {\n btn.parentElement.parentElement.remove();\n}" ]
[ "javascript", "html", "events" ]
[ "Why are we allowed to create sparse arrays in JavaScript?", "I was wondering what the use-cases for code like var foo = new Array(20), var foo = [1,2,3]; foo.length = 10 or var foo = [,,,] were (also, why would you want to use the delete operator instead of just removing the item from the array). As you may know already, all these will result in sparse arrays. \n\nBut why are we allowed to do the above thnigs ? Why would anyone want to create an array whose length is 20 by default (as in the first example) ? Why would anyone want to modify and corrupt the length property of an array (as in the second example) ? Why would anyone want to do something like [, , ,] ? Why would you use delete instead of just removing the element from the array ? \nCould anyone provide some use-cases for these statements ? \n\nI have been searching for some answers for ~3 hours. Nothing. The only thing most sources (2ality blog, JavaScript: The Definitive Guide 6th edition, and a whole bunch of other articles that pop up in the Google search results when you search for anything like \"JavaScript sparse arrays\") say is that sparse arrays are weird behavior and that you should stay away from them. No sources I read explained, or at least tried to explain, why we were allowed to create sparse arrays in the first place. Except for You Don't Know JS: Types & Grammar, here is what the book says about why JavaScript allows the creation of sparse arrays:\n\n\n An array that has no explicit values in its slots, but has a length property that implies the slots exist, is a weird exotic type of data structure in JS with some very strange and confusing behavior. The capability to create such a value comes purely from old, deprecated, historical functionalities (\"array-like objects\" like the arguments object).\n\n\nSo, the book implies that the arguments object somehow, somewhere, uses one of the examples I listed above to create a sparse array. So, where and how does arguments use sparse arrays ?\n\nSomething else that is confusing me is this part in the book \"JavaScript: The Definitive Guide 6th Edition\":\n\n\n Arrays that are sufficiently sparse are typically implemented in a slower, more memory-efficient way than dense arrays are`.\n\n\n\"more memory-efficient\" appears like a contradiction to \"slower\" to me, so what is the difference between the two, in the context of sparse arrays especially ? Here is a link to that specific part of the book." ]
[ "javascript", "sparse-matrix" ]
[ "python multiple execute command", "import subprocess\n\ncommand = r'C:\\Windows\\system32\\windowspowershell\\v1.0\\powershell.exe -noe -c \". \\\"C:\\Program Files\\VMware\\VMware View\\Server\\extras\\PowerShell\\add-snapin.ps1\\\"\"'\ncommand2 = 'Get-PoolEntitlement -pool_id gameserver2 | Remove-\nPoolEntitlement'\noutput = subprocess.getoutput(command)\noutput = subprocess.getoutput(command2)\nprint(output)\n\n\nI have run multiple commands that related commands. But I dont\n\nerror:\n\n'Get-PoolEntitlement' is not recognized as an internal or external command,\n\n\noperable program or batch file." ]
[ "python", "powershell", "vmware", "powercli" ]
[ "add class to last 2 links from a generate ul list", "I have a function that generates a unordered list of links and I want to use javascript to select the last 2 links so that I can align them to the right.\n\nso in the following example I would need to select the li parent of link4 and link5, then add a class so i can style it\n\n<ul>\n<li>link1</li>\n<li>link2</li>\n<li>link3</li>\n<li>link4</li>\n<li>link5</li>\n</ul>\n\n\nIn the end it should be something like this:\n\n<ul>\n<li>link1</li>\n<li>link2</li>\n<li>link3</li>\n<li class=\"align_right\">link4</li>\n<li class=\"align_right\">link5</li>\n</ul>" ]
[ "javascript", "html", "css" ]
[ "Combine replacement of strings in pandas column", "I have a dataframe in the following form:\n\ndf\nText\n\nApple\nBanana\nAnanas\n...\n\n\nAnd I want to replace several strings, but some of them will have the same ouptut afterwards. So right now I am using:\n\ndf['Text'] = df['Text'].replace('Apple', 'Germany', regex=True)\ndf['Text'] = df['Text'].replace('Banana', 'South America', regex=True)\ndf['Text'] = df['Text'].replace('Ananas', 'South America', regex=True)\n\n\nwhich leads to the desired outcome:\n\ndf\nText\n\nGermany\nSouth America\nSouth America\n...\n\n\nBut the command lines are getting some kind of messy, is there a smarter way to do it? Something like: df['Text'] = df['Text'].replace('Ananas' or 'Banana', 'South America', regex=True)\n\nIf I try, this logic: Regex match one of two words\n\ndf['Text'] = df['Text'].replace(/^(Ananas|Banana)$/', 'South America', regex=True) nothing happens" ]
[ "python", "regex", "pandas" ]
[ "Subscript out of range when using Userform input workbook as reference", "I have put together a userform for the user to select an open workbook - ideally would like to have this integrated with a script so that the script runs in reference to the workbook chosen. \nHowever an out of range error presents when running the script:\n\n\nPrivate Sub Go_Click()\n\n If ComboBox1.ListIndex = -1 Then\n MsgBox \"Please select a workbook name and try again\"\n Exit Sub\n End If\n\n Dim wb As Workbook, copytest As Range, pastetest As Range\n\n Set wb = Workbooks(ComboBox1.List(ComboBox1.ListIndex))\n\n\n Set copytest = wb.Worksheets(2).Columns(6)\n Set pastetest = Workbooks(\"VBA Workbook.xlsx\").Worksheets(1).Columns(1)\n copytest.Copy Destination:=pastetest\n\n '~~> Do what you want\n\nDebug.Print\n\nEnd Sub\n\n\nCombo box: \n\nPrivate Sub UserForm_Initialize()\n\n\n Dim wkb As Workbook\n Me.Label1.Caption = \"Please select the relevant workbook\"\n With Me.ComboBox1\n '~~> Loop thorugh all open workbooks and add\n '~~> their name to the Combobox\n For Each wkb In Application.Workbooks\n .AddItem wkb.Name\n Next wkb\n End With\nEnd Sub" ]
[ "excel", "vba" ]
[ "The select drop down menu appear behind other elements in shiny", "Can any one give me a solution to the following issue where the drop down goes under the plotly hover when going to select the fist item in the drop down.\n\n\n\nI used the following code. But didn't work.\n\nin UI,\n\nfluidRow(\n tags$hr(style=\"z-index: 10000;\"),\n column(width = 3,h2(\"Device Type\")),\n column(width = 3,htmlOutput(\"disselect\")),\n column(width = 3,htmlOutput(\"cityeselect\")),\n column(width = 3,h2(\"Property Type\"))\n ),\n\n\nin server\n\noutput$disselect <- renderUI({\n selectInput(\"district\", \"District\", c(\"All\",unique(bookings$District)), selected = \"All\")\n })\n\n\nAny hacks?" ]
[ "javascript", "r", "shiny" ]
[ "How to implement Multi Tenancy architecture using Node and Mongoose?", "I am working on a SaaS application in which every client will have their own database. I am distinguishing the clients via their DNS.\n\nSo, what I learned after googling a while is that I will create a master DB which will have respective username and password for respective client. I will create new connections at the runtime. \n\nI came across different strategies but I can't even find a single proper implementation for the same using Nodejs and Mongoose.\n\nAny help will be appreciated.\n\nThanx in Advance." ]
[ "javascript", "node.js", "mongodb", "mongoose", "multi-tenant" ]
[ "what does ! (exclamatory) mark inside curly braces ({}) when using variable in unix", "Let var be a variable and it assigned a value /home/user as below\n\nvar=/home/user\n\n\nwhen using this variable, i have seen it using both of the below format,\n\n1) cd ${var}\n2) cd ${!var}\n\n\nwhat is the difference? for me second option is not working , if i echo second option returns empty." ]
[ "bash", "shell", "sh" ]
[ "PartialSubmit not working in Icefaces 3.3", "I have a project to Migrate icefaces 1.8 to 3.3 . This is the first time I am doing this conversion process and facing lots of difficulties. I am very new to Icefaces, so pardon me if I ask any silly questions.\nI can able to run the project in Icefaces 3.3 But some of the functionality was not working properly .I’m facing issue in Partial submit .Can you please provide the alternative code for the below.\n\n<ui:define name=\"content\">\n <ice:form id=\"stackForm\" partialSubmit=\"true\">\n …….\n <ice:commandLink actionListener=\"#{item.userObject.selectPanelStackPanel}\" \n action=\"#{tree.planNodeSelected}\" partialSubmit=\"true\">\n <ice:outputText id=\"treeContentTxt\" value=\"#{item.userObject.plan }\" rendered=\"#{item.leaf}\" />\n <f:param name=\"param1\" value=\"#{item.userObject.param1}\" />\n <f:param name=\"param2\" value=\"#{item.userObject.param2}\" />\n <f:param name=\"param3\" value=\"#{item.userObject.param3}\" />\n <f:param name=\"param4\" value=\"#{item.userObject.param4}\" />\n </ice:commandLink>\n\n …….. \n</ice:form>\n</ui:define>" ]
[ "jsf-2", "icefaces", "icefaces-3", "icefaces-1.8" ]
[ "using Boto How to connect to SSH client using proxy server inbetween?", "Instead of directly connecting to SSh client I have to connect using proxy server and then to ssh client? \n\nI have tried below approach:\nin Boto\\manage\\cmdshell.py I have made below change\n\n while retry < 5:\n try:print \"connecting ssh client\"\n proxy = paramiko.ProxyCommand('connect-proxy -S my_proxy_IP:8080') \n self._ssh_client.connect(self.server.hostname,\n username=self.uname,\n pkey=self._pkey,sock=proxy)\n\n\nwhich is giving me \n File \"C:\\Python27\\lib\\site-packages\\paramiko\\transport.py\", line 465, in start_client\n raise e\nparamiko.SSHException: Error reading SSH protocol banner\n\nI referered this link here in stackoverflow\nParamiko Error: Error reading SSH protocol banner\nwhere they are saying \n\nanswer is \n\nThis issue didn't lie with Paramiko, Fabric or the SSH daemon. It was simply a firewall configuration in ISPs internal network. For some reason, they don't allow communication between different subnets of theirs.\nWe couldn't really fix the firewall configuration so instead we switched all our IPs to be on the same subnet.\n\nbut in my case my host is amazonaws instance what should i do in that case.\n\nI am doing anything wrong here or how can i ovecome this issue." ]
[ "python-2.7", "fabric", "boto", "paramiko" ]
[ "Proper method for simple 'lazy loading' of images", "I am building a web application that is extremely image heavy. A feature of it is an interactive timeline which allows the user to scroll through a series of years. Each year has a photo gallery with 20-50 images. I am looking for the best solution to hide images on load, and load them on demand (a click event). Here are a few options:\n\n1) Use javascript to assign the data-src to the actual src on demand.\n\n<img src=\"blank.png\" data-src=\"images/real-image.jpg\">\n\n\n2) Place all images inside a div with display:none. I believe some browsers still load these images on load, so might not be a good idea\n\n<div style=\"display:none\">\n <img src=\"images/real-image.jpg\">\n</div> \n\n\n3) Use a technique like lazyload. This plug, JAIL allows for images to be loaded after an event is triggered.\n\nThanks in advance!" ]
[ "javascript", "jquery", "html", "image", "lazy-loading" ]
[ "create mysql table if it doesn't exist", "I don't work much with php/mysql, but I need what I thought would be a relatively straightforward task: to check if a table exists and create it if it doesn't. I can't even get a useful error message and there's no table being created in the db. There is obviously something wrong with my syntax.\n\n<?php\n\n session_start();\n error_reporting(E_ALL);\n ini_set('display_errors', 1);\n\n // 1. CONNECT TO THE DB SERVER, confirm connection\n mysql_connect(\"localhost\", \"root\", \"\") or die(mysql_error());\n echo \"<p>Connected to MySQL</p>\";\n $mysql_connexn = mysql_connect(\"localhost\", \"root\", \"\"); // redundant ?\n\n // 2. CONNECT TO THE SPECIFIED DB, confirm connection\n $db = \"weighttracker\";\n mysql_select_db($db) or die(mysql_error());\n echo \"<p>Connected to Database '$db'</p>\";\n $db_connexn = mysql_select_db($db)or die(mysql_error(\"can\\'t connect to $db\"));\n\n // 3. if table doesn't exist, create it\n $table = \"WEIGHIN_DATA\";\n $query = \"SELECT ID FROM \" . $table;\n //$result = mysql_query($mysql_connexn, $query);\n $result = mysql_query($query, $mysql_connexn);\n\n if(empty($result)) {\n echo \"<p>\" . $table . \" table does not exist</p>\";\n $query = \"CREATE TABLE IF NOT EXISTS WEIGHIN_DATA (\n id INT NOT NULL AUTO_INCREMENT,\n PRIMARY KEY(id),\n DATE DATE NOT NULL,\n VALUE SMALLINT(4) UNSIGNED NOT NULL\n )\"\n }\n else {\n echo \"<p>\" . $table . \"table exists</p>\";\n } // else\n\n?>" ]
[ "php", "mysql" ]
[ "XML parsing to get list of values in Python", "i have a XML output like below:\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><soapenv:Body><ns1:getValuesResponse soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"http://soap.core.green.controlj.com\"><getValuesReturn soapenc:arrayType=\"xsd:string[3]\" xsi:type=\"soapenc:Array\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"><getValuesReturn xsi:type=\"xsd:string\">337.81998</getValuesReturn><getValuesReturn xsi:type=\"xsd:string\">129.1</getValuesReturn><getValuesReturn xsi:type=\"xsd:string\">1152.9691</getValuesReturn></getValuesReturn></ns1:getValuesResponse></soapenv:Body></soapenv:Envelope>\n\n\nI want to get all the values regarding \"getValuesReturn\" attribute as a Python list. For this, i used a code like below:\n\nimport libxml2\n\nDOC=\"\"\"<?xml version=\"1.0\" encoding=\"utf-8\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><soapenv:Body><ns1:getValuesResponse soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"http://soap.core.green.controlj.com\"><getValuesReturn soapenc:arrayType=\"xsd:string[3]\" xsi:type=\"soapenc:Array\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"><getValuesReturn xsi:type=\"xsd:string\">337.81998</getValuesReturn><getValuesReturn xsi:type=\"xsd:string\">129.1</getValuesReturn><getValuesReturn xsi:type=\"xsd:string\">1152.9691</getValuesReturn></getValuesReturn></ns1:getValuesResponse></soapenv:Body></soapenv:Envelope>\"\"\"\n\ndef getValues(cat):\n return [attr.content for attr in doc.xpathEval(\"/elements/parent[@name='%s']/child/@value\" % (cat))]\n\n# gelen xml dosyasini yazdir\ndoc = libxml2.parseDoc(DOC)\n\n#getValuesReturn etiketinin degerlerini yazdir\nprint getValues(\"getValuesReturn\")\n\n\nIt just returns me an empty list. But i should get a list such as [\"337.81998\",\"129.1\",\"1152.9691\"]. Could you please help me out with this ?\n\nThanks in advance." ]
[ "python", "xml", "parsing", "libxml2" ]
[ "EXTJS AJAX call need to make synchronous", "I have search functionality, on every search, it hit to the server and gets data to display on the UI.\nWithin few seconds multiple ajax calls may happen.\nRight now all the ajax calls are asynchronous due to asynchronous mechanisms all the calls are triggered at a time and whichever response receives at the end its data is displayed on the UI(reset other responses are overwritten on the store).\nBut I am in search to display the last ajax call response data.\nI am trying to make synchronous call using new Ext.data.Store but nothing worked.\n\nIn the above image advanceTaskSearch.do has been called twice but the second call was of 596ms but the first call was of 3.03sec as the second call response was quicker than the first, first calls response is getting overwritten by second calls response.\nI am assuming by making synchronous the calls will happen one after the other the latest call response data will hold by store.\nsnippet as bellow\n tasksStoreHome = new Ext.data.Store({\n model: Ext.define('tasksReaderHome' + Ext.id(), {\n extend: 'Ext.data.Model',\n fields: fieldsString\n }),\n asynchronousLoad : false,\n sorters : ['dueDate'],\n groupDir : 'ASC',\n groupField : 'TaskStatus',\n pageSize : 20,\n\n proxy : {\n type : 'ajax',\n actionMethods : {\n read : 'POST'\n },\n extraParams : {\n isDeductionTask : false,\n query : Ext.util.JSON.encode({})\n },\n start : 0,\n limit : 20,\n url : SearchUrl,\n async : false, // tried adding async as false here\n \n reader : {\n type : 'safejson',\n rootProperty : 'rows',\n totalProperty : 'results',\n keepRawData :true ,\n async : false // tried adding async as false here\n }\n },\n autoLoad : true\n });\n\n tasksStoreHome.on({\n beforesort:{fn:function(store, sorters, eOpts ){\n var column=sorters[0].getProperty();\n var direction=sorters[0].getDirection();\n var lastParams=store.proxy.extraParams;\n if(lastParams == undefined || lastParams == null || lastParams==''){\n lastParams={};\n }\n lastParams.sort=column;\n lastParams.dir=direction;\n store.setAsynchronousLoad(false); // tried adding async as false here\n store.proxy.setExtraParams(lastParams); \n }\n }\n });\n\nI tried adding async: false at multiple places but nothing helped.\nPlease advise how can I achieve it.\nI am using extjs6\nAdvance thanks." ]
[ "javascript", "ajax", "extjs", "synchronous", "extjs6" ]
[ "How to invoke a parameter to a void class?", "I am dealing with the text extraction from pdf. To this end I wrote my own text extraction \nstrategy. I have one dynamic class and within this class i invoke text extraction strategy.\nHowever, when i introduce some parameters to my dynamic class i cannot use them within strategy class. To be clear i am adding my code template below.\n\nMy question is briefly, is it possible to invoke parameter unq showing up in \"get_intro\" class, from renderText? Or other way around, can a variable or parameter created inside the \"renderText\" class be invoked in the \"get_intro\"?\n\npublic class trial {\n\npublic trial(){}\n\n public Boolean get_intro(String pdf, String unq){\n\n try { ....\n\n for (int j = 1; j <= 3; j++) {\n out.println(PdfTextExtractor.getTextFromPage(reader, j, semTextExtractionStrategy));\n }\n...} catch (Exception e) {\n e.printStackTrace();\n }\n\n\nsemTextExtractionStrategy part:\n\npublic class SemTextExtractionStrategy implements TextExtractionStrategy {\n @Override\npublic void beginTextBlock() {\n}\n\n@Override\npublic void renderText(TextRenderInfo renderInfo) { \n\n text = renderInfo.getText();...}\n\n @Override\npublic void endTextBlock() {\n}\n\n@Override\npublic void renderImage(ImageRenderInfo renderInfo) {\n}\n\n@Override\npublic String getResultantText() {\n //return text;\n return main;\n}\n}" ]
[ "java", "itext", "text-extraction" ]
[ "How to tell if a GET request in Python is using an https or http proxy?", "I am currently using a proxy when making get requests, via the requests library in Python3. I have Tor and Privoxy set up for my proxies, and the code looks like:\n\nimport requests\nproxies = {\n \"http\": \"http://127.0.0.1:8118\",\n \"https\": \"https://127.0.0.1:8118\"\n}\nresp = requests.get(\"https://icanhazip.com\", proxies=proxies)\n\n\nI am wondering if there is a way to look in resp if the http or https proxy was used. Is there a way to do this?" ]
[ "proxy", "python-requests", "tor" ]
[ "MPMoviePlayer - black screen - iOS 5 - no video playing", "In iOS 4 this Code worked to play a movie:\n\n-(IBAction)playMovie:(id)sender\n{\n NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@\"testbild1\" ofType:@\"m4v\"]];\n MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];\n UIView *testview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];\n\n [testview addSubview:moviePlayer.view];\n [self.view addSubview:testview];\n //[self.view addSubview:moviePlayer.view];\n //[moviePlayer setFullscreen:YES animated:YES];\n} \n\n- (void)moviePlaybackComplete:(NSNotification *)notification \n{ \n MPMoviePlayerController *moviePlayerController = [notification object]; \n [[NSNotificationCenter defaultCenter] removeObserver:self \n name:MPMoviePlayerPlaybackDidFinishNotification \n object:moviePlayerController]; \n\n [moviePlayerController.view removeFromSuperview]; \n //[moviePlayerController release]; \n} \n\n\nNow, I only get a blackscreen. No controls, nothing. Video path is correct, I tested that. If I add just a white Subview by button click, it works. So the method is called.\n\nThanks in advance!" ]
[ "ios", "media-player", "mpmovieplayercontroller" ]
[ "How to execute Add-LocalGroupMember script package from user context", "I am trying to implement a script deployment package in SCCM which is meant to execute on freshly deployed workstation in a particular ad OU group. Problem lies within the execution rights; if i deploy package with user rights run mode -i get access denied, if i run it with admin right i get the wrong account added.\n\nI've tried running the script without encoding service account credentials, however this identified the system execution account, then i added credentials and this worked only for admin users.\n\n$User = $env:USERNAME \n$Computer = $env:COMPUTERNAME \n$svcAcc = \"xxx\\svc_LocalAdmin\" \n$PasswordFile = \".\\Password.txt\" $KeyFile = \".\\AES.key\" \n$key = Get-Content $KeyFile\n\n$Cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $svcAcc,(Get-Content $PasswordFile | ConvertTo-SecureString -Key $key)\n\nInvoke-Command -ComputerName $Computer -ScriptBlock {Add-LocalGroupMember -Group \"Administrator\" -Member $args[0]} -ArgumentList $User\n\n\nI was expecting this to run with all accounts, as service account credentials are provided in the script. How do i achieve same results from user account context? \n\nMany Thanks" ]
[ "windows", "powershell", "active-directory", "sccm" ]
[ "Maximizing Performance with the Entity Framework", "I am developing travel web site.\nWhen user input a location for search(autocomplete) my action return all cities, that cities regions, regions, regions translations, hotels..... which start with user input\n\nI used Entity code first. But it is response time is too much. How can I optimize this? How can I decrease time?\n\npublic JsonResult AutoComplateCityxxxxxxxx(string culture, string q)\n {\n\n List<Tuple<string, int, int>> result = new List<Tuple<string, int, int>>();\n\n using (var db = new TourismContext())\n {\n\n ModelState.Remove(q);\n\n var query = SearchWordFunctions.WordFunctions(q);\n\n\n var ListCity = db.CityTranslations.Where(\n c => (c.Slug.StartsWith(query) || c.Name.StartsWith(query))\n &&\n c.City.Latitude.HasValue\n ).GroupBy(x => x.CityID).Select(g => g.FirstOrDefault()).Take(10);\n\n var ListRegion = db.RegionTranslations.Where(\n r => (r.Slug.StartsWith(query) || r.Name.StartsWith(query))\n &&\n r.Region.Latitude.HasValue\n &&\n r.Region.RefID == 0 && r.Region.IsShow > 0\n ).GroupBy(x => x.RegionID).Select(g => g.FirstOrDefault()).Take(10);\n\n var LandMark = db.CityLandMarks.Where(l => l.Translations.Any(t => t.Name.StartsWith(query)) && l.Latitude.HasValue).Take(10);\n\n\n\n var hotel = db.HotelTranslations.Where(t => t.Url.Contains(query) && t.Hotel.Status > 0 && t.Culture.Code == culture).ToList();\n\n result.Clear();\n\n foreach (var item in ListCity.OrderBy(o => o.Name.Length))\n\n {\n result.Add(new Tuple<string, int, int>(string.Concat(item.Name, \" - <b>\", item.City.Country.Translations.Single(t => t.CultureID == 1).Name, \"<b>\"), item.CityID, 1));\n\n if (db.Regions.Any(r => r.CityID == item.CityID))\n {\n var regions = db.Regions.Where(r => r.CityID == item.CityID && r.Latitude.HasValue && r.RefID == 0 && r.IsShow > 0).GroupBy(g => g.ID).Select(x => x.FirstOrDefault()).ToList().OrderByDescending(o => o.SearchRating).Take(10);\n\n foreach (var regItem in regions)\n {\n result.Add(new Tuple<string, int, int>(string.Concat(regItem.Translations.FirstOrDefault().Name, \" - <b>\", item.Name, \"</b> - <b>\", regItem.City.Country.Translations.FirstOrDefault().Name, \"<b>\"), regItem.ID, 2));\n }\n }\n }\n if (ListCity.Count() <= 0)\n {\n foreach (var item in ListRegion)\n {\n result.Add(new Tuple<string, int, int>(string.Concat(item.Name, \" - <b>\", item.Region.City.Translations.Single(t => t.Culture.Code == culture).Name, \"</b> - <b>\", item.Region.City.Country.Translations.Single(t => t.Culture.Code == culture).Name, \"</b>\"), item.RegionID, 2));\n }\n }\n\n foreach (var item in LandMark)\n {\n result.Add(new Tuple<string, int, int>(string.Concat(item.Translations.FirstOrDefault().Name, \" - <b>\", item.City.Translations.FirstOrDefault().Name, \"</b> - <b>\", item.City.Country.Translations.FirstOrDefault().Name, \"</b>\"), item.ID, 3));\n }\n\n foreach (var item in hotel)\n {\n result.Add(new Tuple<string, int, int>(string.Concat(item.Name, \" - <b class=\\\"refid\\\" data=\\\"\" + item.HotelID + \"\\\">\", item.Hotel.Region.City.Translations.First().Name, \"</b>\"), item.Hotel.Region.CityID, 1));\n }\n\n }\n\n return Json(result, JsonRequestBehavior.AllowGet);\n }" ]
[ "entity-framework", "linq-to-entities", "database-performance", "query-performance" ]
[ "Indexing with Logstash to Elasticsearch", "I am working on an Elasticsearch indexing task.\n\nCurrently we are indexing hundreds of thousands of documents to ES cluster (many ES instances) on daily basis. We simply read data from DB and various of data sources, collate and compile them and directly index them to ES using python elasticsearch-dsl lib.\n\nCurrently;\n\n\n\nNow we want use Logstash between the application server and ES however we don't want to change our current codebase. Thus we could easily switch between ES to Logstash and keep business logic in our application.\n\nMy question is how can I use logstash as a transparent middleware. I simply want logstash to forward all rest messages as they are to the ES cluster.\n\nWant to;" ]
[ "elasticsearch", "logstash", "logstash-forwarder" ]
[ "same sum different result R", "i have this code:\n\n>mat_equazioni[]\n intercetta_iperpiani\n[1,] -0.1172197 0.3516591 -0.1562929 -0.7033182\n[2,] -0.1172197 0.3516591 -0.1562929 0.5860985\n> sum(berek1[8,vettvar]*mat_equazioni[1,][-4])\n[1] 0.7033182\n>sum(berek1[8,vettvar]*mat_equazioni[1,][-4])+mat_equazioni[1,4]\nintercetta_iperpiani \n 1.110223e-16 \n> sum(berek1[43,vettvar]*mat_equazioni[1,][-4])\n[1] 0.7033182\n> sum(berek1[43,vettvar]*mat_equazioni[1,][-4])+mat_equazioni[1,4]\nintercetta_iperpiani \n 0 \n\n\ni don't understand why same result 0.7033812 sum to mat_equazioni[1,4]\nthat is equal to -0.7033812 one time give me 0 and other time give me 1.110223e-16" ]
[ "r", "matrix", "sum", "calculator" ]
[ "show rating alert when deleting app in iphone?", "I have seen in most of the apps which i install using itunes has shows a alert please rate the app when deleting the app? is it by default behaviour or we can create it programmatically in our app?" ]
[ "iphone", "iphone-sdk-3.0", "uialertview", "rating" ]
[ "How to zoom in/out in Xcode 4.1 Interface Builder window to see multiple UIViews", "I'm building a xib with multiple views, one oriented for landscape and another for portrait. I'd like to be able to zoom out from the Interface Builder window to see both and then zoom in on one of the views to work on it, rinse, repeat. Can this be done?" ]
[ "xcode", "interface-builder" ]
[ "Overflow of levels for factor columns of data frame in RStudio", "Try this code\n\nf <- factor(sample.int(1000, 100))\ndf <- data.frame(F = f)\nView(df)\n\n\nNow when you mouse over F column in the RStudio View() tab, it shows \"factor with 1 levels\". But when you look at the definition of f separately, it will have all levels. I have tried with different levels. It shows correctly until 64 levels after that it behaves weird. Please let me know how to fix this. I already tried \"nmax\" that has not effect.\n\nBelow code works correctly\n\nf <- factor(sample.int(1000, 64))\ndf <- data.frame(F = f)\nView(df)" ]
[ "r", "rstudio" ]
[ "Multiply 4 ints simultaneously reversed", "I have written a function which multiplies four ints simultaneously in an array using SSE. The only problem is that the four ints which are being multiplied at the same time come back reversed in the array. How can I solve this? For example, if I call the function on {1,2,3,4,5,6,7,8} and multiply by 2, I get {8,6,4,2,16,14,12,10} instead of {2,4,6,8,10,12,14,16}. \n\n int * integerMultiplication(int *a, int c, int N) {\n\n __m128i X, Y;\n X = _mm_set1_epi32(c);\n\n for (int i=0;i<N;i+=4) {\n Y = _mm_set_epi32(a[i], a[i+1], a[i+2], a[i+3]);\n\n __m128i tmp1 = _mm_mul_epu32(X,Y); /* mul 2,0*/\n __m128i tmp2 = _mm_mul_epu32( _mm_srli_si128(X,4), _mm_srli_si128(Y,4)); /* mul 3,1 */\n __m128i ans = _mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, _MM_SHUFFLE (0,0,2,0)), _mm_shuffle_epi32(tmp2, _MM_SHUFFLE (0,0,2,0))); \n _mm_store_si128((__m128i*)&a[i], ans);\n\n }\n return a;\n}" ]
[ "c", "x86", "sse", "simd" ]
[ "Listview - has focus always return false", "I have an edit text in the list view. Listview is created using Base Adapter and used Holders to load the edit text. \n\nWhen I cal holder.edtText.hasFocus(), it always return false. Anything that I am missing in the ListView properties?\n\npublic View getView(final int position, View convertView, final \n ViewGroup parent) \n {
 
 \n if (convertView == null) \n {
 \n LayoutInflater inflater = LayoutInflater.from(getContext());
 \n\n convertView = inflater.inflate(R.layout.screen, parent, false);
 \n holder = new Adapter.ViewHolder(convertView);
 \n convertView.setTag(holder);
 \n }\n else \n {
 \n holder = (Adapter.ViewHolder) convertView.getTag();
 \n }
 
 
 \n holder.edt.setCursorVisible(holder.edt.hasFocus());
 \n holder.edt.setEnabled(true);
 
 \n holder.edt.setTag(R.string.view, “some object”);\n
 \n if (position == 10) \n {
 \n holder.edt.requestFocus();
 \n }\n
 holder.edt.setFilters(new Filter());
 
 \n holder.edt.addTextChangedListener(new Watcher());
 
 \n holder.edt.setText(“text”);
 
 
 \n holder.edt.setSelection(text.length);
 \n holder.edt.setSelectAllOnFocus(true);
 
 \n return convertView;\n 
 }\n\n public class ViewHolder extends RecyclerView.ViewHolder \n {
 \n public EditText edit;
 
 \n public ViewHolder(View itemView) \n {
 \n super(itemView);
 \n edt = (EditText) itemView.findViewById(R.id.edt);
 \n }\n 
 }" ]
[ "android" ]
[ "Listing restaraunts and tourist attractions around a marker", "I am a newbie to android studio. I am doing a project where i am trying to list restaurants and tourist places around a certain place(confined to an area around that place marker).\nFor example, Memphis, Tennessee.\nI want to display the above mentioned places around memphis.\nIs it possible to do that?\nAny suggestions would be much appreciated." ]
[ "android-studio" ]
[ "Matplotlib adding legend based on existing color series", "I plotted some data using scatter plot and specified it as such:\nplt.scatter(rna.data['x'], rna.data['y'], s=size,\n c=rna.data['colors'], edgecolors='none')\n\nand the rna.data object is a pandas dataframe that is organized such that each row represents a data point ('x' and 'y' represents the coordinate and 'colors' is an integer between 0-5 representing the color of the point). I grouped the data points into six distinct clusters numbered 0-5, and put the cluster number at each cluster's mean coordinates.\nThis outputs the following graph:\n\nI was wondering how I can add a legend to this plot specifying the color and its corresponding cluster number. plt.legend() requires the style code to be in the format such as red_patch but it does not seem to take numeric values (or the numeric strings). How can I add this legend using matplotlib then? Is there a way to translate my numeric value color codes to the format that plt.legend() takes? Thanks a lot!" ]
[ "python", "matplotlib", "plot", "graph", "legend" ]
[ "Unable to bottom the text like float:bottom", "I followed the solution mentioned here but, the text doesn't float at the bottom in my webpage, .\n\nRight now, my CSS looks like this:\n\n#note{\n position: absolute;\n bottom: 0px;\n text-align: center;\n}\n\n\nHow do I get it at the bottom, like a footer or copyright message? Also, why is it not centring?\n\njsFiddle" ]
[ "css" ]
[ "Doctrine 2 ORM - Mapping a property with one of multiple target classes", "In my ZF3 application I want to map an entity \"User\" having a property \"plan\" to another entity with could be one of the following classes \"PlanA\", \"PlanB\" or \"PlanC\" using Doctrine 2 ORM. A \"User\" can have one \"Plan\", a \"Plan\" can be associated with many \"Users\".\n\nI looked into discriminator maps, but I am not sure that that's the right approach.\n\nAny ideas/code sample for that?" ]
[ "doctrine-orm", "orm", "zend-framework3" ]
[ "create URL slugs for chinese characters. Using PHP", "My users sometimes use chinese characters for the title of their input.\n\nMy slugs are in the format of /stories/:id-:name where an example could be /stories/1-i-love-php.\n\nHow do I allow chinese characters?\n\nI have googled and found the japanese version of this answer over here.\n\nDon't quite understand Japanese, so I am asking about the chinese version.\n\nThank you." ]
[ "php", "regex", "slug", "non-ascii-characters", "chinese-locale" ]
[ "Vary xytext to prevent overlapping annotations", "So I've got some code that generates a donut chart but the problem is there are cases where the annotations overlap due to the values. Code and problem below. \n\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\n\ndef donut_chart(val):\n\n df_vals = pd.DataFrame.from_dict(val, orient='index')\n labels = df_vals.index.tolist()\n\n fig, ax = plt.subplots(figsize=(6, 6), subplot_kw=dict(aspect=\"equal\"))\n\n color = ['grey']*20\n color[0] = 'red'\n\n wedges, texts, junk = ax.pie(df_vals[0:4], counterclock = True, \n wedgeprops=dict(width=0.6, linewidth = 2, edgecolor = 'w'), \n startangle=90, colors=color,\n autopct='%1.0f%%',\n pctdistance=0.75,\n textprops={'fontsize': 14})\n\n bbox_props = dict(boxstyle=\"square,pad=0.3\", fc=\"w\", ec=\"w\", lw=0.72)\n kw = dict(xycoords='data', textcoords='data', arrowprops=dict(arrowstyle=\"-\"),\n bbox=bbox_props, zorder=0, va=\"center\")\n\n for i, p in enumerate(wedges):\n ang = (p.theta2 - p.theta1)/2. + p.theta1\n y = np.sin(np.deg2rad(ang))\n x = np.cos(np.deg2rad(ang))\n horizontalalignment = {-1: \"right\", 1: \"left\"}[int(np.sign(x))]\n connectionstyle = \"angle,angleA=0,angleB={}\".format(int(ang))\n kw[\"arrowprops\"].update({\"connectionstyle\": connectionstyle})\n ax.annotate(labels[i], xy=(x, y), xytext=(1.2*np.sign(x), 1.2*y),\n horizontalalignment=horizontalalignment, **kw, size=14)\n\n #centre_circle = plt.Circle((0,0),0.5, fc='white',linewidth=1.25)\n #fig.gca().add_artist(centre_circle)\n plt.axis('equal')\n plt.show()\n plt.close()\n\n\nval = {'Label A':50, 'Label B':2, 'Label C':1, 'Label D':0.5}\ndonut_chart(val)\n\n\nProblem: \n\n\n\nWhat I'd like to do is create something like this:\n\n\n\nThe key appears to be varying the y value in the xytext so the labels don't overlap but I'm stuck on how this might be implemented or even whether it is possible. \n\nAny ideas?" ]
[ "python", "matplotlib", "data-visualization" ]
[ "Updating custom WTForm widged from SQLAlchemy object", "Boolean widget is a checkbox in WTForms, while I want to have a yes/no dropdown rather than \"true/false\" selection in generated form.\n\nThis custom widget almost works:\n\nclass SelectYesNo(SelectField):\n\n def __init__(self, *args, **kwargs):\n kwargs['choices'] = [('Yes', 'Yes'), ('No', 'No')]\n super(SelectYesNo, self).__init__(*args, **kwargs) \n\n def process_formdata(self, valuelist):\n if valuelist:\n try:\n self.data = False\n if valuelist[0] == 'Yes':\n self.data = True\n except ValueError:\n raise ValueError(u'Invalid Choice: could not coerce (valuelist: {0})'.format(valuelist))\n\n def pre_validate(self, form):\n pass\n\n\nNow, it works when I'm using .populate_obj method on a form, that is, it stores bool in SQLAlchemy object correctly, like form.populate_obj(SQAItem()) (I can see in the DB that correct value has been stored in the table).\n\nWhere it does not work is reading SQA object value into this widget in the form, like form = form_class(request.POST, sqa_item_instance), where sqa_item_instance has been read from SQLAlchemy and has a bool field.\n\nHow can I get that, that is, \"populate\" form SelectYesNo field correctly from SQA item?" ]
[ "python", "forms", "sqlalchemy", "wtforms" ]
[ "Boost.Python.ArgumentError: Python argument types in World.set(World, str) did not match C++ signature: set(World {lvalue}, std::string)", "I am learning boost-python from the Tutorial, \n\n\nbut getting an error, can you give me some hint, thanks!\n\n#include <boost/python.hpp>\nusing namespace boost::python;\n\nstruct World\n {\n void set(std::string msg) { this->msg = msg; }\n std::string greet() { return msg; }\n std::string msg;\n };\n\n\n\n BOOST_PYTHON_MODULE(hello)\n {\n class_<World>(\"World\")\n .def(\"greet\", &World::greet)\n .def(\"set\", &World::set)\n ;\n }\n\n\nPython Terminal: \n\n>>> import hello\n >>> planet = hello.World()\n >>> planet.set('howdy') \n\nError: \n\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\n Boost.Python.ArgumentError: Python argument types in\n World.set(World, str) did not match C++ signature:\n set(World {lvalue}, std::string)\n\n\nuse the demo code from [boost python \n Tutorial][1][1]:\n https://www.boost.org/doc/libs/1_51_0/libs/python/doc/tutorial/doc/html/python/exposing.html" ]
[ "python", "c++", "boost" ]
[ "How to break up HTML markup into Marionette views?", "I am new to Marionette and trying to understand how to break up HTML markup into Marionette views. The markup I have is for a simple Trader Desktop having two tabs: one showing accounts and another showing pending orders - please see here: http://codepen.io/nareshbhatia/pen/cKdur. The accounts tab is further divided into an accounts table on the LHS and an accounts chart on the RHS. Both these views should be driven by the same model. The tabs are created using Bootstrap. How would you break up this markup into Marionette views?\n\n\nIs it possible/advisable to arrange Marionette views so that this exact markup is produced?\nHow should the Bootstrap tabs be modeled?\nHow should the accounts table and accounts chart be modeled? I was thinking that this would be a Marionette Layout with two regions, but then started thinking why? Isn't the purpose of a layout to give the ability to instantiate different kinds of views in each of its regions? Here I will always have two fixed views, so is layout an overkill?\n\n\nThanks in advance for your time." ]
[ "twitter-bootstrap", "backbone.js", "marionette" ]