texts
sequence
tags
sequence
[ "Software/Plugin for css sprite generation", "does anyone know if there exists any offline software or plugin(dreamweaver, etc) to generate a css sprite. That is: merging images and generating the css rules.\n\nI know there is a post here: Tools to make CSS sprites?\n\nbut all of those are online generation tools." ]
[ "plugins", "css-sprites" ]
[ "How to delete this element of html?", "I'm cleaning the html of this url. In particular, I want to remove <input checked="" class="selectorOpernerBig" id="default" name="selectorOpernerBig" type="radio">. Its full xpath is /html/body/div/div[1]/div/input. Its structure is\n\nI tried to remove with\nimport requests\nfrom bs4 import BeautifulSoup\n\nurl = 'https://www.collinsdictionary.com/dictionary/french-english/aimer'\nheaders = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0'}\nsoup = BeautifulSoup(requests.get(url, headers = headers).content, 'html.parser')\n \nremove = soup.find_all('input', {'checked' : ''}) \nfor match in remove:\n match.decompose() \n\nentry_name = soup.h2.text\ncontent = ''.join(map(str, soup.select_one('.res_cell_center').contents))\n\nSadly, it removes anything in <div class="page" == $0 and </div>. Could you please elaborate on this issue and how to resolve the problem?" ]
[ "html", "python-3.x", "beautifulsoup" ]
[ "Why is my bundle a null object reference?", "I am building an app where the user creates a listView and then the user is able to click on one of the listViews and a dialog will pop up and let the user edit that listView that they clicked on. \nHere is my EditCityFragment where once the user clicks on the listView this fragment is called. also I am using an arraylist to store my data, I have figured out how to add a city.\n\n static AddCityFragment newInstance(City city){\n AddCityFragment fragment = new AddCityFragment();\n Bundle args = new Bundle();\n args.putSerializable(\"city\", city);\n fragment.setArguments(args);\n return fragment;\n }\n\n @NonNull\n @Override\n public Dialog onCreateDialog(@Nullable Bundle savedInstanceState){\n View view = LayoutInflater.from(getActivity()).inflate(R.layout.add_city_fragment_layout, null);\n AddCityFragment.newInstance(savedInstanceState);\n cityName = view.findViewById(R.id.city_name_editText);\n provinceName = view.findViewById(R.id.province_editText);\n\n city = (City) getArguments().getSerializable(\"city\");\n String s = city.getCityName();\n String p = city.getProvinceName();\n cityName.setText(s);\n provinceName.setText(p);\n\n AlertDialog.Builder builder = new AlertDialog.Builder(getContext());\n return builder\n .setView(view)\n .setTitle(\"Edit City\")\n .setNegativeButton(\"Cancel\", null)\n .setPositiveButton(\"Ok\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialogInterface, int i) {\n\n String city = cityName.getText().toString();\n String province = provinceName.getText().toString();\n listener.onOkPressed(new City(city, province));\n\n }}).create();\n }\n\n\n}\n\n\nhere is the error\n\nE/AndroidRuntime: FATAL EXCEPTION: main\n Process: com.example.simpleparadox.listycity, PID: 13929\n java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.Serializable android.os.Bundle.getSerializable(java.lang.String)' on a null object reference\n at com.example.simpleparadox.listycity.EditCityFragment.onCreateDialog(EditCityFragment.java:57)\n at androidx.fragment.app.DialogFragment.onGetLayoutInflater(DialogFragment.java:330)\n at androidx.fragment.app.Fragment.performGetLayoutInflater(Fragment.java:1308)\n at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)\n at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)\n at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)\n at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:802)\n at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)\n at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)\n at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)\n at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)\n at androidx.fragment.app.FragmentManagerImpl$1.run(FragmentManager.java:733)\n at android.os.Handler.handleCallback(Handler.java:883)\n at android.os.Handler.dispatchMessage(Handler.java:100)\n at android.os.Looper.loop(Looper.java:214)\n at android.app.ActivityThread.main(ActivityThread.java:7356)\n at java.lang.reflect.Method.invoke(Native Method)\n at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)" ]
[ "java", "android" ]
[ "Should Core Data Stack inherit from NSObject and why?", "Recently it is practice to move the core data stack implementation from the app delegate to a different class. In most implementations I see that the core data stack inherits from NSObject, even in Apple's documentation. \n\n\nIs there a reason for that? It seems to work without it.\nWhy is Apple's init method not calling super.init() isn't it a must have?\n\n\n\n\nimport UIKit\nimport CoreData\n\nclass DataController: NSObject {\n var managedObjectContext: NSManagedObjectContext\n init() {\n // This resource is the same name as your xcdatamodeld contained in your project.\n guard let modelURL = NSBundle.mainBundle().URLForResource(\"DataModel\", withExtension:\"momd\") else {\n fatalError(\"Error loading model from bundle\")\n }\n // The managed object model for the application. It is a fatal error for the application not to be able to find and load its model.\n guard let mom = NSManagedObjectModel(contentsOfURL: modelURL) else {\n fatalError(\"Error initializing mom from: \\(modelURL)\")\n }\n let psc = NSPersistentStoreCoordinator(managedObjectModel: mom)\n managedObjectContext = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType)\n managedObjectContext.persistentStoreCoordinator = psc\n dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)) {\n let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)\n let docURL = urls[urls.endIndex-1]\n /* The directory the application uses to store the Core Data store file.\n This code uses a file named \"DataModel.sqlite\" in the application's documents directory.\n */\n let storeURL = docURL.URLByAppendingPathComponent(\"DataModel.sqlite\")\n do {\n try psc.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: storeURL, options: nil)\n } catch {\n fatalError(\"Error migrating store: \\(error)\")\n }\n }\n }\n}\n\n\nInitializing the Core Data Stack" ]
[ "ios", "swift", "core-data" ]
[ "Async gRCP server with maximum_concurrent_rpcs limitation raises an exception", "I tried to implement gRPC server with gRPC AsyncIO API. I used this example as a sample and tried to define maximum_concurrent_rpcs limitation on server as described in source code documentation in gRPC AsyncIO server source code.\nHere is my implementation:\nimport asyncio\nfrom grpc.experimental import aio\n\nimport helloworld_pb2\nimport helloworld_pb2_grpc\n\n\nclass Greeter(helloworld_pb2_grpc.GreeterServicer):\n\n async def SayHello(self, request, context):\n return helloworld_pb2.HelloReply(message='Hello, %s!' % request.name)\n\n\nasync def serve():\n server = aio.server(maximum_concurrent_rpcs = 10)\n helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server)\n listen_addr = '[::]:50051'\n server.add_insecure_port(listen_addr)\n logging.info("Starting server on %s", listen_addr)\n await server.start()\n await server.wait_for_termination()\n\n\nif __name__ == '__main__':\n asyncio.run(serve())\n\nBut it raises the following exception:\nAttributeError: 'Server' object has no attribute '_server'\n\nMy question is, how is it possible to define gRPC AsyncIO server with maximum_concurrent_rpcs limitation.\nNote that helloworld_pb2 and helloworld_pb2_grpc are available in this repositroy" ]
[ "python", "python-3.x", "python-asyncio", "grpc", "grpc-python" ]
[ "Pygame Sprite Moving at Constant Speed", "I'm working on a basic pygame but I'm not sure where I want to take it. So as of now I'm only working on the basic mechanics.\n\nThe issue I've ran into is that I need to have enemy sprites move towards the player sprite. I've already figured out the basic vectoring but because the sprites move along a vector, they also slow down the closer they get to their target.\n\nHere is a snip of my code.\n\n#Enemy Mechanics\nfor enemy in enemy_list:\n pygame.draw.rect(screen, green, (enemy.rect.x, enemy.rect.y-5, enemy.Health/4, 3), 0)\n pygame.draw.rect(screen, green, (enemy.rect.x, enemy.rect.y-5, 25, 3), 1)\n\n ppos = pPlayer.rect.x, pPlayer.rect.y\n epos = enemy.rect.x, enemy.rect.y\n etarget = epos[1] - ppos[1], epos[0] - ppos[0]\n\n enemy.rect.x -= etarget[1]/20 #This is the problem\n enemy.rect.y -= etarget[0]/20\n\n\n#Bullet Mechanics\nfor bullet in bullet_list:\n mpos = pygame.mouse.get_pos()\n bpos = bullet.rect.x, bullet.rect.y\n target = bpos[1] - mpos[1], bpos[0] - mpos[0]\n dist = math.sqrt(((bpos[0] - mpos[0])**2) + ((bpos[1] - mpos[1])**2))\n\n bullet.rect.x -= target[1]/20\n bullet.rect.y -= target[0]/20\n\n if dist < 30:\n bExplode(bullet.rect.x, bullet.rect.y)\n blist.remove(bullet)\n bullet.kill()\n\n enemy_hit_list = (pygame.sprite.spritecollide(bullet, enemy_list, False))\n for enemy in enemy_hit_list:\n enemy.Health -= 25\n print(enemy.Health)\n if enemy.Health <= 0:\n enemy_list.remove(enemy)\n all_sprites_list.remove(enemy)\n\n bullet_list.remove(bullet)\n all_sprites_list.remove(bullet)\n blist.remove(bullet)\n\n\nAs you can see, I've been dividing the vectors by 20 because it slows them down to a reasonable speed but they also stop before reaching their target. I need help in making the sprites move at a constant, set speed towards the player." ]
[ "python", "vector", "pygame", "sprite" ]
[ "Automating the generation of multiple plots in R using Python", "I have a folder full of .txt files that I use to generate manhattan and Q-Q plots. I have to write the script for each one, and it's tedious. I know there must be a better way, maybe with Python?. Here is what I am repeating:\n\n> \n> cd /Home/*User*/Path/Path\n> qsub -I\n> R\n> TARC_FVII_man_MAF5<-read.table (\"TARC_man_FULL_Factor_VII_MAF5_20140102.txt\", header=T)\n> source(\"http://dl.dropbox.com/u/66281/0_Permanent/qqman.r\")\n> pdf(\"Tarc_FVII_man_MAF5.pdf\")\n> manhattan(TARC_FVII_man_MAF5)\n> dev.off()\n\n\nSo basically, I am navigating to the .txt files, requesting an interactive node on the cluster, opening R, loading the file into an R dataset, loading some code from a dropbox file (I'm assuming this is what allows R to make the plots, but I'm not clear on it), telling R to make a pdf, putting a manhattan plot into the pdf, and then turning off, or saving the pdf.\n\nWhat I'd like to do is figure out a python script to go into this folder with the multiple .txt files, and use R to make manhattan plots for all of them. Firstly, is this feasible, and if so, how could I begin to go about it?" ]
[ "python", "r", "shell", "automation" ]
[ "Changing learning rate by external function, do I have to run many sessions?", "I have a Function, call it DetermineLearningRate that takes in the accuracy (and other metrics) at each iteration and gives the learning rate to a simple CNN.\n\nWorkflow\n\n\nSimple CNN DetermineLearningRate() would take in the accuracy and\nreturn a learning rate \nThe TensorFlow Graph of the CNN would take in\nthe learning rate and run 1 iteration and return the accuracy \nThis repeats until all iterations over.\n\n\nIf I have 10,000 iterations, does this mean I have to run and close 10,000 sessions? This is because I do not want the iterations to carry on without my function calling at each iteration, getting the accuracy then returning the learning rate.\n\nThis is the workflow I had in mind:\n\n\nGlobal variable LR that the graph accesses \nRun session 1 with the LR given by function \nGet the accuracy\nClose the session \nRun session 2 with the LR given by the function after getting the\naccuracy \nGet accuracy \nClose the session \nRepeat\n\n\nCan someone advice? Thanks a lot." ]
[ "tensorflow" ]
[ "Load HTML in CKEditor", "Could someone explain to me how to load HTML into the CKEditor? \n\nI have an editor in an asp.net page using the ajaxtoolkit. I have a AsyncFileUpload control that allows the user to upload an HTML file which I read and assign the value to the editor's Value property (which appears to be the way to load data into the control). However, this doesn't load the HTML ?!? \n\nI've tried several different methods, but they all come down to this more or less...\n\neditorCorps.Value = Server.HtmlEncode(html)\n\n\nor simply\n\neditorCorps.Value = html\n\n\nThanks in advance,\nSam" ]
[ "asp.net", "ckeditor" ]
[ "Are there any parts of LINQ I should avoid for SQL 2000?", "I have a SQL 2000 backend. SQL 2000 does not support Entity Framework v2. I would like to use LINQ to manipulate collections in memory. \n\nAssuming I do not use Entity Framework v2, are there any parts of LINQ in .NET 4 that do not work with SQL 2000? Are TableAdapters doing CRUD operations ok to use?\n\nAs far as I know, using Entity framework requires the explicit addition of a *.edmx file. So adding *.dmbl (linq to sql) or DataSet (*.xsd) is not a problem. Is this correct? In other words, do any functions of LINQ generate incompatible code, e.g. entities?" ]
[ "linq", "linq-to-sql", ".net-4.0" ]
[ "Codeigniter Project On Ubuntu Nginx - Login not working", "This is nginx configuration file\n # Default server configuration\n #\n server {\n listen 80 default_server;\n listen [::]:80 default_server;\n\nroot /var/www/html;\n\n# Add index.php to the list if you are using PHP\n index index.html index.htm index.php index.nginx-debian.html;\n\n server_name 192.168.0.40;\n\n location / {\n # First attempt to serve request as file, then\n # as directory, then fall back to displaying a 404.\n try_files $uri $uri/ /index.php;\n }\n\n\n # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\n #\n location ~ \\.php$ {\n include snippets/fastcgi-php.conf;\n #\n # # With php5-cgi alone:\n fastcgi_pass 127.0.0.1:9000;\n # # With php5-fpm:\n # fastcgi_pass unix:/var/run/php5-fpm.sock;\n }\n\n # deny access to .htaccess files, if Apache's document root\n # concurs with nginx's one\n #\n location ~ /\\.ht {\n deny all;\n }\n\n\n}\n\nHowever login is working fine on apache but not on nginx" ]
[ "codeigniter", "nginx" ]
[ "How to put the BarCode reader/scanner output in textarea of form developed in swing Java", "I have one form with the BarCode on it.Whenever I read it by BarCode reader,it shows me the output at the cursor position on screen instead of showing it at the textarea on the form developed in Swing Java. What should I do for this ?" ]
[ "java", "swing", "barcode" ]
[ "strange link code in jquery -- adding target attributes", "Hours have already been spent because of my own programmer pride. The coding is calling information for the links from earlier input in the html. The first if then statement below is for the links on the \"more\" buttons in a rotator. The second is for the links on the corresponding thumbnails. After searching this site and finding similar posts, I found that none of them addressed targets for this type of link input. I just need a _parent target on them, that's all. Is there someway to incorporate \"attr\" to get a target _parent for the links in this type of code? Any help would be hugely appreciated. \n\nif(! encDisableTextsAll && encEnableFooter)\n{\n for(i=0; i<encNumOfImages; i++)\n {\n $(\".footerTitle:eq(\" + i + \")\").html(encBannerTexts[i][0]);\n if(encEnableDescription) $(\".footerDesc:eq(\" + i + \")\").html(encBannerTexts[i][1]);\n if(encBannerTexts[i][2] != \"\" & encEnableReadMore)\n {\n $(\".footerLink:eq(\" + i + \")\").html(\"<div class='bttnMore'><a href='\" + encBannerTexts[i][2] + \"'> </a></div>\");\n }\n } \n}\nif(encEnableThumbImageLink && encEnableFooter)\n{\n for(i=0; i<encNumOfImages; i++)\n {\n link = encBannerTexts[i][2];\n $(\"#thumbDiv_\" + i).attr(\"onclick\", \"window.location.href='\" + link + \"'\")\n\n }\n}\n\n// supposed link call\nif ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == \"click\")) && elem[\"on\"+type] && elem [\"on\"+type].apply( elem, data ) === false )\n event.result = false;" ]
[ "jquery", "hyperlink", "parent", "target", "rotator" ]
[ "CakePHP - How to use SQL NOW() in find conditions", "I am having trouble getting any find operations to work using the SQL function NOW() in my conditions.\nI am effectively trying to build a find query that says:\nDesired SQL:\nWHERE (NOW() BETWEEN Promotion.start AND Promotion.end) AND Promotion.active = 1\n\nI have tried many combinations but no matter what I do when using NOW() in the condition, it doesn't work because the query Cake builds puts ' quotation marks around the model fields so they are interpreted by MySQL as a string.\n$this->find('all', array(\n 'conditions' => array(\n '(NOW() BETWEEN ? AND ?)' => array('Promotion.start', 'Promotion.end'),\n 'Promotion.active' => 1\n )\n));\n\nCakePHP created SQL:\nNotice the single quotes around the model fields in the BETWEEN(), so they are treated as strings.\nWHERE (NOW() BETWEEN 'Promotion.start' AND 'Promotion.end') AND `Promotion`.`active` = '1'\n\n\nThis doesn't work either.\n$this->find('all', array(\n 'conditions' => array(\n 'NOW() >=' => 'Promotion.start',\n 'NOW() <=' => 'Promotion.end',\n 'Promotion.active' => 1\n )\n));\n\nI know why these solutions don't work. It's because the model fields are only treated as such if they are the array key in the conditions, not the array value.\nI know I can get this to work if I just put the whole BETWEEN() condition as a string:\n$this->find('all', array(\n 'conditions' => array(\n 'NOW() BETWEEN Promotion.start AND Promotion.end',\n 'Promotion.active' => 1\n )\n));\n\n\nAnother example of the same problem is, which is simpler to understand:\nDesired SQL:\nWHERE Promotion.start > NOW() AND Promotion.active = 1\n\nSo I try this:\n$this->find('all', array(\n 'conditions' => array(\n 'Promotion.start >' => 'NOW()',\n 'Promotion.active' => 1\n )\n));\n\nAnd again it doesn't work because Cake puts ' quotations around the NOW() part.\nCakePHP created SQL:\nWHERE `Promotion`.`start` > 'NOW()' AND `Promotion`.`active` = '1''" ]
[ "cakephp", "cakephp-2.0" ]
[ "Confirm password value lost during postback in zend framwork?", "I am working with Zend Framework. In my Zend form when there is post back or validation error all the fields contain there values but confirm password lost it's value.How to solve this issue." ]
[ "zend-framework", "zend-form" ]
[ "save a pandas groupby object into a csv file", "I have an issue that I cannot figure out although I read similar posts such as Pandas groupby to to_csv. It does not work for me. I am trying to write code to separate each group from a groupby object and save each group into its own excel spreadsheet.\n\nI attached a toy example of the code that I did to get my groupby object on pandas with some columns. \n\nNow, I need to save each group from this object into a separate csv file, or at least in a separate worksheet in excel. \n\ndff = pd.DataFrame({'SKU': ['001', '002', '003'],\n 'revenue_contribution_in_percentage': [0.2, 0.5, 0.3],\n 'BuyPrice' : [2,3,4],\n 'SellPrice' : [5,6,6],\n 'margin' : [3,3,2],\n 'Avg_per_week' : [3,2,5],\n 'StockOnHand' : [4,10,20],\n 'StockOnOrder': [0,0,0],\n 'Supplier' : ['ABC', 'ABC', 'ABZ' ],\n 'SupplierLeadTime': [5,5,5],\n 'cumul_value':[0.4,0.6,1],\n 'class_mention':['A','A','B'],\n 'std_week':[1,2,1],\n 'review_time' : [2,2,2],\n 'holding_cost': [0.35, 0.35, 0.35],\n 'aggregate_order_placement_cost': [200, 230,210]\n})\n\n\nI have done the following to get a groupby supplier object\n\ngroups = [group.reset_index().set_index(['SKU'])[[\n 'revenue_contribution_in_percentage',\n 'BuyPrice',\n 'SellPrice',\n 'margin',\n 'Avg_per_week',\n 'StockOnHand',\n 'StockOnOrder',\n 'Supplier',\n 'SupplierLeadTime',\n 'cumul_value',\n 'class_mention',\n 'std_week',\n 'review_time',\n 'holding_cost',\n 'aggregate_order_placement_cost',\n 'periods']] for _, group in dff.groupby('Supplier')]\n\ndf_group = pd.DataFrame(groups).sum()\ngroup_to_excel = df_group.to_csv('results.csv')\n\n\nand the output that I would like to get is the folowing: two distinct datasets that can saved in csv format and look like this:\n\n SKU revenue_contribution_in_percentage BuyPrice SellPrice margin \\\n0 001 0.2 2 5 3 \n1 002 0.5 3 6 3 \n\n Avg_per_week StockOnHand StockOnOrder Supplier SupplierLeadTime \\\n0 3 4 0 ABC 5 \n1 2 10 0 ABC 5 \n\n cumul_value class_mention std_week review_time holding_cost \\\n0 0.4 A 1 2 0.35 \n1 0.6 A 2 2 0.35 \n\n aggregate_order_placement_cost \n0 200 \n1 230 \n\n\nand\n\n SKU revenue_contribution_in_percentage BuyPrice SellPrice margin \\\n0 003 0.3 4 6 2 \n\n Avg_per_week StockOnHand StockOnOrder Supplier SupplierLeadTime \\\n0 5 20 0 ABZ 5 \n\n cumul_value class_mention std_week review_time holding_cost \\\n0 1 B 1 2 0.35 \n\n aggregate_order_placement_cost \n0 210 \n\n\nAt this point my code give one and only worksheet (horrendous worksheet) with pretty much nothing on it. I am not sure what is wrong at this point. \nI would greatly appreciate some help on this one! thanks a lot!" ]
[ "python", "pandas" ]
[ "Tensor Entry Selection Logic Divergence in PyTorch & Numpy", "Description\n\nI'm setting up a torch.Tensor for masking purpose. When attempting to select entries by indices, it turns out that behaviors between using numpy.ndarray and torch.Tensor to hold index data are different. I would like to have access to the design in both frameworks and related documents that explain the difference.\n\nSteps to replicate\n\nEnvironment\n\nPytorch 1.3 in container from official release: pytorch/pytorch:1.3-cuda10.1-cudnn7-devel\n\nExample\n\nSay I need to set up mask as torch.Tensor object with shape [3,3,3] and set values at entries (0,0,1) & (1,2,0) to 1. The code below explains the difference.\n\nmask = torch.zeros([3,3,3])\nindices = torch.tensor([[0, 1],\n [0, 2],\n [1, 0]])\n\nmask[indices.numpy()] = 1 # Works\n# mask[indices] = 1 # Incorrect result\n\n\nI noticed that when using mask[indices.numpy()] a new torch.Tensor of shape [2], while mask[indices] returns a new torch.Tensor of shape [3, 2, 3, 3], which suggests difference in tensor slicing logic." ]
[ "python", "numpy", "pytorch" ]
[ "Junit: less-than assertion?", "Is there anything like assertThat(a, lessThan(b)); ? I'm currently using Junit 4.8.1 and I haven't been able to find lessThan. Instead I have to do assertTrue(a < b), but this has a drawback that it doesn't print two numbers in test log." ]
[ "unit-testing", "junit" ]
[ "How do I list the defined make targets from the command line?", "I feel almost silly for asking this but I couldn't find anything on this...\nSuppose I have a cmake project containing a number of targets (libraries, executables, external targets, etc). How do I list them using the cmake command line interface?\nI want a list of things that are valid to substitute for $target in the following command line:\ncmake . && cmake --build . --target $target\n\nLot's of bonus points for a solution that uses neither grep nor find nor python nor perl nor... you get the idea." ]
[ "cmake" ]
[ "Ctrl + z: why it resets count in C program that counts key strokes", "The following program simply counts the number of key strokes until reaching EOF, and prints the count. It works as designed unless I press \"Ctrl+Z\" at some point, which actually resets (zeros out) the count. Why is this happening?\n\n#include <stdio.h>\n\nint main(){\n char ch;\n int cnt = 0;\n while ((ch = getchar()) != EOF)\n {\n cnt ++;\n }\n printf(\"%d\",cnt);\n return 0;\n}\n\n\nHere, Ctrl+D activates EOF (note final count includes space):\n\n\n\nBut here, Ctrl+Z resets count to Zero:\n\n\n\nAnd here, shows how count continues from zero after ctrl+z reset:" ]
[ "c" ]
[ "ListView does not work on inflated view", "If I use fragment it does not show any entries , but if I add an adapter to ListView directly inside layout, it works well.\n\nCan someone explain this?\n\n\n\nHere is my code:\nMainActivity\n\npackage com.example.testandroid;\n\nimport java.util.ArrayList;\n\nimport android.app.Activity;\nimport android.os.Bundle;\nimport android.view.View;\nimport android.widget.ArrayAdapter;\nimport android.widget.ListView;\n\npublic class MainActivity extends Activity {\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n\n View view = getLayoutInflater().inflate(R.layout.list_fragment, null);\n ListView listv = (ListView) view.findViewById(R.id.ListViewInFragment);\n ListView listv2 = (ListView) findViewById(R.id.listViewInRoot);\n\n // ListView listv = (ListView) getFragmentManager().findFragmentById(R.id.fragment1).getView().findViewById(R.id.ListView1);\n\n ArrayList<String> alist = new ArrayList<String>();\n alist.add(\"text1\");\n alist.add(\"text2\");\n alist.add(\"text3\");\n\n ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,\n R.layout.list_view, R.id.listRow, alist);\n\n\n listv.setAdapter(adapter);\n listv2.setAdapter(adapter);\n }\n\n}\n\n\nactivity_main.xml\n\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:tools=\"http://schemas.android.com/tools\"\n android:id=\"@+id/container\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:orientation=\"vertical\"\n tools:context=\"com.example.testandroid.MainActivity\"\n tools:ignore=\"MergeRootFrame\" >\n\n <fragment\n android:id=\"@+id/fragment1\"\n android:name=\"com.example.testandroid.ListFragment\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"0dp\"\n android:layout_weight=\"1\"\n tools:layout=\"@layout/list_fragment\" />\n\n <LinearLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"10dp\" >\n\n </LinearLayout>\n\n <ListView\n android:id=\"@+id/listViewInRoot\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"0dp\"\n android:layout_weight=\"1\" >\n\n </ListView>\n\n</LinearLayout>\n\n\nListFragment\n\npackage com.example.testandroid;\n\nimport android.app.Fragment;\nimport android.os.Bundle;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\n\npublic class ListFragment extends Fragment {\n\n @Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n return inflater.inflate(R.layout.list_fragment, container, false);\n }\n}\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ListView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:id=\"@+id/ListViewInFragment\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\" >\n\n</ListView>\n\n\nlist_view.xml\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:orientation=\"horizontal\" >\n\n <TextView\n android:id=\"@+id/textView1\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:text=\"- \" />\n\n <TextView\n android:id=\"@+id/listRow\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:text=\"TextView\" />\n\n</LinearLayout>" ]
[ "android", "listview", "android-fragments", "android-arrayadapter" ]
[ "Celery multi not working as expected", "I have this my project folder structure\n\napi\n -- __init__.py\n --jobs/\n -- __init__.py\n -- celery.py\n -- celeyconfig.py\n -- tasks.py\n --api_helpers/\n --views/\n\n\ntasks has a task called ExamineColumns\n\nI launch the worker using celery worker -A api.jobs --loglevel=Info\n\nIt works fine and I can run the tasks. \n\nThis is the ourput of celery examine command\n\n$ celery inspect registered\n-> ranjith-ThinkPad-T420: OK\n * ExamineColumns\n * celery.backend_cleanup\n * celery.chain\n * celery.chord\n * celery.chord_unlock\n * celery.chunks\n * celery.group\n * celery.map\n * celery.starmap\n\n\nBut when I try the multi mode it simply does not work. I am trying to run by running\n\ncelery multi start w1 -c3 -A api.jobs --loglevel=Info\n\n\nBut it does not start at all.\n\n$ celery inspect registered\nError: No nodes replied within time constraint.\n\n\nI am not sure why it is not working" ]
[ "celery", "celery-task", "celeryd" ]
[ "How to trigger oninput during onwheel event without using eval?", "How do I trigger an element's oninput event during an onwheel event?\nXML\n<input max="10" min="-10" oninput="a_function('param string',param_obj);" type="range" value="0" />\n\nJavaScript\nwindow.onwheel = function(event)\n{\n if (event.target.nodeName == 'input' && event.target.getAttribute('type') == 'range')\n {\n event.preventDefault();\n if (event.deltaY < 0 || event.deltaX > 0) {event.target.stepUp();}\n else if (event.deltaY > 0 || event.deltaX < 0) {event.target.stepDown();}\n }\n}\n\nI am considering using something along the lines of:\nif (event.target.hasAttribute('oninput')) {}\n\n...and parsing the functions and parameters such as window['a_function']('param string',param_obj); however I'm not sure how reliable that will be or how extensive that would get in regards to things like this.\nAbsolutely no frameworks, libraries or use of eval() and am not interested in addEventListener." ]
[ "javascript", "dom-events" ]
[ "JQuery DataTable rowCallback is called on change of checkbox in IE 11", "By the refrence of the following snippet JQuery DataTable rowCallback is called when I change the checkbox. This checkbox is in the header of a table and once it will be checked all of the checkboxes in the table will be checked or unchecked depending on the status of parent check box. \n\nThis is working fine in chrome and rowCallback does not fire even when I change the state of check box. Once I chnage the state of check box in IE 11, rowCallback will be fired and will render all of the check boxes again and this will remove the current state of all other check boxes. \n\nFollowing is the snippet: \n\n$(document).ready(function() {\n\n $(\"#tableID\").on('change', \"#cbCheckAll\", function(e) {\n\n //Once it is fired it will fire rowCallback also and if it was checked it will render all checkboxed again beacuse rowCallback was fired. This is happening only in IE 11 and working fine in Chrome.\n var table = $('#tableID').DataTable();\n var cells = table.rows({\n search: 'applied'\n }).nodes();\n var listChkBox = $(cells).find(\".foo:enabled\");\n var cbCheckAll = this.checked;\n $(listChkBox).each(function() {\n //This fires correctly on both Chrome and IE 11 but rowCallback is also fired.\n this.checked = cbCheckAll;\n });\n });\n});\n\n$(\"#tableID\").DataTable({\n bAutoWidth: false,\n data: JsonData,\n destroy: true,\n paging: false,\n order: [],\n info: false,\n columns: [\n\n {\n data: null,\n title: \"<input id='cbCheckAll' type='checkbox' />\",\n defaultContent: \"\",\n className: \"chkBox\"\n }\n\n ],\n\n rowCallback: function(row, data, index) {\n\n //Fired even the cbCheckAll change is fired.\n var chkBx = \"<input class=\\\"foo\\\" type=\\\"checkbox\\\">\";\n $(row).find(\".chkBox\").html(chkBx);\n }\n\n});" ]
[ "jquery", "datatables" ]
[ "Globally accessible object across all Celery workers / memory cache in Django", "I have pretty standard Django+Rabbitmq+Celery setup with 1 Celery task and 5 workers.\nTask uploads the same (I simplify a bit) big file (~100MB) asynchronously to a number of remote PCs.\nAll is working fine at the expense of using lots of memory, since every task/worker load that big file into memory separatelly.\nWhat I would like to do is to have some kind of cache, accessible to all tasks, i.e. load the file only once. Django caching based on locmem would be perfect, but like documentation says: "each process will have its own private cache instance" and I need this cache accessible to all workers.\nTried to play with Celery signals like described in #2129820, but that's not what I need.\nSo the question is: is there a way I can define something global in Celery (like a class based on dict, where I could load the file or smth). Or is there a Django trick I could use in this situation ?\nThanks." ]
[ "python", "django", "caching", "global-variables", "celery" ]
[ "How to add messagebox in case of Error 1004", "I want to improve whole code by adding MsgBox in case of:\n\nRun-time error '1004': PasteSpecial method of Range class failed.\n\nThis Error is caused if clipboard is empty and I run the macro.\nAny Advise?\n\nSub Test()\nOn Err.Number = 1004 GoTo ErrMsg\nDim Val As Variant\nSheets(\"Sheet 3\").Select\nVal = Range(\"A2\").Value\nSheets(\"Sheet 1\").Select\nCall TextFromClipboard\nRange(\"AY\" & Val).Select\nActiveSheet.Paste\nSheets(\"Sheet 3\").Select\nErrMsg:\nMsgBox \"Nothing to paste!\", vbCritical, \"Clipboard is empty!\"\nEnd Sub\n\n\nOrgin" ]
[ "excel", "vba" ]
[ "Save Canvas on disk from clients browser?", "With node-canvas (https://github.com/learnboost/node-canvas) we can save Canvas on disk.\n\nHow can we access Canvas element on client's side from Node.js server?\n\n\nClient connects to Node.js server\nServer serves response. Client draws on Canvas\nClient clicks \"save\" and SERVER saves this Canvas to server's disk.\n\n\nPossible?" ]
[ "javascript", "node.js", "express", "socket.io" ]
[ "Map! procedure in Racket", "The map! procedure should modify the existing list to have the values of the operator applied to the original values.\n\nFor example:\n\n(define a '(1 2 3 4 5))\n(define double (lambda (x) (* x 2)))\n\n(map! double a)\n\n\nreturns\n\ndone\n\n\nThen when a is evaluated, a should return\n\n(2 4 6 8 10)\n\n\nmap! procedure must do that work.\n\n(define (map! operator given-list)\n (if (null? given-list) 'done\n (<the procedure that does the modification>)))\n\n\nMy guess1: \n\n(map (lambda (x) (set! x (operator x))) given-list)\n\n(map! double a) \n\n\nreturns:\n\n'(#<void> #<void> #<void> #<void> #<void>)\n\n\nMy guess2:\n\n(cons (operator (car given-list)) (map! double (cdr given-list)))\n\n(map! double a) \n\n\nreturns:\n\n'(2 4 6 8 10 . done)\n\n\nMy guess3:\n\n(set! given-list (map operator given-list))\n\n(map! double a)\n\n\nreturns:\n\n'(2 4 6 8 10)\n\n\nMy guess4:\n\n(let ((element (car given-list)))\n (set! element (operator given-list) (map! operator (cdr given-list)))\n\n(map! double a)\n\n\nreturns:\n\n'done\n\n\nbut, when \"a\" is evaluated, it still says:\n\n'(1 2 3 4 5)\n\n\nWhat do I have to do for this?????" ]
[ "racket" ]
[ "Understand pandas groupby/apply behaviour", "Let's take the following DataFrame:\n\n location outlook play players temperature\n0 Hamburg sunny True 2.00 25.00\n1 Berlin sunny True 2.00 25.00\n2 Stuttgart NaN True 4.00 19.00\n3 NaN NaN NaN nan nan\n4 Flensburg overcast False 0.00 33.00\n5 Hannover rain NaN 0.00 27.00\n6 Heidelberg rain NaN 0.00 21.50\n7 Frankfurt overcast True 2.00 26.00\n8 Augsburg sunny True 2.00 13.00\n9 Koeln sunny True 2.00 16.00\n\n\nI run\n\ng = df(by=[\"outlook\", \"play\"])\ndef gfunc(x):\n print(x)\ng.apply(gfunc)\n\n\nand this is printed\n\n location outlook play players temperature\n4 Flensburg overcast False 0.00 33.00\n location outlook play players temperature\n4 Flensburg overcast False 0.00 33.00\n location outlook play players temperature\n7 Frankfurt overcast True 2.00 26.00\n location outlook play players temperature\n0 Hamburg sunny True 2.00 25.00\n1 Berlin sunny True 2.00 25.00\n8 Augsburg sunny True 2.00 13.00\n9 Koeln sunny True 2.00 16.00\n\n\nI don't mind not returning anything; I just want to understand why it prints the exact same output twice and then a couple of different outputs. Shouldn't the output of printing rather be a different subgroup every time? What am I missing?" ]
[ "python", "pandas" ]
[ "Select many row at once in the table", "Today you can make a sinlge selection but If I want to select everything by checkboxing the input box (left of the text \"Name\").\n\nI don't know how to do it?\n\nInfo.\nAnother thing to take account to. If you have selected a single row and them you want to select everyting included the selected one or many.\nAnd also one thing. The header should not be selected by changing the background color.\n\nThanks!\n\n\r\n\r\n$(\"table input[type=checkbox]\").on(\"change\", function() {\r\n if (this.checked) {\r\n $(this).parents('tr').addClass('selected');\r\n } else {\r\n $(this).parents('tr').removeClass('selected');\r\n } \r\n});\r\ntr.selected { background-color: yellow; }\r\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"></script>\r\n<table>\r\n <thead>\r\n <tr>\r\n <th><input type=\"checkbox\" /></th>\r\n <th>Name</th>\r\n <th>Location</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td><input type=\"checkbox\" /></td>\r\n <td>Name 1</td>\r\n <td>Location 1</td>\r\n </tr>\r\n <tr>\r\n <td><input type=\"checkbox\" /></td>\r\n <td>Name 2</td>\r\n <td>Location 2</td>\r\n </tr>\r\n <tr>\r\n <td><input type=\"checkbox\" /></td>\r\n <td>Name 3</td>\r\n <td>Location 3</td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n\r\n\r\n\n\n\"http://jsfiddle.net/jcftsazk/9/\"" ]
[ "jquery" ]
[ "Lemon-Model: Instantiation of SenseContext Object", "Currently I try to convert some xml files into the Lemon Model. I use the Lemon API and the lemon factory to create instances of the needed objects. Unfortunately I am not able to find out how to instantiate an object of the class SenseContext. \n\nE.g. The Lexical Sense can be created like this: \n\nLexicalSense lclsns = factory.makeSense(senseURI); \n\n\nwhere factory is an instance of LemonFactory. For SenseContext, there exists no make function in the LemonFactory and trying to use the method make() did not work out, i.e.: \n\nSenseContext sns = factory.make(SenseContext.class, snsURI, snsURI); \n\n\n(inserting twice the same URI was just for testing reasons). \n\nCan anyone tell me how to instantiate the SenseContext object correctly? \n\nThanks in advance! \n\nAdd On (12.01.2015 - 17:47): The Doc about the API can be found here: http://lemon-model.net/apidocs/index.html and the API itself here http://lemon-model.net/download/api.php" ]
[ "java" ]
[ "Captured Photo orientation is changing in android", "I'am opening camera app on click of a button. And displaying the captured photo in next activity. But the captured photo is rotating by 90 degrees. When I display the image in a view after I capture it, it's orientation is always landscape. Why is the photo not being shown in portrait as is when the photo is taken in portrait mode? \n\nonClick of a button :\n\nIntent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);\ni.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(APP_DIR+\"/latest.png\"))); \nstartActivityForResult(i, CAPTURE_PHOTO_CONSTANT);\n\n\nInside onActvityresult:\n\nbmp = BitmapFactory.decodeFile(APP_DIR+\"/latest.png\");\nstartActivity(new Intent(this, DisplayActivity.class));\n\n\nDisplaying captured photo:\n\nphotoViewRelativeLayout.setBackgroundDrawable(new BitmapDrawable(getResources(), CaptureActivity.bmp));" ]
[ "android", "bitmap", "camera" ]
[ "Unable to get css and image files in Themes webroot folder of cakephp", "I have a small problem with croogo CMS application while accessing of css and image files in app/Views/Themed/mythemename/webroot folder \n\n <?php echo $this->Html->css(array('style'));?>\n\n\nthis gives me a css reference link in view-source \n\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/croogo/theme/mythemename/css/style.css\" />\n\n\nbut when i click on this link(/croogo/theme/mythemename/css/style.css) it gives me that the url i'm trying to access is not found on the server" ]
[ "cakephp" ]
[ "Finding the spatial length of a list of coordinates", "I have a list of spatial x and y coordinates that make up a line in space (see picture). The coordinates are ordered which means that the first x and y coordinates are the coordinates of one end of the line and the last x and y coordinates are the coordinates of the opposite end of the line. I want to find the total length of the line.\n\nxcoordinates = [-95.10786437988281, -94.80496215820312, -94.5020751953125, -94.19918060302734, -93.89629364013672, -93.59339904785156, -93.29051208496094, -92.98760986328125, -92.68472290039062, -92.3818359375, -92.07894134521484, -91.77605438232422, -91.47315979003906, -91.17027282714844, -90.86737823486328, -90.56449127197266, -90.2615966796875, -89.95870971679688, -89.65582275390625, -89.35292053222656, -89.05003356933594, -88.74713897705078, -88.44425201416016, -88.141357421875, -87.83847045898438, -87.53556823730469, -87.23268127441406, -86.9297866821289, -86.62689971923828, -86.32401275634766, -86.0211181640625, -85.71823120117188, -85.41533660888672, -85.1124496459961, -84.80955505371094, -84.50666809082031, -84.20376586914062, -83.90087890625, -83.59799194335938, -83.29509735107422, -82.9922103881836, -82.68931579589844, -82.38642883300781, -82.08352661132812, -81.7806396484375, -81.47774505615234, -81.17485809326172, -80.87196350097656, -80.56907653808594, -80.26618957519531, -79.96329498291016, -79.660400390625, -79.35751342773438, -79.05461883544922, -78.7517318725586, -78.44883728027344, -78.14595031738281, -77.84305572509766, -77.5401611328125, -77.23727416992188, -76.93437957763672, -76.63148498535156, -76.32859802246094, -76.02570343017578, -75.72281646728516, -75.41992950439453, -75.11703491210938, -74.81414031982422, -74.5112533569336, -74.20835876464844, -73.90547180175781, -73.60257720947266]\nycoordinates = [-22.71684455871582, -22.413955688476562, -22.413955688476562, -22.11106300354004, -22.11106300354004, -22.11106300354004, -21.808170318603516, -21.808170318603516, -21.808170318603516, -21.808170318603516, -21.808170318603516, -21.808170318603516, -21.808170318603516, -22.11106300354004, -22.11106300354004, -22.11106300354004, -22.11106300354004, -22.11106300354004, -22.413955688476562, -22.413955688476562, -22.413955688476562, -22.71684455871582, -22.71684455871582, -23.01973533630371, -23.01973533630371, -23.01973533630371, -23.322628021240234, -23.322628021240234, -23.625518798828125, -23.92841148376465, -24.231300354003906, -24.231300354003906, -24.534191131591797, -24.83708381652832, -24.83708381652832, -25.139976501464844, -25.139976501464844, -25.442867279052734, -25.442867279052734, -25.745756149291992, -25.745756149291992, -26.048648834228516, -26.048648834228516, -26.048648834228516, -26.351539611816406, -26.351539611816406, -26.351539611816406, -26.65443229675293, -26.65443229675293, -26.65443229675293, -26.65443229675293, -26.65443229675293, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082, -26.95732307434082]\n\nplt.plot(xcoordinates,ycoordinates)\nplt.show()" ]
[ "python", "matplotlib" ]
[ "How can I prevent RMySQL errors and show to user in Shiny?", "I have a Shiny App that executes a query to a MySQL database like this example:\n\nUI\n\ntextAreaInput(\"query\")\n\n\nSERVER\n\ndata <- reactive({\n df<-dbGetQuery(conection, input$query)\n return(df)\n})\n\n\nThe problem is that when the user types a wrong syntax in the textAreaInput the Shiny App closes and the error is shown in the R Console. \n\nWhat I want is to print that error in the app so the user can try again and write another query.\n\nCan someone help me please?" ]
[ "r", "shiny", "rmysql" ]
[ "How to mock BitmapFactory: Method decodeFile", "I have a program which creates thumbnail image from a full size image saved in the storage area . I am trying to test that functionality using mockito but it gives me the following error: \n\njava.lang.RuntimeException: Method decodeFile in android.graphics.BitmapFactory not mocked\n\n//Solved(Updated code)\n\nI am running unit tests using mockito for the first time, Could someone please suggest what I am doing wrong(which I know definitely doing). I am also using ExifInterface to extract the metaData associated with the image but it is giving me the same error again: \njava.lang.RuntimeException: Method getAttribute in android.media.ExifInterface not mocked.\n\nHere is the MainActivity class :(where I am running the method).\n\n public class MainActivity extends AppCompatActivity {\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n initValue();\n }\n\n public void initValue()\n {\n BitmapFactory.Options options = new BitmapFactory.Options();\n options.inJustDecodeBounds = true;\n Bitmap thumbnail = createThumbnailFromBitmap(\"/storage/emulator/0/demo/abcd\", 100, 100);\n\n try {\n ExifInterface exifInterface = new ExifInterface(\"/storage/emulator/0/demo/abcd\");\n String jsonData = exifInterface.getAttribute(\"UserComment\");\n\n try {\n JSONObject rootJson = new JSONObject(jsonData);\n dateList.add(rootJson.getString(\"captured\"));\n\n }\n\n catch(JSONException e)\n {\n }\n }\n catch(Exception e)\n {\n System.out.println(\"exception \"+e);\n }\n }\n\n private Bitmap createThumbnailFromBitmap(String filePath, int width, int height){\n return ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(filePath), width, height);\n }\n\n }\n\n\nMy test class: \n\n @RunWith(PowerMockRunner.class)\n@PrepareForTest({BitmapFactory.class ,ThumbnailUtils.class})\n public class initValueTest {\n\n\n @Mock\n private Bitmap bitmap;\n\n\n @Test\n public void initValueTest()\n {\n PowerMockito.mockStatic(BitmapFactory.class);\n PowerMockito.mockStatic(ThumbnailUtils.class);\n when(BitmapFactory.decodeFile(anyString())).thenReturn(bitmap);\n MainActivity mainActivity = new MainActivity();\n mainActivity.initValue();\n }\n }\n\n\nThanks for your help guys. Please excuse if I am doing anything wrong." ]
[ "android", "unit-testing", "mockito", "powermockito" ]
[ "Get products and their variants", "i need help please with one query. I need a query that get products or variations from tables. So, if i needs products \"a\", \"b\" + variation of product \"a1\". How will the looks query?\nI need get three products from tables and to the last product (with ID: a) and replace with modifed values (price, weight, sales)\n\nHere is example of tables and rows:\n\nproducts\n------------------\nCREATE TABLE IF NOT EXISTS `products` (\n `id` varchar(10) NOT NULL,\n `hidden` tinyint(1) NOT NULL,\n `only_variations` int(1) NOT NULL DEFAULT '0',\n `price` decimal(20,6) NOT NULL,\n `weight_in_package` int(11) NOT NULL COMMENT 'mg',\n `stock_pieces` int(11) NOT NULL,\n `gifts` text NOT NULL,\n `rating` int(11) NOT NULL,\n `sold_pieces` int(11) NOT NULL,\n `brand` int(11) NOT NULL,\n `deleted` int(1) NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\nINSERT INTO `products` (`id`, `hidden`, `only_variations`, `price`, `weight_in_package`, `stock_pieces`, `gifts`, `rating`, `sold_pieces`, `brand`, `deleted`) VALUES\n('a', 0, 0, 12.000000, 50, 10, '', 0, 35, 1, 0),\n('b', 0, 0, 11.000000, 50, 15, '', 0, 22, 2, 0);\n\n\nvariations\n------\n\n\nCREATE TABLE IF NOT EXISTS `product_variations` (\n `id` varchar(10) COLLATE utf8_bin NOT NULL,\n `product` varchar(10) COLLATE utf8_bin NOT NULL,\n `price` decimal(20,6) NOT NULL,\n `stock_pieces` int(11) NOT NULL,\n `weight` int(11) NOT NULL COMMENT 'mg',\n `sales` int(11) NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;\n\n\nINSERT INTO `product_variations` (`id`, `product`, `price`, `stock_pieces`, `weight`, `sales`) VALUES\n('a1', 'a', 50.000000, 10, 0, 0),\n('a2', 'a', 40.000000, 11, 0, 0);\n\n\nAnd this output i needs in sql query:\n\nid | price | variation\na 12 NULL\nb 11 NULL\na 50 a1\n\n\nTHANKS VERY MUCH FOR ANY HELP!" ]
[ "php", "mysql", "product", "variants" ]
[ "Can we add and update on same column in PHP at MySQL database?", "mysql_query(\"insert into support values('null','$status','$sbj','$message','$userid','$user','','','$date','')\", $dbc) or die('Could not connect: ' . mysql_error());\n\n$index = mysql_insert_id();\n$inci = '1' . $index;\n\necho \"$inci\";\n\nmysql_query(\"UPDATE support SET incidentno='$inci' WHERE index='$index'\",$dbc) or die('Could not connect: ' . mysql_error());\n\nprintf(\"<h2>your incident id is: %d\\n</h2>\", $inci) ;\n\necho $inci;" ]
[ "php", "mysql" ]
[ "Fast word count function in Vim", "I am trying to display a live word count in the vim statusline. I do this by setting my status line in my .vimrc and inserting a function into it. The idea of this function is to return the number of words in the current buffer. This number is then displayed on the status line. This should work nicely as the statusline is updated at just about every possible opportunity so the count will always remain 'live'. \n\nThe problem is that the function I have currently defined is slow and so vim is obviously sluggish when it is used for all but the smallest files; due to this function being executed so frequently.\n\nIn summary, does anyone have a clever trick for producing a function that is blazingly fast at calculating the number of words in the current buffer and returning the result?" ]
[ "vim" ]
[ "GetGeotagAsync fails on files from a list created via Folder.CreateFileQueryWithOptions w/ OrderByName", "Objective: get a list of image files from a user specified folder and retrieve the latitude/longitude metadata for each file if available.\n\nThe approach is to use Folder query with options to return a list of files which are then iterated over to get the geotag info. As a simple test I just added some code to the Geotag sample provided by MS; ChooseFolderButton_Click method added. It uses FolderPicker then simply picks the first file from the query (just as a test) and treats it like the original demo does to display geotag info.\n\nThe problem appears to be with how the StorageFile items are returned from the query AND only when CommonFileQuery.OrderByName is used. If DefaultQuery is used then all works.\n\nHere is the code added to MS Samples Geotag (a button was added to the XAML):\n\nprivate async void ChooseFolderButton_Click()\n{\n FolderPicker picker = new FolderPicker\n {\n SuggestedStartLocation = PickerLocationId.PicturesLibrary,\n CommitButtonText = \"Select\",\n ViewMode = PickerViewMode.Thumbnail,\n };\n picker.FileTypeFilter.Add(\"*\");\n StorageFolder Folder = await picker.PickSingleFolderAsync();\n\n if (Folder != null) { \n // Get the files and sort them myself\n IReadOnlyList<StorageFile> files = await Folder.GetFilesAsync();\n List<StorageFile> sortedList = files.Where(f => string.Compare(f.FileType,\".jpg\", ignoreCase: true) == 0 )\n .OrderBy(f => f.DisplayName)\n .Select(f => f)\n .ToList();\n file = sortedList.FirstOrDefault();\n }\n\n if (Folder != null) {\n // Use Folder GetFiles with query options to get sorted list\n var queryOptions = new QueryOptions(CommonFileQuery.DefaultQuery, new List<string> { \".jpg\" })\n {\n FolderDepth = FolderDepth.Shallow\n };\n //queryOptions.SetPropertyPrefetch(PropertyPrefetchOptions.ImageProperties, null);\n IReadOnlyList<StorageFile> files2 = await Folder.CreateFileQueryWithOptions(queryOptions).GetFilesAsync();\n var file2 = files2[0];\n }\n\n if (Folder != null && file != null)\n {\n FileDisplayName.Text = file.DisplayName;\n FileOperationsPanel.Visibility = Visibility.Visible;\n }\n else\n {\n FileOperationsPanel.Visibility = Visibility.Collapsed;\n }\n}\n\n\nSelecting the file from sortedList works fine. Using the result from files2 will also work when DefaultQuery is used as shown. Change it to OrderByName and the GetGeotagAsync call will fail, returning null.\n\nLooking into it in detail, it appears the StorageFile instance returned is different in this last case. The FolderRelativeId has the file extension duplicated; numbers\\filename.ext.ext ; however, access through the StorageFile instance seems to work otherwise... except for GetGeotagAsync() at a minimum. This makes me wonder if a copy of the files are being created and the metadata is not included.\n\nI am relatively new to C# and UWP and this is my first question post so I hope this is enough detail... The Question is basically: Am I missing something here? Doing something wrong in the Folder Query? I can work around it using linq as I did in the example code, or even just use DefaultQuery; yet this is uncomfortable as I do use the folder query approach in several other things. Does query OrderByName duplicate or do something undesireable?" ]
[ "c#", "uwp", "windows-10-universal" ]
[ ".h file not found from dependent subproject in Xcode when archiving", "When I try to Archive my Xcode project, it can no longer find the .h files from the subproject in the same workspace. It works fine otherwise. \n\nAny ideas on how to fix it?" ]
[ "xcode" ]
[ "Failing to Record using opencv 2.2 and Python 2.7", "I am trying to write a code to record video from webcam using opencv 2.2 and python 2.7. I got a code which seem to give me an error.\n\nCode:\n\nimport cv, sys\n\ncap = cv.CaptureFromCAM(0) # 0 is for /dev/video0\nif not cap:\n sys.stdout.write(\"!!! Failed CaptureFromCAM\")\n sys.exit(1)\n\nframe = cv.RetrieveFrame(cap)\nif not frame: \n sys.stdout.write(\"!!! Failed to retrieve first frame\")\n sys.exit(1)\n\n\nfps = 25.0 # so we need to hardcode the FPS\nprint \"Recording at: \", fps, \" fps\" \n\nframe_size = cv.GetSize(frame)\nprint \"Video size: \", frame_size \n\nwriter = cv.CreateVideoWriter(\"out.mp4\", cv.CV_FOURCC('F', 'M', 'P', '4'), \n fps, frame_size, True)\nif not writer:\n sys.stdout.write(\"!!! Error in creating video writer\")\n sys.exit(1)\n\n\nwhile True :\n if not cv.GrabFrame(cap) : \n break\n frame = cv.RetrieveFrame(cap)\n cv.WriteFrame(writer, frame)\n\ncv.ReleaseVideoWriter(writer)\ncv.ReleaseCapture(cap)\n\n\nError is:\n\n!!! Failed to retrieve first frame Traceback (most recent call last): \nFile \"C:\\Users\\Acer\\Desktop\\WORKING PROGRAMS\\mp4.py\", line 11, in\n<module>\n sys.exit(1) SystemExit: 1\n\n\nI often get error such as this (image)on my Windows 7 machine when I try to run python programs without any error." ]
[ "python", "opencv", "computer-vision", "video-recording" ]
[ "Base64 - Embedded image drag-and-drop", "I embedded an base64 image like this:\n\n<img alt=\"Embedded Image\" title=\"My image\" alt=\"\"My image\" src=\"data:image/png;base64,AUa4GWAoUW...\n\n\nIf I drag-and-drop that image from the browser to my desktop I just get a HTML document shown instead of a PNG image. (Firefox / Opera)\n\nHow to make drag and drop for base64 images possible? \n\nThanks" ]
[ "drag-and-drop", "base64" ]
[ "swift iOS how get UICollectionViewCell for item", "I have UICollectionView which feed from myArray.\nI added newItem in myArray and I can see newItem.image in my UICollectionView. And now I need make some animation in the centre of this UICollectionViewCell.\nHow can I receive this cell (or indexPath for cell) with content myArray[0]?\n\nmyArray.insert(newItem, atIndex: 0)\nmyCollectionView.reloadData()\n\nvar indexPath = //?????? (it's my question)\n\nif let index = indexPath {\n\n var cell = self.collectionView.cellForItemAtIndexPath(index) as! myCollectionViewCell\n self.myImageView.center = cell.center\n cell.itemImage.transform = CGAffineTransformRotate(cell.donutsImage.transform, CGFloat(DegreesToRadians(90)))\n}" ]
[ "ios", "swift", "uicollectionview", "uicollectionviewcell" ]
[ "Failing to retrieve fabric repository", "I need to install fabric in a Linux(debian-wheezy) machine.\nBut it cn't find the repository; I've already run \"apt-get update\", but it doesn't find any fabric, even with \"apt-cache search fabric\".\n\nAnd I have it on ubuntu.. how can I get it?" ]
[ "fabric" ]
[ "Row for each date from start date to end date", "What I'm trying to do is take a record that looks like this:\n Start_DT End_DT ID\n4/5/2013 4/9/2013 1\n\nand change it to look like this:\n DT ID\n4/5/2013 1\n4/6/2013 1\n4/7/2013 1\n4/8/2013 1\n4/9/2013 1\n\nit can be done in Python but I am not sure if it is possible with SQL Oracle? I am having difficult time making this work. Any help would be appreciated.\nThanks" ]
[ "sql", "oracle", "date", "recursive-query" ]
[ "node js websocket requires c++", "I want to install:\n\nnpm install websocket\n\n\nand I get the message:\n\nNative code compile failed!!\nOn Windoes, native extensions require Visual Studio and Python\n\n\nThen I installed Visual Studio 8 and Python, but I still get the message.\nHow can Visual Studio compile the code?" ]
[ "node.js", "visual-studio-2008", "websocket" ]
[ "scikit-learn:ImportError: cannot import name atleast2d_or_csr", "When I am working with ELM(extreme learning machine) in python, I came into this problem:ImportError: cannot import name atleast2d_or_csr.The details of error is listed as follows:\n\nC:\\Users\\sherlock\\Anaconda2\\lib\\site-packages\\sklearn\\cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.\n\"This module will be removed in 0.20.\", DeprecationWarning)\nTraceback (most recent call last):\n\nFile \"<ipython-input-50-dad0703e9d35>\", line 1, in <module>\nrunfile('C:/Users/sherlock/Desktop/Ensemble Learnig/Python-ELM-master\n/plot_elm_comparison.py', wdir='C:/Users/sherlock/Desktop/EnsembleLearnig\n/Python-ELM-master')\n\nFile \"C:\\Users\\sherlock\\Anaconda2\\lib\\site-packages\\spyder\\utils\n\\site\\sitecustomize.py\", line 866, in runfile\nexecfile(filename, namespace)\n\nFile \"C:\\Users\\sherlock\\Anaconda2\\lib\\site-packages\\spyder\\utils \n\\site\\sitecustomize.py\", line 87, in execfile\nexec(compile(scripttext, filename, 'exec'), glob, loc)\n\nFile \"C:/Users/sherlock/Desktop/Ensemble Learnig/Python-ELM-master \n/plot_elm_comparison.py\", line 75, in <module>\nfrom elm import ELMClassifier\n\nFile \"elm.py\", line 34, in <module>\nfrom random_hidden_layer import SimpleRandomHiddenLayer\n\nFile \"random_hidden_layer.py\", line 27, in <module>\nfrom sklearn.utils import check_random_state, atleast2d_or_csr\n\nImportError: cannot import name atleast2d_or_csr\n\n\nThe concerned statement may be:\n\nfrom sklearn.utils import check_random_state, atleast2d_or_csr" ]
[ "python", "scikit-learn" ]
[ "Testing observable from angular service, angular4", "I want to test Observable return data, in angular component.\n\nI have created a slackblitz https://stackblitz.com/edit/observable-testing-101.\n\nHere you can see the logic for component + service.\n\nMy testing code is also included in slack.\n\nOn my local m/c I am getting erro : Expected undefined to be 1.\n\nPlease help, I am new to testing angular." ]
[ "angular" ]
[ "Fill data in SQL Server table", "I am new to SQL and I am experimenting.\n\nI have created a SQL Server Project in VS2013 and generated several tables using the GUI (using the auto-generated CREATE TABLE command).\n\nNow I want to implement in C# a stored procedure to populate the tables with data statically before the deployment.\n\nCould someone give me an example/link about how to do that?" ]
[ "c#", "sql", "sql-server", "visual-studio" ]
[ "Get the transaction id when the transaction is committed", "I am using IEnlistmentNotification interface from transaction scope and I want to access the current transaction id in the commit method after the scope is completed like this:\n\npublic void Commit(Enlistment enlistment)\n{ \n string transactionId = Transaction.Current.TransactionInformation.LocalIdentifier;\n enlistment.Done();\n} \n\n\nBut I am getting an error because now the transaction.current is null.\nFrom what I check the enlistment instance has private member of the transactionId, but I can't access it for his protection level.\n\nIs there another way to get the transaction id when the scope is completed?" ]
[ "c#", "transactions", "transactionscope" ]
[ "how to read a linux etc/passwd file and compare the user input name for authentication in C", "This is the program i have written can anyone tell what is wrong with it, because whatever input i give, it shows valid user.\n\n#include<stdio.h>\n#include<string.h>\n#define max_size 20\nvoid main()\n{\n File *Fptr;\n char username[max_size];\n char line[20];\n if((fptr=fopen(\"/etc/passwd\",\"r\"))==NULL)\n { \n printf(\"cannot open file\");\n }\n else\n {\n fptr=fopen(\"/etc/passwd\",\"r\");\n fputs(\"enter the username\",stdout);\n fflush(stdout);\n fgets(username,sizeof username,stdin);\n while((fgets(line,sizeof(line),fptr))!=NULL)\n { \n if(strcmp(line,username))\n {\n printf(\"%s valid user\",username);\n break; \n }\n else\n {\n printf(\"%s not valid user\",username);\n } \n } \n fclose(fptr);\n }\n}" ]
[ "c" ]
[ "How to add an Azure App Service extension via powershell?", "Our continuous integration environment automatically deploys a new Azure App Service on each deploy. So this means it removes the old staging slot and re-creates it again before swapping into production. So we get a fresh start and all new configuration and services are deployed. \n\nThis has been fine until now we also need a useful site extension installed. When we install this extension manually it will just get lost when we do a fresh deploy again.\n\nHow can I install a site extension to an Azure App Service via powershell? My CI process can do this easily." ]
[ "powershell", "azure", "continuous-integration", "azure-web-app-service" ]
[ "trying to understand different $(this) in jquery", "<!doctype html>\n<html>\n<head>\n <meta charset=\"utf-8\" />\n <title>Demo</title>\n <style type=\"text/css\">\n #gallery\n {\n width: 960px;\n margin: 0 auto;\n }\n .galleryitem\n {\n width: 300px;\n height: 300px;\n float: left;\n font-family: Lucida Sans Unicode, Arial;\n font-style: italic;\n font-size: 13px;\n border: 5px solid black;\n margin: 3px;\n }\n .galleryitem img\n {\n width: 300px;\n }\n .galleryitem p\n {\n text-indent: 15px;\n }\n #galleryhoverp\n {\n margin-top: -55px;\n background-color: black;\n opacity: 0.5;\n -moz-opacity: 0.5;\n filter: alpha(opacity=50);\n height: 40px;\n color: white;\n padding-top: 10px;\n }\n #singleimagedisplay\n {\n width: 800px;\n }\n #singleimagedisplay img\n {\n width: 800px;\n }\n #singleimagedisplay a\n {\n float: right;\n color: white;\n }\n </style>\n</head>\n<body>\n <div id=\"gallery\">\n <div class=\"galleryitem\">\n <img src=\"computer1.png\" alt=\"A beautiful Sunset over a field\" /><p>\n A beautiful Sunset over a field</p>\n </div>\n <div class=\"galleryitem\">\n <img src=\"computer2.png\" alt=\"Some penguins on the beach\" /><p>\n Some penguins on the beach</p>\n </div>\n <div class=\"galleryitem\">\n <img src=\"computer3.png\" alt=\"The sun trying to break through the clouds\" /><p>\n The sun trying to break through the clouds</p>\n </div>\n <div class=\"galleryitem\">\n <img src=\"computer.png\" alt=\"Palm tress on a sunny day\" /><p>\n Palm tress on a sunny day</p>\n </div>\n <div class=\"galleryitem\">\n <img src=\"computer4.png\" alt=\"The sun bursting through the tall grass\" /><p>\n The sun bursting through the tall grass</p>\n </div>\n </div>\n</body>\n</html>\n<script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\"></script>\n<script>\n $('p').hide();\n var galleryItems = $('.galleryitem');\n galleryItems.css('height', '200px');\n var images = $('.galleryitem').find('img');\n galleryItems.hover(\n function () {\n $(this).children('p').show().attr('id', 'galleryhoverp');\n },\n function () {\n $(this).children('p').hide().attr('id', '');\n }\n)\n images.click(function () {\n $(this).parent().attr('id', 'singleimagedisplay').css('height', $(this).height()).siblings().hide();\n })\n\n</script>\n\n\nAbove code is from here: http://www.1stwebdesigner.com/tutorials/jquery-beginners-4/\n\nQuestion:\n\nFor this line: $(this).parent().attr('id', 'singleimagedisplay').css('height', $(this).height()).siblings().hide();\n\n1.I know the first $(this) means the img that clicked, but what does sencond $(this) mean? \n\n2.when I clicked one img on the frontend, I can see see the img get enlarged, and it shows style=\"height: 533px; in firebug, but how come it is 533px? in css script, there is no such definition as height: 533px." ]
[ "javascript", "jquery" ]
[ "While loop within a while loop, how to both conditions work?", "I am writing a program that involves reading numerous bits of data from files, and I have ran into a bit of a dilemma (being a relatively inexperienced programmer). If a while loop is contained within another while loop, which conditions need to be fulfilled in order to leave the loop?\nMy specific situation is shown below, (emptyLineFound is a Boolean set to be true when empty line has been found)\n\nwhile(!file.eof()) {\n ....\n while(!emptyLineFound) {\n ....\n }\n}\n\n\nWhich condition takes priority? Must they both be satisfied to leave that section of code? e.g if it is at the end of the file and an empty line can not be found as there is no line, will it mess up?" ]
[ "c++" ]
[ "Trigger on Multiple Mysql Database tables using php", "If I have a table t1 in db1 and t2 in db2 . now on any operation on t1 table of db1 i want the same operation to be performed on t2 of db2.\n\nConsider a scenario...if i insert in t1 same record should get added on t2. db1 and db2 both are situated on same database.\n\ncan anyone tell what specific steps i should do to fulfill this scenario...or how to open both the database connections before firing trigger?" ]
[ "mysql", "triggers" ]
[ "How show specific part of an image in javafx", "i have this picture(all of these effects are in one .png file ) i want to display for example second picture how can i use Image and ImageView in javafx to display specific part of this image ? thanks" ]
[ "java", "javafx" ]
[ "CSS transition doesn't work properly after a function executes", "So I have a transition that modifies the background color of a div when I hover the mouse over it and if I press the button that executes myFunction2 that also changes the background color of the div before hovering on the div, then the transition will not modify the background color anymore.\n\n\r\n\r\nfunction myFunction2() {\r\n document.getElementById(\"myDIV\").style.backgroundColor = \"yellow\";\r\n}\r\n\r\nfunction myFunction() { document.getElementById(\"myDIV\").style.WebkitTransition = \"all 2s\"; // Code for Safari 3.1 to 6.0\r\n document.getElementById(\"myDIV\").style.transition = \"all 2s\"; // Standard syntax\r\n}\r\n#myDIV {\r\n border: 1px solid black;\r\n background-color: lightblue;\r\n width: 270px;\r\n height: 200px;\r\n overflow: auto;\r\n }\r\n \r\n #myDIV:hover {\r\n background-color: coral;\r\n width: 570px;\r\n height: 500px;\r\n padding: 100px;\r\n border-radius: 50px;\r\n }\r\n<!DOCTYPE html>\r\n<html>\r\n <head>\r\n </head>\r\n <body>\r\n <p>Mouse over the DIV element and it will change, both in color and size!</p>\r\n <p>Click the \"Try it\" button and mouse over the DIV element again. The change will now happen gradually, like an animation:</p>\r\n <button onclick=\"myFunction2()\">Try it2</button><br>\r\n <button onclick=\"myFunction()\">Try it</button> \r\n <div id=\"myDIV\">\r\n <h1>myDIV</h1>\r\n </div>\r\n </body>\r\n</html>" ]
[ "javascript", "html", "css" ]
[ "Need Postgres query result in given timezone", "I save all columns in UST. But I need to get all results in a particular timezone. I am using postgres.\n\nI am looking for something like following\n\nSELECT reported_time IN timezone 'Asia/Kolkata' FROM allusers;\n\n\nI need result in 'Asia/Kolkata' timezone for exporting to a csv" ]
[ "postgresql" ]
[ "Calling a functon in code behind by using an imagebutton in a gridview", "I have an ImageButton within a GridView in .aspx on clicking this ImageButton i have to call a function.\nThis is how i tried and the function was not being called.\nCode inside.aspx page:\n\n<GridView ......>\n <asp:HyperLink ID=\"HyperLink2\" runat=\"server\" \n NavigateUrl='<%# DataBinder.Eval(Container.DataItem,\"VehID\",\"mngVeh.aspx?delid={0}\") %>'> \n <asp:ImageButton runat=\"server\" ID=\"DeleteUrlImageButton\" \n width='24' height='24'\n ImageUrl=\"~/images/delete.jpeg\" \n OnClick=\"DeleteUrlImageButton_Click\"\n OnClientClick=\"return confirm('Are you sure you want to delete?');\" />\n <!--<img src=\"images/delete.jpeg\" alt='edit' border=\"0\" width='24' height='24'/> -->\n </asp:HyperLink>\n</GridView>\n\n\ncode in .aspx.cs page:\n\npublic void DeleteUrlImageButton_Click(object sender, EventArgs e)\n{\n //code to perform the necessary action.\n}" ]
[ "c#", "asp.net" ]
[ "How to find the root device name of a debootstrap image", "I'm creating a ubuntu 20.04 QEMU image with debootstrap (debootstrap --arch amd64 focal .). However, when I tried to boot it with a compiled Linux kernel, it failed to boot:\n[ 0.678611] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)\n[ 0.681639] Call Trace:\n...\n[ 0.685135] ret_from_fork+0x35/0x40\n[ 0.685712] Kernel Offset: disabled\n[ 0.686182] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---\n\nI'm using the following command:\nsudo qemu-system-x86_64 \\\n -enable-kvm -cpu host -smp 2 -m 4096 -no-reboot -nographic \\\n -drive id=root,media=disk,file=ubuntu2004.img \\\n -net nic,macaddr=00:da:bc:de:00:13 -net tap,ifname=tap0,script=no \\\n -kernel kernel/arch/x86/boot/bzImage \\\n -append "root=/dev/sda1 console=ttyS0"\n\nSo I'm guessing the error comes from the wrong root device name (/dev/sda1 in my case). Is there any way to find the correct root device name?\n\nUpdate from @Peter Maydell's comment:\n[ 0.302200] VFS: Cannot open root device "sda1" or unknown-block(0,0): error -6\n[ 0.302413] Please append a correct "root=" boot option; here are the available partitions:\n[ 0.302824] fe00 4194304 vda \n[ 0.302856] driver: virtio_blk\n[ 0.303152] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)\n\nWhere vda should be the root device name." ]
[ "linux", "linux-kernel", "debian", "kernel", "qemu" ]
[ "is the Netlab's function mlperr calculating the mean squared error?", "I wonder if the mlperr from the Netlab package is calculating the mean squared error.\nThe documentation states that it's dependent on the ouput's units activation function. How does that make sense? Shouldn't it be independent from that?\n\nI also tried to read the source code of mlperr and I didn't see any signs that could make me think that this is a MSE error function.\n\nAny Netlab expert here that can offer some insights? Thanks! :)" ]
[ "matlab", "machine-learning", "neural-network", "mean-square-error" ]
[ "Non encoded percent in URL", "I have a php script, and someone else is generating URL-s to it.\n\nAnd that person didn't knew the % character has to be encoded so i have the problem that apache is refusing those requests. (Bad Request)\n\nSo my question is, how do i convert a URL like \nsite.com/search/one two %\ninto a valid \nsite.com/search/one two %25\n\nThanks" ]
[ "apache", "url", "url-rewriting", "urlencode" ]
[ "Warning: A non-numeric value encountered", "Recently updated to PHP 7.1 and start getting following error\n\n\n Warning: A non-numeric value encountered in on line 29\n\n\nHere is what line 29 looks like\n\n$sub_total += ($item['quantity'] * $product['price']);\n\n\nOn localhost all works fine..\n\nAny ideas how to tackle this or what it is ?" ]
[ "php" ]
[ "can i get my project source code from google developer console", "I was working on a project but due to some reason I lost the source code of my project . I was using google authentication for that project hence it is there on Google Developer Console . Is there any way I can get my code back from google developer console ." ]
[ "google-developers-console" ]
[ "Find sub-string / replace full-string with new value across entire data.frame in R", "I have a large data frame with many columns. For a subset of these columns I would like to match on a substring and replace \n\nAn example of a subset of two columns looks like: \n\ndf <- data.frame(list(A=c(\"0/0:52,0:52:High_Confidence:99:0\",\"0/0:2,0:2:Low_Confidence:3:0,3,45,1858\",\"0/0:52,0:52:High_Confidence:99:0,135,1858\",\"0/0:9,0:9:Low_coverage_High_quality:21:0,21,291\"), B=c(\"0/0:5,0:5:Low_Confidence:15:0,15,194\",\"0/0:21,0:21:High_Confidence:51:0,51,675\",\"0/0:1,0:1:Low_Confidence:3:0,3,39\",\"0/0:17,0:17:High_Confidence:48:0,48,609\")))\n\n\nI would like to use a grepl type command to replace fields with \"Low_Confidence\" in them with ./. across the entire data frame. \n\nI've tried:\n\ndf[grepl(\".*Low_Confidence.*\", df)] <- \"./.\" # replaces ALL values with ./.\ndf[agrep(\".*Low_Confidence.*\", df)] <- \"./.\" # Does nothing\n\ndf[grep(\".*Low_Confidence.*\", df)] <- \"./.\" \ndf[grep(\"Low_Confidence\", df)] <- \"./.\"\n\n\nMost of these return data.frames with all values in the relevant columns with ./. regardless of whether they match the Low_Confidence criteria or not. \n\nI also tried converting the data.frame to a matrix\n\ndf <- as.matrix(df)\ndf[df==\".*Low_Confidence.*\"] <- \"./.\" # does nothing\n\n\nWithout success. I know it's possible if I do this one column at a time, for example:\n\ndf$V85[grepl(\".*Low_Confidence.*\", df$V85)] <- \"./.\"\n\n\nBut for 100s of columns that's highly repetitive. \n\nSo i'm looking for a solution that will find/replace with a wild card match the entire string (not just the matching text) in a data.frame across all, or a subset of columns (either will work).\n\nThanks!" ]
[ "regex", "r", "dataframe", "grepl" ]
[ "Removing non-English words/characters from .csv file using Powershell?", "I've exported an IoT dataset with scraped together content from their websites into a .csv file (let's call data.csv). Some of this content is encoded in Japanese/Chinese/various European languages, and refuses to open when the program I'm importing it in detects one of these special characters.\n\nIs there any way to use PowerShell to remove any and all non-English encodings from the csv and export it as a copy? I mean, keep a-z,A-Z,0-9, commas, question marks, brackets, etc., but remove anything that's non-English from the dataset?\n\nI've tried saving the file as a utf-8 encoding from Notepad, but that didn't fix it." ]
[ "powershell", "character-encoding", "export-to-csv" ]
[ "Cordova changing resolution?", "I create an android application using angular 4 and framework cordova.Ijust have one problem with screen resolutions\n\nimg1\n\nimg2\n\nI try to change the view port but still the same \n\n<meta name=\"viewport\" \n content=\"width=device-width, \n initial-scale=1.0, \n maximum-scale=1.0, \n target-densitydpi=medium-dpi, user-scalable=0\" />" ]
[ "html", "angular", "cordova" ]
[ "how to set OracleCommand.BindByName =true in .net?", "Environment:\n\n-Visual Studio 2010 (.NET FrameWork 4)\n\n\nASP.NET web Application\nOracle Database\nusing System.Data.OracleClient\n\n\nI have a web form where a user can enter any or no data into text boxes corresponding to each parameter in my query.if user entered no data the text box will get \"0\" value.\n\nhere is my query:\n\nSELECT \"CardNo\" , \"Name\"\nFROM CardList\nWHERE(\"CardNo\"=:CardNo or :CardNo=0) and (\"Name\"=:Name or :Name=0)\n\nwhen I right click on the query from the table adapter in the MYDATABASE.xsd panel, and select 'Preview Data' and fill parameter values with \"0\" i get the error (\" ORA-01008 : Not all variables bound\" ). After a lot of searching i found out that i should set OracleCommand.BindByName =true (apparently it is not true by default)\n\ncan anyone help me how to do it?" ]
[ ".net", "oracle", "visual-studio", "odp.net", "system.data.oracleclient" ]
[ "ToolBar ControlTemplates, Missing Overflow Items, and ToolBarTray Orientation", "I'm writing a ControlTemplate for toolbars that utilizes a UniformGrid in order to provide multiple columns for toolbar items. So far, it seems that even with mostly default ControlTemplate markup (a la MSDN Documentation), Overflow into the ToolBarOverflowPanel no longer works. I have tried using both the default ToolBarOverflowPanel and a StackPanel, to no effect; the relevant template snippit can be found here.\n\nHow do I get Overflow to work properly?\n\nAdditionally, when placing a ToolBar control inside a ToolBarTray, how can I detect and set the \"Thumb\", \"Content\", and \"Overflow Toggle Button\" to their correct positions? The documentation for ToolBar ControlTemplates does not seem to cover this.\n\nedit: Also something I'm curious about, how can I tie into the UniformGrid's Column property in my Main window xaml?\n\nedit 2: Got the basic for dealing with ToolBarTray Orientation resolved, just needed to add ControlTemplate triggers for the related attached properties (Trigger Property=\"ToolBarTray.Orientation\" Value=\"Vertical\"). Also, who downvotes a decently written question, seriously?\n\n<ToggleButton DockPanel.Dock=\"Right\" \n ClickMode=\"Press\"\n IsChecked=\"{Binding \n IsOverflowOpen, \n Mode=TwoWay, \n RelativeSource={RelativeSource TemplatedParent}\n }\" \n IsEnabled=\"{TemplateBinding HasOverflowItems}\" \n>\n <ToggleButton.Template>\n <ControlTemplate TargetType=\"{x:Type ToggleButton}\">\n <Border x:Name=\"Border\"\n Background=\"{StaticResource \n {x:Static SystemColors.MenuBarBrushKey}\n }\" \n CornerRadius=\"0,3,3,0\" \n SnapsToDevicePixels=\"true\" \n >\n <Grid>\n <Path x:Name=\"Arrow\" \n Data=\"M -0.5 3 L 5.5 3 L 2.5 6 Z\" \n Fill=\"{StaticResource {x:Static \n SystemColors.ControlTextBrushKey\n }}\" \n Margin=\"2,3\" \n VerticalAlignment=\"Bottom\" \n />\n <ContentPresenter />\n </Grid>\n </Border>\n </ControlTemplate>\n </ToggleButton.Template>\n <Popup x:Name=\"OverflowPopup\" \n AllowsTransparency=\"true\" \n Focusable=\"false\" \n IsOpen=\"{Binding \n IsOverflowOpen, \n RelativeSource={RelativeSource TemplatedParent}\n }\" \n Placement=\"Bottom\" \n PopupAnimation=\"Slide\" \n StaysOpen=\"false\" \n >\n <Border x:Name=\"DropDownBorder\"\n Background=\"{StaticResource \n {x:Static SystemColors.MenuBarBrushKey}\n }\" \n BorderBrush=\"{StaticResource \n {x:Static SystemColors.ControlDarkBrushKey}\n }\" \n BorderThickness=\"1\"\n >\n <StackPanel x:Name=\"PART_ToolBarOverflowPanel\" \n Focusable=\"true\" \n FocusVisualStyle=\"{x:Null}\" \n KeyboardNavigation.TabNavigation=\"Cycle\" \n KeyboardNavigation.DirectionalNavigation=\"Cycle\" \n Margin=\"2\" \n />\n <!--<ToolBarOverflowPanel \n x:Name=\"PART_ToolBarOverflowPanel\" \n Focusable=\"true\" \n FocusVisualStyle=\"{x:Null}\" \n KeyboardNavigation.TabNavigation=\"Cycle\" \n KeyboardNavigation.DirectionalNavigation=\"Cycle\" \n Margin=\"2\" \n WrapWidth=\"200\" \n />-->\n </Border>\n </Popup>\n</ToggleButton>" ]
[ "c#", "wpf", "xaml", "templates", "controls" ]
[ "If and Countif Function and Slicer", "ColumnA - Agent name (Say 1, 2, 3....)\n\nColumnB - Dealer Name(Say a, b, c, d, e, f, ....)\n\n1 agent have multiple dealers, but a dealer must have one unique agent\n\nColumnC - Year(2016,NA)\n\nSample of the table:\n\nAgent Dealer Year\n1 AB 2016\n1 MN 2016\n1 XY NA\n2 CD 2016\n2 EF NA\n2 GH NA\n3 RT 2016\n3 TN 2016\n3 RZ 2016\n\n\nThis formula helps in counting the total active agent name = total agent name minus total agent name with NA \n\nFor Agent1, active dealer count = 3-1 = 2\n\nFor Agent2, active dealer count = 3-2 = 1\n\nFor Agent3, active dealer count = 3-0 = 3\n\nHow do I get the active agent details count, agent wise.\n\nLike For Active Agent1 = Total count of agent(1) - total year (na) for agent1\n\nFor Active Agent2 = Total count of agent(2) - total year (na) for Agent2\n\nif and count if and counta\n\n=if(A:A=\"AGENTNAME\",(COUNTA('Working Sheet'!$C$4:$C$1048576)-COUNTIF('Working Sheet'!$C$4:$C$1048576,\"NA\")" ]
[ "excel", "excel-formula" ]
[ "how to execute Python 3.3 script in Spyder console with variables?", "how can I execute Python 3.3 script in Spyder console, and that has variables?\n\nMy sample code (C:/test/myfile.py) is\n\nfrom sys import argv\nscript, first, second, third = argv\nprint(\"The script is called:\", script)\nprint(\"Your first variable is:\", first)\nprint(\"Your second variable is:\", second)\nprint(\"Your third variable is:\", third)\n\n\nI have tried exec(open(\"C:\\test\\myfile.py\").read()) - and the error I get is \"ValueError: need more than 1 value to unpack. I want to supply the variables first = \"1st\", second = \"2nd\", third = \"3rd\". How can I write the exec() so that it can handle the inputs?\n\nI'm using Python 3.3, 64-bit installation, Windows OS, installation: WinPython." ]
[ "python", "python-3.x", "spyder" ]
[ "Dynamically submitting a file upload form in IE10 using jQuery", "I have a form whose only purpose is to upload files, but for user experience reasons, I need a nice-looking button that:\n\n\nloads the file dialog\nauto-submits the form when a file has been selected\n\n\nThe original solution was something like this JSFiddle, where you have a link that loads the file dialog, then listens for the dialog's change event to auto-submit the form:\n\n$(\"input[type=file]\").on(\"change\", function () {\n // auto-submit form\n $(\"form\").submit();\n});\n\n$(\"#my-nice-looking-button\").on(\"click\", function (e) {\n e.preventDefault();\n // load file dialog\n $(\"input[type=file]\").trigger(\"click\");\n});\n\n\nIf you try that fiddle, it will work in IE9, Chrome, Firefox, etc., but it doesn't work in Internet Explorer 10. All the JavaScript functionality works, including the form's submit event getting fired. But, the browser never POSTs the form data to the server; it just sits there.\n\nIs there some security safeguard or file upload limitation built into IE10 that prevents this from working?" ]
[ "javascript", "jquery", "internet-explorer", "internet-explorer-10" ]
[ "How to subtract rows in xts with multiple columns", "How do you subtract a single row of data in an xts object from the entire (multi-row), xts object?\n\nMWE\n\nrequire(xts)\ndata(sample_matrix)\nx <- as.xts(sample_matrix)\nx-coredata(x['2007-06-09'])[1,]\n\n\nFrom the output, R has taken the row vector, stripped of its context, and subtracted it by recycling across the columns.\n\nE.g. if I were using the following xts object in place of x\n\na1 b1 c1 d1\na2 b2 c2 d2\n\n\nAnd made the following subtraction\n\nx-coredata(x[2,])[1,]\n\n\nThe result would be\n\na1-a2 b1-c2 c1-a2 d1-c2 \na2-b2 b2-d2 c2-b2 0\n\n\nMy intended output:\n\na1-a2 b1-b2 c1-c2 d1-d2\n 0 0 0 0" ]
[ "r", "xts" ]
[ "Android Native Determine SD Format", "I have been searching everywhere to determine if this is even possible and have not found any results. We have devices that read SD Cards which can be a range of different formats: fat, fat32, exfat, ntfs. We are building an android native app and are looking for a way to find the current format of the card and reformat the card with the same format.\nIf this is possible some reference code of documentation would be greatly appreciated." ]
[ "android" ]
[ "Laravel 4.2 | Auth attempt ignore active status", "I'm using laravel 4.2 auth system, trying auth with the next command:\n\nAuth::attempt(['email' => Input::get('email'), 'password' => Input::get('password'), 'active' => true], true)\n\n\nThe problem is that I'm trying to sign in with user that marked as non-active in the database - the the response is true.\n\nAny suggestions?" ]
[ "php", "laravel", "authentication" ]
[ "Calling javascript object's own properties", "I have this object 'cp'. and it has got some properties like labels and arcSettings in it. Whenever i initialize this object and call the method 'graph()' it says \n\nUncaught TypeError: Cannot read property '0' of undefined \n\n\nAm I doing something wrong?\n\nfunction cp() { \n this.labels = [{\n \"pointThickness\": 0.8,\n \"distance\": 8,\n \"textDistance\": 7,\n \"strokeColor\": \"#888\",\n \"strokeWidth\": 0.5,\n \"textColor\": \"#777\",\n \"pointColor\": \"#888\",\n \"textSize\": 4,\n //\"interval\":100,\n //\"precision\":2,\n \"num\": 10,\n \"startValue\": 0,\n \"endValue\": 300\n }\n ];\n\n this.arcSettings = [\n {\n \"totalArcAngle\":300,\n \"startAngle\":(-this.totalArcAngle/2),\n \"endAngle\":(this.totalArcAngle/2),\n \"progressValue\":200,\n \"radius\":150,\n \"thickness\":30,\n \"displayValue\":this.progressValue\n }\n ]; \n}\n\ncp.prototype.getOneUnit = function () {\n return oneUnit = (this.arcSettings[0].totalArcAngle) / (this.label[0].endValue - this.label[0].startValue);\n\n}\n\ncp.prototype.graph= function(){ \nvar oneUnit = this.getOneUnit();\n\n}\n\nvar cp = new cp();\ncp.graph();" ]
[ "javascript", "oop" ]
[ "Apache mod_rewrite does not work", "Im using a J2ee application with spring framework 2.0 on a apache tomcat 5.5. I have used URL mapping to change the extension from .jsp to .htm. I have an URL which looks like this\nhttp://www.800promotion.com/promotion.htm?cid=1344159422528120632840257756098788\nI want to change it to\nhttp://www.800promotion.com/1344159422528120632840257756098788\nI have referred samples of working on mod_rewrite. However I cant seem to get it working. These are the lines in my .htaccess file.\nRewriteEngine on\nRewriteRule ^([^/.]+)/?$ /promotion.htm?cid=$1 [L]\n\nI have checked with my host and they said mod_rewrite was supported on the server. I do not have access to the httpd.conf file. However I have verified from the support that AllowOverride is set to all. When I hit the URL the page works fine however the URL doesnt get mapped. Where am I going wrong?" ]
[ "mod-rewrite" ]
[ "Display only single line at a time, in a Multiline Edittext", "I have tried android:singleLine, maxLines, lineSpacing attributes but my EditText always displays a part of next line. How can I force it to display a single line at a time? \n\n<EditText\n android:layout_width=\"match_parent\"\n android:layout_height=\"30dp\"\n android:id=\"@+id/formulaView\"\n android:textColor=\"#000000\"\n android:textCursorDrawable=\"@drawable/visible_cursor\"\n android:background=\"#ffffff\"\n android:layout_marginTop=\"1dp\"\n android:textSize=\"18sp\"\n android:maxHeight=\"30dp\"\n android:gravity=\"center_vertical\"\n android:layout_marginBottom=\"1dp\"\n android:paddingStart=\"10dp\"\n android:paddingEnd=\"10dp\"\n android:scrollbars=\"vertical\"\n android:imeOptions=\"actionNext\"\n android:completionThreshold=\"1\"\n android:inputType=\"textMultiLine|textNoSuggestions\"/>" ]
[ "android", "android-edittext" ]
[ "Two strings compare equal using '=' but fail in 'like' compare", "Sql-Server 2008 R2 Collation is Chinese_Simplified_Pinyin_100_CI_AS.\nWhen I use \n\nselect 1 where N'⑦' = N'7'\n\n\nit output 1, but when I change the operator to like\n\nselect 1 where N'⑦' like N'7'\n\n\nit wont output anything.\n\nWhy is like operator act so weird? Did I miss something?" ]
[ "sql-server-2008", "tsql", "sql-server-2008-r2", "string-comparison" ]
[ "Can an inport be forwarded to an outport using signal w/o a method?", "I have a SystemC module that implements a hardware block, where an input is directed as-is to the output (think for example about a non-inverting buffer). Say I defined:\n\nsc_in<bool> ip;\nsc_out<bool> op;\n\n\nCan I forward the input to the output with just an sc_signal object (i.e., do not create a method with a sensitivity list for the input)? \n\nsc_signal<bool> net;\n....\n\n// in the constructor:\nip(net);\nop(net);" ]
[ "systemc" ]
[ "Ruby 1.9.3 memory issue", "We're having many automation libraries which can automate devices and we have some automation scripts which are running from a decade. \n\nRecently we are trying to integrate multiple devices and perform automation. When we run our scripts which independent to specific device separately we don't have any issue, but when we run the scripts which are specific to more than device we are facing the issue.\n\nIssue:\n\nDuring the batch executions after a specific point (after execution of 5 or 6 scripts) the execution got terminated without any error.\n\nLater on our investigation we found that memory lagging could be issue and we have increased the Heap size of ruby, but still no luck.\n\nThis is how we have increased the Heap slots and size." ]
[ "ruby", "memory-management", "heap-memory", "ui-testing" ]
[ "Anybody know a simple base64 conversion site?", "I need to convert some images to base64 for embedding into my CSS... anyone know a simple site that will allow me to simply enter a URI and have it convert so I can copy-paste into my code?" ]
[ "css", "base64" ]
[ "Check if user refreshed, went back, closed browser etc.. socket.io", "I have an application where I use socket.io alongside node.js. I can't find / figure out a way to check for events when users leave application i.e. close browser, refresh page, go back etc.. every one is connected in specific room. I need to know when someone leaves the room, know what their socket.io id was etc.. is there a method to achieve this?" ]
[ "javascript", "node.js", "sockets", "websocket", "socket.io" ]
[ "API for collect pearson correlation coefficients", "I make an app which shows graphs. I need to calculate pearson correlation coefficients in it. My question is:\nIs there an API or library can I use to calculatet it in Android or Java? \n\nThnank you all and Regardes" ]
[ "android" ]
[ "Button to display html code that is hidden?", "I am wondering if it is possible for once a user clicks on a button on a html/jsp website that something appears on the same page? So essentially some text is hidden until the button is click and then it will appear? I'm new to web dev so am unsure if this is even possible, thanks" ]
[ "java", "html", "web", "button" ]
[ "SQL Join on a column LIKE another column", "Possible Duplicate:\n mysql join query using like? \n\n\n\n\nI want to do a join where one column contains a string from another table's column:\n\nSELECT\na.first_name,\nb.age\nFROM names a\nJOIN ages b\nON b.full_name LIKE '%a.first_name%'\n\n\nIs this possible? I'm using MySQL. Of course the above query will not work since the LIKE '%a.first_name%' will just look for the string a.first_name, and not the column's actual value." ]
[ "mysql", "sql", "join", "sql-like" ]
[ "How to combine several annotation into one in Kotlin?", "I'm trying to validate RequestBody using my custom annotations.\n\nWith configuration below my validation works:\n\ndata class PlayerRegistration(\n @field: Email\n val email: String,\n @field: Pattern(regexp = NICK_REGEX)\n @field: Size(min = 5, max = 15)\n val nick: String,\n @field: Pattern(regexp = PASSWORD_REGEX)\n @field: Size(min = 8, max = 20)\n val password: String,\n val birthDate: LocalDate\n)\n\n\nBut when I try to sum up annotations like this:\n\ndata class PlayerRegistration(\n @field: Email\n val email: String,\n @field: ValidNick\n val nick: String,\n @field: ValidPassword\n val password: String,\n val birthDate: LocalDate\n)\n\n@Pattern(regexp = NICK_REGEX)\n@Size(min = 5, max = 15)\n@Target(AnnotationTarget.FIELD)\nprivate annotation class ValidNick\n\n@Pattern(regexp = EMAIL_REGEX)\n@Size(min = 8, max = 20)\n@Target(AnnotationTarget.FIELD)\nprivate annotation class ValidPassword\n\n\nIt doesn't work. What am I doing wrong?" ]
[ "kotlin" ]
[ "Load external css with font-face", "I know that font-face does not allow an external url to the font in some browsers (for example, this will not work in Firefox).\n\nBut lately I discovered the plugin \"video-js\" which helps you embed videos in a video player. The css file from that plugin contains a font called vjs.\n\nWhy can I use their hosted version and their custom font \"vjs\" still works on my website server1.example.com?\n\n<link href=\"http://vjs.zencdn.net/4.1/video-js.css\" rel=\"stylesheet\">\n<script src=\"http://vjs.zencdn.net/4.1/video.js\"></script>\n\n\nAs soon as I host the css on my second webserver server2.example.com, it will not work anymore until I move the file back to server1.example.com or use the hosted version by zencdn. \n\nWhy is that? Did they modify some settings in their web server?" ]
[ "css", "url", "font-face", "external", "absolute" ]
[ "mysqldump error 2003 Can't connect to MySQL server ... (110)", "I don't think this is a dup question as I have read other posts about error 2003 and none resolve my situation.\n\nI have a bash script that executes mysqldump on a nightly basis against many tables in an Amazon RDS database. It has worked without issue for months, but recently, I've started seeing errors. Example results for a recent week:\n\nDay 1: success\nDay 2: success\nDay 3:\n TBL citygrid_state: export entire table\n TBL ci_sessions: export entire table\nmysqldump: Got error: 2003: Can't connect to MySQL server on 'blah' (110) when trying to connect\n... wrlog crit forced halt\nDay 4: success\nDay 5:\n TBL sparefoot.consumer_lead_action_meta: export entire table\n TBL sparefoot.consumer_lead_action_type: export entire table\nmysqldump: Got error: 2003: Can't connect to MySQL server on 'blah' (110) when trying to connect\n... wrlog crit forced halt\n\n\nSince the script works completely some nights and the calls to mysqldump work dozens of times before an error occurs, my thought is that I have a timeout problem. But where? Might it be a MySQL setting? Or does the issue lie elsewhere?\n\nSome of the MySQL timeout settings:\n\n connect_timeout 10\n interactive_timeout 14400\n net_read_timeout 30\n net_write_timeout 60\n wait_timeout 28800" ]
[ "mysql", "mysqldump", "connection-timeout" ]
[ "Remove a MongoDB Document using Express JS", "I have careted an application that interacts with MongoDb using NodeJS (Express JS). I am trying to remove a document using the \"_id\" (the one generated by MongoDB). The following piece of code just logs \"Deleted Successfully\", but does not actuall remove the record:\n\napp.post('/TaskDone', function (req, res) {\n var mongo = require('mongodb'),\n Server = mongo.Server,\n Db = mongo.Db;\n var server = new Server('localhost', 27017, { auto_reconnect: true });\n var database = new Db('pending-list-2', server);\n database.open(function (err, db) {\n if (!err) {\n console.log(\"Connected for Deletion\");\n db.collection('tasks', function (err, coll) { \n var str = \"{_id :\"+\"ObjectId(\" + \"\\\"\" + req.body + \"\\\"\" + \")\" + \"}\";\n console.log(str);\n coll.remove(str, function (err) {\n if (err) console.log(err);\n else console.log(\"Deleted successfully\"); \n }\n );\n });\n }\n });\n});\n\n\nIf I use the MongoDB client and just run db.tasks.remove({_id:ObjectID(\"idhere\")}) , it works. Is there something wrong with the express js code that I have written. I have tried a lot of things but nothing seems to work." ]
[ "node.js", "mongodb", "express" ]
[ "Why do integers have to be converted to strings before they can be used to access items in a collection?", "I am new to VB in general. I am going through some old VB code and I see statements like - \n\n Addr.AddrType(CStr(0)).A_Type = \" \"\n\n\nWhy does the integer 0 have to be converted to a string? \n\nNote that Addr is defined as\n\n Public Addr As clsAddressDetail \n\n\nAddrType is defined as a collection\n\n Public AddrType As New Collection" ]
[ "collections", "vb6" ]
[ "Compiler flags in Eclipse", "My build requires that I issue the following commands:\n\n$ g++ sniff.cpp -o sniff -lcrafter \n\n\nHowever, in my Eclipse build, all the complier gets is:\n\ng++ -o \"sniffer_crafter\" ./src/sniffer_crafter.o \n\n\nAfter getting these commands it complains that I have an undefined reference to the library Crafter.\n\nHow can I resolve this linking issue using Eclipse? I have seen others answers to similar questions, but they don't seem to address Eclipse's current layout. I'm using the most recent edition of Eclipse Kepler." ]
[ "c++", "eclipse", "linker", "compiler-flags" ]
[ "Text output from html document to php form", "I want separate html-documents to use the same php-file for the email-functionality. Therefore I need to import some plain text from the relevant html-document and into the php-form. \n\nWith this code..: \n\n $email_message = \"Thank you for your request on $htmltextid .\\n\\n\";\n\n\n..it's no problem to include outputs from the text-fields to the email: \n\n<input name=\"htmltextid\" id=\"htmltextid\" type=\"text\" placeholder=\"Some text\" />\n\n\nBut when I try to include some text outside the text-fields, the result is some empty space in the email: \n\n<H1 id=\"htmltextid\">flying pigs</H1> \n\n\nI've tried similar with \"p\" and \"span\" too. \n\nAny help would be highly appreciated!" ]
[ "php", "html", "text", "output" ]
[ "Trying to replicate custom titles in new version of Fancybox", "In the old version of Fancybox, I was able to find a code that would allow me custom titles for individual images. But upgrading to Fancybox v.2, I can't figure out how to update the function so it will still work. Yes, I'm a newbie. Help, or a link, would be greatly appreciated.\n\nOld code...\n\n<script type=\"text/javascript\">\n $(document).ready(function() {\n\n $(\"a[rel=blanchard_group]\").fancybox({\n 'transitionIn' : 'fade',\n 'transitionOut' : 'fade',\n 'titlePosition' : 'over',\n 'titleShow' : 'true',\n 'overlayShow' : 'true',\n 'overlayColor' : '#fff',\n 'overlayOpacity' : '0.9',\n 'showNavArrows' : 'true',\n 'enableEscapeButton' : 'true',\n 'scrolling' : 'no',\n 'onStart':function(currentArray,currentIndex,currentOpts){\n var obj = currentArray[ currentIndex ];\n if ($(obj).next().length)\n this.title = $(obj).next().html();},\n 'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {\n return '<span id=\"fancybox-title-over\">' + title + '</span>';\n }\n });\n });\n</script>\n\n\nNew code ...\n\n <script type=\"text/javascript\">\n$(document).ready(function() {\n $(\".fancyproject\").fancybox({\n prevEffect : 'fade',\n nextEffect : 'fade',\n nextClick : true,\n helpers : {\n title : {\n type : 'inside'\n },\n overlay : {\n opacity : 0.9,\n css : {\n 'background-color' : '#fff'\n }\n },\n thumbs : {\n width : 50,\n height : 50\n }\n }\n });\n\n});\n</script>" ]
[ "jquery", "fancybox" ]
[ "Compiling with boost regex C++", "I used boost::regex before, on my old computer, but now I can't figure out how to be able to use it.\n\nI have problems with the linker, I'm getting :\n\n||=== Build: Release in regex test (compiler: GNU GCC Compiler) ===|\nC:\\boost\\stage\\lib\\libboost_regex-mgw53-mt-1_63.a(regex.o)||duplicate section `.rdata$_ZTSN5boost16exception_detail19error_info_injectorISt13runtime_errorEE[__ZTSN5boost16exception_detail19error_info_injectorISt13runtime_errorEE]' has different size|\nC:\\boost\\stage\\lib\\libboost_regex-mgw53-mt-1_63.a(regex.o)||duplicate section `.rdata$_ZTSN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEEE[__ZTSN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEEE]' has different size|\nC:\\boost\\stage\\lib\\libboost_regex-mgw53-mt-1_63.a(regex.o)||duplicate section `.rdata$_ZTVN5boost16exception_detail19error_info_injectorISt13runtime_errorEE[__ZTVN5boost16exception_detail19error_info_injectorISt13runtime_errorEE]' has different size|\nC:\\boost\\stage\\lib\\libboost_regex-mgw53-mt-1_63.a(regex.o)||duplicate section `.rdata$_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEEE[__ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEEE]' has different size|\nC:\\boost\\stage\\lib\\libboost_regex-mgw53-mt-1_63.a(cpp_regex_traits.o)||duplicate section `.data$_ZZN5boost16cpp_regex_traitsIcE21get_catalog_name_instEvE6s_name[__ZZN5boost16cpp_regex_traitsIcE21get_catalog_name_instEvE6s_name]' has different size|\nobj\\Release\\main.o:main.cpp:(.text$_ZNK5boost16re_detail_10630031cpp_regex_traits_implementationIcE18lookup_collatenameEPKcS4_[__ZNK5boost16re_detail_10630031cpp_regex_traits_implementationIcE18lookup_collatenameEPKcS4_]+0x80)||undefined reference to `boost::re_detail_106300::lookup_default_collate_name(std::string const&)'|\nobj\\Release\\main.o:main.cpp:(.text$_ZN5boost16re_detail_10630018basic_regex_parserIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE4failENS_15regex_constants10error_typeEiSsi[__ZN5boost16re_detail_10630018basic_regex_parserIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE4failENS_15regex_constants10error_typeEiSsi]+0x1d4)||undefined reference to `boost::regex_error::regex_error(std::string const&, boost::regex_constants::error_type, int)'|\n||error: ld returned 1 exit status|\n||=== Build failed: 3 error(s), 5 warning(s) (0 minute(s), 0 second(s)) ===|\n\n\nThe code is this :\n\n#include <boost/regex.hpp>\n\nint main()\n{\n boost::regex test(\"test\");\n return 0;\n}\n\n\nI am linking C:\\boost\\stage\\lib\\libboost_regex-mgw53-mt-1_63.a, and the search directory is C:\\boost.\n\nI am compiling using Code Blocks for your info.\n\nI compiled, or \"made\" the libs with mingw/gcc, and actually I tried a lot of things... I also downloaded and installed mingw, even if I already had it with Code Blocks, and I \"made\" the libs with the one I installed later. (the path for mingw is set to there)." ]
[ "c++", "boost" ]
[ "Show a new empty Sales Order after creating one", "My client creates many sales order and it is boring for him to see the sale order he has just created. He would like when he clicks on the save button, to be presented with a new view of sales order (like when he clicks on 'create' button)\nI have overridden the function for creation of sales order in my custom module and try to return a new views of sale order.\n\nIt does not work, I don't know if is the good way.\n\nThanks for your help\n\nThis is my code :\n\nfrom openerp.osv import osv, fields\nclass sale_order(osv.osv):\n _inherit = \"sale.order\"\n def create(self, cr, uid, vals, context=None):\n super(sale_order, self).create(cr, uid, vals, context=context)\n return {\n 'type': 'ir.actions.act_window',\n 'view_type': 'form',\n 'view_mode': 'form',\n 'res_model': 'sale.order',\n 'context': context,\n 'target': 'new',\n }" ]
[ "openerp", "odoo-8" ]
[ "C sprintf breaks with byte parameters (Keil compiler)", "I have code running in 2 projects/platforms. It works in one, not the other. Code is like this:\n\nuint8_t val = 1;\nuint8_t buff[16];\nsprintf(buff, \"%u\", val);\n\n\nThe expected output is \"1\" (gcc) but on one compiler (Keil) it returns \"511\", which in hex is 0x1FF. Looks like its not promoting the byte to int with this compiler. This is confirmed because it works ok if I do this:\n\nsprintf(buff, \"%u\", (int)val);\n\n\nMy question is this: why does one compiler do what I consider the 'right thing', and one does not? Is it my incorrect expectations/assumptions, a compiler setting, or something else?" ]
[ "c", "gcc", "printf", "keil", "integer-promotion" ]
[ "How to get data from a database created in salesforce in android?", "I am trying to fetch data from a database which has been created in salesforce, I haven't worked on it before and have no idea that how can I access that database. Can anybody tell me any reference or any idea that how can I achieve that." ]
[ "android", "salesforce" ]
[ "NodeJS memory growth (memory leak)", "I am working on my NodeJS app, and I can see the growth of memory consumption is about 100 kb per hour.\nWhen I do profiling with --inspect node flag and analyse heap dumps in chrome-devtools\n\n\n\nit shows that \"code\" section on \"statistic\" view is constantly growing:\n\n \n\n\nSo, is it a memory leak, or is it ok for node?\nThe application is idling, I do not do any special actions." ]
[ "javascript", "node.js", "memory-leaks", "google-chrome-devtools" ]