texts
sequence
tags
sequence
[ "Xamarin BeginInvokeOnMainThread without Xamarin.Forms", "Sorry for what I'm sure will turn out to be a very stupid question..\n\nI am using Android UI not Xamarin Forms for the presentation layer in my Xamarin app, but I want to use the Activity.RunOnUIThread (from Android), which all Xamarin docs suggests is Device.BeginInvokeOnMainThread (from the Xamarin.Forms) project. Obviously I don't have this available since I don't have a reference on the xamarin.forms project.\n\nWhere do I find the run-on-ui-thread mechanism in Xamarin if I don't want to use Forms?" ]
[ "xamarin", "xamarin.forms", "xamarin.android" ]
[ "Instantiating instances of classes stored in HashMap", "I wanted to created an Enum where each enum object will be mapped to an event, and would have a class associated with each event.\nA factory class would return an instance of correct class based on event type. This is what i am trying to do:\n\nEnum:\n\npublic Enum Event{\n\n EVENT_1(\"First Event\",EventProcessor1.class);\n private final String eventType;\n private final Class<? extends IEventProcessor> processorClass;\n Event(String eventType, Class<? extends IEventProcessor> processorClass){\n {\n this.eventType = eventType;\n this.processorClass = processorClass;\n }\n // getters setters ignored\n ....\n}\n\n\nFactory:\n\npublic class EventFactory{\n ....\n public static IEventProcessor getEventProcessor(Event e){\n return e.getProcessorClass.newInstance();\n }\n ....\n}\n\n\nThe line where i create a new instance shows no compilation issues but throws Instantiation Exception. So my questions are:\n Why the Exception?\n Any alternative way to accomplish this?\n\n[IEventProcessor is the interface implemented by all EventProcessor classes]" ]
[ "java", "generics", "reflection", "enums", "factory" ]
[ "ActiveMQ + REST + Java environment creation", "I got several questions regarding this issue\n\n1) ActiveMQ after installed and started also starts Jetty? Jetty is running on port 80?\n(the environment where my application is going to be installed already running Apache, so there can't be another web server on port 80...)\n\n2) I have managed successfully post and get messages from queue using java on my machine using following url: http://localhost:8161/demo/message/FOO/BAR. Application will be running on remote machine, where only port 80 is opened.. Is it possible with JAX-RS to create restful web service, which is going to serve queue content on port 80 when I'm just going to access for example the following url: /demo/message/FOO/BAR ?\n\n3) Is there a lot of complex configuration needed to be done on web.xml of ActiveMQ or another files to make this working?\n\nThanks a lot!" ]
[ "java", "jms", "activemq" ]
[ "Cannot access a disposed object while using OracleCommand in using loop. The async method is called through Task.Run() many times", "This ia my async method which is called 1 000 000 times through Task.Run() and checking each task status later time:\n\nprivate static async Task ExecuteOracleCommandAsync(DataTable schemaTable, OracleConnection oraConn, string insertString, object[][] obj, OracleParameter[] param)\n {\n using (OracleCommand cmd = oraConn.CreateCommand())\n {\n cmd.CommandText = string.Concat(insertString, \")\");\n cmd.ArrayBindCount = obj[0].Length;\n\n for (int i = 0; i < schemaTable.Rows.Count; i++)\n {\n cmd.Parameters.Add(param[i]);\n }\n\n await cmd.ExecuteNonQueryAsync();\n }\n }\n\n\nI get the error:\n\n\n C# TPL issue: Cannot access a disposed object while using OracleCommand in using loop" ]
[ "c#", "task-parallel-library" ]
[ "Lotus notes agent runs slower in server compared to development PC", "I have an attendance recording system that has 2 databases, one for current, another for archiving. The server processes attendance records, and puts records marked completed into the archive. There is no processing done in the archive database.\n\nHere's the issue. One of the requirement was to build a blank record for each staff every day, for which attendance records are put into. The agent that does this calls a few procedures and does some checking within the database. As of current, there are roughly 1,800 blank records created daily. On the development PC, processing each records takes roughly 2 to 3 seconds, which translates to an average of an hour and a half. However, when we deployed it on the server, processing each records takes roughly 7 seconds, roughly translates into 3 and a half hours to complete. We have had instances when the agent takes 4.5 to 5 hours to complete. \n\nNote that in both instances, agents are scheduled. There are no other lotus apps in the server, and the server is free and idle most of the time (no other application except Windows Server and Lotus Notes). Is there anything that could cause the additional processing time compared on the development PC and the server?" ]
[ "lotus-notes", "lotus-domino", "lotus", "lotusscript" ]
[ "Remove an key value from an object in react js", "I have an object in the state ,\n\nthis.state = {\n selectedValue: {}\n}\n\n\nNow,Here I am adding a property to this by object in the following way\n\nif (e.currentTarget.checked) {\n this.setState({\n selectedType: {\n ...this.state.selectedType,\n [resumeId]: type\n }\n })\n\n\nNow, In else part I have to remove the property with the matching resumeId.\n\nOr Do I need to create an array of objects ? I am kind of confused here. \n\nCan any one help me with this ?" ]
[ "javascript", "arrays", "json", "reactjs" ]
[ "show only sub categories in wordpress", "I need to show the category thumb and description of custom taxonomy. lets say I have this:\n\n<ul>\n<li>Cars\n <ul>\n <li>Electric cars</li>\n <li>foo cars\n <ul>\n <li>Toyota</li>\n <li>Nissan</li>\n </ul>\n </li>\n </ul>\n</li>\n</ul>\n\n\nAnd what i need is to show the thumb and description of the subcategories electric cars and foo cars, not the post inside them.\n\nAnyone can guide me, where i can looking foor?\n\nTks" ]
[ "wordpress", "taxonomy" ]
[ "Setup Gist extension for VS Code", "I'm trying to use the Gist extension for VS Code.\n\nI did the following steps:\n\n\nInstall extension\nGIST: select profile\nCreate New Profile -> Github.com (common)\nOn Github, I created a new access token, then I copied the token and I pasted it on VS Code\n\n\nWhen I do GIST: open gist I have no gist in the list, but on Github I have 3 secret gists.\n\nWhy? What am I doing wrong?" ]
[ "github", "visual-studio-code", "gist" ]
[ "JProfiler Negates -parameter Compiler Argument", "I am using JDBI for database access. As recommended, I am using the -parameter compiler argument to allow JDBI to get parameter names via reflection. This works perfectly well. Except that, if I try to profile the running code using JProfiler in full instrumentation mode, JDBI seems to lose the ability to resolve the parameter names. It seems strange to me that JProfiler is interfering with compilation instructions, but, nonetheless that appers to be the case. The precise error I get from JDBI is:\n\njava.lang.IllegalArgumentException: Instance factory 'public MyClass(int,long,java.lang.String,java.lang.String,int,java.lang.String,long,long,boolean,boolean,boolean,boolean)' could not match any parameter to any columns in the result set. Verify that the Java compiler is configured to emit parameter names, that your result set has the columns expected, annotate the parameter names explicitly with @ColumnName, or annotate nullable parameters as @Nullable\n\n\nIs there any way to configure JProfiler to prevent it from causing this error?" ]
[ "java", "jprofiler", "jdbi" ]
[ "Kafka Acknowledgment vs Kafka commit", "What is the difference between Kafka Acknowledgment and Kafka consumer commitSync ()\n\nBoth are used for purpose of manual offset management, and hope both works Synchronously.\n\nPlease assist" ]
[ "apache-kafka", "kafka-consumer-api", "spring-kafka" ]
[ "Interact with executables over server in Python?", "I want to run an executable on a TCP server and take its input from socket connections interactively and send the output back to the client until the executable is terminated. I was trying it with piping through Popen class of subprocess but its not helping with interaction with executable ( its just take input only one time but i want the input to be taken all the time until program exits ).\n\nSuppose I send \"1\" input to the server then server must send the stdout corresponding to \"1\" input to client and then ask for next input and do it till the executable exits in continuation ." ]
[ "python", "subprocess", "popen" ]
[ "How to validate fields of request body in SpringBoot controllers (customize Jackson)", "SpringBoot controller consumes @RequestBody that is a bean class, for example it's a class Basket with a list of fields. Some of these fields are read-only, and I want to throw an exception when user tries to send a request to update them. \n\nI use custom @ReadOnly annotation to mark read-only fields of class Basket. I want to customize Jackson in a way when Jackson constructs object Basket - it should analyze bean with annotations and throw an exception when incoming JSON contains read only fields. \n\nPlease do not advice JSR-303 Bean Validation." ]
[ "java", "json", "spring", "jackson" ]
[ "XML QDomElement comparison made general - C++/Qt", "I implemented a routine C++/Qt to compare QDomElement in most general case. \n\nbool XMLtools::compare( QDomElement & element1, QDomElement & element2 )\n{\n QString tag1 = element1.tagName() ; \n QString tag2 = element2.tagName() ;\n if ( tag1 != tag2 )\n return false ;\n QList<QDomElement> elts1 = getChildElements(element1);\n QList<QDomElement> elts2 = getChildElements(element2);\n QDomElement c1, c2, tmp ;\n\n QString name1, name_tmp, text1, text2 ;\n if(elts1.size() != elts2.size())\n return false ;\n if(elts1.size() == 0)\n {\n text1 = c1.text() ;\n text2 = c2.text() ;\n\n if( text1 != text2 )\n return false ;\n }\n for ( int i = elts1.size() - 1 ; i > -1 ; i-- ) \n {\n c1 = elts1.at(i);\n QString name1 = c1.tagName();\n\n for( int j = elts2.size() - 1 ; j > -1 ; j-- )\n {\n tmp = elts2.at(j) ;\n name_tmp = tmp.tagName() ;\n\n if( name_tmp == name1 )\n {\n c2 = tmp ;\n break ;\n }\n\n if( j == 0 )\n return false ; \n }\n if ( ! compare(c1, c2) )\n return false ; \n }\n return true ;\n}\n\n\n1. Can all QDomNode elements be compared using this method (ie. comparing text()) ?\n\n\nIn particular, should i be cautious with special cases, as QDomCDATASection elements and binary format ?\nif a QDomNode contains binary data, how to comare them, returning true when same data is inside ?\n\n\nThanks !" ]
[ "c++", "xml", "qt", "parsing", "binary" ]
[ "Mongoose is Returning an Empty Array", "This question has been asked a few times by others and I haven't found an answer that is working for me. I built this app as a personal project, but when I migrated to a new machine I had to rebuild the database. The app is getting a connection confirmation, but it is returning a 200 status code with an empty array. I know the API should work because it did on my other machine. I'm wondering if I did something wrong when I created the documents in the Mongo Shell. Unfortunately I no longer have access to the original database to compare the formatting. Here are some code snippets.\nSchema\nconst mongoose = require('mongoose');\n\nconst recipeSchema = new mongoose.Schema({\n recipeName: {\n type: String,\n required: true\n },\n ingredients: {\n type: String,\n required: true\n },\n instructions: {\n type: String,\n required: false\n }\n});\n\nconst itemSchema = new mongoose.Schema({\n listItem: {\n type: String,\n required: true\n },\n listQuantity: {\n type: Number,\n required: false\n },\n listUnitOfMeasure: {\n type: String,\n required: false\n },\n listItemComplete: {\n type: Boolean,\n required: true\n }\n})\n\nconst chefSchema = new mongoose.Schema({\n chefName: {\n type: String,\n required: true\n },\n recipe: [recipeSchema],\n item: [itemSchema] //put this here until multiple shopping lists are enabled.\n});\n\nmongoose.model('Recipe', recipeSchema);\nmongoose.model('Item', itemSchema);\nmongoose.model('Chef', chefSchema);\n\nController\nconst mongoose = require('mongoose');\nconst Chf = mongoose.model('Chef');\n\nconst chefGetAll = (req, res) => {\n console.log('fetching API method chefGetAll');\n Chf.find({})\n .exec((err, chef) => {\n if (!chef) {\n return res\n .status(404)\n .json({\n "message": "Chef not found"\n });\n } else if (err) {\n return res\n .status(404)\n .json(err);\n } else {\n console.log('The chef is', chef);\n return res\n .status(200)\n .json(chef);\n }\n });\n};\n\nmodule.exports = {\n chefGetAll\n};\n\nDB documents from Mongo Shell\n> db.chef.find().pretty()\n{\n "_id" : ObjectId("5fbad08d54734cb04d7ff5bc"),\n "chefName" : "Jon",\n "recipe" : [\n {\n "recipeName" : "Cereal",\n "ingredients" : "Milk and Cereal",\n "instructions" : "Pour cereal into bowl. Add milk and serve.",\n "_id" : ObjectId("5fbadae154734cb04d7ff5bf")\n },\n {\n "recipeName" : "Brownies",\n "ingredients" : "2 large eggs, 1 stick of butter and brownie mix",\n "instructions" : "Melt butter and mix with eggs and brownie mix. Bake at 425 degrees for 30 minutes.",\n "_id" : ObjectId("5fbc5f687429f588d949a3e9")\n }\n ],\n "item" : [\n {\n "listItem" : "Oreo",\n "listQuantity" : 1,\n "listUnitOfMeasure" : "pack",\n "listItemComplete" : false,\n "_id" : ObjectId("5fbae17b54734cb04d7ff5c0")\n },\n {\n "listItem" : "Butter",\n "listQuantity" : 1,\n "listUnitOfMeasure" : "pack",\n "listItemComplete" : false,\n "_id" : ObjectId("5fbc5f877429f588d949a3ea")\n }\n ]\n}\n{ "_id" : ObjectId("5fc5a1270477072a44385926"), "chefName" : "Martha" }" ]
[ "mongodb", "api", "express", "mongoose", "mongoose-schema" ]
[ "Image::load_from_memory() Error Cannot fill whole buffer", "I have a method where I load an image from a request, to resize and upload to s3.\nHere is the code of the resizing function :\npub fn generate_size(self, new_w: f32, data: Vec<u8>) -> ImageResult<Vec<u8>> {\n let img = image::load_from_memory(&data)?; // Error here, cannot fill whole buffer.\n let mut result: Vec<u8> = Vec::new();\n\n let old_w = img.width() as f32;\n let old_h = img.height() as f32;\n let ratio = new_w.clone() / old_w;\n let new_h = (old_h * ratio).floor();\n\n let scaled = img.resize(new_w as u32, new_h as u32, image::imageops::FilterType::Lanczos3);\n scaled.write_to(&mut result, ImageOutputFormat::Jpeg(90)).expect("Failed to write image to result");\n\n Ok((*result).to_vec())\n}\n\nIt happens with images with a size bigger than ~200kb on my server.\nI wonder if it is a ram space issue. I'm stuck on this error, the documentation does not mention it." ]
[ "rust" ]
[ "docker - jwilder/nginx-proxy, container create issue", "After updating dockeron Version 18.03.0-ce-win59 (16762), jwilder/nginx-proxy doesn't running.\n\ni'm currently working on WINDOWS 10 and DOCKER VERSION:18.03.0-ce-win59 (16762).\nAnd Here is my docker Compose file.\n\nversion: \"3.1\"\n\nservices:\n\n #docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock jwilder/nginx-proxy \n proxy-server:\n image: jwilder/nginx-proxy\n container_name: proxy-server\n ports: \n - 80:80\n volumes: \n - /var/run/docker.sock:/tmp/docker.sock\n networks:\n - development_network\n\n\nand the error is:\n\n\n ERROR: for proxy-server Cannot create container for service\n proxy-server: b'Mount denied:\\nThe source path\n \"\\\\var\\\\run\\\\docker.sock:/tmp/docker.sock\"\\nis not a valid\n Windows path' ERROR: Encountered errors while bringing up the project." ]
[ "docker", "jwilder-nginx-proxy" ]
[ "R Faster way to create lag by entire group using data.table", "I have a simple data.table as follows-\n ID = c(rep("A", 1000), rep("B", 1000), rep("C", 1000), rep("D", 1000))\n val = c("a", "a", "a", "b", "b", "c", "c","d","d","d","d","e","e","f","f","g","g","g","g","g")\n\n dt = data.table(ID, val)\n\nI want to add a new column to this data.table which will have the lag of val by group ID.\nHere is the expected output\n> head(dt, 20)\n ID val val_lag\n 1: A a <NA>\n 2: A a <NA>\n 3: A a <NA>\n 4: A b a\n 5: A b a\n 6: A c b\n 7: A c b\n 8: A d c\n 9: A d c\n10: A d c\n11: A d c\n12: A e d\n13: A e d\n14: A f e\n15: A f e\n16: A g f\n17: A g f\n18: A g f\n19: A g f\n20: A g f\n\nThe current solution I am using is -\ndt[, val_lag := with(rle(val), rep(c(NA, head(values, -1)), lengths)), by = ID]\n\nHowever, this solution is super slow on the actual dataset, which is very large and has millions of rows. Is there any faster way to solve this problem?\nFollowing is the performance result of all methods discussed in this post -\n microbenchmark::microbenchmark(rles = dt[, val_lag1 := with(rle(val), rep(c(NA, head(values, -1)), lengths)), by = ID],\n chinsoon = dt[, val_lag := shift(val)[nafill(replace(seq.int(.N), rowid(rleid(val)) > 1L, NA_integer_), "locf")], by = ID],\n TiC = dt[, val_lag3 := c(NA,rle(val)$values)[cumsum(c(0,head(val,-1)!=tail(val,-1)))+1], by = ID],\n times = 1000\n )\n\nUnit: milliseconds\n expr min lq mean median uq max neval cld\n rles 1.549548 1.781014 2.750187 2.096805 2.743668 46.65326 1000 a \n chinsoon 1.766827 2.060233 3.059109 2.379477 3.077080 67.16040 1000 a \n TiC 1.986808 2.226933 3.472451 2.624236 3.397165 60.67802 1000 b\n\nThanks!" ]
[ "r", "data.table" ]
[ "What is the correct way to terminate all threads that are 'sub' to main", "I am running multiple threads, and when one of the threads sets the global function '$trade_executed' to true I want it to kill all other threads and remove them from the global '$threads' array.\n\nThen I restart the thread creation process.\n\nBelow is a simplified version of my codebase.\n\n3 Threads are created and it looks like 2 threads are deleted but a third thread stays. (for reasons unknown) \n\nIdeally this script would never print '2' or '3' because it would always trigger at '1' minute and kill all threads and reset. \n\n*\nthr.exit is preferred. I don't want any code pushed from other threads with a thr.join after $trade_executed is set\n\nrequire 'thread'\n\nclass Finnean \n def initialize\n @lock = Mutex.new\n end\n\n def digger(minute) \n sleep(minute * 60)\n coco(minute)\n end \n\n def coco(minute) \n @lock.synchronize {\n puts \"coco #{minute}\"\n\n $threads.each do |thr|\n next if thr == Thread.current\n thr.exit\n end\n $trade_executed = true\n Thread.current.exit \n } \n end \nend\n\nminutes = [1, 2, 3]\n$threads = Array.new \n$trade_executed = false \nabc = Finnean.new\n\ndef start_threads(minutes, abc)\n minutes.each do |minute|\n $threads << Thread.new {abc.digger(minute)}\n puts minute\n end\nend\n\nstart_threads(minutes, abc)\n\nwhile true\n if $trade_executed != false then \n count = 0\n $threads.map! do |thr|\n count += 1\n puts \"#{thr} & #{thr.status}\"\n thr.exit\n $threads.delete(thr)\n puts \"Iteration #{count}\"\n end\n\n count = 0\n $threads.each do |thr|\n count += 1\n puts \"#{thr}\" ##{thr.status}\n puts \"Threads Still Left: #{count}\"\n end \n\n $trade_executed = false\n abc = Finnean.new\n start_threads(minutes, abc)\n end\nend" ]
[ "ruby", "multithreading" ]
[ "Finding the average of the three smallest values in range - Unexpected Compile Error", "I am trying to find the average value of the three smallest values in a range. To do so, I am combining the Average and Small function as seen below.\n\nI've based my attempt on the 4th reply on this oz forum post, (https://www.ozgrid.com/forum/forum/help-forums/excel-general/13081-searching-range-for-lowest-three-values), but keep getting a compile error that highlights the \":\" between A2 and A10 where I'm defining my range. \n\ndim threeminavr AS single\n\nthreeminavr = WorksheetFunction.Average(Small(A2:A10,1), Small(A2:A10,2), Small(A2:A10,3))\n\n\nAny ideas?" ]
[ "excel", "vba" ]
[ "Multiple ManyToMany relationships using \"mappedBy\" with Super class member", "I am developing an application using Hibernate and am trying to model the following scenario:\n\nI have an Activity Abstract class, defined as follows:\n\n@Entity\n@Inheritance(strategy=InheritanceType.SINGLE_TABLE)\n@DiscriminatorColumn(name=\"activityType\")\n@Table(name = \"BF_ACTIVITY\")\npublic abstract class Activity extends PersistableObject {\n\n @ManyToOne\n @JoinColumn(name = \"ASSIGNED_TO\")\n protected Contactable assignedTo;\n\n @ManyToOne\n @JoinColumn(name = \"RAISED_BY\")\n protected Contactable raisedBy;\n\n\nNote I am using Single Table inheritance (so all implementing objects will use the same table) and have set a DiscriminatorColumn.\n\nNow I have two objects that extend Activity: ToDo and Status:\n\n@Entity\n@Table(name = \"BF_TODO\")\n@DiscriminatorValue(\"Todo\")\npublic class ToDo extends Activity {\n...\n\n\n@Entity\n@Table(name = \"BF_STATUS\")\n@DiscriminatorValue(\"Status\")\npublic class Status extends Activity {\n...\n\n\nAgain note that for both implementations i have set a DiscriminatorValue.\n\nFinally, I want to have a Person object, and the person can have a list of Status and a list of ToDo - I also want to capture the bi-directional relationship, so am modelling it using the mappedBy configuration, but in both cases using the \"raisedBy\" field that exists in the super class \"Activity\":\n\npublic abstract class Person {\n\n @ManyToMany(mappedBy=\"raisedBy\", targetEntity=Activity.class)\n private List<ToDo> todoItems = new ArrayList<ToDo>();\n\n\nAs i am using mappedBy with the member variable \"raisedBy\" from the super class I have also specified the targetEntity (otherwise it is not able to find the field in the ToDo object).\n\nThe problem is when I try to call getTodoItems() - it is actually just returning all \"Activity\" objects linked by \"raisedBy\" to the current person. e.g. it throws a cast exception because it is expecting the list of ToDos but Hibernate is returning Status objects in the list as well.\n\nI was hoping the mappedBy config along with DiscriminatorValue would be enough to make this work - has anyone come across this or resolved it?\n\nThanks\n\n\n\nEDIT\n\nI have just found this post:\n\nCan someone point me in the direction of a good @Where overview and example? could I just update my person as follows to use @Where with the discriminator column?\n\npublic abstract class Person {\n\n @ManyToMany(mappedBy=\"raisedBy\", targetEntity=Activity.class)\n @Where(clause=\"activityType=Todo\")\n private List<ToDo> todoItems = new ArrayList<ToDo>();" ]
[ "java", "hibernate", "inheritance", "one-to-many" ]
[ "Chrome Extension : read response.body of any post or get request using devtools.network api", "Currently trying to create a chrome extension which needs to listen to the page's HTTP requests, waiting for any response and get it .\ni know there is a way to do this with chrome.devtools.network api but i don't know where i strat .\nI can't seem to understand how to read the page's requests from my extension so what would be the best way of handling the situation?\nplease any help" ]
[ "javascript", "google-chrome", "http", "request" ]
[ "Find first element in array that matches a specific condition in Swift", "Let's say I have an array like so:\n\n[\n [\"required\": true],\n [\"required\": true],\n [\"required\": false],\n [\"required\": false],\n [\"required\": false],\n [\"required\": false],\n [\"required\": false]\n]\n\n\nI want to insert a new element into this array at the index where required first equals false (at position 2). I'm sure I could determine this using a basic for-each loop, e.g.:\n\nvar idx = 0\nfor (i, el) in myArray.enumerate() {\n if el[\"required\"] == false {\n idx = i\n break\n }\n}\n\n\nBut this doesn't seem very Swift-like. Is there a cleaner (i.e. less code) way of doing this in Swift 2? Perhaps something using filter or map?" ]
[ "ios", "arrays", "swift" ]
[ "why web service can't be accessed", "When i try to access web service from the development server, it returns the error below.\nWhen I access the same service from my local machine, it works fine.\nDo you have idea what might be the reason?\nThank you very much in advance!\n\nSystem.ServiceModel.ProtocolException: The remote server returned an unexpected response: (405) Method Not Allowed. ---> System.Net.WebException: The remote server returned an error: (405) Method Not Allowed.\n at System.Net.HttpWebRequest.GetResponse()\n at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)\n --- End of inner exception stack trace ---\n\nServer stack trace:\n at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)\n at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)\n at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)\n at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)\n at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)\n at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)\n\nException rethrown at [0]:\n at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)\n at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)\n at Portal.ExportSvcReference.IExportDataService.AddDataRequest(ExportData request)" ]
[ "c#", "asp.net-mvc-3", "wcf" ]
[ "Deploying Different Functions Depending on if the Second is Even or Odd", "I am trying to create a function that will depend on whether the time in seconds is currently even or currently odd. For some reason the pop-up is always giving me an “Odd” pop-up. I have a couple ideas of why that is, but I haven’t been able to fix it. Do you have any suggestions? Thanks for the help.\n\n <button onclick=\"myFunction()\">Seconds</button>\n<p id=\"seconds\"></p>\n<script>\n function myFunction() {\n var date = new Date();\n var seconds = date.getUTCSeconds();\n document.getElementById(\"seconds\").innerHTML = seconds;\n }\nfunction checkEven(seconds){\n return(seconds%2 == 0);\n}\nif(checkEven(seconds)){\n alert(\"Even\");\n}\nelse{\n alert(\"Odd\");\n}\n</script>`" ]
[ "javascript", "html" ]
[ "DAX LOOKUPVALUE on text/string", "I would like to create some kind of LOOKUPVALUE on text in DAX that will match a sentence with a particular keyword. For instance in the example below the second and third row have a hit because “Apple” and \"Chicken\" is in the string. The problem is that the text is in a string and not a standalone value.\n\nTable 1\n\n\n\nTable 2\n\n\n\nOutput" ]
[ "excel", "string", "text", "vlookup", "dax" ]
[ "If File = \"False\" Application.GetOpenFileName Error 13 Type Mismatch", "I'm working on a code that uses the Application.GetOpenFileName. Im trying to ensure that that code doesn't break if someone hits cancel when selecting a file. I have a if statement that states if file = \"false\" then show a msgbox and exit sub. This works fine when no file is selected, however when I run the macro with the files selected then I get a Type Mismatch error. Ive tried a bunch of different runarounds and nothing has worked. Ive looked at other similar questions on here but nothing has worked for me.\n\nDim nom As String\nDim wb1, wb2, wb3, wb4, wb5 As Excel.Workbook\nDim i, j, k, file As Variant\n\nnom = ActiveWorkbook.Name\nIf CurDir() <> CurDir(\"J:\") Then\n ChDrive \"J:\"\n ChDir \"J:FEA Material Data\"\nEnd If\nFor i = 1 To 5\nApplication.ScreenUpdating = False\nMsgBox (\"Select Compound\" & vbNewLine & vbNewLine & \"If Data From Criterion, Select Loading Only\" & vbNewLine & vbNewLine & \"If Data From Alliance, Select All\")\nfile = Application.GetOpenFilename( _\n FileFilter:=\"Text Files (*.csv), *.csv\", _\n MultiSelect:=True)\n If file = \"False\" Then\n MsgBox \"No File Selected\"\n Exit Sub\n Else\n counter = 1\n While counter <= UBound(file)\n Workbooks.Open file(counter)\n counter = counter + 1\n Wend\n End If \nmore code" ]
[ "vba", "excel", "macros" ]
[ "Unknown Provider in AngularJS when Injecting custom service into different module", "I am fairly new to AngularJS and have been working on trying to create a service that will wrap socket.io for a networking sandbox application.\n\nI have created a 'NetworkServices' module in a separate file:\n\n(function(){\n var app = angular.module('NetworkServices', []);\n app.factory('$socket', ['', function(){\n var Socket = {\n ip: '127.0.0.1',\n port: '8080',\n socket: null,\n Connect: function(ip, port, sock){\n Socket.ip = ip;\n Socket.port = port;\n Socket.log('Connecting to ' + Socket.ip + ':' + Socket.port);\n Socket.socket = window.io.connect(Socket.ip + ':' + Socket.port);\n sock = Socket.socket;\n }\n };\n return Socket;\n }]);\n})();\n\n\nAnd here is the module I am trying to inject the service into:\n\n(function(){\n var app = angular.module('server', ['ui.bootstrap', 'NetworkServices']);\n\n app.controller('ServerCtrl',['$scope','$socket', function ($scope, $socket) {\n var val = $scope;\n val.test = true;\n\n var self = this;\n self.isCollapsed = false;\n self.ip = '129.119.228.206';\n self.port = '8080';\n self.socket = {};\n\n self.Connect = function(){\n $socket.Connect(self.ip, self.port, self.socket);\n };\n }]);\n\n\n app.directive('server', function(){\n return {\n restrict: 'E',\n templateUrl: 'views/server.html',\n controller: 'ServerCtrl',\n controllerAs: 'server'\n };\n });\n\n\n})();\n\n\nWhen I add the $socket service to the server module, I get the following error:\n\nError: [$injector:unpr] Unknown provider: Provider <- <- $socket\n\n\nI have added the \"NetworkServices' Module as a dependency to the \"Server\" module, but I cant tell why I do not have access to the $socket service? Any suggestions?" ]
[ "javascript", "angularjs", "service", "socket.io" ]
[ "How can I Show the difference between values of two columns of devexpress gridview into anothere column", "I have a devexpress gridview in which there is a column containing textbox. Users will input integer values into the textbox. I want to show the differences between the given values(textboxes) and values of a column of the gridview into another column of the gridview. Client side is preferable. Can anyone help me?" ]
[ "javascript", "c#", "devexpress" ]
[ "CefSharp-WPF : Application is not rendered in other PC", "I am new on CefSharp so I followed the first tutorial of CefSharp-WPF that was made me creating a new application. \n\nHowever when I copied this application with folder in bin/x64/release directory to other pc, It opened the application but the page won't rendered.\n\nNeed I set something configs for launch other PC?\n\nHere is my code snippet. \n\n\n MainWindow.xaml.cs\n\n\nusing CefSharp;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing System.Windows.Media.Imaging;\nusing System.Windows.Navigation;\nusing System.Windows.Shapes;\nusing NetFwTypeLib;\n\nnamespace StocktalkPC\n{\n /// <summary>\n /// MainWindow.xaml에 대한 상호 작용 논리\n /// </summary>\n public partial class MainWindow : Window\n {\n public MainWindow()\n {\n\n var settings = new CefSharp.CefSettings\n {\n };\n settings.CefCommandLineArgs.Add(\"disable-gpu\", \"1\");\n Cef.Initialize(settings);\n\n InitializeComponent();\n }\n }\n}\n\n\n\n MainWindow.xaml\n\n\n<Window x:Class=\"StocktalkPC.MainWindow\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n xmlns:local=\"clr-namespace:StocktalkPC\"\n xmlns:cefSharp=\"clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf\"\n mc:Ignorable=\"d\"\n Title=\"MainWindow\" Height=\"700\" Width=\"1260\">\n <Grid>\n <cefSharp:ChromiumWebBrowser Grid.Row=\"0\"\n Address=\"http://pc.dev.stocktalk.kr:30802/webchat\" />\n </Grid>\n</Window>" ]
[ "wpf", "chromium-embedded", "cefsharp" ]
[ "Compile time triggered range check for std::vector", "The goal:\nI would like to have a range checked version of std::vector's operator [] for my debug builds and no range check in release mode.\nThe range check in debug mode is obviously good for debugging, but it causes a slowdown of 5% - 10% in my release code which I would like to avoid.\nPossible solutions:\nI found a solution in Stroustrup's "The C++ programming language". He did the following:\ntemplate <class T>\nclass checked_vector : public std::vector<T> {\n public:\n using std::vector<T>::vector;\n\n //override operator [] with at()\n};\n\nThis is problematic because it inherits from a class with non-virtual destructor which is dangerous. (And the Lounge was not too fond of that solution.)\nAnother idea would be a class like this:\ntemplate <class T>\nclass checked_vector {\n std::vector<T> data_;\n\n public:\n //put all public methods of std::vector here by hand\n\n};\n\nThis would be both tedious and create a large amount of copy-paste which is bad too.\nThe nice thing about both the above solutions is that I can simply toggle them on and off with a macro definition in my makefile.\nThe questions:\n\nIs there a better solution? (If not, why not?)\nIf not, is one of the above considered acceptable? (I know this one is opinion based, please focus on No. 1 if possible.)" ]
[ "c++", "c++11", "vector" ]
[ "Background Scan for 32-bit UUID Service in iOS", "I am trying to scan for a service with a 32-bit UUID while in the background. \n\nSame code works as expected for a 128 bit UUID in foreground and background.\n\nThe scan for 32-bit UUID only works while the app is in foreground.\n\nIs there a limitation that says that the UUID must be 128-bit?" ]
[ "ios", "core-bluetooth" ]
[ "Is if __name__ == '__main__' in python same as the main() in java?", "I am familiar with java but new to python and I wanted to know whether this piece of code is same as the main method in java if __name__ == '__main__'. Do all the python class need this code to execute. what if I did not have this code in my .py file. Will it throw any error message" ]
[ "java", "python" ]
[ "Maven Resources and docker-maven-plugin", "I would like to understand better how Maven deals with resources and in particular how plugins can reuse the Resources infrastructure that Maven provides:\n\nI have already read the resources section of Maven and looked at the Maven Resources Plugin.\n\nNow I came across the Docker Maven Plugin from Spotify. Which contains the following configuration section:\n\n<configuration>\n <imageName>${docker.image.prefix}/${project.artifactId}</imageName>\n <dockerDirectory>src/main/docker</dockerDirectory>\n <resources>\n <resource>\n <targetPath>/</targetPath>\n <directory>${project.build.directory}</directory>\n <include>${project.build.finalName}.jar</include>\n </resource>\n </resources>\n</configuration>\n\n\nLooking at the Readme of the plugin I could not find any explanation which child elements are allowed for a <resource> element. I am assuming that the <resource> element is in fact related to Maven's org.apache.maven.model.Resource class and that I can just reuse the documentation of Maven to understand who it works. But according to the Maven documentation I linked above, it seems that <include> elements must be nested inside an <includes> element which the above code listing does not do. Now I am confused.\n\nTo summarize: Where can I look to get a definitive answer if a plugin does not exactly document how its configuration works. Does there exist some kind of XML schema reference for plugins where I can lookup how particular elements work?" ]
[ "maven", "maven-resources-plugin" ]
[ "how to create static class List property inside static class", "I have created following class:\n\n public static class Current\n {\n public static class User\n {\n public static int UserID { get; set; }\n public static string UserName { get; set; }\n public static List<UserRole> Role { get; set; }\n }\n public static class UserRole\n {\n public static int RoleID { get; set; }\n public static string RoleName { get; set; }\n }\n }\n\n\nBut it will gives me an error: in this line \n\npublic static List<UserRole> Role { get; set; }\n\n\nError 1 'Framework.Security.Current.UserRole': static types cannot be used as type arguments" ]
[ "c#" ]
[ "How to trigger only the event that is being clicked?", "I have two image sliders that both get fired even if I only click the arrow on one of them. I just want function to work on only the slider that is being clicked on. \n\nI know that I need to use an event.target so that way it would only fire on the arrow that is being clicked. However, I am unsure of what the syntax would look like because everything I have tried keeps giving me an error. \n\nHere is the Jquery that I have written\n\n//Funtion for gallery slider\n$(document).ready(function () {\n\n\n var arrowRight = document.querySelector('.gallery-arrow-right');\n var arrowLeft = document.querySelector('.gallery-arrow-left');\n\n var show = 4;\n var width = $('#slider').width() / show;\n console.log(width)\n\n var length = $('.slide').length;\n\n\n $('.slide').width(width);\n $('#slide-container').width(width * length)\n\n\n\n function sliderNext(e) {\n $('.slide:first-child').animate({\n marginLeft: -width + -35\n }, 'slow', function () {\n $(this).appendTo($(this).parent()).css({marginLeft: 0});\n });\n }\n\n function sliderPrev(e) {\n $('.slide:last-child').prependTo($('.slide:last-child').parent()).css({marginLeft:-width});\n $('.slide:first-child').animate({\n marginLeft: 0\n }, 'slow')\n }\n\n\n arrowRight.addEventListener('click', sliderNext )\n arrowLeft.addEventListener('click', sliderPrev )\n\n});\n\n\n\n\nHere is my html \n\n <section class=\"gallery\">\n <div class=\"gallery-slider\" id=\"slider\">\n <h1 class=\"d-flex justify-content-center\">This is the gallery</h1>\n <div class=\"d-flex\" style=\"padding-left: 0; padding-right:0; \"id=\"slide-container\" >\n <div class=\"slide\">\n <a href=\"#\">\n <img class=\"\" src=\"/images/components/gallery_slider/Bathroom_slider.jpg\" alt=\"\">\n <p class=\"gallery-slider-title\">Shop Bathroom</p>\n </a>\n </div>\n <div class=\"slide\">\n <a href=\"#\">\n <img class=\"\" src=\"/images/components/gallery_slider/Dining_slider.jpg\" alt=\"\">\n <p class=\"gallery-slider-title\">Shop Dining</p>\n </a>\n </div>\n <div class=\"slide\">\n <a href=\"\">\n <img class=\"\" src=\"/images/components/gallery_slider/Diningroom_slider.jpg\" alt=\"\">\n <p class=\"gallery-slider-title\">Shop Dining Room</p>\n </a>\n </div>\n <div class=\"slide\">\n <a href=\"#\">\n <img class=\"\" src=\"/images/components/gallery_slider/Kitchen_slider.jpg\" alt=\"\">\n <p class=\"gallery-slider-title\">Shop Kitchen</p>\n </a>\n </div>\n <div class=\"slide\">\n <a href=\"#\">\n <img class=\"\" src=\"/images/components/gallery_slider/Dining_slider.jpg\" alt=\"\">\n <p class=\"gallery-slider-title\">Shop Slider</p>\n </a>\n </div>\n </div>\n </div>\n <i class=\"fa fa-angle-left fa-2x gallery-arrow-left\" style=\"margin-right: 20px;\"></i>\n <i class=\"fa fa-angle-right fa-2x gallery-arrow-right\"></i>\n </section>" ]
[ "javascript", "jquery", "events", "target" ]
[ "mysql match value, find similar and sort, then order the sorted groups by orginal match value", "Can't seem to get this query right. Here's what I need to do. \n\nGet by Age under 40, example return...\n\n| NAME |--| AGE |\n|------|--|-----|\n| Amy | | 26 |\n| John | | 22 |\n| Dan | | 30 |\n\n\nFind Names that are like the names returned from above and sort alphabetically...\n\n| NAME |--| AGE |\n|------|--|-----|\n| Aaron| | 33 |\n| Amy | | 26 |\n| Jacob| | 25 |\n| John | | 22 |\n| Dan | | 30 |\n\n\nSort the alphabetical groups by original returned age values values...\n\n| NAME |--| AGE |\n|------|--|-----|\n| Jacob| | 25 |\n| John | | 22 |-->was youngest from first query so his group goes first\n| Aaron| | 33 |\n| Amy | | 26 |\n| Dan | | 30 |" ]
[ "php", "mysql", "sorting" ]
[ "Using Language Class in Controller (CodeIgniter)", "First of all, I made research but couldn't find anything about it. \n\nI'm sending flash data to users when they update or add something. My controller file's related part is like this;\n\nfunction hizmet_ekle()\n {\n if($this->mhizmetler->hizmet_ekle())\n {\n $this->session->set_flashdata('ok', 'hizmet sisteme eklendi!');\n redirect('panel/hizmetler');\n }\n else\n {\n $this->session->set_flashdata('hata', 'Bir hata oluştu. Lütfen tekrar deneyin!');\n redirect('panel/hizmetler');\n }\n }\n\n\nAnd my view's related parts are like this;\n\n<?php if($this->session->flashdata('ok')): ?>\n <div class=\"alert alert-success fade in widget-inner\">\n <button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n <i class=\"fa fa-check\"></i> <?php echo $this->session->flashdata('ok');?>\n </div> \n <?php endif; if($this->session->flashdata('hata')): ?>\n <div class=\"alert alert-danger fade in widget-inner\">\n <button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n <i class=\"fa fa-times\"></i> <?php echo $this->session->flashdata('hata');?>\n </div>\n <?php endif; echo validation_errors('\n <div class=\"alert alert-danger fade in widget-inner\">\n <button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n <i class=\"fa fa-times\"></i> ', '\n </div>'); ?>\n\n\nMy system has a few different languages, it means I have to send different notification messages(session flashdata's) for each language but I can't use lang key in my controller file. How can I handle it?\n\nThanks in advance." ]
[ "php", "codeigniter", "lang" ]
[ "How to correctly parse build parameters in Jenkins running on Linux when receiving a string with spaces and double quotes?", "I configured a parametrized Jenkins Job build which takes the following argument called \"testcases\":\n\n-t \"Can Get Fake Name\" -t \"Can call Password\"\n\nThis is a string that has to be passed via command line to the robot framework executable.\n\nJenkins is running on Linux (Centos 7) and this is the build script I wrote to achieve my target:\n\nrobot \"${testcases}\" myrobottest.robot\n\n\nI have found the ${testcases} suggestion here which is partially solving my issue.\n\nThe result command on Jenkins is as it follows:\n\n+ robot '-t \"Can Get Fake Name\" -t \"Can call Password\"' myrobottest.robot\n[ ERROR ] Suite 'myrobottest' contains no tests named ' \"Can Get Fake Name\" -t \"Can call Password\"'.\n\n\nThe problem here are the trailing single-quotes that I don't know how to remove (or to not produce).\n\nBefore using the ${testcases} notation I also tried to use the environment variable like $testcases but it produces something with many useless single-quotes.\n\nAny suggestion please?\n\nI expect the generated command line to be \n\nrobot -t \"Can Get Fake Name\" -t \"Can call Password\" myrobottest.robot\n\n\nbut actual output is:\n\nrobot '-t \"Can Get Fake Name\" -t \"Can call Password\"' myrobottest.robot\n\n\nEDIT\n\nI did one more attempt.\nIf I change the script line as below:\n\neval echo robot \\${testcases} docker-robot-framework.robot\n\n\nI get the following console output.\n\n+ eval echo robot '${testcases}' myrobottest.robot\n++ echo robot -t '\"Can' Get Fake 'Name\"' myrobottest.robot\nrobot -t \"Can Get Fake Name\" myrobottest.robot\n\n\nI think I'm close to the solution, because I only have to execute such eval expression (that is correct by the way)." ]
[ "linux", "variables", "jenkins", "environment", "single-quotes" ]
[ "Problem with printing a product matrix using print", "I have a matrix A and B and I want the product of both these matrices. Here's my code in python.\n\nimport numpy as np\n\ndef matrix_multiplication(a: np.ndarray, b: np.ndarray) -> np.ndarray:\n\n n, m_a = a.shape\n m_b, p = b.shape\n\n c = np.zeros((n, p))\n\n if m_a != m_b:\n raise ValueError('Dimensions of the Matrix A and B are not compatable.')\n else:\n for i in range(len(0, a.shape)):\n for j in range(len(0, a.shape[0])):\n for k in range(0, len(b.shape)):\n c += a[i][j] * b[j][k]\n\n print(c)\n return c\n\n\nBut when I run the code, I get \"Process finished with exit code 0\" and not the matrix C. what could be wrong here?" ]
[ "python", "arrays", "function", "matrix" ]
[ "Selenium relative locator searches from a WebElement extremely slow", "I am using Selenium 2.0, Firefox 11.0, and Java to process a table. I have a table element composed of td cells, some which contain text included in a span element, others which contain input elements which have text in their value attributes. My goal is to get the text of every cell so I can output the table contents and compare them against expected values. I thought I would just do something like this:\n\nLocate the table WebElement by id\nList<WebElement> cells = tableElem.findElements(By.xpath(\".//td\"));\n\n\nThen I would loop through all the cells and run findElements with the xpath \".//input\" and if the list was empty I would run getText on the webElement, and if the list wasn't empty I would run getAttribute on the input element.\n\nBut to my surprise, this took several minutes to run on firefox (I'm afraid to try it on IE, which is where its supposed to be tested). When I debug it is obvious that the bottleneck is the .//input search from the td which is killing me. It is upwards of ten seconds, and so even with just a few cells my tests are taking forever. I've tried all sorts of minor variations to the xpath, tried going to css selectors, and continue to get the same results. \n\nI want some advice about how to either tackle this problem differently or how to optimize my current method. I was hoping this would only take a couple of seconds.\n\nI've included some sample code that should illustrate the slowdown I'm experiencing. This is not the website I'm screen scraping, but the slowness is the same:\n\n webDriver.navigate().to(\"https://accounts.google.com/NewAccount\");\n List<WebElement> TDxpath = webDriver.findElements(By.xpath(\"//td\"));\n List<WebElement> TDcss = webDriver.findElements(By.cssSelector(\"td\"));\n for (WebElement td : TDcss) {\n List<WebElement> q = td.findElements(By.cssSelector(\"input\"));\n }\n for (WebElement td : TDxpath) {\n List<WebElement> r = td.findElements(By.xpath(\".//input\"));\n }" ]
[ "performance", "selenium", "selenium-webdriver", "web-scraping", "webdriver" ]
[ "Adjust images with different dimensions side by side with css in Jupyter", "I'm trying to put two images side-by-side in a markdown cell in Jupyter. But the two images have different dimensions and I can't get them to be exactly the same size. \n\nMy goal is that the images have the same proportions regardless of their size. In the image that I put here you can see that the \"fig 2\" lacks height to match in size with the \"fig 1\".\n\n![Images side by side][(https://imgur.com/af9Xr3V)\n\nBelow I put the CSS and HTML code that I have used to put images side by side.\n\nCode:\n\n\r\n\r\n* {\r\n box-sizing: border-box;\r\n}\r\n\r\n.column {\r\n float: left;\r\n width: 50%;\r\n height: auto;\r\n padding: 3px;\r\n text-align: center;\r\n background-position: 50% 50%;\r\n background-repeat: no-repeat;\r\n object-fit: fill;\r\n overflow: hidden;\r\n vertical-align: top;\r\n}\r\n\r\n\r\n}\r\n\r\n/* Clearfix (clear floats) */\r\n.row::after {\r\n content: \"\";\r\n clear: both;\r\n display: table;\r\n}\r\n<div class=\"column\">\r\n <a id=\"fig1\" href=\"./../../Images/r-project.png\">\r\n <img src=\"https://imgur.com/opaKw3b\" alt=\"R-Proyect\" style=\"width:100px height:100px\"/>\r\n </a>\r\n <figcaption>Fig 1</figcaption>\r\n</div>\r\n<div class=\"column\">\r\n <a id=\"fig2\" href=\"./../../Images/cran.png\">\r\n <img src=\"https://imgur.com/iYnTl8H\" alt=\"CRAN\" style=\"width:50% height:100px\">\r\n </a>\r\n <figcaption>Fig 2</figcaption>\r\n</div>\r\n\r\n\r\n\n\nI hope you can help me with that little problem. Thanks." ]
[ "html", "css", "image", "jupyter", "jupyter-lab" ]
[ "Recursive Descent Parser", "The book 'Modern Compiler Design' is the nice book about compilers. In its source code something that is annoying me is AST or Abstract Syntax Tree. Suppose we want to write a parenthesized expression parser which parses something like: ((2+3)*4) * 2! The book says that we have an AST like:\n\n ((2+3)*4) * 2\n / | \\\n (2+3) *4 * 2\n / | \\\n (2+3) * 4\n / | \\\n 2 + 3\n\n\nSo should I save a tree in memory or just use recursive calls; Note: if I don't store it in memory, how can I convert it to machine code ?\n\nParser code:\n\nint parse(Expression &expr)\n{\n if(token.class=='D')\n { \n expr.type='D';\n expr.value=token.val-'0';\n get_next_token();\n return 1;\n }\n if(token.class=='(') \n {\n expr.type='P';\n get_next_token();\n parse(&expr->left);\n parse_operator(&expr->op);\n parse(&expr->right);\n if(token.class!=')')\n Error(\"missing )\");\n get_next_token();\n return 1;\n }\n return 0;\n}\n\n\nGrammar is:\n\nexpr -> expr | (expr op expr)\ndigit -> 0|1|2....|9\nop -> +|*" ]
[ "c++", "parsing", "compiler-construction" ]
[ "Load image from URL and limit the size of the file", "I have found how to load an image from an Url using this question on SO : how to load a image from web in java\n\nBut I'd like to limit the size of the file being loaded because all the answers have this in common : if a user give the url to a one terabyte file, it will crashes my server :/\n\nHow can I limit the size of the file being downloaded ?\n\nThanks for your help! :)" ]
[ "java", "image", "url", "download" ]
[ "Where to include text notes in R package directory structure?", "I authored an R package which has currently the following directory structure: \n\n.git \n.Rproj.user \ndocs \ninst \nman \nMeta \nR \ntests \nvignettes\n\n\nI keep the package code on the GitHub repository. I want to add a note in a form of TXT file which will contain some package-relevant information (pseudo code of the main package algorithm). I want to add it to the package so as it can be accessed from the package's GitHub repository. \n\nWhat is the best location in the files to add it so as the package check does not throw a message that there is some redundant file hanging?" ]
[ "r", "directory", "package" ]
[ "How to verify that a word is Bold in selenium webdriver using Java?", "I have a web application.I have a scenario that a search term becomes bold in some pages so i need to verify whether the search term is Bold or not.\nI have tried the following code but i am not able to verify:\n\nString colour = driver.findElement(By.className(\"classname\")).getCssValue(\"color\");\nif(colour.contains(\"rgba(46,46,46,1)\"))\nSystem.out.println(\"Term is Bold\");\nelse\nSystem.out.println(\"Term is not Bold\");" ]
[ "java", "selenium", "selenium-webdriver" ]
[ "Problems with facebooks conceal library", "I'm having issues with reading decrypted data from conceal. It looks like I can't correctly finish streaming.\nI pretend there is some issue with conceal, because of when I switch my proxyStream (just the encryption part) to not run it through conceal, everything works as expected. I'm also assuming that writing is ok, there is no exception whatsoever and I can find the encrypted file on disk.\n\nI'm proxying my data through contentprovider to allow other apps read decrypted data when the user wants it. (sharing,...) \n\nIn my content provider I'm using the openFile method to allow contentResolvers read the data\n\n@Override\npublic ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {\n\n try {\n ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createPipe();\n String name = uri.getLastPathSegment();\n File file = new File(name);\n InputStream fileContents = mStorageProxy.getDecryptInputStream(file);\n ParcelFileDescriptor.AutoCloseOutputStream stream = new ParcelFileDescriptor.AutoCloseOutputStream(pipe[1]);\n PipeThread pipeThread = new PipeThread(fileContents, stream);\n pipeThread.start();\n return pipe[0];\n } catch (IOException e) {\n e.printStackTrace();\n }\n return null;\n}\n\n\nI guess in the Facebook app Facebook android team could be rather using a standard query() method with a byte array sent in MediaStore.MediaColumns() which is not suitable for me because of I'm not only encrypting media files and I also like the approach of streams better.\n\nThis is how I'm reading from the Inpustream. It's basically a pipe between two parcelFileDescriptors. The inputstream comes from conceal and it is a FileInputstream wrapped into a BufferedInputStream originaly.\n\nstatic class PipeThread extends Thread {\n InputStream input;\n OutputStream out;\n\n PipeThread(InputStream inputStream, OutputStream out) {\n this.input=inputStream;\n this.out=out;\n }\n\n @Override\n public void run() {\n byte[] buf=new byte[1024];\n int len;\n\n try {\n while ((len=input.read(buf)) > 0) {\n out.write(buf, 0, len);\n }\n\n input.close();\n out.flush();\n out.close();\n }\n catch (IOException e) {\n Log.e(getClass().getSimpleName(),\n \"Exception transferring file\", e);\n }\n }\n}\n\n\nI've tried other methods how to read the stream, so it really shouldn't be the issue.\n\nFinally here's the exception I'm constantly ending up with. Do you know what could be the issue? It points to native calls, which I got lost in..\n\nException transferring file\ncom.facebook.crypto.cipher.NativeGCMCipherException: decryptFinal\n at com.facebook.crypto.cipher.NativeGCMCipher.decryptFinal(NativeGCMCipher.java:108)\n at com.facebook.crypto.streams.NativeGCMCipherInputStream.ensureTagValid(NativeGCMCipherInputStream.java:126)\n at com.facebook.crypto.streams.NativeGCMCipherInputStream.read(NativeGCMCipherInputStream.java:91)\n at com.facebook.crypto.streams.NativeGCMCipherInputStream.read(NativeGCMCipherInputStream.java:76)\n\n\nEDIT:\nIt looks like the stream is working ok, but what fails is the last iteration of reading from it. As I'm using buffer it seems like the fact that the buffer is bigger then the amount of remaiming data is causing the issue. I've been looking into sources of conceal and it seems to be ok from this regard there. Couldn't it be failing somewhere in the native layer?\nNote: I've managed to get the decrypted file except its final chunk of bytes..So I have for example an incomplete image file (with last few thousands of pixels not being displayed)" ]
[ "java", "android", "facebook", "encryption", "io" ]
[ "EXC_BAD_ACCESS on CCLabelBMFont dealloc?", "On CCLabelBMFont, I get a EXC_BAD_ACCESS on its dealloc method. Specifically, line [configuration_ release];\n\nI do not understand that at all. What could possibly cause that? My CCLabelBMFont was created alright, displayed alright, and when it is dealloced (when the scene is replaced), bang, the error comes.\n\nIdeas?" ]
[ "objective-c", "cocos2d-iphone" ]
[ "Open and Collect Data from Multiple Files in Elixir", "I am teaching myself Elixir for my research, and oftentimes my research requires opening several dozen or hundred text files, combining the data in these files, and manipulating the data. I am trying to figure out how I can open all the files I have in a directory and access the data in all these files. I would like to avoid using a for loop because to iterate through 100 files in a loop would be very slow. I think that the Stream module is ideal for my purposes, but I don't know quite how to use it.\n\nBelow, I have some test code. All it is supposed to do is open a bunch of files containing random numbers, convert the strings of numbers in the files to integers, and sort them. Everything works except the opening files part. You can see I tried to use the Path module, and this does succeed in finding all the files, but I don't know how to then pass that to the sort_num function in a usable way. Thanks for your help everyone!\n\ndefmodule OpenFiles do\n\n def file_open do\n Path.wildcard(\"numfiles/*.txt\")\n end\n\n def sort_num do\n file_open\n |> File.stream!\n |> Stream.map(&String.strip/1)\n |> Stream.map(&String.to_integer/1)\n |> Enum.sort\n end \nend\n\nIO.inspect OpenFiles.sort_num" ]
[ "functional-programming", "stream", "elixir" ]
[ "Spoj - EverLast - Need Hint", "I am trying to solve the SPOJ Problem EVERLAST, as given here,\nThe fate of the Pineapple\n\nCurrently what I am trying is:\n\n1) After the first season the population = N * K\n2) After the second season the population = N * K^2*(1-p)\nsince p is the probability that each pineapple is sterile and the initial N* K population dies out\n3) After the third season the population = N * K^3 * (1-p)^2\n\na)The probability that pineapple population survives after second season = (1- p^(N * K)), since it dies out completely with a probability p^(N * K)\nb)Probability that pineapple population survives after third season = 1 - p^ (N* K^2 *(1-p)), since it dies out completely with a probability p^(N * K^2 * (1-p))\nand so on.. \n\nso the probability of population surviving forever will be\n(1-p^(N * K)) * (1-p^(N * K^2 * (1-p))) * .......\n\nBut I am getting the wrong answer, I cant find the hints to this anywhere.\nWhere am I going wrong in my approach? any hints please?" ]
[ "algorithm" ]
[ "Application focus changed after closing messagebox", "In our WPF application We open one window for authentication as showdialog and set owner as Mainwindow. After authentication we open another window as showdialog and set owner as Mainwindow then close the previous window using coding. When close the second window manually, the focus changed automatically to some other applications. Any help on this is highly appreciated. \n\nThanks" ]
[ "wpf" ]
[ "Universal Windows Project, VS17, Cannot Install Microsoft.Azure.Devices.Client IOT SDK", "I'm getting the following failure report when attempting to install version 1.31.2 in VS17 using Nuget.\nError NU1202 Package Microsoft.Azure.Devices.Client 1.31.2 is not compatible with uap10.0.15063 (UAP,Version=v10.0.15063) / win10-arm [and other Windows 10 versions]. Package Microsoft.Azure.Devices.Client 1.31.2 supports:\n\nnet451 (.NETFramework,Version=v4.5.1)\nnet472 (.NETFramework,Version=v4.7.2)\nnetstandard2.0 (.NETStandard,Version=v2.0)\nnetstandard2.1 (.NETStandard,Version=v2.1)\n\nAny advice on how to resolve this would be appreciated. Do I need to use and earlier version?" ]
[ "azure-iot-sdk" ]
[ "how to create a timer?", "i want to make a flappy bird game, and i want to know how to make a timer that starts when the player presses the screen, the bird (or squid in my case) will start to go up and when the timer ends it will start to go down again.\n\nhere is the code\n\nbatch.begin();\n //ignore this part\n batch.draw(Assets.sprite_back,BackX ,0);\n batch.draw(Assets.sprite_back2,BackX2 ,0);\n //this is the squid\n batch.draw(Assets.sprite_squiddy,10 ,squiddyY);\nbatch.end();\n\n}\n\npublic void generalUpdate(){\n //ignore\n BackX -= 1;\n BackX2 -= 1;\n //look at this\n squiddyY -=4;\n //continue ignoring\n if(BackX<=-480){\n BackX = 480;\n }\n if(BackX2<=-480){\n BackX2 = 480;\n }\n //this is the part we need\n if(Gdx.input.justTouched()){\n squiddyY += 100;\n\n }\n}\n\n\nso actually now if you press it goes automatically up and i want him to go there smoothly\n\ni hope i explained myself good enough.\n\noh yea and if there is a better way to do it please tell me" ]
[ "java", "libgdx" ]
[ "Laravel multi authetification with different users tables", "I'm trying to build a multiple authentification in laravel with different tables (2 tables) for admin and user. The problème is that the registration and login forms work only with default auth login/register.\n\nI've tried some examples form web tutorials but it didn't work.\n\nHomeController.php:\n\npublic function __construct() {\n $this->middleware('auth');\n}\n\npublic function index() {\n return view('home');\n}\n\n\nI have added createAdmin function in \"Auth/RegisterController.php\":\n\nprotected function createAdmin(array $data)\n{\n $this->validator($data->all())->validate();\n $admin = Admin::create([\n 'name' => $data['name'],\n 'email' => $data['email'],\n 'password' => Hash::make($data['password']),\n ]);\n return redirect()->intended('login/admin');\n}\n\n\nI have changed email validation rules to:\n\n'email' => ['required', 'string', 'email', 'max:255', 'unique:users'|'unique:admins']\n\n\nAnd the route (web.php) is:\n\nRoute::post('/register/admin', 'Auth\\RegisterController@createAdmin');\n\n\nWhen I fill admin register credentials and click register button I get this message:\n\n\n Symfony\\Component\\Debug\\Exception\\FatalThrowableError Too few arguments to function App\\Http\\Controllers\\Auth\\RegisterController::createAdmin(), 0 passed and exactly 1 expected" ]
[ "laravel" ]
[ "set devise users/sign_up page as landing page", "I'm new to rails and I'm using devise to authenticate users.\n\nI have a devise User model and I'm using devise views.\n\nmy routes.rb file goes like this \n\nFreshconnection::Application.routes.draw do\n root to: 'pages#home'\n\n\n devise_for :admin_users, ActiveAdmin::Devise.config\n ActiveAdmin.routes(self)\n\n devise_for :users do\n ActiveAdmin.routes(self)\n get '/users/sign_out' => 'devise/sessions#destroy'\n end\n\n\nAs of now when I run the server, the request is routed to pages#home which is my landing page.\n\nI want the users/sign_up page to be the landing page so that the user can sign_up and start using the website.\n\nPlease guide me on how this has to be accomplished.\nMany thx" ]
[ "ruby-on-rails", "ruby", "devise" ]
[ "MySql Update with count based on an input of comma separated values", "If I were to supply MySql a comma separated string like ('US,UK,CA') (which comes from a form through a php script), how can I get MySql to loop through that string and do a count for each country code in there and update a different table where the country codes in that table are equal to the country codes in the string.\n\nExample:\n\ntable_a\n\n\"id\" \"countries\"\n\"1\" \"US,CA\"\n\"2\" \"US,CA\"\n\"3\" \"US,AU\"\n\"4\" \"US,UK\"\n\"5\" \"US\"\n\n\ntable_b\n\n\"id\" \"country\" \"total\"\n\"1\" \"US\" \"0\"\n\"2\" \"CA\" \"0\"\n\"3\" \"UK\" \"0\"\n\"4\" \"AU\" \"0\"\n\n\nHow can I do:\n\nEg: if I supplied ('US,UK,CA')\n\nupdate table_b set country = (\n\n select count(id) from table_a where country = (// each country in that string ('US,UK,CA'))\n\n) where country = (country currently selected from the string above)\n\n\nCan something like this be done? It works OK if there's just one country. How can I do it when there are more?\n\nIn the end, I'm hoping to end up with results like:\n\ntable_b\n\"id\" \"country\" \"total\"\n\"1\" \"US\" \"5\" // There are 5 in table_a\n\"2\" \"CA\" \"2\" // There are 2 in table_a\n\"3\" \"UK\" \"1\" // Only 1 in table_a\n\"4\" \"AU\" \"1\" // Only 1 in table_a" ]
[ "mysql", "sql" ]
[ "duplicate div inside the one class then remove the duplicate one", "i have one div\n\n<div class='complete_status'>Upload Complete</div>\n\n\nwhich could contain the \n\n <div class='complete_status'><div class=\"test\">test test</div></div>\n\n\ni want if \n\n<div class='complete_status'><div class=\"test\">test test</div><div class=\"test\">test test</div></div>\n\n\n\"comlete_status\" have div inside it \"test\" more then one.then remove the other div which have name \"test\"\n\na minor update here :\n i have 20 div with class name \".complete_status\" i want this according to multiple divs\nevery div should have only one class\"test\"" ]
[ "javascript", "jquery" ]
[ "With the find function, how do you find the last occurrence (not first occurrence) of a key with multimap on C++?", "I have a multimap set with multiple similar keys. It's sorted and I need to obtain the last occurrence of a value first." ]
[ "c++" ]
[ "Is it possible to dynamically update parametrized fixture's params?", "I want to run the same set of tests on multiple fixture values, but I don't want to \"hardcode\" those values in fixture definition. \n\nMy use-case is an interface with multiple implementations and I want to run the same tests on each implementation.\n\nFor example, my_code.py \n\nclass Interface:\n def method():\n pass\n\nclass Impl1(Interface):\n def method():\n return 1\n\nclass Impl2(Interface):\n def method():\n return 2\n\n\ntest_interface.py:\n\ndef test_method(instance: Interface):\n assert type(instance.method()) == int\n\n\ntest_impl1.py\n\nfrom my_code import Impl1\[email protected]\ndef instance():\n return Impl1()\n\n\ntest_impl2.py\n\nfrom my_code import Impl2\[email protected]\ndef instance():\n return Impl2()\n\n\nObviously this code does not work (because fixture \"instance\" is not found). I can write something like this in conftest.py\n\[email protected](params=[Impl1(), Impl2()])\ndef instance(request):\n return requst.param\n\n\nbut I want to be able to run test_impl1.py to only test Impl1. Also, if I ever going to write Impl3, I dont want to change conftest.py, I want to just add simple test_impl3.py\nAnd what if my implementation is in completely other package?\n\nIn short, I want to reuse my tests for each value from a list of fixtures, but I want to change this list of fixtures in runtime (e.g. depending on available implementations)" ]
[ "python", "pytest" ]
[ "Two internal webservers, one public IP", "I have two internal webservers both running Centos 7 which need access to ports 443 and 80 for obvious reasons. The problem is only one of them can use those ports because they are on the same internal network and they both share the same public IP address.\n\nWhat can I do so both servers can access these ports? I have been reading up about reverse proxies or changing the default Apache port but struggling to find an easy to follow guide or solution. \n\nAny ideas?" ]
[ "apache", "https", "webserver", "reverse-proxy", "centos7" ]
[ "Android 4.0.4 Webview - html5 video autoplay randomally not working", "I am using a Webview and have html5 video tag: \n\n<video id=\"video\" class=\"video-full-screen\" preload=\"none\" poster=\"{poster URL here}\" webkit-playsinline>\n <source id=\"mp4\" src=\"{Video mp4 source here}\" type=\"video/mp4\">\n <p>Your user agent does not support the HTML5 Video element.</p>\n</video>\n\n\nFor autoplay of Android API 17+ I use the autoplay=\"autoplay\" attribute on the video tag + I use the setMediaPlaybackRequiresUserGesture (set to false). \n\nFor API level below 17 I use:\n\nvar video = $('video');\nvideo.bind(\"loadeddata\", function(){\n setTimeout(function(){\n video[0].play();\n },100);\n}); \n\n\nThis works on all devices but Android 4.0.4 (Samsung galaxy s3). On this device it works randomly (I couldn't find any reproduction scenario. It just works randomly). \nI registered to the \"playing\" event:\n\nvideo.bind(\"playing\", function(){\n console.log(\"playing\");\n}); \n\n\nand I see that this event is triggered when the video does not play. What I see a grey screen with the player image inside. The current time of the video stays 0 even after few seconds." ]
[ "javascript", "android", "html", "webview", "html5-video" ]
[ "How to prevent removing text from mail destroying HTML?", "I have a procedure that finds a certain string and removes it.\n\nThis is done through Replace().\n\nHowever when the incoming mail is HTML rather than plain text, most HTML features are destroyed, and the mail is plain text plus hyperlinks. \n\nIt is therefore obvious that my procedure kills something in addition to the string.\n\nHere is my procedure: \n\nPublic Sub EditBodyCgReplace()\n\n 'Declarations\n Dim obj As Object\n Dim Sel As Outlook.Selection\n Dim DoSave As Boolean\n Dim NewBody As String\n Dim strDelete01 As String\n Dim strDelete02 As String\n Dim strDelete03 As String\n\n 'Fill the variables \n strDelete01 = \"Diese E-Mail kommt von Personen außerhalb der Stadtverwaltung. Klicken Sie nur auf Links oder Dateianhänge, wenn Sie die Personen für vertrauenswürdig halten.\"\n strDelete02 = \"################################################################################\"\n\n 'Work with it \n If TypeOf Application.ActiveWindow Is Outlook.Inspector Then\n Set obj = Application.ActiveInspector.CurrentItem\n Else\n Set Sel = Application.ActiveExplorer.Selection\n If Sel.Count Then\n Set obj = Sel(1)\n DoSave = True\n End If\n End If\n\n If Not obj Is Nothing Then\n NewBody = Replace(obj.Body, strDelete01, \"\")\n NewBody = Replace(obj.Body, strDelete02, \"\")\n If NewBody <> \"\" Then\n obj.Body = NewBody\n If DoSave Then\n obj.Save\n End If\n End If\n End If\n\nEnd Sub\n\n\nWhat can I do that this (or a similar) procedure kills the string but does not harm the HTML structure of the e-mail so that it's visual features on screen are persevered?" ]
[ "vba", "outlook" ]
[ "Can't setup Gitlab-ci with a symfony project", "I'm trying to configure Gitlab-ci with a Symfony project, and after reading the documentation and some examples in external blogs I'm unable to complete the setup. Those are my files:\n\n.gitlab-ci.yml:\n\n# Select image from https://hub.docker.com/_/php/\nimage: php:5.6\n# Select what we should cache\ncache:\n paths:\n - vendor/\n\nbefore_script:\n# Install git, the php image doesn't have installed\n- apt-get update -yqq\n- apt-get install git -yqq\n- apt-get install wget -yqq\n- apt-get install zip unzip zlib1g-dev -yqq\n\n# Install mysql driver & zip\n- docker-php-ext-install pdo_mysql\n- docker-php-ext-install zip\n- docker-php-ext-install mbstring\n\n# Install composer\n- curl -sS https://getcomposer.org/installer | php\n\n# Install all project dependencies\n- mv app/config/parameters.gitlab.yml app/config/parameters.yml.dist\n- ping -c 3 mysql\n- php -v\n- php composer.phar clear-cache\n- php composer.phar install\n- php bin/console doctrine:schema:create\n\nservices:\n- mysql:latest\n\nvariables:\n # Configure mysql service (https://hub.docker.com/_/mysql/)\n MYSQL_DATABASE: symfony\n MYSQL_ROOT_PASSWORD: password\n\n# We test PHP5.6 (the default) with MySQL\ntest:mysql:\n script:\n - vendor/bin/phpunit --configuration phpunit.xml --coverage-text\n\n\nparameters.gitlab.yml (which becomes parameters.yml.dist)\n\n# This file is auto-generated during the composer install\nparameters:\n database_driver: pdo_mysql\n database_host: mysql\n database_port: 3306\n database_name: symfony\n database_user: root\n database_password: password\n\n\nI have tried mysql user root, and another user using 'MYSQL_USER' variable. The result is always the same:\n\n$ mv app/config/parameters.gitlab.yml app/config/parameters.yml.dist\n$ ping -c 3 mysql\nPING mysql (172.17.0.2): 56 data bytes\n64 bytes from 172.17.0.2: icmp_seq=0 ttl=64 time=0.282 ms\n64 bytes from 172.17.0.2: icmp_seq=1 ttl=64 time=0.140 ms\n64 bytes from 172.17.0.2: icmp_seq=2 ttl=64 time=0.151 ms\n--- mysql ping statistics ---\n3 packets transmitted, 3 packets received, 0% packet loss\nround-trip min/avg/max/stddev = 0.140/0.191/0.282/0.065 ms\n$ php -v\nPHP 5.6.26 (cli) (built: Sep 23 2016 21:22:39) \nCopyright (c) 1997-2016 The PHP Group\nZend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies\n$ php composer.phar clear-cache\nDo not run Composer as root/super user! See https://getcomposer.org/root for details\nClearing cache (cache-dir): /root/.composer/cache\nClearing cache (cache-files-dir): /root/.composer/cache/files\nClearing cache (cache-repo-dir): /root/.composer/cache/repo\nCache directory does not exist (cache-vcs-dir): \nAll caches cleared.\n$ php composer.phar install\n......\n> Incenteev\\ParameterHandler\\ScriptHandler::buildParameters\nUpdating the \"app/config/parameters.yml\" file\n> Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap\n> Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache\n\n [Doctrine\\DBAL\\Exception\\ConnectionException] \n An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused \n\n [Doctrine\\DBAL\\Driver\\PDOException] \n SQLSTATE[HY000] [2002] Connection refused \n\n [PDOException] \n SQLSTATE[HY000] [2002] Connection refused \n\nScript Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception\n\n\nWhat am I doing wrong or missing?" ]
[ "symfony", "gitlab-ci" ]
[ "Use jQuery :has() and :contains() selectors together", "I have a list item element that contains a label element. I want to select the list item element with the :has() selector. Inside the label element there is text I want to match with :contains(). Is it possible to do both of these things with a single line of jQuery? If not, what is an elegant way to select the li element based on the contents of its child label element?\n\n<li>\n <!-- I want to select this one -->\n <label>Label 1</label>\n <!-- more follows -->\n</li>" ]
[ "javascript", "jquery", "html", "css" ]
[ "Can't properly retrieve objects from NSMutableArray", "I will be putting a variety of things in this mutable array, but first I am just trying to make sure it works by putting in strings, and then pulling out the strings. Here is my code\n\nstr1=@\"1\";\nstr2=@\"2\";\nstr3=@\"3\";\nNSMutableArray *testArray;\n[testArray addObject:str1];\n[testArray addObject:str2];\n[testArray addObject:str3];\n\nretrieve =[testArray objectAtIndex:1];\nNSLog(@\"the test number is %@\",retrieve);\n\n\nThe problem is that my string:retrieve equals \"null\" after receiving the string from the array. I'm not sure what I am doing wrong, I've looked at Apple's documentation but I'm having trouble making sense of it. I know I must be interacting with the array incorrectly, but I'm not sure how exactly. Help will be appreciated.\n-Thank you!" ]
[ "ios", "objective-c", "xcode" ]
[ "Java Program Design Layout Recommendations?", "I've learned enough to begin writing programs from scratch, but I'm running into the problem of not knowing how to design the layout and implementation of a program. To be more precise, I'm having difficulty finding a good way to come up with an action plan before I dive in to the programming part. I really want to know what classes, methods, and objects I would need beforehand instead of just adding them along the way. \n\nMy intuition is leading me to using some kind of charting software that gives a hierarchal view of all the classes and methods. I've been using OmniGraffle Pro and while it does seem to work somewhat, I'm still having trouble planning out the program in its entirety. \nHow should I approach this problem? What softwares out there are available to help with this problem? Any good reads out there on this issue?\n\nThanks so much!\n\nEdit: Oh yeah, I'm using Eclipse and I code mainly in Java right now." ]
[ "java", "design-patterns", "oop" ]
[ "Total number of ways to write a positive integer as the sum of powers of 2 in efficient time", "I've been looking at Number of ways to write n as a sum of powers of 2 and it works just fine, but I was wondering how to improve the run time efficiency of that algorithm. It fails to compute anything above ~1000 in any reasonable amount of time (under 10 seconds).\n\nI'm assuming it has something to do with breaking it down into subproblems but don't know how to go about it. I was thinking something like O(n) or O(nlogn) runtime - I'm sure it is possible somehow. I just don't know how to split up the work efficiently.\n\ncode via Chasefornone\n\n #include<iostream>\nusing namespace std;\n\nint log2(int n)\n{\n int ret = 0;\n while (n>>=1) \n {\n ++ret; \n }\n return ret;\n}\n\nint power(int x,int y)\n{\n int ret=1,i=0;\n while(i<y)\n {\n ret*=x;\n i++;\n }\n return ret;\n}\n\nint getcount(int m,int k)\n{\n if(m==0)return 1;\n if(k<0)return 0;\n if(k==0)return 1;\n if(m>=power(2,k))return getcount(m-power(2,k),k)+getcount(m,k-1);\n else return getcount(m,k-1);\n\n}\n\nint main()\n{\n int m=0;\n while(cin>>m)\n {\n int k=log2(m);\n cout<<getcount(m,k)<<endl;\n }\n return 0;\n}" ]
[ "c++", "c", "algorithm", "performance", "runtime" ]
[ "Cannot open include file 'afxwin.h':no such header fileor directory in vs 2013 c++", "So,I am trying to port some old code to newer version of vs so I imported the sln of the project into my vs 2013 and I get this error and some others and I have gone through some of the other questions on this forum.So I understand that this has something to do with MFC(microsoft foundation classes) but all of them talk about vs 2010 express edition which doesn't include MFC module.I am currently using vs 2013 community edition which is supposed to have full feature access of vs.Still I get this error so please help!!\n\nThanks!" ]
[ "c++", "visual-c++", "visual-studio-2013", "mfc", "visual-c++-2013" ]
[ "How do I display Active Directory jpegPhoto with ColdFusion?", "I'm creating a company directory using our existing Active Directory information. I'm able to pull all the data I need, but I wanted to use Active Directory for the photo as well.\n\nI found this snippet of code on this blog: http://plus10.blogspot.com/2008/02/coldfusion-cfldap-display-images-stored.html\n\n <!--- imageFile.cfm --->\n\n<cfsilent>\n\n<cfldap action=\"QUERY\"\nname=\"ldap\"\nattributes=\"jpegPhoto\"\nstart=\"dc=[yourdc],dc=com\"\nfilter=\"sAMAccountName=[loginname]\"\nserver=\"[yourserver]\"\nusername=\"[username]\"\npassword=\"[password]\">\n\n<cfscript>\n ldapPhoto = toString(ldap.jpegPhoto);\n ldapPhoto = binaryDecode(ldapPhoto,\"base64\");\n</cfscript>\n\n</cfsilent><cfcontent type=\"image/jpeg\" variable=\"#ldapPhoto#\">\n\n\n<!--- to display the image on a page --->\n\n<img src=\"imageFile.cfm\" width=\"100\" height=\"125\" alt=\"\">\n\n\nI plugged in all my server data and I get the error\n\n\n The image \"....imagefile.cfm\" cannot be displayed because it contains errors\n\n\nWhy isn't the image displaying? and how can I correct the code?\n\nI did a <cfdump> on the query and it just shows as \"jpegPhoto\" not binary data.\n\nI can't post the actual page because it is on an internal network only." ]
[ "coldfusion", "active-directory", "binary" ]
[ "put childs above header in ExpandableListView", "I'm trying to put childs in expandableListView at the top of the header, so that when user clicks on an item, the children show up above it and not below it.\n\nany idea how it is possible?\n\nthanks in advance." ]
[ "android", "listview" ]
[ "How to use the twitcurl library", "I am trying to use the twitcurl library in linux. I used this as a guide to install the library. But when I try to run the twitterclient.cpp example application that is given, after it asks me if I have a proxy server installed, I get the following errors:\n\ntwitterClient:: twitCurl::accountVerifyCredGet web response:\n{\"errors\":[{\"code\":32,\"message\":\"Could not authenticate you.\"}]}\n\ntwitterClient:: twitCurl::followersIdsGet for user [nextbigwhat] web response:\n{\"errors\":[{\"code\":32,\"message\":\"Could not authenticate you.\"}]}\n\nNEXT CURSOR: \"code\":32,\"message\":\"Could not authenticate you.\"}]}\n\ntwitterClient:: twitCurl::followersIdsGet for user [nextbigwhat] web response:\n\nterminate called after throwing an instance of 'std::out_of_range'\n what(): basic_string::substr\nAborted (core dumped)\n\n\nCan anyone help me by pointing out what I'm doing wrong? \n\nEDIT: I'll list the exact steps I used to install the library.\n\n\nCloned this project.\nIn the libwitcurl directory and ran the make command. This generated the twitcurl shared library libtwitcurl.so.1.0.\nCopied libtwitcurl.so.1.0 to /usr/lib/ directory as libtwitcurl.so.\nBuilt the example application using g++ twitterClient.cpp -ltwitcurl and ran the application." ]
[ "c++", "curl", "twitter", "twitter-oauth" ]
[ "JSON error in AFNetworking", "I'm trying to use the AFNetworking library to send a post request to an URL like this:\n\nhttps://m.com/api/2.0/basic/sim_balance.json\n\nThat expects a username and password in the URL that are my parameters (as NSDictionary).\n\nThe URL gives a JSON back like this:\n\n{\n \"valid_until\": \"2011-05-05 22:13:28\",\n \"sms\": 0,\n \"sms_super_on_net_max\": 300,\n \"voice_super_on_net\": 0,\n \"credits\": \"0.00\",\n \"bundles\": [],\n \"is_expired\": true,\n \"sms_super_on_net\": 0,\n \"voice_super_on_net_max\": 3600,\n \"data\": 0\n}\n\n\nThis is my request function:\n\n +(void) request:(NSString *)endpoint : (NSDictionary *) parameters\n {\n AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];\n [manager POST:endpoint parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {\n NSLog(@\"JSON: %@\", responseObject);\n } failure:^(AFHTTPRequestOperation *operation, NSError *error) {\n NSLog(@\"Error: %@\", error);\n }];\n }\n\n\nI always get this as error:\n\nError: Error Domain=NSCocoaErrorDomain Code=3840 \"The operation couldn’t be completed. (Cocoa error 3840.)\" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x904b7e0 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}\n\n\nI validated the JSON and the server is sending valid JSON.\n\nCan someone help me out on this?" ]
[ "ios", "objective-c", "json", "ios7", "afnetworking-2" ]
[ "How get unmatched list from dictionary", "I want to get unmatched dictionary based on list item using LINQ. Please refer my sample code\n\nDictionary<string, List<int>> lowerActionRoles = new Dictionary<string, List<int>>();\nDictionary<string, List<int>> upperActionRoles = new Dictionary<string, List<int>>();\n\nlowerActionRoles.Add(\"11\", new List<int>() { 1, 2, 4 });\nupperActionRoles.Add(\"11\", new List<int>() { 1, 2, 4, 5 });\nlowerActionRoles.Add(\"13\", new List<int>() { 1, 2, 4 });\n\nlowerActionRoles.Add(\"21\", new List<int>() { 1, 2, 4 });\nupperActionRoles.Add(\"21\", new List<int>() { 1, 2, 4 });\n\n\nHere I have 2 dictionary lowerActionRoles and upperActionRoles. Dictionary with key 21 matched and key 11 is not matched. Here I want get dictionary with key 11." ]
[ "c#", "linq" ]
[ "How to access browser's network headers data after getting redirected from payment gateway to my order confirmation page", "I am working on payment gateway integration and my web site is on rails framework .\nMy problem is , when i am getting redirected to my payment confirmation page , there is some response coming with my giving callback url and that response has some vital information like payment is successful or not etc.\n\nThis network response i can see in chrome network header tab [under developer option (press f12)]\n\nIMAGE -i have given link of image that shows - chrome's network tab that contains headers for order115 under that formdata is available that i need to fetch for payment confirmation\n\n\nplease look into the image for better understanding\n\nis there any way to get this response in my rails App ?\ni have tried with request.headers that does not contain this info .\n\nthanks in advance !" ]
[ "javascript", "ruby-on-rails", "paytm" ]
[ "New Column that is 1-n for each new factor level", "I am looking for advice on how to add a column to a dataframe that for each factor level counts from 1 to n the number of factors in that level. Here is the example I am working with. \n\ncollatzRule <- function(m){\n if ( m %% 2 == 0) {\n return(m/2)\n } else {\n return(3*m + 1)\n }\n}\n\ncollatz <- function(n, limit = 1000000000) {\n # collatz numbers will go in this vector\n numbers <- numeric(limit)\n # keep count of how many numbers we have made:\n counter <- 0\n while ( n > 1 & counter < limit) {\n # need to make a new number\n counter <- counter + 1\n # put the current number into the vector\n numbers[counter] <- n\n # make next Collatz number\n n <- collatzRule(n)\n }\n # find how many Collatz numbers we made:\n howMany <- min(counter, limit)\n # print them out:\n print(numbers[1:howMany])\n}\n\ndatalist = list()\n\nfor (i in 2:100) {\n # ... make some data\n dat <- collatz(i) %>% as.data.frame()\n dat$i <- i %>% as.factor() # maybe you want to keep track of which iteration produced it?\n datalist[[i]] <- dat # add it to your list\n}\n\nbig_data = do.call(rbind, datalist)\n\n\nThis produces a data frame that looks likes:\n\n . i \n1 2 2 \n2 3 3 \n3 10 3 \n4 5 3 \n5 16 3 \n6 8 3\n\n\nI want to add a column that looks like this.\n\n . i x\n1 2 2 1 \n2 3 3 1 \n3 10 3 2 \n4 5 3 3 \n5 16 3 4 \n6 8 3 5\n\n\nAny help would be greatly appreciated!\n\nBest wishes," ]
[ "r", "iteration" ]
[ "Why does my sprite disappear when I call shiftHSL?", "If I uncomment the shiftHSL line below, the sprite does not appear.\n\n<script src='https://rawgit.com/photonstorm/phaser/master/build/phaser.js'></script>\n\n<script>\nvar game = new Phaser.Game(800, 400, Phaser.AUTO, '', {\n preload: function() { this.game.load.image('dwarf', 'res/dwarf.png') },\n create: function() {\n var bmd = game.make.bitmapData()\n bmd.width = 80\n bmd.height = 80\n bmd.circle(bmd.width / 2, bmd.width / 2, bmd.width / 2, '#ffffff')\n bmd.alphaMask('dwarf', bmd)\n // bmd.shiftHSL(0, -.5, 0)\n var sprite = game.add.sprite(100, 100, bmd)\n }\n});\n</script>" ]
[ "phaser-framework" ]
[ "Suggested database design for columns that are usually empty", "I have a table with four fields that are usually filled in:\n\n`animal`\n- id\n- type\n- name\n- weight\n- location\n\n\nThree additional fields are filled in if the animal type = 'person'. This happens about 5% of the time. The additional table would be:\n\n`person_additional`\n- animal_id (FK)\n- IQ\n- native_language\n- handedness\n\n\nIs the suggested practice in db design to store this in two tables or one table? It almost makes no difference to me, but I was curious about best practices and why one would be preferable over the other." ]
[ "mysql", "sql", "database", "database-design" ]
[ "How to enable the second tab after the completion of the first tab validation", "I have tab with the following fields\n\n <div id=\"tabs\">\n <ul>\n <li><a href=\"#tabs-1\">Tab1</a> </li>\n <li><a href=\"#tabs-2\">Tab2</a></li>\n <li><a href=\"#tabs-3\">Tab3</a></li>\n <li><a href=\"#tabs-4\">Tab4</a></li>\n </ul>\n <div id=\"tabs-1\">\n <b>Name</b>\n <input type=\"text\" id=\"name\"><br/>\n <b>Age</b>\n <input type=\"text\" id=\"age\"><br/>\n <input type=\"submit\" value=\"next\" id=\"submit\"/>\n </div>\n <div id=\"tabs-2\">\n <form name=\"nithin\">\n\n </div>\n <div id=\"tabs-3\">\n <p>Tab3</p>\n </div>\n <div id=\"tabs-4\">\n <p>Tab4</p>\n </div>\n</div> \n<input type=\"checkbox\" name=\"tabs-2\" value=\"2\">tabs-2 \n<input type=\"checkbox\" name=\"tabs-3\" value=\"3\">tabs-3 \n<input type=\"checkbox\" name=\"tabs-4\" value=\"4\">tabs-4 \n<br>\n\n\nHere tab-1 has two fields.The second tab of this must be enable only after the completion of the validation of first tab.We can select show/hide using the checkbox but will not activated.How can I do this? You can see the code DEMO" ]
[ "javascript", "jquery", "html", "css" ]
[ "Azure SAS Token for Webjob DashboardConnectionString and StorageConnectionString", "Azure web jobs want me to set AzureWebJobsDashboard and AzureWebJobsStorage properties on startup but, i do not want to expose AccountKey in code.\nWhen I try to use SAS Token, JobHostConfiguration class trying to parse SAS Token and throws exception\n\n var config = new JobHostConfiguration();\n config.DashboardConnectionString = ConfigurationManager.GetSetting(KeyVaultSecrets.StorageReadWriteConnectionString);\n config.StorageConnectionString = ConfigurationManager.GetSetting(KeyVaultSecrets.StorageReadWriteConnectionString);\n\n\nException\n\n\n System.InvalidOperationException occurred\n HResult=0x80131509\n Message=Failed to validate Microsoft Azure WebJobs SDK Dashboard connection string. The Microsoft Azure Storage account connection string is not formatted correctly. Please visit http://msdn.microsoft.com/en-us/library/windowsazure/ee758697.aspx for details about configuring Microsoft Azure Storage connection strings.\n Source=\n StackTrace:\n at Microsoft.Azure.WebJobs.Host.Executors.StorageAccountParser.ParseAccount(String connectionString, String connectionStringName, IServiceProvider services)\n at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageAccountProvider.set_DashboardConnectionString(String value)\n\n\nIs there any way to use SAS Token while creating configuration for JobHostConfiguration?" ]
[ "azure", "azure-storage", "azure-webjobs" ]
[ "Dimitre Novatchev's XPath visualizer help", "I want to try what looks like a really cool tool. I've dl'd the FF version from http://www.huttar.net/dimitre/XPV/TopXML-XPV.html.\n\nI open XPathMain.htm in FireFox, Browse to the provided test1.xml file, click Process File, with the default //* in the XPath window. In FF, I get this:\n\n\n [Exception... \"Access to restricted\n URI denied\" code: \"1012\" nsresult:\n \"0x805303f4 (NS_ERROR_DOM_BAD_URI)\"\n location:\n \"file:///Users/doug/Dev/XPV-FF/XPathMain.htm\n Line: 43\"]\n\n\nI also opened it in Safari, followed the above, and nothing happened, when I clicked Process File. \n\nOnce I get it working, what am I expecting to see? I assume I will see the xml file in the big window with selected nodes highlighted? \n\nI'm on OS X 10.6.6 and FF 3.5.16. Thank you." ]
[ "firefox", "xpath", "visualizer" ]
[ "Exception in thread \"main\" java.lang.ArrayStoreException when store object into array", "This is my whole code, the problem requires me to use Array for solution.\n\nimport java.lang.reflect.Array;\n\npublic class MyStack<T> {\n public MyStack (Class<T[]> _class,int size){\n final T[] values = (T[]) Array.newInstance(_class,size);\n this.values = values;\n this.size=size;\n }\n\n private T[] values;\n private int top=0,size;\n\n public void push(T nextElement){\n if(isFull()){\n System.out.println(\"full\");\n }\n else {\n values[top++] = nextElement;\n }\n }\n\n public T pop(){\n if(isEmpty()) {\n System.out.println(\"empty\");\n return null;\n }\n else {\n return values[top--];\n }\n }\n\n public boolean isEmpty(){\n if (top==0)return true;\n return false;\n }\n\n public boolean isFull(){\n if(top==size-1)return true;\n else return false;\n }\n\n public static void main(String args[]){\n MyStack<Integer> myStack = new MyStack<Integer>(Integer[].class,9);\n for (int i =0;i<10;i++)\n {\n myStack.push(i);\n }\n while(!myStack.isEmpty()){\n System.out.println(myStack.pop());\n }\n }\n}\n\n\nWhen i compile it it throws Exception in thread \"main\" java.lang.ArrayStoreException: java.lang.Integer at values[top++] = nextElement; no matter which type i used from String, Integer or any other Objects.\nIs there a way to fix this problem ?" ]
[ "java", "arrays", "object" ]
[ "Html/php script (POST method) works on local host but doesn't do anything on my hosting website", "I want to make a script for my website that it shows a form and a visitor can write his email and a message this is the code:\n\n<html>\n<head>\n<title>Feedback</title>\n</head>\n<body>\n\n <form method=\"post\" action=\"post.php\" >\n Email<input name=\"email\" type=\"text\" ><br/>\n\n Message<input name=\"message\" type=\"text\" ><br/>\n\n\n\n <input type=\"submit\" \">\n </form> \n\n</body>\n\n\n</html>\n\n\nnow with a php script (post.php) I want to collect this information and save it to a text file (information.txt). This is the script:\n\n<?php\n\n$email = $_POST[\"email\"];\n$message = $_POST[\"message\"];\n\n$f = fopen(\"information.txt\", \"w\");\nfwrite($f,\"Email: $email\\r\\nMessage: $message\");\nfclose($f);\n\n?>\n\n\nThat works locally but when I upload those files to my control panel on my hosting website it doesn't work (notice that I give the right paths)" ]
[ "php", "html" ]
[ "drop-down menu that lists columns", "I'm trying to create a football website and I need someone to help me . I want to add a drop-down menu that lists columns of football competitions .Exactly in \"competitions \" just like this drop-down menu that lists columns.\n\n@Mostafa Baezid Here is the code:\n\n\r\n\r\n<!-- outer-wrapper start -->\r\n \r\n <body>\r\n <nav class='navbar navbar-default'>\r\n<div class='navbar-header'>\r\n <button class='navbar-toggle' data-target='.js-navbar-collapse' data-toggle='collapse' type='button'>\r\n <span class='sr-only'>Toggle navigation</span>\r\n <span class='icon-bar'/>\r\n <span class='icon-bar'/>\r\n <span class='icon-bar'/>\r\n </button>\r\n <a class='navbar-brand' href='#'>LOGO</a>\r\n</div>\r\n\r\n\r\n<div class='collapse navbar-collapse js-navbar-collapse'>\r\n <ul class='nav navbar-nav'>\r\n <li><a href='#'>Home</a></li>\r\n <li><a href='#'>News</a></li>\r\n <li><a href='#'>EUROPE</a></li>\r\n <li><a href='#'>AFRICA</a></li> \r\n <li><a href='#'>WORLDWIDE</a></li>\r\n \r\n <li class='dropdown mega-dropdown'>\r\n <a class='dropdown-toggle arrow' data-toggle='dropdown' href='#'>Competitions <span class='glyphicon glyphicon-chevron-down '/></a>\r\n\r\n <ul class='dropdown-menu mega-dropdown-menu'><!--megaMenu Wih 3 column start-->\r\n \r\n <li class='col-sm-4 nopadding'>\r\n <ul>\r\n <li class='dropdown-header'>France</li>\r\n <li><a href='#'>Demo Link</a></li>\r\n <li><a href='#'>Demo Link</a></li>\r\n <li><a href='#'>Demo Link</a></li>\r\n <li class='divider'/>\r\n </ul>\r\n </li>\r\n <li class='col-sm-4 nopadding'>\r\n <ul>\r\n <li class='dropdown-header'>Europe</li>\r\n <li><a href='#'>Demo Link</a></li>\r\n <li><a href='#'>Demo Link</a></li>\r\n <li><a href='#'>Demo Link</a></li>\r\n <li class='divider'/>\r\n \r\n </ul>\r\n </li>\r\n <li class='col-sm-4 nopadding'>\r\n <ul>\r\n <li class='dropdown-header'>INTERNATIONAL</li>\r\n <li><a href='#'>Demo Link</a></li>\r\n <li><a href='#'>Demo Link</a></li>\r\n <li><a href='#'>Demo Link</a></li>\r\n <li class='divider'/>\r\n \r\n </ul>\r\n </li>\r\n </ul><!--megaMenu Wih 3 column End-->\r\n\r\n </li>\r\n <li><a href='#'>Live Matches</a></li>\r\n <li><a href='#'>Mercato</a></li> \r\n <li><a href='#'>Videos</a></li> \r\n </ul>\r\n \r\n </div>\r\n<!-- /.nav-collapse -->\r\n </nav>\r\n\r\n\r\n <h1 class='c-text'> Mega Menu Demo </h1>\r\n<script type='text/javascript'>$(function () { $('.arrow').click(function () { $('.glyphicon-chevron-down').toggle(); }); }); </script>\r\n</body>\r\n <div id='searchformfix'>\r\n <form action='/search' id='searchform'>\r\n <input name='q' onblur='if (this.value == "") {this.value = "Text to Search...";}' onfocus='if (this.value == "Text to Search...") {this.value = "";}' type='text' value='Text to Search...'/>\r\n </form>\r\n </div>\r\n \r\n \r\n <div class='clear'/>\r\n\r\n\r\n <!-- secondary navigation menu end -->\r\n <!-- content wrapper start -->" ]
[ "javascript", "html", "css" ]
[ "How to validate form data first before uploading a file?", "I have a /register user service with form data such as firstName, lastName, profileImage..etc.\n\nI am using MulterModule for parsing the formData but the problem is that profileImage is getting uploaded first and then the validation is done by the ValidationPipe.\n\nI know that in nest.js middlewares are ran first and then Pipes are run but I don't know how can I make my validation first before uploading process.\n\nNow, for me this is a critical problem because I am working in an IT firm and we are building a social media like application. So, there are going to be lots of videos & image uploads along with other details. Hence, the upload directory is going to be flooded with all the unused files.\n\nAnd also I know that this is not a problem of Nest.js but however, I searched everywhere but there is no solutions given anywhere.\n\nPlease help me resolve this issue." ]
[ "node.js", "nestjs", "multer" ]
[ "Ant: use include and exclude together", "OK, this seems like it should be really simple. I'm using Apache Ant 1.8, and I have a target which does:\n\n<delete file=\"output/program.tar.bz2\"/>\n<tar basedir=\"input\" destfile=\"output/program.tar.bz2\" compression=\"bzip2\">\n <tarfileset dir=\"input\">\n <include name=\"goodfolder1/**\"/>\n <include name=\"goodfolder2/**\"/>\n <exclude name=\"**/badfile\"/>\n <exclude name=\"**/*.badext\"/>\n </tarfileset>\n</tar>\n\n\nI want it to make a .tar.bz2 of input/goodfolder1 and input/goodfolder2, excluding files named \"badfile\", and excluding files with extension \".badext\". It's giving me a .tar.bz2, but it's including badfile and *.badext -- the excludes seem to be ignored.\n\nThe order of include/exclude doesn't seem to make a difference. I tried wrapping the includes/excludes in a (the docs say it's implicit?), but it made no difference.\n\nI'm sure there's something simple I'm missing, since the manual has a very similar example, though in a somewhat different context.\n\nEDIT: It looks like it could be related to the dir=\"input\" attribute: it's adding everything in \"input\", and then adding everything in the tarfileset to that. Files I want appear twice in the program.tar.bz2, but files that are excluded only appear once. But dir is mandatory, and I don't see how this is different from the examples in the manual." ]
[ "ant", "include", "fileset" ]
[ "jdbc metadata getTables to list only table list", "i am trying to list tables from a database, when i use the below syntax\n\nResultSet rs = md.getTables(null, null, \"%\" ,null);\n\n\nthis returns me all the tables, views, index, system_tables from the database.\n\nbut i need only list of tables from the public schema so i have given the below syntax,\n\nResultSet rs = md.getTables(null, \"public\", \"%\" ,\"TABLE\");\n\n\nwhich shows me the following error\n\nrequired: String,String,String,String[]\nfound: <null>,String,String,String\nreason: actual argument String cannot be converted to String[] by method invocation conversion\n\n\njust need to list the tables alone from public schema.\n\nplz help with the syntax" ]
[ "java", "jdbc", "metadata" ]
[ "Design pattern for self-registering components/plugins", "I have singleton class World. (It isn't required to be singleton, but nonetheless it is defined so in my project.)\n\nThen I have Component interface, which is then implemented by ConcreteComponent1, ConcreteComponent2 etc. These all implement some nice methods like decorateTheWorld.\n\nAt some point, the World instance would then iterate through all its children Compontents and ask them to decorate itself by calling decorateTheWorld on them.\n\nThe problem with this approach is that the World, or something outside the World would then need to know about any kind of Component the World can have, since Component instances need to be created at some point, somehow.\n\nThe point is I don't want to make silly things like 100 lines of some repetetive code like \n\n(new ConcreteComponent1())->registerInTheWorld()\n(new ConcreteComponent2())->registerInTheWorld()\n(new ConcreteComponent3())->registerInTheWorld()\n\n\n...and I don't want to resort to reflection.\n\nSo, is there any design pattern that would make the registration part automatically, out of the box? Or am I asking for impossible?" ]
[ "php", "design-patterns" ]
[ "how to setup spring data jpa with multiple datasources", "I am using Spring Data Jpa version 1.0.0.M2 here is the url:\nhttp://static.springsource.org/spring-data/data-jpa/docs/1.0.0.M2/reference/pdf/spring-data-jpa-reference.pdf\n\nAll is promised to be very simple and nice, but when it comes to two datasources it breaks down. The question is how to setup with two data sources? The JpaRepository automatically searches for EntityManager, when it finds more than two it throws exceptions.\n\nIf you have any idea with EntityManager and how to setup the spring data jpa, please post a reply. Your help is truly appreciated!!!" ]
[ "spring", "jpa", "unique", "entitymanager", "spring-data" ]
[ "Update query with inner join - use updated column value to the another column of same table", "I want to update one column valur from the another updated column in same table with same SQL query. There are 3 tables joined in update query as below:\n\nUPDATE table1\n INNER JOIN table2 ON table2.id = table1.pid\n INNER JOIN table3 ON table3.id = table2.cid\nSET \n table1.col1 = \"1+2+3\",\n table1.col2 = table1.col1 + 5\nWHERE \n table1.id = 5\n\n\n\nAny help would be appreciated" ]
[ "mysql", "sql", "database" ]
[ "Reversing MySQL result in php", "I need to reverse result from mysql query, but i cannot use ORDER BY xxx ASC/DESC, and I dont want to create new array from fetch_assoc and run through it second time.\nIs there any way to do it different way? Or select top 10 records, then in ajax call next top 10 records under previous records." ]
[ "php", "mysql", "reverse" ]
[ "Maintain data columns when converting pandas hdfstore with odo", "I'm using odo from the blaze project to merge multiple pandas hdfstore tables following the suggestion in this question: Concatenate two big pandas.HDFStore HDF5 files\n\nThe stores have identical columns and non-overlapping indicies by design and a few million rows. The individual files may fit into memory but the total combined file probably will not.\n\nIs there a way I can preserve the settings the hdfstore was created with? I loose the data columns and compression settings.\n\nI tried odo(part, whole, datacolumns=['col1','col2']) without luck.\n\nAlternatively, any suggestions for alternative methods would be appreciated. I could of course do this manually but then I have to manage the chunksizing in order to not run out of memory." ]
[ "python", "pandas", "hdfstore", "blaze" ]
[ "Jquery each() function", "Given list\n\n<ul>\n <li>aaa</li>\n <li>sss</li>\n <li>ddd</li>\n</ul>\n\n\njs code:\n\n$(document).ready( function () {\n\n $(\"ul li\").each( function () {\n\n $(\"ul\").empty();\n\n alert( $(this).text() ); \n\n });\n\n});\n\n\nThis code returns every element normally, Why? Why list is not cleared at first iteration?" ]
[ "javascript", "jquery" ]
[ "Make Git Global/System Configuration readonly", "'Git Config' can set configurations in multiple levels as mentioned below:\n\n\nRepository Configuration\nGlobal Configuration\nSystem Level Configuration.\n\n\nRepository configuration overwrites Global. Global overwrites System configuration. \n\nQuestion #1: How Can I make sure the Repository Configuration not overwritting the Global Configuration? For instance,\n\nCommand 1: git config --global http.sslVerify 'true'\n\nCommand 2: git config http.sslVerify 'false'\n\nCommand 2 will be overriding the secure configuration (ie. Always do SSL Verification) set on Global Configuration. Command 2 will stop the SSL Verification. I want to make sure all git repositories does have secure configuration and not have the ability to override it. Is it possible to do it?\n\nQuestion #2: Git users also have the ability to override the global configuration by using commandline options as mentioned below. Is it possible to block this as well?\n\nCommand: git -c http.sslVerify=false clone https://domain.com/path/to/git\n\nPlease let me know if you need more information." ]
[ "git", "ssl", "github" ]
[ "How to convert mongodb timestamps to an actual date?", "I have createdAt propery like this: 2020-03-30T12:44:20.221+00:00. Now, I want something like 30 march 2020. Is it possible? I don't need the time and timezone, just the date. Thanks." ]
[ "javascript", "mongodb", "date" ]
[ "Partition graph into k non-empty pieces - maximization", "I'm looking for algorithm (links/names would be enough) to partition graph into k ( in my case ~2-4 ) non-empty pieces such that sum of total edges weights (sum weights for each piece) is maximal. I'm aware that this problem probably lies in NP class but I have small amount of vertices (8-15), graphs are dense and connected. Edges weights could be negative." ]
[ "algorithm" ]
[ "Dispose h2 database after @DataJpaTest", "I have a lot of Test classes annotated with Spring Boot's @DataJpaTest. For each of those classes, a new h2 database is being created and a set of liquibase scripts are being executed. Then the tests run.\n\nThe problem with this setup is that after each test class execution, the database that was created and used, remains in-memory. After 20-some test classes, I run out of memory. I'd like to dispose the database once my test class is done with it. \n\nI read that DB_CLOSE_DELAY=0 will force the database to be closed after the last connections is closed. I believe when a test class is finished with, the Spring's DataSource will close all connections, however I don't see a way to set this property in the connection string. Here's where the \"magic\" happens.\n\nAny suggestions?" ]
[ "spring-data-jpa", "h2", "spring-boot-test" ]
[ "TFS work item migration do not migrates work items with all links", "I have run a migration from one project to another in the different TFS Collections using TFS Integration Tool. All of the work items transferred but none of the linking occurred." ]
[ "tfs-workitem", "tfs-2015", "tfs-migration", "tfs-to-tfs-migration-tool" ]
[ "The name parameter 'Child' isn't defined for BottomAppBar() widget", "I'm currently trying to construct a bottom app bar for my flutter. I am new to the BottomAppBar widget and as I concurrently referred to the documentation while making the code, I've stumbled upon this error.\n\nThe following image shows the error\n\n![BottomAppBar]: https://ibb.co/Bn3hKFN" ]
[ "flutter" ]
[ "Mobile Optimization - Conditionally load HTML depending on screen size", "I am redesigning my site for mobile first. I have read a few stackoverflow questions relating to this but none seemed to be a complete answer. I searched the web and came across http://www.smashingmagazine.com/2013/04/03/build-fast-loading-mobile-website/\n\nIn the CODE FOR MOBILE-FIRST section, it says the best way to conditionally load images for different screen sizes. What I'm looking for is that, but for html elements.\n\n<div class=\"social_buttons\">\n <ul>\n <li>google</li>\n <li>twitter</li>\n <li>facebook</li>\n <li>pinterest</li>\n </ul>\n</div>\n\n\nI do not want this section of html to be loaded when loaded from a mobile device, however I DO want it when called from desktop computer.\n\nUsing the solution from smashingmagazine (conditionally loaded using css) is it possible doing it this way or does it just apply to images?\n\nThanks for any help =)" ]
[ "css", "mobile", "optimization", "responsive-design", "media-queries" ]
[ "How do I select content between two patterns with preg_match_all on php?", "Im trying to search for two HTML tags, and also grab everything in between. When I try each of the tags separately it finds them fine, so I know that they are spelled right and exist. The problem I think is with the pattern, can someone please help me with it. \nEverything I research online seems to go right over my head. So if you could please explain how your pattern works, that would be awesome! \n\nSee code below, and if you have any questions feel free to ask. \n\nThanks for your time:)\n\n<?php\n$date= date(Y).\"/\".date(n).\"/\".date(j);\n$address= \"http:www.example.com/\".$date;\n$text_page = file_get_contents(\"$address\");\n\n$searchfor1 = '<li id=\"menuSynchronizeSwitch\">';\n$searchfor2 = '<li id=\"footerPrevWeek';\n\nheader('Content-Type: text/plain');\n\n$pattern1 = preg_quote($searchfor1, '/');\n$pattern2 = preg_quote($searchfor2, '/');\n\n$pattern = \"/^.*$pattern1.*\\r*$pattern2.*\\$/m\";\n\n\nif(preg_match_all($pattern, $text_page, $matches)){\n echo \"Found matches:\\n\";\n echo implode(\"\\n\", $matches[0]);\n}\nelse{\n echo \"No matches found\";\n}\n?>" ]
[ "php", "html", "regex", "preg-match-all" ]
[ "Reading Regular Expressions from a text file", "I'm currently trying to write a function that takes two inputs:\n\n1 - The URL for a web page\n2 - The name of a text file containing some regular expressions\n\nMy function should read the text file line by line (each line being a different regex) and then it should execute the given regex on the web page source code. However, I've ran in to trouble doing this:\n\nexample\nSuppose I want the address contained on a Yelp with URL = http://www.yelp.com/biz/liberty-grill-cork\nwhere the regex is \\<address\\>\\s*([^<]*)\\\\b\\s*<. In Python, I then run:\n\naddress = re.search('\\<address\\>\\s*([^<]*)\\\\b\\s*<', web_page_source_code)\n\n\nThe above will work, however, if I just write the regex in a text file as is, and then read the regex from the text file, then it won't work. So reading the regex from a text file is what is causing the problem, how can I rectify this?\n\nEDIT: This is how I'm reading the regexes from the text file:\n\nwith open(\"test_file.txt\",\"r\") as file:\n for regex in file:\n address = re.search(regex, web_page_source_code)\n\n\nJust to add, the reason I want to read regexes from a text file is so that my function code can stay the same and I can alter my list of regexes easily. If anyone can suggest any other alternatives that would be great." ]
[ "python", "regex" ]