texts
list
tags
list
[ "gawk command in CMD with && operator not working", "I'm issuing gawk command from Windows CMD but it just stuck there.Same command is working perfectly fine in Cygwin Terminal.\nI am trying to find first occurrence of ending brace \"}\" on first column in a file after line number 30 \n\nCommand is\n\ngawk 'NR > 30 && /^}$/ { print NR; exit }' Filename.c > Output.txt\n\n\nI noticed another thing that when i issue command form CMD,Besides sticking it creates a file with the name of Line number(If above command is executed then 30 is created)" ]
[ "cmd", "cygwin", "gawk" ]
[ "Session value gets deleted after redircing with payment gateway?", "My Application is using MonesterPay payment method.\nI am storing some user information in session variable as it will use after transaction is complete successfully.\nBut once my transaction is complete the session values gets deleted which I have stored.\nAny solutions or reason there?" ]
[ "php", "session", "payment-gateway" ]
[ "With out any data loss, how can we interchange hashtable key values?", "I have been facing a question frequently regarding Hashtable.\n\nHow to convert key as value and value as key with out any data loss using java.util.Hashtable.\n\n Hashtable ht = new Hashtable();\n\n ht.put(1,\"One\");\n ht.put(2,\"Two\");\n ht.put(3,\"One\");\n\n\nI would like to convert keys as \"One\",\"Two\",\"One\" and values as 1,2,3 respectively.\n\nThanks for your valuable support." ]
[ "java" ]
[ "Why expm(2*A) != expm(A) @ expm(A)", "According to the rule exp(A+B) = exp(A)exp(B), which holds for commuting matrices A and B, i.e. when AB = BA, we have that exp(2A) = exp(A)exp(A). However when I run the following in Python:\n\nimport numpy as np\nfrom scipy.linalg import expm\n\nA = np.arange(1,17).reshape(4,4)\n\nprint(expm(2*A))\n[[ 306.63168024 344.81465009 380.01335176 432.47730444]\n [ 172.59336774 195.36562731 214.19453937 243.76985501]\n [ -35.40485583 -39.87705598 -42.94545895 -50.01324379]\n [-168.44316833 -190.32607875 -209.76427134 -237.72069322]]\n\nprint(expm(A) @ expm(A))\n[[1.87271814e+30 2.12068332e+30 2.36864850e+30 2.61661368e+30]\n [4.32685652e+30 4.89977229e+30 5.47268806e+30 6.04560383e+30]\n [6.78099490e+30 7.67886126e+30 8.57672762e+30 9.47459398e+30]\n [9.23513328e+30 1.04579502e+31 1.16807672e+31 1.29035841e+31]]\n\n\nI get two very different results. Note that @ is just the matrix product. \n\nI also tried it in Matlab and the two results are the same as expected. What am I missing here?\n\nEdit: I have NumPy 1.15.3, SciPy 1.1.0, Python 3.6.4, Windows 7 64-bit\n\nAs suggested in comments by Warren Weckesser, using A = A.astype(np.float64) solves the problem." ]
[ "python", "numpy", "scipy" ]
[ "How to use Msbuild.Community.Tasks.Version in a csproj file", "I want to use the VersionTask from the MSBuild Community Tasks to set the Revision calculation type. However, I am having difficulty understanding how to actually wire up the task within my csproj file.\n\nThe project has an AssemblyInfo.cs which has the following attribute defined:\n\n[assembly: AssemblyVersion(\"3.2.5.*\")]\n\n\nWhat I want to do is over-ride the generation of the Revision number handling with my own custom handling.\n\nI have put the customised Version task into the csproj file as follows:\n\n<UsingTask TaskName=\"MyCo.Build.Tasks.Version\" AssemblyFile=\"$(SolutionDir)\\..\\Build\\.build\\MyCo.Build.Tasks.dll\" />\n\n\nThe actual task is then called as follows:\n\n <Target Name=\"BeforeBuild\">\n<Message Text=\"Setting Revision Number to $(BuildNumber)\" />\n<MyCo.Build.Tasks.Version RevisionType=\"BuildServerNumber\" Revision=\"$(BuildNumber)\" /></Target>\n\n\nI can see the target BeforeBuild being called because of the Message Task but the exe file still has the standard generated numbering as follows: File Version : 3.2.5.27547\n\nI was expecting something like 3.2.5.111 (the build number passed into MSBuild as a parameter).\n\nAs the Version task is overriding the default handling of the '*' value for Revision I don't believe it is necessary to actually modify the AssemblyInfo.cs file. \n\nDo I need to pass the output value from the Version task into an MSBuild parameter? Do I actually need to use the AssemblyVersion task to update the values in the file?\n\nObviously I am trying to avoid having to change the AssemblyInfo.cs, I just want to override the Version number handling. \n\nCan someone advise please?\n\nEDIT: I just found the following example of usage in the chm file from the installer which partly answers my question. \n\n <Version BuildType=\"Automatic\" RevisionType=\"Automatic\" Major=\"1\" Minor=\"3\" >\n <Output TaskParameter=\"Major\" PropertyName=\"Major\" />\n <Output TaskParameter=\"Minor\" PropertyName=\"Minor\" />\n <Output TaskParameter=\"Build\" PropertyName=\"Build\" />\n <Output TaskParameter=\"Revision\" PropertyName=\"Revision\" />\n </Version>\n <Message Text=\"Version: $(Major).$(Minor).$(Build).$(Revision)\"/>\n\n\nHowever, when I run the build I can output the generated Assembly Version in a Message task but the exe file still has the default Revision as before" ]
[ "msbuild-task", "csproj", "msbuildcommunitytasks" ]
[ "Laravel dynamic route domain configuration and cached routes", "I want to provide my customer with an option to configure their subdomain names in .env and config/app.php file. My Laravel route configuration is as follows:\n\n Route::group(['namespace' => 'PublicSite',\n 'domain' => config('app.app_domain_public')], function () {\n\n // public routes here\n\n });\n\n Route::group(['namespace' => 'AdminSite',\n 'domain' => config('app.app_domain_admin')], function () {\n\n // admin routes here\n\n });\n\n\nIt works fine and reacts to .env changes. But when I prepare my application package for deployment, I run php artisan route:cache and this makes the values of config('app.app_domain_x') frozen somewhere in bootstrap/cache/routes.php. \n\nAs the result, the application no more reacts to route domain changes in .env unless I run php artisan route:cache on the server. But there are situations when it's not possible to run artisan on the server. \n\nOf course, I could configure .env as necessary before deployment but this breaks the idea of being able to modify .env settings without rewriting other application files (route cache, to be more specific).\n\nIs there any workaround to make Laravel to cache at least some routes but still provide dynamic domain configuration?" ]
[ "php", "caching", "laravel-5", "url-routing" ]
[ "Redis ZRANGEBYSCORE: what is offset and count", "ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]\n\n\nWhat is offset and count? How am I supposed to use them if I just want the member with the highest score?" ]
[ "redis" ]
[ "ServerSocket - Is it really necessary to close() it?", "I have this damnable structure:\n\npublic void run() {\n\n try {\n if (!portField.getText().equals(\"\")) { \n String p = portField.getText();\n CharSequence numbers = \"0123456789\";\n\n btnRun.setEnabled(false);\n\n if (p.contains(numbers)) {\n ServerSocket listener = new ServerSocket(Integer.parseInt(p));\n\n while (true) {\n Socket socket = listener.accept();\n try {\n PrintWriter out = new PrintWriter(socket.getOutputStream(), true);\n out.println(\"Hi there, human.\"); \n } finally {\n socket.close(); \n }\n }} else {\n JOptionPane.showMessageDialog(null, \"Only numbers are allowed.\");\n }\n }\n\n } catch (NumberFormatException | HeadlessException | IOException e) {\n e.printStackTrace();\n } \n }\n\n\nAs you can see, I need to close the listener exactly as I did with the socket. The problem is that if I try to do so after the loop the code will be \"unreachable\", and if I try to declare a field anywhere for the ServerSocket, I get a NullPointerException. I don't want to close the ServerSocket together with the socket/client because I want to make new connections. \n\nSo that's my question:\n\nIt's REALLY necessary to close the ServerSocket in this case? The ServerSocket closes itself by its own when the software is shut down? (System.exit(0)). If the ServerSocket continues to run when I close the software just because I have not closed it, then I have a problem, because I can't reach that bloody piece of code to close it :)." ]
[ "java", "serversocket" ]
[ "check if element is present", "I use selenium web-driver in Eclipse.I need to check if table is displayed on page. I use such code:\n\ntry {\n Assert.assertTrue(driver.findElement(By.xpath(\".//*[@id='flexibleTable']\")).isDisplayed());\n} catch (AssertionError e) {\n System.err.println(\"overview not found: \" + e.getMessage());\n}\n\n\nAlso block if\n\nif (driver.findElement(By.xpath(\".//*[@id='flexibleTable']\")).isDisplayed()) {\n ...\n} else {\n ...\n}\n\n\nBut if such element is not found test is interrupted. How can I organize check so my test continue even if element is not on the page and block else will execute?\n\nEdit\nFailure trace \n\norg.openqa.selenium.NoSuchElementException: Unable to find element with xpath == .//*[@id='flexibleTable'] (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 360 milliseconds\nFor documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html\nBuild info: version: '2.23.1', revision: '17143', time: '2012-06-08 18:59:04'\nSystem info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.7.0_04'\nDriver info: driver.version: RemoteWebDriver\nSession ID: c57bdd3e-ff76-43f8-9cd5-898248a4546a\nat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\nat sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)\nat sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\nat java.lang.reflect.Constructor.newInstance(Constructor.java:525)\nat org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188)\nat org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)\nat org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:458)\nat org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:226)\nat org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:311)\nat org.openqa.selenium.By$ByXPath.findElement(By.java:343)\nat org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:218)\nat system.Salutation.testUnit(Salutation.java:104)\nat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\nat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\nat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\nat java.lang.reflect.Method.invoke(Method.java:601)\nat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)\nat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)\nat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)\nat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)\nat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)\nat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)\nat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)\nat org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)\nat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)\nat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)\nat org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)\nat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)\nat org.junit.runners.ParentRunner.run(ParentRunner.java:300)\nat org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)\nat org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)\nat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)\nat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)\nat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)\nat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)\n\n\nI use selenium 2.23.1" ]
[ "java", "selenium", "webdriver" ]
[ "What is the point of using a Composite hash range partition", "If I have a table that has values in ranges, then I should create a range partition... if the table does not have data that can fit in a range or list portion, then a hash partition should be created. Then what is the point of joining multiple partitions together?" ]
[ "sql", "oracle", "database-partitioning" ]
[ "Is there any react.js open source calendar or scheduler", "I need to make a date booking interface where a service provider can select date slots to set as available and has the ability to accept and reject appointment date requests. This task has to be done using react.js. I have never worked with calendars, so I am confused about whether I should build the interface from scratch or use open-source calendar libraries. If there are any tutorials or open-source libraries that can help me get this task done, please let me know because I haven't been finding anything helpful." ]
[ "reactjs", "frontend", "scheduler", "web-frontend", "web-site-project" ]
[ "Update form data in django", "I have a form created by django. I do the insert without any difficalty, but when I want to use it in edit mode, when I click the form submit button, and I debug the code, request.POST is sent empty; that's because I send the parameter \"id\" to the view. (As when I remote this parameter, I have the values in request.POST). but what should I do?\n\nmodels.py:\n\nclass Urls(models.Model):\n\n url = models.TextField(\n blank=True,\n )\n\n\nforms.py:\n\nclass SaveUrl(forms.Form):\n url = forms.CharField(\n label=u'Url',\n widget=forms.TextInput(attrs={'size':32})\n )\n\n\nurls.py:\n\nurlpatterns = patterns('systemSettings.views',\n url(r'^$',\n 'systemSettings',\n name='systemSettings'),\n url(r'^edit/(?P<id>\\d+)/$',\n 'editSystemSetting',\n name='editSystemSetting'),\n)\n\n\nin template,urlsSetting.html:\n\n<form action=\"{{ action }}\" id=\"urlsForm\" method=\"POST\">\n <label for=\"id_url\">Url:</label></td><td>\n {{ form.url }}\n <input type=\"submit\" value=\"insert\" />\n</form>\n\n\nthe view:\n\ndef editSystemSetting(request, id):\n Url = Urls.objects.get(id = id)\n editData = {'url':Url.url}\n URLS = Urls.objects.all()\n\n form = SaveUrl(request.POST)\n\n if form.is_valid():\n url = form.cleaned_data['url']\n Url.url=url\n Url.save()\n else:\n form = SaveUrl(editData)\n\n\n variables = RequestContext(request, {\n 'form': form,\n 'urls':URLS,\n 'action':'/systemSettings/edit/'+id,\n })\n return render_to_response('systemSettings/urlsSetting.html', variables)" ]
[ "python", "django", "django-forms" ]
[ "ImageSource already loaded blink in Collection View", "I'm working on an app where a page is displaying previous photos and new one that I can take a shot from the app.\nI have an ObservableCollection where the object is containing the ImageSource.\ntry\n {\n if (SDCard.Updated || SDCard.FirstLoad) \n { \n List<MyObject> myObjects = (List <MyObject> )await DataStore.GetItemsAsync(true);\n MyObservableCollection.Clear();\n foreach (var myObject in myObjects)\n {\n MyObservableCollection.Add(myObject);\n } \n \n }\n }\ncatch (Exception ex)\n {\n Debug.WriteLine(ex);\n }\n finally\n {\n if(IsBusy==true)\n IsBusy = false;\n }\n\nBinded in a CollectionView.\n<CollectionView x:Name="ItemsListView" ItemsLayout="HorizontalList"\n ItemsSource="{Binding MyObservableCollection}" \n SelectionMode="None">\n <CollectionView.ItemTemplate>\n <DataTemplate>\n <RelativeLayout x:DataType="model:MyObject">\n <Image Source="{Binding PhotoSource}" BackgroundColor="AliceBlue" Aspect="AspectFill" RelativeLayout.WidthConstraint=\n "{ConstraintExpression Type=RelativeToParent, Property=Width}" RelativeLayout.HeightConstraint=\n "{ConstraintExpression Type=RelativeToParent, Property=Height}"/>\n...\n\nPhotoSource is a ImageSource Property.\nAfter I shot the new photo from the app, I save it on the application (in Application.Current.Properties).\nThen, when I come back on this page, the "try{}" part rebuilt ObservableCollection with saved data and so the CollectionView is updated (with a little delay/blink during the photo loading).\nThe issue is : After this, EVEN if I don't reload the ObservableCollection linked, the app always seems to "reload" the photo each time when i go on the page which is displaying total photo list. There is a delay (on .APK tested on my Android phone) or a blink (from the Android emulator).\nIs there somebody who faced this issue ?\n\nWhen I open the app, the photos page is load with already saved photos and there is only 1 "load effect" (short delay/blink). If I come back there further, it doesn't load and the images are directly shown.\nI added breakpoint in my reload list function to be sure after I add a new photo the list isn't reload each time I go to this page so I can confirm that the ObservableCollection isn't modified when I come back on the page.\n\nI repeat : the issue is that the application seems to refresh each time the new PhotoSource added during the use of the application. If I close the app, relaunch it, then go to the page : there is a single loading effect, and the nexts access are fluid (photosources are already loaded)." ]
[ "c#", "android", ".net", "xamarin", "collectionview" ]
[ "Apache POI : parsing Boolean value but as text in another language independantly from user's local", "I don't know if I'm overthinking this, but I need to parse an input file, with a column that is semantically a boolean value, but most of our users are French, so I decided to parse the cells as text and ask the users to type VRAI or FAUX (which are TRUE and FALSE in french), the problem is that when receiving this input, the server interprets them as Boolean because it's running on French, and so they come as TRUE AND FALSE even if I try to get the String value or use a dataFormatter, what I really want is to receive the Strings VRAI and FAUX and not have them interpreted as boolean, to avoid any conflicts if a user's PC is in English or if we ever change server language.\n\nWhat I did for now is something like this :\n\nprivate void setValueFromCell(Cell cell, Person p) {\n String cellValue = dataFormatter.formatCellValue(cell).trim();\n CellType cellType = cell.getCellType();\n if (CellType.BOOLEAN.equals(cellType)) {\n p.setHelpful(cell.getBooleanCellValue());\n } else if (CellType.STRING.equals(cellType) && (\"VRAI\".equals(cellValue) || \"FAUX\".equals(cellValue))) {\n p.setHelpful(\"VRAI\".equals(cellValue));\n } else {\n log.error(\"Cell value not allowed\");\n }\n}\n\n\nI did this so if the local is French, POI will do the transformation for the cell and i can get the boolean value, otherwise I know it's going to be the literal String \"VRAI\" or \"FALSE\", any help is appreciated" ]
[ "java", "excel", "apache-poi" ]
[ "Laravel: Order query by count id field on relation", "I have a resources table, and a resources_votes table in which I have a record for everytime a user likes [vote_id 1] or dislikes [vote_id 2] a resource. now I need to retrieve all the resource information ordered from most liked to the less one, and since resource has many resources_votes when I use ->with('votes') it returns an array of objects with each one of the resources_votes related to the resource ID.\n\nIs there a way I can count how many positive votes a resource has [vote_id =2], add a field with this count and order the query from most voted to less voted?\n\nPD: this is an example of a resource object with the resources_votesrelationship, there you can see the votes array and the vote ID which I need to count and order according to:\n\n {\n \"id\": 2,\n \"name\": \"aspernatur\",\n \"image\": \"http://lorempixel.com/480/480/?31738\",\n \"author\": \"Max Thiel\",\n \"created_by\": 6,\n \"reviewed_by\": \"Mr. Emiliano Frami\",\n \"lang_id\": 2,\n \"resource_type_id\": 1,\n \"status\": \"Borrado\",\n \"resource_type\": \"Imagen\",\n \"platforms\": [],\n \"classifications\": [],\n \"votes\": [\n {\n \"id\": 2,\n \"user_id\": 2,\n \"resource_id\": 2,\n \"vote_id\": 1\n },\n {\n \"id\": 29,\n \"user_id\": 1,\n \"resource_id\": 2,\n \"vote_id\": 2\n },\n {\n \"id\": 24,\n \"user_id\": 12,\n \"resource_id\": 2,\n \"vote_id\": 1\n },\n ]\n }," ]
[ "php", "mysql", "laravel", "eloquent" ]
[ "Selenium Web driver saying No class definition found in JSF project", "I'm trying to use Selenium Web driver to capture screen in a JSF project using ANT. I have included all the jar files list is below in the image:\n\n\n\nWhen I try to deploy it on jboss, it fails saying \n\"Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver\".\n\nThe code I'm using is:\n\nWebDriver driver = new FirefoxDriver();\ndriver.get(\"http://www.google.com/\");\nFile scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);\nFileUtils.copyFile(scrFile, new File(\"C:/capture/screenshot.png\"));" ]
[ "java", "jsf", "selenium", "selenium-webdriver" ]
[ "Scipy: how to convert KD-Tree distance from query to kilometers (Python/Pandas)", "This post builds upon this one. \n\nI got a Pandas dataframe containing cities with their geo-coordinates (geodetic) as longitude and latitude. \n\nimport pandas as pd\n\ndf = pd.DataFrame([{'city':\"Berlin\", 'lat':52.5243700, 'lng':13.4105300},\n {'city':\"Potsdam\", 'lat':52.3988600, 'lng':13.0656600},\n {'city':\"Hamburg\", 'lat':53.5753200, 'lng':10.0153400}]);\n\n\nFor each city I'm trying to find two other cities that are closest. Therefore I tried the scipy.spatial.KDTree. To do so, I had to convert the geodetic coordinates into 3D catesian coordinates (ECEF = earth-centered, earth-fixed):\n\nfrom math import *\n\ndef to_Cartesian(lat, lng):\n R = 6367 # radius of the Earth in kilometers\n\n x = R * cos(lat) * cos(lng)\n y = R * cos(lat) * sin(lng)\n z = R * sin(lat)\n return x, y, z\n\ndf['x'], df['y'], df['z'] = zip(*map(to_Cartesian, df['lat'], df['lng']))\ndf\n\n\nThis give me this:\n\n\n\nWith this I can create the KDTree:\n\ncoordinates = list(zip(df['x'], df['y'], df['z']))\n\nfrom scipy import spatial\ntree = spatial.KDTree(coordinates)\ntree.data\n\n\nNow I'm testing it with Berlin,\n\ntree.query(coordinates[0], 2)\n\n\nwhich correctly gives me Berlin (itself) and Potsdam as the two cities from my list that are closest to Berlin. \n\nQuestion: But I wonder what to do with the distance from that query? It says 1501 - but how can I convert this to meters or kilometers? The real distance between Berlin and Potsdam is 27km and not 1501km.\n\nRemark: I know I could get longitude/latitude for both cities and calculate the haversine-distance. But would be cool that use the output from KDTree instead.\n\n\n (array([ 0. , 1501.59637685]), array([0, 1]))\n\n\nAny help is appreciated." ]
[ "python", "scipy", "geospatial", "spatial", "kdtree" ]
[ "What is FreeBSD MD5 and why does it produce hashes in non-hexadecimal notation?", "I am doing a hacking challenge from Hack This Site in which I found a password hash and then cracked it by brute forcing possibilities. The format that my hash cracker (John the Ripper) used was something called \"FreeBSD MD5\". The password and hash are the following:\nPW: shadow\nHASH: $1$AAODv...$gXPqGkIO3Cu6dnclE/sok1\n\nMy question is, doesn't MD5 normally only have the charset 0123456789abcdef (hexadecimal)? Why is this hash suddenly including a bunch of other characters?\n\nScreenshot:" ]
[ "cryptography", "md5", "freebsd", "hash-function" ]
[ "Java: Remembering a result from a previous step in a recursive method", "I'm working on a Boggle game and some people told me the best way to search words is using recursion. I'm trying out a searchWord method to search the word. If the first letter is found, the method calls itself and drops the first letter. The method returns true when the length == 0 (word is found) or false (when the letter is not found). Problem is sometimes in boggle one \"dice\" has a same letter multiple times around it... To solve that I need to count that letter and if it's there more than once, it should search for the next appearance of that letter (search for the same word without dropping first letter). I need a way to memorize that letter and the index of the letter around which the multiple letters bound so it can be used when the letter is not found to check if there would be other possibilities. Since it's a recursive method I have no idea how to put these in a variable because they would be changed whenever the method calls itself... \n\nHope you guys can help! Here's the method:\n\npublic boolean searchWord(String word, int i, int j) {\n boolean res;\n if (word.length() == 0) {\n res = true;\n } else {\n String theWord = word.toUpperCase();\n int[] indexes = searchLetter(Character.toString(theWord.charAt(0)), i, j);\n if (indexes[0] > -1) {\n res = searchWord(theWord.substring(1), indexes[0], indexes[1]);\n } else if(countLetter(Character.toString(/*The value that has to be memorized*/), /*index 1 that has been memorized*/, /*index 2 that has been memorized*/) > 1) {\n res = searchWord(theWord, i, j);\n } else {\n res = false;\n }\n }\n return res;\n}\n\n\nNote: yes I use Strings which is weird because chars may be a better option but I could change that later." ]
[ "java", "arrays", "recursion", "boggle" ]
[ "jQuery - growlUI Notification using screen scraped tweet", "I am trying to pull my latest tweet into a variable in javascript, then use growlUI() to display this in a notification in jQuery.\n\nCurrently, I have pulled my tweet using PHP into a variable in javascript called test. I need to adjust the following jQuery code to use \"test\" instead of \"Hello\".\n\nCurrent code works:\n\n$.growlUI('Growl Notification','Hello'); \n\n\nAttempted code does not work:\n\n$.growlUI('Growl Notification', $(test));\n\n\nMy Question\n\nHow do I use the variable test, which is a javascript variable, as a jQuery attribute?\n\nMany thanks!\n\nMy source code:\n\n<html>\n\n<head>\n\n <!-- Styling for growlUI -->\n<style type=\"text/css\">\n div.growlUI { background: url(check48.png) no-repeat 10px 10px }\n div.growlUI h1, div.growlUI h2 {\n color: white; padding: 5px 5px 5px 75px; text-align: left\n}\n</style>\n\n<!-- Import jquery from online -->\n<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js\"></script>\n<!-- Import blockUI -->\n<script type=\"text/javascript\" src=\"js/jquery.blockUI.js\"></script>\n\n<script type = \"text/javascript\">\n\n<!-- Screenscrape using PHP, put into javascript variable 'test' -->\n\n <?php\n\n $url = \"http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=XXXXXXXXXX\";\n $raw = file_get_contents($url);\n $newlines = array(\"\\t\",\"\\n\",\"\\r\",\"\\x20\\x20\",\"\\0\",\"\\x0B\");\n $content = str_replace($newlines, \"\", html_entity_decode($raw));\n\n $start = strpos($content,'<text>');\n $end = strpos($content,'</text>',$start);\n $latesttweet = substr($content,$start,$end-$start);\n\n echo \"var test = \".$latesttweet.\";\\n\";\n\n ?>\n\n</script>\n\n</head>\n\n<!-- Here I'm attempting to use test variable in second half of growlUI parameters -->\n<body onLoad=\"$.growlUI('Latest Update',test); \">\n\n</body>\n\n</html>" ]
[ "php", "javascript", "jquery", "growl" ]
[ "rspec install failed", "screen:\n\nE:\\ir\\InstantRails\\rails_apps>gem install rspec\n\nAttempting local installation of 'rspec'\nLocal gem file not found: rspec*.gem\nAttempting remote installation of 'rspec'\nERROR: While executing gem ... (Gem::GemNotFoundException)\n Could not find rspec (> 0) in the repository\n\nmy env: InstantRails 1.3a on windows\n\nthanks for help!" ]
[ "ruby-on-rails", "rspec" ]
[ "Why does socket.isOutputShutdown() returns false even if the socket is closed?", "The Java Socket API tells me that closing a socket will also close the socket's InputStream and OutputStream.\n\nNeither the Socket API Javadoc, nor the Input/OutputStream API info defines (I haven't found it yet) exactly what \"shutdown\" means for an OutputStream or InputStream, but I have been assuming that closing either puts them into a \"shutdown\" state.\n\nHowever, after I invoke my client socket's close() method successfully (invoking isClosed() returns true), if I then invoke either that socket's isInputShutdown() or isOutputShutdown() method, the result is a false.\n\nI'm confident that neither stream has unread/unsent data buffered at the time the Socket's close() is invoked.\n\nI'm assuming that I don't understand what \"is shutdown\" means for a socket's input/output streams, and/or when shutting down occurs." ]
[ "java", "sockets" ]
[ "Doxverilog - not patching when configuring", "I have doxygen 1.8.5 and Doxverilog (for doxygen 1.7.0). Following the instructions quoted below I get messages saying that patches have previously been applied. Then some of the HUNKs fail.\n\nIf I proceed anyway and set up the verilog.cfg, running doxygen with this cfg produces \n\n\"Warning: ignoring unsupported tag `OPTIMIZE_OUTPUT_VERILOG =' at line 35, file verilog.cfg\"\nThen blank output.\n\nThe instructions I'm using to setup doxverilog are:\n\n\n\ninstall the doxygen-1.7.0 sources\n\n1. copy the Verilog files verilogparser.y verlogscanner.l and the source files to the doxygen-1.7.0\\src directory\n\n2. copy the patch file verilog.patch to directory doxygen-1.7.0\n\n3. open a shell in the doxygen-1.7.0 directory\n\n3.1 configure doxygen\n sh configure\n\n3.2 make patch # patch -p1 < verilog.patch\n\n4 compile the source files\n make all\n\n5 If the compilation was successful create a doxygen configuration file with # doxygen -s -g verilog.cfg\n In the configuration file you should see the option OPTIMIZE_OUTPUT_VERILOG. \n The file patterns for the Verilog parser are *.v and *.V" ]
[ "doxygen" ]
[ "N1QL query spanning multiple buckets", "Two Couchbase related questions...\n\n\nI am using Java SDK 2.2.0 on Couchbase 4.0 RC0 to run some N1QL queries which joins more than one bucket. In Java SDK, query is a functionality exposed by the bucket interface. So, if I want to run a N1QL query joining more than one bucket which bucket should I get a handle for (i.e. which bucket name should I pass when invoking Cluster.openBucket(...)). Operations like insert, upsert, delete etc being tied to a bucket makes sense because they working on a document in a bucket but shouldn't a query be more generic?\nDoes CouchbaseCluster.create() and Cluster.disconnect() create the necessary connections to the cluster? If so, what does opening and closing a bucket do?" ]
[ "couchbase", "n1ql" ]
[ "How do you split up content into paginated chunks using jQuery?", "I am breaking up content into chunks using pagination (we have next, previous, current button). \n\nI want to show data in pagination (in other words I want to only 500 characters in one page). Example I have div (having some data ) I want to show that data in pagination(next,previous button disable). If user click first button it show only first 500 character(,previous are disable), then if user click next button than it show next 500 character(previous are enable). Now user can use check next or previous 500 character.\n\non clicking current button it show all content.\nwhen I am using this it is not displaying 500 character I used like this\nhttp://jsfiddle.net/naveennsit/aD4EF/5/\n\nalert($(\"#test\").html());\nalert($(\"#test\").html().length);\nvar currentpage = 0;\nvar str = new Array();\nvar len = $(\"#test\").html().length;\n/*for(var i = 0; var = len; i++){\n\n str[i] = $(\"#test\").html().substr(0, 500);\n}*/\n\n$(\"#first\").click(function () {\n alert(\"first\");\n var text = $(\"#test\").html().substr(0, 500);\n alert(text);\n $(\"#test\").empty();\n $(\"#test\").val(text); // First time it is not working ?\n\n});\n$(\"#nxt\").click(function () {\n alert(\"nxt\");\n});\n\n$(\"#pre\").click(function () {\n alert(\"pre\");\n});" ]
[ "javascript", "jquery" ]
[ "initializing Foreign Key models in code has no effect", "I have a foreign key model like this:\n\ninvite_discount_owner = models.ForeignKey('self', verbose_name='aaa', null=True, blank=True, on_delete=models.CASCADE,\n related_name='invited_customer')\n\n\nand in some part of my code, I want to initialize it with a correct data type:\n\nrequest.user.invite_discount_owner = discount_owner\n\n\nbut it has no effect and this field stays empty!" ]
[ "python", "django" ]
[ "Chef: access values from nested hash", "I have the following array in my recipe\n\n users = {\n 'User1': {'car': 'auto1', 'number': NumGenerator.generate}, \n 'User2': {'car': 'auto2', 'number': NumGenerator.generate}\n}\n\n\nAnd my template erb file is\n\n<%= @car %>\n\n\nI want to generate a file with the name of the user - for example \"User1\" and I want to add the value of the variable \"car\" - auto1 - to the template. How can I achieve this? It would be great if the order of the values doesn`t matter. \n\ntemplate '/etc/mytest/User1.txt' do\n source 'mytest.conf.erb'\n variables(car: users['User1']['car'])\nend \n\n\nEven \n\n variables(car: users[0][1])\n\n\nis not working. I always get the error message \"undefined method [] for nil.NilClass\"" ]
[ "ruby", "chef-infra", "erb" ]
[ "Remap Control_R in emacs", "I would like to rebind Right Control to BackSpace (or 'pipe/backslash'). I would prefer to do this with emacs lisp, but am open to other solutions. (I tried doing this with xmodmap but it didn't work)" ]
[ "emacs", "elisp", "ubuntu-12.04", "key-bindings" ]
[ "Is it possible to return from the *calling* method using IL?", "There's an annoying quirk in the way Response.Redirect works: you almost always want to terminate excecution right away and jump to the new page:\n\nIf ThisIsTheWrongPage Then\n Response.Redirect(sUrl, False)\nEnd If\n\n'this code should not execute\nDoSomethingWithThisPage\n\n\nBut Response.Redirect doesn't end execution, it just keeps on going and executes the subsequent lines of code. This is causing a lot of havoc in a legacy app I'm maintaining. So you have to do this:\n\nIf ThisIsTheWrongPage Then\n Response.Redirect(sUrl, False)\n Return\nEnd If\n\n\nWhat I would like to do is implement a method like this:\n\nSub RedirectToUrl(sUrl As String)\n 'redirect to the specified url\n HttpContext.Current.Response.Redirect(sUrl, False)\n\n 'return from the CALLING method\nEnd Sub\n\n\nAnd then I could write this:\n\nIf ThisIsTheWrongPage Then\n RedirectToUrl(sUrl)\nEnd If\n\n\nAnd not have to worry about the missing Return statement. I know it's not hard to write that return statement, but there are about 1,000 of these in the code, and new ones being added, and I want a method that the developer can call and not have to be careful about that Return statement. It's a bug just waiting to happen.\n\nI know there's no way to do this in traditional .NET code, but I was wondering if it could be implemented in IL, to pop the stack twice and jump to the calling method's return location." ]
[ "asp.net", ".net", "vb.net", "il" ]
[ "Inline editing in GWT cell table", "I have a cell table in one of my GWT screen. Now requirement is that there will be some button on the screen clicking on which one editable row will be inserted into the cell table. if I am not wrong this is called inline editing.\n\nCan somebody please help me with that? I have just started working in GWT." ]
[ "gwt" ]
[ "Nodejs, Mongodb filter sub array of array of objects", "Hi everyone I have an array of objects with some populated fields. This is the schema of the product.\nimport mongoose, { Schema } from 'mongoose';\n\nconst productSchema = new mongoose.Schema(\n {\n name: String,\n description: String,\n sku: String,\n barcode: String,\n isActive: Boolean,\n quantity: Number,\n availability: String,\n taxClass: [{ type: Schema.Types.ObjectId, ref: 'TaxClass' }],\n images: [{ type: Schema.Types.ObjectId, ref: 'Image' }],\n variants: [{ type: Schema.Types.ObjectId, ref: 'Variant' }],\n tags: [{ type: Schema.Types.ObjectId, ref: 'Tag' }],\n price: {\n comparePrice: Number,\n price: Number\n },\n seo: {\n name: String,\n keywords: [\n {\n name: String\n }\n ],\n description: String,\n image: String\n }\n },\n { timestamps: true }\n);\n\nconst Product = mongoose.model('Product', productSchema);\nexport default Product;\n\nSo i have a function and I want to return all the products with the variant color of green.\nexport const returnFilteredProducts = async (_, { filters = null, page = 1, limit = 20 }, context) => {\n await jwtAuthentication.verifyTokenMiddleware(context);\n\n try {\n let searchQuery = {};\n\n const products = await Product.find(searchQuery).populate(['variants', 'tags', 'images', 'taxClass']);\n\n console.log(products.filter((item) => item.variants.filter((e) => e.color.indexOf('green') >= 0)));\n\n return {\n products\n };\n } catch (error) {\n handleError(error);\n }\n};\n\nThe thing is that it does not return me the document with a variant color of green, instead it returns all the documents.\nI am implementing a filtering system so I don't filter the products with in the frontend with redux." ]
[ "javascript", "node.js", "mongodb" ]
[ "What's the recommended 'design pattern' for exposing data via class variables?", "I've seen quite a few modules allow people to access data using:\n\nprint blah.name\n\n\nAs opposed to:\n\nprint blah.get_name()\n\n\nGiven the name is a a static variable, it seems like a better choice to use the variable method rather than calling a function.\n\nI'm wondering what the best 'design' is for implementing this myself. For example, given a Person object, how should I expose the name and age ?\n\nclass Person:\n\n def __init__(self, id):\n\n self.name = self.get_name(id)\n self.age = self.get_age(id)\n\n def get_name(self, id=None):\n\n if not id:\n return self.name\n else:\n # sql query to get the name\n\n\nThis would allow me to:\n\nx = Person\nprint x.name\n\n\nIs there a recommended alternative?" ]
[ "python", "oop", "design-patterns" ]
[ "How to manage custom settings for a IIS6 hosted WCF service?", "I have an wcf service that is hosted in II6. The service uses the server's file system to persist information. Now the persistence directory is hard coded to be F:\\PM.\nHow can I use a configuration file to store this directory? How can I access this file with a form application so as to modify it?" ]
[ "c#", ".net", "wcf", "iis" ]
[ "How to redirect the output of csh script that runs in background", "I'm running multiple csh scripts in parallel (each script takes 2 arguments) that does a lots of funny stuff in the background (details are not important to my problem). So far I'm running them as:\n\nmy_script arg1 arg2 &\nmy_script arg3 arg4 & \n...\n\n\nThis works just fine but I would like that each run of the script to redirect it's standard output into a log file. If I do the following command works well: \n\nmy_script arg1 arg2 >! somefile.log\n\n\nThe problem is that I need to run at least 5 of these scripts in parallel (background each of them). When I try the following sequence, the jobs are dispatched but is reported as \"Suspended (tty output)\" and the log file is not updating:\n\nmy_script arg1 arg2 >! somefile.log &\nmy_script arg3 arg4 >! somefile1.log &\nmy_script arg5 arg6 >! somefile2.log &\n....\n\n\nAny ideas to this issue. Oh...also I forgot to mention that I need to use CSH unfortunatelly I can't switch to bash or anything else. \n\nMany thanks!" ]
[ "shell", "unix", "csh" ]
[ "C++ wxWidgets: Set Transparent Background Color", "I recently started learning C++ and wxWidgets and now I'm building a calculator program. I want to know how to change the background of my main frame with light grey colour and I want it to be a little bit transparent, like on windows calculator." ]
[ "c++", "user-interface", "wxwidgets" ]
[ "Connect sortable lists together and update SQL using jQuery UI", "I'm using jQuery UI's sortable lists to sort items in a todo list, and the reordering of the lists works like a charm.\n\nI have several UL lists for each todo category, i.e. Design, Development, etc.\n\nI want to be able to move an item from one category to another, and jQuery UI's sortable lists plugin allows me to do this with the connectWith option parameter.\n\nBut I can't seem to find how to update the database as well. The todo database table has a field for a reference to the category which is laying in it's own table.\n\nThis is the current code:\n\n$('.sortable').sortable({\n axis: 'y',\n opacity: .5,\n cancel: '.no-tasks',\n connectWith: '.sortable',\n update: function(){\n $.ajax({\n type: 'POST',\n url: basepath + 'task/sort_list',\n data: $(this).sortable('serialize')\n });\n }\n});\n\n\nDo I need to add another value to the AJAX's data parameter, or do the sortable plugin this for me in the serialize function?" ]
[ "ajax", "jquery-ui", "jquery-ui-sortable" ]
[ "pypi UserWarning: Unknown distribution option: 'install_requires'", "Does anybody encounter this warning when executing python setup.py install of a PyPI package?\n\ninstall_requires defines what the package requires. A lot of PyPI packages have this option. How can it be an \"unknown distribution option\"?" ]
[ "python", "distutils", "pypi" ]
[ "Generate Unique Random Numbers with Range", "I am beginner in android.\n\ndisplay random numbers of images, kids have to count number images\n\nfor answer generate 4 random choice, code is working fine\n\nbut sometimes app get hanged, can't optimize code.\n\nGenerate Answer\n\nint[] answer = new int[4];\n\n\n int count=0,random_integer;\n while(count<=3){\n random_integer = r.nextInt((imageCount+2) - (imageCount-2)) + (imageCount-2);\n if(!exists(random_integer,answer)){\n answer[count] = random_integer;\n Log.d(\"answer\",\"Array \" + count + \" = \" + random_integer);\n count++;\n }\n }\n\n if(!exists(imageCount,answer)){\n answer[r.nextInt(3 - 0) + 0] = imageCount;\n }\n\n\nCheck Duplicate\n\npublic boolean exists(int number, int[] array) {\n if (number == -1)\n return true;\n\n for (int i=0; i<array.length; i++) {\n if (number == array[i])\n return true;\n }\n return false;\n}\n\n\nLogcat\n\n\nWhile generating 4 value it stopped\nThanks in advance" ]
[ "android", "random" ]
[ "Creating Vue application: vue create does not work", "I am trying to create a vue app with vue-cli on a ubuntu running on a vagrant & virtual box on Windows 10 and i get the following error which I cannot solve.\n\nnpm ERR! path /vagrant/vuetest/node_modules/@babel/helper-plugin- \nutils/package.json.4118558811\nnpm ERR! code ETXTBSY\nnpm ERR! errno -26\nnpm ERR! syscall rename\nnpm ERR! ETXTBSY: text file is busy, rename \n'/vagrant/vuetest/node_modules/@babel/helper-plugin- \nutils/package.json.4118558811' -> \n'/vagrant/vuetest/node_modules/@babel/helper-plugin-utils/package.json'\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /home/vagrant/.npm/_logs/2018-06-07T01_37_02_093Z-debug.log\nERROR command failed: npm install --loglevel error\n\n\nAny ideas? anything?" ]
[ "vuejs2", "vue-cli" ]
[ "How to quote identifiers with LINQPad + IQ Driver + MySQL?", "I'm working with a rather horrible schema designed by an external party and it contains a table named order so when I invoke a query that references this table in LINQPad I get a SQL syntax error.\n\nI know how to quote the identifier in MySQL, but I can't see how to do this with LINQPad and the IQ Driver. Looking at this it seems to be up to the driver implementation." ]
[ "mysql", "linqpad" ]
[ "Spring batch Scheduling using ESP Scheduler", "I want to schedule spring batch jobs using ESP Scheduler. Can we even do it or not?\n\nOne of the solutions is that we can make rest endpoints to start job, and poll the results after some time - Can we do better than this?\n\nI have explored the possibilities that we can do it with Spring Cloud Data Flow. But how it can be achieved?" ]
[ "java", "spring", "spring-batch", "spring-cloud-dataflow" ]
[ "Send e-mail with attachment on Android", "I'm developing an application for Android that runs experiments and gets some statistics from Android devices. After getting the results, the app tries to send them by e-mail (with Intent.ACTION_SEND). However, I've been having a problem with the size of the raw message, so the message is compressed before being sent using GZip. I wouldn't like to create a file to be attached to message, as I would do if I used putExtra(Intent.EXTRA_STREAM, ...). It would be very straightforward if I could modify the message headers, but it seems that there is no way to do that. I've also tried to put headers information before the message, but the attachment hasn't been recognized by GMail client - Android embeds the whole message inside something like another attachment that has text/plain type. Is there a way to send a message with attachment without generating files?\n\nprivate void sendResults(String title) {\n String body;\n\n try {\n\n body = \"Content-type: multipart/mixed; boundary=\\\"anexo\\\"\\n\\n\";\n\n body += \"--anexo\\n\";\n body += \"Content-type: application/gzip; name=\\\"results.gz\\\" \\n\";\n body += \"Content-disposition: attachment; filename=\\\"results.gz\\\" \\n\";\n body += \"Content-Transfer-Encoding: base64 \\n\";\n body += Base64.encodeToString(ZipUtil.compress(results).getBytes(), Base64.DEFAULT) + \"\\n\";\n\n body += \"--anexo\\n\";\n body += \"Content-type: text/plain; charset=us-ascii \\n\";\n body += \"Results.\\n\";\n body += \"--anexo--\\n\\n\";\n\n Intent sendIntent = new Intent(Intent.ACTION_SEND);\n sendIntent.putExtra(Intent.EXTRA_TEXT, body);\n String[] to = { \"[email protected]\" };\n sendIntent.putExtra(Intent.EXTRA_EMAIL, to);\n sendIntent.putExtra(Intent.EXTRA_SUBJECT, \"[dsp-benchmarking] \"+title);\n sendIntent.setType(\"message/rfc822\");\n startActivity(Intent.createChooser(sendIntent, \"Send results\"));\n\n } catch (IOException e) {\n Log.e(\"SEND_RESULTS\", \"Error: \" + e.getMessage());\n }\n}" ]
[ "java", "android" ]
[ "WCF REST and SOAP Service without WebServiceHostFactory", "Despite reading a number of posts eg (This one seems popular) I can't seem to expose my service as multiple endpoints that are compatible with both the SOAP and REST protocol - my problem seems to be with the \n\n Factory=\"System.ServiceModel.Activation.WebServiceHostFactory\"\n\n\nelement in the Service code behind page. \n\nIf I leave it out, my SOAP endpoint works grand, but my JSON endpoint is not found. If I put the line in, my REST endpoint sings like bird and the the SOAP endpoint is results in \"Endpoint not found\" on the Service.svc page. \n\nMy operations appear to set up in the standard way eg:\n\n [OperationContract]\n [WebGet(UriTemplate = \"/GetData\", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]\n string GetData();\n\n\nAnd the configuration file\n\n <endpoint address=\"rest\" binding=\"webHttpBinding\" contract=\".IMeterService\" behaviorConfiguration=\"REST\" />\n\n <endpoint address=\"soap\" binding=\"wsHttpBinding\" contract=\"IMeterService\" bindingConfiguration=\"secureBasic\" />\n\n <behavior name=\"REST\">\n <webHttp />\n </behavior>\n\n\nHow can I achieve this? Is there a way to set up the REST endpoint without the System.ServiceModel.Activation.WebServiceHostFactory attribute? \n\nThanks in advance." ]
[ "wcf", "rest", "soap" ]
[ "Is emplace_back ever better than push_back when adding temporary objects?", "Suppose we want to insert an object of type T into a container holding type T objects. Would emplace be better in any case? For example:\nclass MyClass {\n MyClass(int x) { ... }\n}\n\nMyClass CreateClass() {\n int x = ... // do long computation to get the value of x\n MyClass myClass(x);\n return myClass;\n}\n\nint main() {\n vector<MyClass> v;\n // I couldn't benchmark any performance differences between:\n v.push_back(CreateClass());\n // and\n v.emplace_back(CreateClass());\n}\n\nIs there any argument to prefer v.emplace_back(CreateClass()) rather than v.push_back(CreateClass())?" ]
[ "c++", "vector", "move", "perfect-forwarding", "emplace" ]
[ "How to hook into event fired from grandchild control?", "Consider a hierachy like the following:\n\nParent Grid -> Detail Grid -> Detail of Detail Grid\n\n\nWhere each contains the grid following it. Now, I want to fire an event from Detail of Detail Grid. I've set up my handler and events as follows.\n\npublic static readonly RoutedEvent DetailofDetailVmClickedEvent =\n EventManager.RegisterRoutedEvent(\"DetailofDetailVmClicked\", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(RepoBreakdownRecordControl));\n\npublic event RoutedEventHandler DetailofDetailVmClicked\n{\n add { AddHandler(DetailofDetailVmClickedEvent, value); }\n remove { RemoveHandler(DetailofDetailVmClickedEvent, value); }\n}\n\npublic void RaiseDetailofDetailVmClickedEvent()\n{\n var args = new RoutedEventArgs(DetailofDetailVmClickedEvent);\n args.Source = MyDetailOfDetailGrid.GetFocusedRow() as DetailofDetailVm;\n RaiseEvent(args);\n}\n\nprivate void MyDetailOfDetailGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)\n{\n RaiseDetailofDetailVmClickedEvent();\n}\n\n\nI want to handle this at the Parent Grid level. Since I can't hook directly into the Detail of Detail Grid event handler (as Parent Grid, Detail Grid, and Detail of Detail Grid are all their own controls), how can I accomplish this? \n\nI will happily admit I'm probably having a brainfart from lack of coffee, but such is life." ]
[ "c#", "wpf" ]
[ "Php / Mysql number formatting", "I am trying to have my output displayed with commas in the number. I am sure im being stupid but I cannot think of how to make it work. I am looking just to format the number output for the prices.\n\n echo \"</tr></table><br>\";\n echo mysql_result($result,$i,\"shortdescription\").\"<br><br>\";\n\n echo \"<div style=\\\"background-color:#FDFFDB\\\">\";\n echo \"<table border=1 cellpadding=5>\";\n echo \"<tr>\";\n echo \"<td class=txt width=200><b>Price low season</b><br><i>May 15th - Nov 30th</i></td>\";\n echo \"<td class=txt width=200><b>Price high season</b><br><i>Dec 1st - May 14th</i></td>\";\n echo \"<td class=txt width=200><b>Xmas, New Year &<br>Sailing regattas</b></td>\";\n echo \"</tr>\";\n echo \"<tr>\";\n echo \"<td class=txt>US$ \".mysql_result($result,$i,\"pricelownight\").\" per night</td>\";\n echo \"<td class=txt>US$ \".mysql_result($result,$i,\"pricehighnight\").\" per night</td>\";\n if (mysql_result($result,$i,\"pricespecial\")){\n echo \"<td rowspan=2 class=txt>US$ \".mysql_result($result,$i,\"pricespecial\").\" per week</td>\";\n } else {\n echo \"<td rowspan=2 class=txt>Price upon request</td>\";\n }" ]
[ "php", "mysql" ]
[ "How to add imageview to fragment?", "There are tons of questions like this, but they all address adding a view in onCreateView() before returning the root layout. I want to add a view in the middle of code execution, in onClick()\n\n\n\nNote this is a fragment, which is why I can't update the UI without onCreateView():\n\npublic void onClick(View v) {\n switch (v.getId()) {\n case R.id.button:\n\n //RelativeLayout Setup\n RelativeLayout relativeLayout = new RelativeLayout(getActivity());\n\n relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,\n RelativeLayout.LayoutParams.MATCH_PARENT));\n\n //ImageView Setup\n ImageView imageView = new ImageView(getActivity());\n\n //setting image resource\n imageView.setImageResource(R.drawable.lit);\n\n //setting image position\n imageView.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,\n RelativeLayout.LayoutParams.WRAP_CONTENT));\n\n RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);\n params.addRule(RelativeLayout.BELOW, R.id.button);\n\n imageView.setLayoutParams(params);\n //adding view to layout\n relativeLayout.addView(imageView);\n\n\n break;\n }\n}\n\n\nHere I get an instance of the layout and modify it. However, I cannot apply this modified fragment layout back into the application UI. How can I update the app interface after fragment UI modification?\n\nThanks for your time." ]
[ "android", "android-layout", "android-fragments" ]
[ "java telnet socket : BufferedReader / BufferedWriter", "My server opens a telnet port on 23999 and when I give telnet localhost 23999, it shows below :\n\n< BP-SAS ==> bplin19 !>telnet 0 23999\nTrying 0.0.0.0...\nConnected to 0.\nEscape character is '^]'.\nPlease enter password to authenticate:\n(here i give password for example abc123) \nEnter 'help' at any point to get a listing of all registered commands...\nBAS> log set-info 1 ( commad i have entered and it does somthing )\n\n\nNow Instead of open like this, I have to write java code which does this thing.\n\n\nconnect to host 23999 port\nenter password\nenter commad\n\n\n\n \n\n\nSocket soc=new Socket(\"192.168.9.7\",23999);\n while(true){\n //create buffered writer\n BufferedReader bwin = new BufferedReader(new InputStreamReader(soc.getInputStream()));\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(soc.getOutputStream()));\n BufferedWriter bw1 = new BufferedWriter(new OutputStreamWriter(soc.getOutputStream()));\n String readFir = bwin.readLine();\n System.out.println(readFir);\n if(readFir.startsWith(\"Please\")){\n System.out.println(\"Password Entered\");\n bw.write(\"abc123\");\n bw.flush();\n bw.close(); //close buffered Reader \n }\n\n readFir = bwin.readLine();\n if(readFir.startsWith(\"Enter\")){\n System.out.println(\"Enter command\");\n bw1.write(\"log set-info 1\");\n bw1.flush();\n bw1.close(); //close buffered Reader \n }\n //readFir = bwin.readLine();\n }\n\n\nThis is not working.Actually, I am bit confused what approach I should follow.Very much confused between reader/writer.\n\nPlease help." ]
[ "java", "jakarta-ee", "bufferedreader" ]
[ "Selenium/Python - hover and click on element", "I'm running into an issue with my Selenium script on Python. In the javascript web application that I'm interacting with, an element I need to click doesn't exist until I hover over it. I've looked and found various answers on how to hover, but the sequence needs to include the clicking of a new element during the hover event. Here is the code I am currently working with. The element is renamed from add to add1 when a hover occurs, once add1 exists; I should be able to click/send.keys to execute said element.\n\n...\ndriver = webdriver.Firefox()\nfrom selenium.webdriver.common.action_chains import ActionChains\n...\nadd = driver.find_element_by_css_selector('input.add')\nHover = ActionChains(driver).move_to_element(add)\nHover.perform()\nSearchButton = driver.find_element_by_css_selector('input.add1')\nSearchButton.click()\n\n\nI'm new with Python and with programming in general, but I can't figure out how to sequence this correctly.\n\nAny help would be greatly appreciated." ]
[ "python", "firefox", "hover", "selenium-webdriver" ]
[ "Amazon Ubuntu Instance and SES using php mail function not working", "I m using ubuntu amazon instance and configured SES username and password successfully then \nI successfully verified my email address as sender on SES console.\n\nI installed postfix on server then I changed main.cf and ses_psword file as instructed on amazon tutorial but even when I try using mail function of php I cant receive email even mail function returns true but I m not receiving email in my inbox.\n\nwhen I try using console to check email configuration using following command:\n\nopenssl s_client -crlf -quiet -starttls smtp -connect email-smtp.us-east-1.amazonaws.com:25\n\n\nI get response:\n\ndepth=2 C = US, O = \"VeriSign, Inc.\", OU = VeriSign Trust Network, OU = \"(c) 2006 VeriSign, Inc. - For authorized use only\", CN = VeriSign Class 3 Public Primary Certification Authority - G5\nverify error:num=20:unable to get local issuer certificate\nverify return:0\n250 Ok\n421 Timeout waiting for data from client.\n\n\nI m losed now,I also trying using exact path of certificate file in /etc/ssl/certs/ca-certificates.crt using above command that is not working at all for me.\n\nIf any body faced this problem before then please suggest me direction that where may be I m wrong.\n\nthanks" ]
[ "php", "email", "ubuntu", "amazon-ses" ]
[ "Using python to get sharepoint page", "I'm trying to get the html object of a local sharepoint page using python and when I try to send request I get 403 error. Below is the code which I'm using.\n\n\n \n \n import requests\n from requests_ntlm import HttpNtlmAuth\n request=requests.get(\"https://my.mycompany.net/Profile.aspx?acname=i%3A0%23.f%7Cmembership%7Cparametertext%40company.net\", auth=HttpNtlmAuth('domain\\userid','mypassword'))\n print(request)\n \n \n \n\n\ncan you say why I'm getting 403 error and Is there any other way to get the html of sharepoint page? I tried simple request as below using beautifulsoap but still I get error 403.\n\nresponse = requests.get(url)\n\nsoup = BeautifulSoup(response.text, \"html.parser\")\n\nMy goal is to get data on the page based on class name, ID or Tag.\n\nPlease let me know how to resolve this issue." ]
[ "python-3.x", "sharepoint" ]
[ "Typescript property selector", "I need simple type checking based on object property which I'd like to use like this:\n\ntype User = { id: string, name: string }\nsort<User>(\"name\");\n\n\nwhere Intellisense offers me \"name\" or \"id\" for input or shows \"error\" if anything else is entered.\n\nWith my current implementation property is not of type string, although I'm able to pass only string value.\n\nsort<T extends { [key: string]: any }>(property: keyof T) {\n // how can I make 'property' string ???\n // required API object is e.g. { property: \"Id\", desc: true }\n}\n\n\nHere is playground." ]
[ "typescript", "typescript-typings" ]
[ "IRenderFactory help in Minecraft Forge", "I've been having trouble with the new syntax for entity registry, specifically rendering the entity. Before, you simply added the RenderingRegistry.registerEntityRenderingHandler line to your ClientProxy, and that was that. But now, it's asking me to use RenderingRegistry.registerEntityRenderingHandler in the preInit along with a parameter called IRenderFactory. I'm not really sure how IRenderFactory works, or how I can create one (if I need to).\nI've been told that you can use a method reference to pass your Render class's constructor (RenderMyEntity::new) as an IRenderFactory instead, but I really don't know how to go about this. I've done all kinds of research, but none of it makes sense.\nHere's my MobExample class (the line RenderingRegistry.registerEntityRenderingHandler(RenderGelZombie.class, renderFactory) only works in the preInit of MobExample class, which is why it's there and not in ClientProxy):\npackage com.aideux.mobexample;\n\nimport com.aideux.basemod.BaseMod;\n\nimport net.minecraft.client.model.ModelZombie;\nimport net.minecraftforge.fml.client.registry.RenderingRegistry;\nimport net.minecraftforge.fml.common.registry.EntityRegistry;\n\npublic class MobExample \n{\npublic static int currentEntityId = 0;\n\npublic static void preInit()\n{\n createEntityWithEgg(EntityGelZombie.class, "CustomMob", 0x00FF00, 0xFF0000);\n RenderingRegistry.registerEntityRenderingHandler(RenderGelZombie.class, renderFactory);\n}\n\npublic static void init()\n{\n BaseMod.proxy.registerEntityRenderers();\n}\n\npublic static void createEntityWithEgg(Class entityClass, String entityName, int solidColor, int spotColor)\n{\n int entityId = currentEntityId++;\n EntityRegistry.registerModEntity(entityClass, entityName, entityId, BaseMod.instance, 250, 1, true, solidColor, spotColor);\n}\n}" ]
[ "java", "minecraft", "minecraft-forge" ]
[ "Date format yyyy-MM-dd Docker iis", "I have a problem with the Docker on which the iis server is installed.\nUnfortunately, the date in my program is set in the format \"MM / dd / yyyy\" and I want it to be in the format \"yyyy-MM-dd\"\nHow to set the Dockerfile so that the date is in the format \"yyyy-MM-dd\"" ]
[ "docker", "asp.net-web-api", "iis-8" ]
[ "How to trigger an onclick event from the console?", "Suppose I have this webpage. I would like to pass a JS command to in the console to select \"All languages\".\n\n\n\nThe button is an input with onchange=\"widgetEvCall('handlers.updateFilter', event, this);\n\nThis is the complete chunk of html for the botton:\n\n<input id=\"filters_detail_language_filterLang_ALL\" type=\"radio\" name=\"filters_detail_language_filterLang_0\" value=\"ALL\" onchange=\"widgetEvCall('handlers.updateFilter', event, this);\">\n\n\nI would like to use the handlers.updateFilter function to pass the id of the filter I want to select (id=\"filters_detail_language_filterLang_ALL\") and \"simulate\" that the button is clicked runnig handlers.updateFilter in the chrome console." ]
[ "javascript" ]
[ "knitr compile problems with RStudio (windows)", "i have a knitr based Rnw file that is compiling to pdf perfectly fine in RStudio on mac (v0.97.316) and knitr (v1.1) but in a windows enviornment (same versions) i get a compilation error. I've checked the options in RStudio in both environments and they are consistent.\n\nIt appears that the windows setup is always injecting: \"\\SweaveOpts{concordance=TRUE}\" into the \".tex\" file even though i have no such flag in the Rnw file, and/or if i toggle the settings in the preferences, and/or if i add the \"opts_knit$set(concordance=FALSE)\" options to a knitr settings chunk. If i drop the line from the \".tex\" file and compile it manually at the cmd prompt the output is generated as expected.\n\nI'm not sure if this is an RStudio or knitr problem, but any pointers would be appreciated.\n\nNote, i've also posted this question on the RStudio support board (http://support.rstudio.org/help/discussions/problems/5039-knitr-compile-problems-with-rstudio-windows?unresolve=true)." ]
[ "r", "knitr", "rstudio" ]
[ "I want to use a Swing timer to make queries to an SQL table, set a Swing label to the returned result. It does not work", "I'm trying to make a booking system. It has a seperate class for SQL, with methods inside for some specific requests I want, e.g getCurrentBooking. \n\nI made a Swing timer in the body of the JFrame code, and made it set the current booking label on the GUI to the result of the getCurrentBooking method in my sql class, but it only returns \"No bookings right now\" which is what the method is supposed to return when there is no booking that has the same date as \"now\". Only if I restart the application it works.\n\nHow do I make it so that it displays the current booking in the label? Thanks.\n\nHere's the code:\n\nSQL. java(I've only included relevant methods)\n\npublic class SQL {\n private static Connection conn;\n private static Calendar now;\n private static SimpleDateFormat format = new SimpleDateFormat(\"dd MMMM yyyy HH:mma\");\n\npublic SQL() throws SQLException{\n conn = DriverManager.getConnection(\n \"jdbc:mysql://localhost:3306/bookings?zeroDateTimeBehavior=convertToNull&useSSL=false\",\"myuser\",\"xxxx\");\n now = Calendar.getInstance();\n}\n\npublic String readResultSet(ResultSet rs){\n String result = \"\";\n try {\n ResultSetMetaData meta = rs.getMetaData();\n int colCount = meta.getColumnCount();\n\n\n\n while(rs.next()){\n for(int i = 1; i <= colCount;i++){\n result += rs.getString(i);\n //System.out.print(rs.getString(i));\n //System.out.print(\" \");\n\n }\n //System.out.println(\"\");\n }\n\n } catch (SQLException ex) {\n Logger.getLogger(SQL.class.getName()).log(Level.SEVERE, null, ex);\n }\n\n return result;\n\n}\n\npublic String getCurrentBooking(){\n String currentBooking = \"\";\n try{\n Statement stmt = conn.createStatement();\n\n String getSet = \"select * from bookings where \" + \"date\" + \" = \" + \n \"'\" + format.format(now.getTime()) + \"'\" + \";\";\n ResultSet rs = stmt.executeQuery(getSet);\n\n //check if empty, if not..\n if (!rs.isBeforeFirst()){\n //no bookings rn\n currentBooking = \"No bookings right now.\";\n }\n\n else{\n //read rs\n\n String queryName = \"select name from bookings where \" + \"date\" + \" = \" + \n \"'\" + format.format(now.getTime()) + \"'\" + \";\";\n\n ResultSet rsName = stmt.executeQuery(queryName);\n String name = readResultSet(rsName);\n\n String queryDate = \"select date from bookings where date = \" \n + \"'\" + format.format(now.getTime()) + \"'\" + \";\";\n\n ResultSet rsDate = stmt.executeQuery(queryDate);\n String date = readResultSet(rsDate);\n\n currentBooking = name + \" \" + date;\n\n }\n\n } catch (SQLException ex) {\n Logger.getLogger(SQL.class.getName()).log(Level.SEVERE, null, ex);\n }\n\n return currentBooking;\n}\n\n\nJFrame timer code:\n\nSQL sql; //intialised in JFrame constructor\n SimpleDateFormat printDayOnly = new SimpleDateFormat(\"EEEE\");\n SimpleDateFormat formatDate = new SimpleDateFormat(\"dd MMMM yyyy\");\n Timer timer = new Timer(100, new ActionListener() {\n\n@Override\npublic void actionPerformed(ActionEvent e) {\n\n //set time every sec\n Calendar now = Calendar.getInstance();\n String date = formatDateWithTime.format(now.getTime());\n timeLbl.setText(date);\n\n //update currentbooking\n String currentBkngText = sql.getCurrentBooking();\n currentBooking.setText(currentBkngText);\n}\n\n});" ]
[ "java", "sql", "swing", "jdbc", "netbeans" ]
[ "Right Justifying output stream in C++", "I'm working in C++. I'm given a 10 digit string (char array) that may or may not have 3 dashes in it (making it up to 13 characters). Is there a built in way with the stream to right justify it?\n\nHow would I go about printing to the stream right justified? Is there a built in function/way to do this, or do I need to pad 3 spaces into the beginning of the character array?\n\nI'm dealing with ostream to be specific, not sure if that matters." ]
[ "c++" ]
[ "Can't find registry key using GetValue", "Our VB.net application relies on a 3rd party DLL. We call it with:\n\nDLLType = Type.GetTypeFromProgID(\"APLW.WSEngine\")\n\n\nI'd like to first check to see if it has been registered properly. I poked about in Regedit, and sure enough, the key is where I would expect it to be:\n\nHKEY_CLASSES_ROOT\\APLW.WSEngine\n\n\nSo, reading MS's docs on this sort of thing, I did:\n\nDim exists As Object = Microsoft.Win32.Registry.GetValue(\"HKEY_CLASSES_ROOT\\APLW.WSEngine\", \"CLSID\", Nothing)\n\n\nThis always returns Nothing, in spite of GetTypeFromProgID working fine, and the key and value clearly being there in the reg. I've tried every variation I can think of, including using ClassesRoot.GetValue in the method instead of the generic version of GetValue, trying various keys and values...\n\nOk, what am I doing wrong? I assume it's something trivial..." ]
[ "vb.net", "registry" ]
[ "AngularJS: Using css media query for screen resize", "I have an existing CSS, it does media query and displays a message box when the screen is resize to a certain size. I want the message box to disappear after 5 seconds.\n\nAny idea how to do it in AngluarJs?\n\nCSS:\n\n@media all and (max-width: 1024px), all and (max-height: 760px) {\n div#bestview {\n display: block;\n position:fixed;\n z-index: 9999; /* above everything else */\n top:0;\n left:0;\n bottom:0;\n right:0;\n background-image: url(../img/transpBlack75.png);\n }\n}\n\n\nHTML:\n\n<div id=\"bestview\">The selected browser size is not optimal for.....</div>" ]
[ "css", "angularjs" ]
[ "using jquery function export to excel not working", "I am trying to use jquery for exporting grid view to excel. But I am not successful with the code.\ncode referred from : http://www.c-sharpcorner.com/blogs/export-to-excel-using-jquery1\nMy code:\n\n<script type=\"text/javascript\">\n $(\"[id$=btnExcel]\").click(function (e) {\n alert(\"testing\");\n window.open('data:application/vnd.ms- excel,' + encodeURIComponent($('#grdCharges').html())); \n e.preventDefault();\n });\n </script>\n\n<asp:UpdatePanel ID=\"UpdatePanel1\" runat=\"server\">\n <ContentTemplate>\n <div id=\"div_report\" runat=\"server\" visible=\"false\">\n <div id=\"grdCharges\" runat=\"server\" style=\"width: 90%; overflow: auto;\">\n <asp:GridView ID=\"GridView1\"\n runat=\"server\"\n CellPadding=\"3\"\n CellSpacing=\"2\"\n AutoGenerateColumns=\"true\"\n ShowFooter=\"true\"\n FooterStyle-HorizontalAlign=\"Left\"\n RowStyle-BorderColor=\"Black\" HeaderStyle-BackColor=\"#0CA3D2\">\n <FooterStyle BackColor=\"#87CEFA\" />\n </asp:GridView>\n </div>\n </div> \n </ContentTemplate> \n </asp:UpdatePanel>\n <div class=\"div_labels\">\n<asp:Button ID=\"btnExcel\" class=\"input-submit\" ClientIDMode=\"Static\" runat=\"server\" Text=\"Excel\" /> \n </div> \n\n\nBut when I press the btnExcel I could not get even the alert window. Why is it so?" ]
[ "javascript", "jquery", "asp.net" ]
[ "Get garbage value in file while downloading from ftp", "I tried to download csv file from ftp .\nFile is downloaded successfully but it gives me garbage value in that file.\nFollowing is my code\n\nString server = \"client.in\";\n int port = 21;\n String user = \"user\";\n String pass = \"pwd\";\n InputStream input=null;\n BufferedWriter out = null;\n FTPClient ftpClient = new FTPClient();\n try {\n\n ftpClient.connect(server, port);\n ftpClient.login(user, pass);\n ftpClient.enterLocalPassiveMode();\n\n ftpClient.setFileType(FTP.BINARY_FILE_TYPE);\n\n FileOutputStream fos = null;\n\n String filename = \"Test.csv\";\n OutputStream data = (OutputStream) new FileOutputStream(\"Test/\"+filename);\n\n ftpClient.retrieveFile(filename, data);\n\n data.close();\n }\n catch(Exception e)\n {\ne.printStackTrace();\n }\n\n\nWhat is the solution ....\nplease help" ]
[ "java", "file", "csv", "file-io", "ftp" ]
[ "Change Submit targeted form with jquery onclick", "I'm making a list for product types. Each line has its own update and delete button. While each form has its only submit for update. For delete it calls another popup div that is created once and should target the form that owns the delete button I clicked. How do I accomplish this?\n\n<?\n$sql = \"SELECT * FROM tipoproducto\";\n$result = mysqli_query($conex, $sql);\nwhile($data = mysqli_fetch_array($result, MYSQLI_ASSOC))\n{\n ?>\n <form id=\"tipoprod<? echo $data['id_tipoproducto']; ?>\" method=\"post\" enctype=\"multipart/form-data\" action=\"<? echo htmlspecialchars($_SERVER[\"PHP_SELF\"]);?>\">\n <input type=\"hidden\" name=\"idprod\" value=\"<? echo $data['id_tipoproducto']; ?>\" required>\n <tr>\n <td width=\"50%\"><input type=\"text\" name=\"tprod\" value=\"<? echo $data['tipo_producto']; ?>\" required></td>\n <td width=\"50%\"><input name=\"act\" type=\"submit\" class=\"button\" value=\"Actualizar\" form=\"tipoprod<? echo $data['id_tipoproducto']; ?>\"/>\n </form>\n <button name=\"del\" class=\"button inset\">Borrar</button></td>\n </tr>\n <?\n}\n?>\n\n<div name=\"hoverdel\" id=\"hover\"></div>\n<div name=\"popupdel\" id=\"popup\" class=\"normal\">\n<p><i class=\"icon-warning-sign icon-large\"></i> Esta seguro que desea borrar este producto?</p>\n<br>\n<input name=\"borrar\" type=\"submit\" class=\"button inset\" value=\"Si\" form=\"This is what jQuery should update\"/>\n<button name=\"cancelar\" class=\"button inset\">No</button>\n</div>\n\n$(\"button[name = 'del']\").click(function()\n {\n $(\"div[name = 'hoverdel']\").fadeIn();\n $(\"div[name = 'popupdel']\").fadeIn();\n $(\"button[name = 'borrar']\").attr(\"form\", Form Name);\n });" ]
[ "javascript", "php", "jquery", "html", "forms" ]
[ "AzureKeyVault Integration AzureFunction and xamarin forms", "I have a xamarin app --> azureFunction --->BlobStorage. so far so good.\nThe AzureFunction is set with AuthorizationLevel.Function.\n\n\nI have set the azure function Managed identity \"ON\"\nI have assigned a role to the BlobStorage (Blob data Contributor)\nI can successfully call the function using postman using the function key.\n\n\nI would like to store the functionKey in the KeyVault and call it from my mobile app \n\nQuestion\n\nAs anybody got a walkthrough and snippet how to integrate the keyvault with a function key and call it from a mobile app (xamarin forms) c#? \n\nI do not want to hardcode any keys in my mobile app.\n\nI would be very grateful.Lots of googling and nothing.\n\nthanks" ]
[ "xamarin.forms", "azure-functions" ]
[ "Using sqlite in VB.NET Metro App", "I am struggling for days to adjust my VB.NET metro app to uses SQLite database.\n\nI have metro app that targets Win 8\nthen I added reference to:\n\n.NET for Windows Store apps\nMicrosoft Visual C++ Runtime Package\nSQLite for Windows Runtime\n\n\nStill no way to work with database this way.\nWhen I try to add:\n\nImports SQLite\n Using db = New SQLite.SQLiteConnection(dbpath)\n\n\n\nits not being recognized\n\n\nWhat EXACTLY do I need to setup SQlite for VB.NET Metro App ?\nIs there any sample project that I can download and start with ?" ]
[ "vb.net", "sqlite", "windows-8", "microsoft-metro" ]
[ "How do I put every date of 2013 in an CSV/Excel sheet?", "I'm currently looking for an excel/CSV sheet which includes all the days of 2013 or 2014 in a column.\n\nThis so I can register my working hours, I was thinking to create the CSV using PHP, but maybe there's an other method to achieve this." ]
[ "php", "excel", "csv" ]
[ "Is a dependency registered as .InstancePerRequest() in autofac always available in an asynchronous continuation?", "In an Autofac config: I have registered a dependency to be .InstancePerRequest() \nand have part of my code that is either using the async keyword or .continueWith(). My question is: if the dependency is used in a continuation that is executed asynchronously, will the dependency only be disposed once the async code has been executed or could it happen before? \n\nSpecific scenario:\n\n // in IocConfig.cs\n ContainerBuilder.Register(c => Context.CreateFromToken( \n c.Resolve<IUser>().Name, \n .As<Context>()\n .InstancePerRequest();\n\n\nThen in one file I have this code:\n\n // elsewhere in the code for a specific request..\n client.PostAsync(new Uri(_context.GetSetting(\"SomeEndpoint\")),requestContent)\n .ContinueWith(task =>\n {\n ErrorLog.Write(_context.CreateErrorEntry($\"Request: sent {task.Result.StatusCode} result: {task.Result.ToJson()}\", LogLevel.Debug));\n });\n\n\nWill the _context here (which is .InstancePerRequest()) still be available in the .ContinueWith(), or can it be disposed?" ]
[ "c#", "autofac" ]
[ "Run multiple classes separately in netbeans", "I am writing a code for chatting between client server. I have 2 classes, one for server and one for client. Both containing main functions. I need a way to run the classes separately. first server class then client class. But when I am running the program, net beans run the entire project. How can i run both of these classes separately ??" ]
[ "java", "class", "netbeans", "server", "client" ]
[ "how to use django rest filtering with mongoengine", "Hi I am starting django 1.8.3 with mongodb using mongo engine to create rest api.\n\nI am using rest_framework_mongoengine to do so.\nI wanted to use a feature of DjangoFilterBackend for same.\n\nMy code is:\n\nmodels.py:\n\nfrom mongoengine import * \nfrom django.conf import settings \nconnect(settings.DBNAME)\n\nclass Client(Document):\n name = StringField(max_length=50)\n city = StringField(max_length=50)\n country = StringField(max_length=200, verbose_name=\"Country\")\n address = StringField(default='')\n\n\nSerializer.py\n\nfrom client.models import Client \nfrom rest_framework_mongoengine.serializers import DocumentSerializer \n\n\nclass ClientSerializer(DocumentSerializer):\n class Meta:\n model = Client\n depth = 1\n\n\nviews.py\n\nfrom rest_framework_mongoengine.generics import * \nfrom rest_framework import filters \n\n\nclass ClientList(ListCreateAPIView):\n serializer_class = ClientSerializer\n queryset = Client.objects.all()\n filter_backends = (filters.DjangoFilterBackend,)\n filter_fields = ('name',)\n\n\nI start getting error\n QuerySet object has no attribute model\n\nDon't know where its going wrong. If I remove filter_field It works but I can not use filter feature.\n\nAny help would be of great use" ]
[ "django", "mongodb", "python-2.7", "django-rest-framework", "mongoengine" ]
[ "C++ Template-styled function calling?", "I want my code to be clean and therefore I would like to achieve something like this:\n\nSet<Color>(255, 255, 255);\nSet<Opacity>(128);\nDraw<Rectangle>(0, 0, 50, 50);\nSet<Opacity>(255);\nDraw<Texture>(Textures::Woman, 75, 75);\n\n\nBasically multiple forms of a function for different names that are placed between the <>.\n\nWould be great if it wasn't an actual template though, that would require me to code everything in .h files and I don't find that clean." ]
[ "c++", "function", "void" ]
[ "App works in Unity editor but not on Android", "Building a Unity front-end app that communicates with a PHP/MySQL back-end. Right now I am working on the register and login portions of it. In the Unity editor, all works perfectly, on the browser front end registration is working fine as well. But as soon as I take the working build in Unity and build it to test on my Google Pixel phone, registration and login both fail on my phone. The error message I am getting on Login is \"Error parsing response from server, please try again!\" which is in my UILogin.cs. Yet there is nothing else attached. I tried following the Unity documentation for debugging, adb, and DDMS to get access to find out what is happening but I have failed on all those ventures. Is there something particularly different about Android and WWW objects or web communications? Here is a portion of my UILogin.cs and also will include the Login.php.\n\nUILogin.cs\n\nIEnumerator AttemptLogin(bool quickLogin)\n {\n CreateLoadingScreen();\n DeactivateForm();\n WWWForm form = new WWWForm();\n form.AddField(\"email\", Email.text);\n form.AddField(\"password\", Password.text);\n\n WWW www = new WWW(URL.GetLoginURL, form);\n yield return www;\n\n DestroyLoadingScreen();\n ActivateForm();\n ParseResult(www.text, quickLogin);\n }\n\n void ParseResult(string result, bool quickLogin)\n {\n byte resultCode;\n if (!byte.TryParse(result, out resultCode))\n Result.text = \"Error parsing response from server, please try again!\";\n else if (resultCode == 0)\n {\n if (RememberToggle.isOn && !quickLogin) // Remember me\n {\n PlayerPrefs.SetInt(\"remember\", 1);\n PlayerPrefs.SetString(\"email\", Email.text);\n PlayerPrefs.SetString(\"password\", Password.text);\n }\n else if (!quickLogin)\n {\n TemporaryAccount.Email = Email.text;\n TemporaryAccount.Password = Password.text;\n }\n\n SceneManager.LoadScene(3);\n }\n else // Failure\n {\n if (quickLogin)\n ShowForm();\n\n Result.text = WebError.GetLoginError(resultCode);\n }\n }\n\n\nLogin.php\n\n<?php\n require \"conn.php\";\n\n $stmt = $pdo->prepare(\"SELECT * FROM account WHERE email=:email\");\n $stmt->bindParam(\":email\", $_POST['email']);\n $stmt->execute();\n $count = $stmt->rowCount(); // gets count of records found\n\n if($count > 0) {\n $result = $stmt->fetch(); // gets resultset\n if(!password_verify($_POST['password'], $result[4]))\n echo \"2\";\n else\n echo \"0\";\n }\n else {\n echo \"1\";\n }\n?>\n\n\nAny ideas?\n\nUpdate #1\nI printed www.text and www.error after the yield return www; Text is null and error says: Unknown Error.\n\nUpdate #2\nInterestingly enough, I get Unknown Error from this as well:\n\nClickme.cs\n\nusing System.Collections;\nusing UnityEngine;\nusing UnityEngine.UI;\n\npublic class Clickme : MonoBehaviour\n{\n public Text Result;\n\n public void OnClick()\n {\n StartCoroutine(RunScript());\n }\n\n IEnumerator RunScript()\n {\n WWW www = new WWW(\"http://www.familypolaris.com/helloWorld.php\");\n yield return www;\n\n if (www.text == \"\")\n Result.text = \"Result was empty, error: \" + www.error;\n }\n}\n\n\nHelloWorld.php\n\n<?php\n echo \"Hello World!\";\n?>" ]
[ "c#", "php", "android", "mysql", "unity3d" ]
[ "I need list of all class name of Font-Awesome", "I build app that will present a lot of icons so I need list of all Font-Awesome class name like\n [\"fa-dropbox\",\"fa-rocket\",\"fa-globe\", ....]\nso on is there any way to get it ?" ]
[ "javascript", "css", "font-awesome" ]
[ "Pushing S3 data from one AWS account to another S3 bucket using Lambda", "My use-case is to push data from one AWS account S3 bucket to another AWS account S3 bucket continuously. A cross account push.\n\nI’m using lambda to do this job. \n\nAssume in AWS account A, data is frequently landed from some source into S3 bucket. I need to create an S3 trigger which will invoke Lambda function in AWS account A and push account A S3 bucket data to another S3 bucket in AWS account B.\n\nIs this possible?" ]
[ "amazon-web-services", "amazon-s3", "aws-lambda" ]
[ "Convert \"float;#22.0000000000000\" into just \"22.0\" in C#", "I'm doing a ToString() on an object and the output I am getting is float;#22.0000000000000. I just need 22.0.\n\nHow do I achieve this in C#?\n\nAdditional info:\nThe object is the value from a Number column in a SharePoint list. The value is being retried in my code with a CAML query. I'm sure it's the use of a CAML query that's causing me this issue. If I retrieve the item just by iterating through all the items in the list I don't have this issue, but this approach is not as efficient as a CAML query.\n\nUpdate:\nIt seems it is not the ToString() that's causing this output. The object that I'm calling ToString() on already seems to be set as float;#22.0000000000000, so this is what's coming straight out of the CAML query." ]
[ "c#", "sharepoint", "floating-point" ]
[ "animate fade fixed back to top button", "I have a down link that moves the page down to the next section of the website when the user click. How can i make this fade into a back to top button when the user begins to scroll. Is there also a way of fixing this into position. Guessing this would be done through Jquery but not too sure.\n\n<div class=\"down-link\"><a href=\"#about\" id=\"w-downlink\"><i class=\"ss-navigatedown\"></i></a></div>\n\n\n.down-link {\n width:100%;\n height:50px; \n}\n\n#w-downlink i {\n line-height: 42px;\n font-size: 24px;\n color: #fff;\n display: block;\n width: 24px;\n margin: 0 auto;\n margin-top:10px;\n}\n\n#w-downlink {\n height: 60px;\n width: 60px;\n background-color: #191919;\n background-color: rgba(20, 20, 20, 0.4);\n position:absolute;\n bottom:0;\n margin-bottom:30px;\n right:0;\n margin-right:20px;\n cursor: pointer;\n -webkit-transform: translate3d(0, 0, 0);\n opacity: 1;\n}\n\n.w-downlink:hover {\n height: 60px;\n width: 60px;\n background-color: #191919;\n background-color: rgba(20, 20, 20, 0.4);\n position:absolute;\n bottom:0;\n margin-bottom:30px;\n right:0;\n margin-right:20px;\n cursor: pointer;\n -webkit-transform: translate3d(0, 0, 0);\n opacity: 0.5;\n}" ]
[ "javascript", "jquery", "html", "css" ]
[ "Not able to update xcode 6", "I'm not able to update my Xcode to 6.1. I'm not able to build an app on my device which \nhas iOS 8. After Googling I found I have to update Xcode but I'm not able to do that.\n\nGetting this error:\n\n\n There was an error in the App Store. Please try again later. (13)." ]
[ "macos", "xcode6" ]
[ "IE9 no sub-pixel anti-aliasing on border-radius", "I have applied border-radius on a div and the result is very poor rendering in IE9.\nI know that I am probably asking for too much, but still this is something that should not happen at all.\n\nIt is very dificult to explain to a client what sub-pixel anti-aliasing is.\n\nThis is my CSS:\n\n-moz-border-radius: 10px;\n-webkit-border-radius: 10px;\n border-radius: 10px;" ]
[ "internet-explorer-9", "css" ]
[ "How to store a pandas dataframe with datetime.timedelta type data objects into a postgresql d/b using sqlalchemy?", "I would like to store a pandas dataframe containing columns of type timedelta64 in a Postgresql database using sqlalchemy. Reading the documentation (https://docs.sqlalchemy.org/en/latest/core/type_basics.html) I expect that python 'timedelta' datatype could be mapped upon the postgresql 'interval' datatype, but I don't understand how to do this. I have tried the following code:\n\nimport sqlalchemy as sa\nimport pandas as pd\nfrom datetime import timedelta\n\nengine = sa.create_engine('postgresql+psycopg2://postgres:password@floris/floris')\n\nmy_df = pd.DataFrame(data=[ timedelta(days=1), timedelta(days=2), timedelta(days=3)], index=range(0,3), columns=['delay'])\n\nmy_df.to_sql('my_table', con=engine, dtype={'delay': sa.types.Interval})\n\n\n\nI got the following error:\n\npsycopg2.ProgrammingError: column \"delay\" is of type interval but expression is of type bigint\nLINE 1: INSERT INTO my_table (index, delay) VALUES (0, 8640000000000...\n ^\nHINT: You will need to rewrite or cast the expression.\n\n\nIt seems that sqlalchemy is not preserving the timedelta data type, but converting it to an bigint. How to solve this?" ]
[ "python", "postgresql", "sqlalchemy" ]
[ "video effect using javascript", "Can any one please tell me how to get the video effect shown on this page? It has 100% width, is responsive and uses Javascript.\n\nIf you have any code samples that would be great." ]
[ "javascript", "video" ]
[ "Variable Scope in VS C# vs VB", "I have a solution with 2 projects - 1 VB, 1 C#. I want to see and edit a global variable of my VB project from my C# project. I have declared the string variable (in VB) as Public Shared. \n\nI can't see it from my C# project. \n\nI am not familiar with C#, so I am not sure how to do the equivalent of an 'Imports' statement to get visibility of my VB project and its global variable. Can I do this? Or am I not really thinking this through correctly? (I am a VB guy, so C# is a bit of a mystery still). Thanks." ]
[ "c#", "vb.net", "visual-studio-2012" ]
[ "Understanding cmp in python and recursion", "I'm working with some existing code that redefines equality (via a __cmp__ method) for a class. It doesn't work as expected and in trying to fix it I've come across some behavior I don't understand. If you define __cmp__ on a class that just calls the built in function cmp, then I would expect it to always hit the maximum recursion depth. However if you try to compare an instance of the class to itself it returns 0.\n\nHere's the code:\n\nclass A:\n def __cmp__(self, other):\n return cmp(self, other)\n\na = A()\nb = A()\ncmp(a, a) # returns 0\ncmp(b, b) # returns 0\ncmp(a, b) # results in RuntimeError: maximum recursion depth exceeded\n\n\nThe RuntimeError I understand, but I don't understand why the first two calls to cmp succeed.\n\nI've read through the data model section of the python docs and other things like this nice breakdown of python equality but can't find an answer to this recursion.\n\nAnd, yes I understand that as written this is a totally pointless class. The code I'm working with tries to redefine equality in certain situations and otherwise falls through to a basecase. The basecase doesn't work as implemented and so I am trying to fix it. I thought calling cmp might work and discovered this issue. I'm hoping that understanding this will help me with finding a suitable solution." ]
[ "python", "python-2.7" ]
[ "Visual Foxpro Query for pending quantity", "I am having two tables AORDER for Purchase & BORDER for sale. I want to get pending quantity. Sale orders can have more than 1 records against one purchase order. I do not want to show those order having pending quantities 0. I tried this:\n\nSELECT ;\n aorder.orderid,;\n aorder.orderdate,;\n aorder.itemname,;\n aorder.partyname,;\n aorder.qty as Purchase,;\n SUM(border.qty) AS Sale,;\n SUM(aorder.qty-border.qty) as Pending;\n FROM ;\n aorder;\n LEFT JOIN border ;\n ON aorder.orderid = border.porderid;\n GROUP BY ;\n aorder.orderid,;\n aorder.orderdate,;\n aorder.itemname,;\n aorder.partyname,;\n aorder.qty\n\n\nBut I am failed to hide those records having purchase qty = sale qty.\n\nThnx in advance." ]
[ "sql", "select", "foxpro", "visual-foxpro" ]
[ "Can't open a file inside a google test", "I have a file in the same directory as the test.\nSince I'm using Bazel as the build system (in Linux) I don't have to create the main and initialize the tests (In fact I don't know where the main function resides when using Bazel).\n#include <string>\n#include <fstream>\n//Other include files\n#include "gtest/gtest.h"\n\nTEST(read_file_test, read_file) {\n std::string input_file("file_path");\n graph gr;\n graph_loader loader;\n\n ASSERT_TRUE(loader.load(gr, input_file));\n}\n\nThe BUILD file for the tests:\ncc_test(\n name = "loaderLib_test",\n srcs = ["loaderLib_test.cpp"],\n deps = [\n "//src/lib/loader:loaderLib",\n "@com_google_googletest//:gtest_main",\n ],\n data = glob(["resources/tests/input_graphs/graph_topology/**"]),\n)\n\nThe WORKSPACE file:\nload("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")\n\ngit_repository(\n name = "com_google_googletest",\n remote = "https://github.com/google/googletest",\n tag = "release-1.8.1",\n)\n\nThe directory structure:\n.\nβ”œβ”€β”€ README.md\nβ”œβ”€β”€ WORKSPACE\nβ”œβ”€β”€ bazel-bin -> /home/mmaghous/.cache/bazel/_bazel_mmaghous/35542ec7cbabc2e6f7475e3870a798d1/execroot/__main__/bazel-out/k8-fastbuild/bin\nβ”œβ”€β”€ bazel-graph_processor -> /home/mmaghous/.cache/bazel/_bazel_mmaghous/35542ec7cbabc2e6f7475e3870a798d1/execroot/__main__\nβ”œβ”€β”€ bazel-out -> /home/mmaghous/.cache/bazel/_bazel_mmaghous/35542ec7cbabc2e6f7475e3870a798d1/execroot/__main__/bazel-out\nβ”œβ”€β”€ bazel-testlogs -> /home/mmaghous/.cache/bazel/_bazel_mmaghous/35542ec7cbabc2e6f7475e3870a798d1/execroot/__main__/bazel-out/k8-fastbuild/testlogs\nβ”œβ”€β”€ resources\nβ”‚ └── tests\nβ”‚ └── input_graphs\nβ”‚ β”œβ”€β”€ graph_data\nβ”‚ β”‚ └── G1_data.txt\nβ”‚ └── graph_topology\nβ”‚ β”œβ”€β”€ G1_notFully_notWeakly.txt\nβ”‚ β”œβ”€β”€ G2_notFully_Weakly.txt\nβ”‚ β”œβ”€β”€ G3_fully_weakly.txt\nβ”‚ β”œβ”€β”€ G4_fully_weakly.txt\nβ”‚ β”œβ”€β”€ G5_notFully_weakly.txt\nβ”‚ β”œβ”€β”€ G6_notFully_weakly.txt\nβ”‚ └── G7_notFully_notWeakly.txt\nβ”œβ”€β”€ src\nβ”‚ β”œβ”€β”€ lib\nβ”‚ β”‚ β”œβ”€β”€ algorithms\nβ”‚ β”‚ β”‚ β”œβ”€β”€ BUILD\nβ”‚ β”‚ β”‚ └── graph_algorithms.hpp\nβ”‚ β”‚ β”œβ”€β”€ graph\nβ”‚ β”‚ β”‚ β”œβ”€β”€ BUILD\nβ”‚ β”‚ β”‚ └── graph.hpp\nβ”‚ β”‚ └── loader\nβ”‚ β”‚ β”œβ”€β”€ BUILD\nβ”‚ β”‚ └── graph_loader.hpp\nβ”‚ └── main\nβ”‚ β”œβ”€β”€ BUILD\nβ”‚ └── main.cpp\nβ”œβ”€β”€ tests\nβ”‚ β”œβ”€β”€ BUILD\nβ”‚ β”œβ”€β”€ algorithmsLib_test.cpp\nβ”‚ β”œβ”€β”€ graphLib_test.cpp\nβ”‚ └── loaderLib_test.cpp\n└── todo.md\n\nSo how should I reference the file if it's in the same folder as the test or any other folder?\nBTW: Using the full path from the root of my file systems works fine." ]
[ "c++", "googletest", "bazel" ]
[ "Adding Asynchronously Generated Elements As Children To Layout", "I have page called MainPage.cs. \n\nMainPage contains X amount of elements. \n\n1/3 of X elements are Grids that contain information retrieved from REST API.\n\nThese Grids and information within them are absolutely necessary for the application to function.\n\nclass MainPage: ContentPage\n{\n public MainPage()\n {\n var Scroll = new ScrollView\n {\n Content = new StackLayout\n {\n Children =\n {\n // Grids that contains Y elements\n ...\n Some other elements X elements\n ...\n },\n }\n };\n }\n}\n\n\nThese grids are being generated within an Asynchronous methods:\n\npublic async Task<Grid> TopGrid(){\n var ReturnGrid = new Grid{\n RowDefinitions =\n {\n new RowDefinition {....},\n }};\n\n ReturnGrid.Children.Add(await GetPropertyPicker(), 0, 0);\n return ReturnGrid;\n}\n\nasync Task<Picker> GetPropertyPicker()\n{\n var ReturnPicker = new Picker();\n\n string JsonItemList = await API.GetJsonResponse(...);\n var Elements = JsonConvert.DeserializeObject<List<Property>>(JsonItemList);\n foreach (var item in Elements)\n {\n ReturnPicker.Items.Add(item.PropertyName);\n }\n\n return ReturnPicker;\n}\n\n\nThe code above creates a gird with one row, which contains one Picker element.\nBoth of the methods are of type async.\n\nNow the problem is that I want to add this grid with its contents as a children to StackLayout. However, it is not possible since it's not an async method and await won't work.\n\nHow would I be able or what is the advisable way of adding asynchronously generated elements to the application? Do I need to first create all the app elements \"empty\" and then run a async method to fill with the necessary data them?" ]
[ "c#", "asynchronous", "xamarin" ]
[ "My app works only on emulator, not on the real device", "I test my application on the emulator and it works fine. When I launch it on the real device, it doesn't work (components are load normally). It only consists of a textfield, where as soon as \"1\" is pressed on it, \"Hello, world\" should be written on it. I use:\n\nimport android.media.MediaPlayer;\nimport android.support.v7.app.ActionBarActivity;\nimport android.os.Bundle;\n\nimport android.view.KeyEvent;\nimport android.view.Menu;\nimport android.view.MenuItem;\nimport android.view.View;\nimport android.widget.EditText;\n\npublic class MainActivity extends ActionBarActivity {\nString current_string;\nint length;\nEditText et;\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n et = (EditText) findViewById(R.id.editText);\n\n et.setOnKeyListener(new View.OnKeyListener() {\n public boolean onKey(View v, int keyCode, KeyEvent event) {\n if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_1)) {\n et.setText(\"Hello, world!\");\n current_string = et.getText().toString();\n length = current_string.length();\n et.setSelection(length);\n return true;\n }\n return false;\n }\n });\n}\n\n@Override\npublic boolean onCreateOptionsMenu(Menu menu) {\n\n // Inflate the menu; this adds items to the action bar if it is present.\n getMenuInflater().inflate(R.menu.main, menu);\n return true;\n}\n\n@Override\npublic boolean onOptionsItemSelected(MenuItem item) {\n // Handle action bar item clicks here. The action bar will\n // automatically handle clicks on the Home/Up button, so long\n // as you specify a parent activity in AndroidManifest.xml.\n int id = item.getItemId();\n if (id == R.id.action_settings) {\n return true;\n }\n return super.onOptionsItemSelected(item);\n}\n\n\n}\n\nAnd the xml I use:\n \n \n \n \n\n<application\n android:allowBackup=\"true\"\n android:icon=\"@drawable/ic_launcher\"\n android:label=\"@string/app_name\"\n android:theme=\"@style/AppTheme\" >\n <activity\n android:name=\"com.testingname.testapp.app.MainActivity\"\n android:label=\"@string/app_name\" >\n <intent-filter>\n <action android:name=\"android.intent.action.MAIN\" />\n\n <category android:name=\"android.intent.category.LAUNCHER\" />\n </intent-filter>\n </activity>\n</application>" ]
[ "android", "emulation", "device" ]
[ "Boost C++ date_time microsec_clock and second_clock", "I discovered a strange result in Boost C++ date time library. There is inconsistency between microsec_clock and second_clock, and I don't understand why is that. I am using Windows XP 32-bits\n\nMy snip of code:\n\nusing namespace boost::posix_time;\n...\nptime now = second_clock::universal_time();\nstd::cout << \"Current Time is: \"<< to_iso_extended_string(now)<< std::endl;\nptime now_2 = microsec_clock::universal_time();\nstd::cout << \"Current Time is: \"<< to_iso_extended_string(now_2)<< std::endl;\n...\n\n\nThe print-out I expected are current time without miliseconds and with milliseonds. However, what I have in my pc is:\n\n\n2009-10-14T16:07:38 \n1970-06-24T20:36:09.375890\n\n\nI don't understand why there is a weired date (year 1970???) in my microsec_clock time. Related documentation for Boost: link to boost date time" ]
[ "c++", "datetime", "boost", "utc", "clock" ]
[ "How to concatenate two properties of object in array to use as label in ngOptions", "How to concatenate two properties of object in array to use as label in ngOptions of angular JS? I have tried the below code, but get an error in the console.\n\n<select name=artArtist class=form-control ng-model=artArtist ng-options=\"art.firstName + ' ' + art.lastName for art in artists\" required></select>\n\n\nThe following code works, but produces the artist name without space between the first name and last name. What am I doing wrong?\n\n<select name=artArtist class=form-control ng-model=artArtist ng-options=\"art.firstName + art.lastName for art in artists\" required></select>" ]
[ "javascript", "angularjs" ]
[ "Authenticate Grape 0.10.1 with doorkeeper 2.0.1", "I'm using grape along with doorkeeper fro OAuth2 authentication. Now, I want to upgrade from grape 0.8 to grape 0.10.1, and doorkeeper to 2.0.1. Unfortunately, I ran into some problems. Before, I could use grape-doorkeeper to integrate doorkeeper easily in grape https://github.com/fuCtor/grape-doorkeeper\n\nBut after upgrading, I get some errors like uninitialized constant Doorkeeper::DoorkeeperForBuilder (NameError), and also the doorkeeper_for helper seems to be removed from doorkeeper and replaced by before_action :doorkeeper_authorize! (see https://github.com/doorkeeper-gem/doorkeeper/blob/master/CHANGELOG.md#backward-incompatible-changes).\n\nHere https://github.com/intridea/grape#register-custom-middleware-for-authentication the Grape documentation tells us, that we can use rack-oauth2 for OAuth2 authentication, but as far as I see, this lacks of the easy rails integration that doorkeeper provides, right?\n\nSo now, I'm a little bit confused, how to integrate doorkeeper 2.0.1 into grape 0.10.1. I already read some tutorials, but they are targeting older versions for this gems. So, any help is appreciated!\n\nUpdate\n\nI digged into the GrapeDoorkeeper gem, and found the following lines (https://github.com/fuCtor/grape-doorkeeper/blob/master/lib/grape-doorkeeper/oauth2.rb#L64):\n\n\n module OAuth2\n def doorkeeper_for *args\n doorkeeper_for = Doorkeeper::DoorkeeperForBuilder.create_doorkeeper_for(*args)\n use GrapeDoorkeeper::Middleware, doorkeeper: doorkeeper_for\n end\n end\n\n\nThen I looked into doorkeeper 2.0.1 and noticed, that the class DoorkeeperForBuilder and and the create_doorkeeper_for method are gone. I also couldn't find a replacement or another way to do this. To me, it looks like Doorkeeper::DoorkeeperForBuilder.create_doorkeeper_for returns a middleware that is used by grape. So, how would that be done with the new doorkeeper?\n\nAnother question would be, if this line still would work with doorkeeper 2: https://github.com/fuCtor/grape-doorkeeper/blob/master/lib/grape-doorkeeper/oauth2.rb#L73\n\n\nGrape::API.extend GrapeDoorkeeper::OAuth2" ]
[ "ruby-on-rails", "ruby", "oauth-2.0", "grape", "doorkeeper" ]
[ "hornerq JMSbridge acknowledge", "I learning Hornetq code recently, and have a doubt about JMSbridge.\nyou can see, there has a fun named "sendMessages()" in the JMSbridgeImpl.java. the fun send msg to the remote JMSServer, but without doing acknowledge.\nbut int the fun named "sendBatchNonTransacted()" , there just dong acknowledge with the last msg, such as "messages.getLast().acknowledge();"\nso the question is: why not do ack by the each msg in the fun named "sendMessages()"?\napologize, my English is pool.\nI'm online waiting for you help! thank you !\n--------------------------------------------\noh, thanks "Moj Far" very much for the frist question, i got it.\nbut i have a other question: i modifid the hornetQ source codes,\ni want to use ClientConsumer(have successful init) to get msg in the local HornetQ\nand use JMS producer to send msg to the remote JMSServer.\nIn the "Run" function of the "SourceReceiver" class, i modyfy as this:\nif (bridgeType == JMSBridgeImpl.ALL_NETTY_MODE ) {\n msg = sourceConsumer.receive(1000);\n} else { /* core client receive msg */\n cmsg = localClientConsumer.receive(1000);\n if (cmsg != null) {\n hq_msg = HornetQMessage.createMessage(cmsg, localClientSession);\n //hq_msg = HornetQMessage.createMessage(cmsg, null);\n hq_msg.doBeforeReceive();\n //cmsg.acknowledge(); do ack after send\n msg = hq_msg;\n }\n} \n\nbut after 2 hours runing, the VM memary is Overflow.\ni alsotry to not use localClientSession to create HornetQMessage,but the memory is also Overflow.\nis there something wrong in my code?" ]
[ "jms", "overflow", "hornetq", "bridge" ]
[ "Change serverSorting programatically in kendo ui grid", "I have a kendo ui grid. In my page I two button that when user click button1, I want to disable paging and disable server sorting on grid and when user click button2, I want to enable paging and server sorting.\n\nI disable paging by this code:\n\n\n $('#grid').data('kendoGrid').dataSource.pageSize(0);\n\n\nand enable paging by this code:\n\n\n $('#grid').data('kendoGrid').dataSource.pageSize(10);\n\n\nAlso I want to disable server sorting by this code:\n\n\n $('#grid').data('kendoGrid').dataSource.options.serverSorting = flase;\n\n\nBut it does not worked.\nHow to I do that?\nThanks." ]
[ "javascript", "kendo-ui", "kendo-grid" ]
[ "IPython notebook widgets using interactive", "I'm having trouble creating widgets in a Jupyter notebook that update when other widget values are changed. This is the code I've been playing around with:\n\nfrom ipywidgets import interact, interactive, fixed\nimport ipywidgets as widgets\nfrom IPython.display import display\n\ndef func(arg1,arg2):\n print arg1\n print arg2\n\nchoice = widgets.ToggleButtons(description='Choice:',options=['A','B'])\ndisplay(choice)\n\nmetric = widgets.Dropdown(options=['mercury','venus','earth'],description='Planets:')\ntext = widgets.Text(description='Text:')\n\na = interactive(func,\n arg1=metric,\n arg2=text,\n __manual=True)\n\ndef update(*args):\n if choice.value == 'A':\n metric = widgets.Dropdown(options=['mercury','venus','earth'],description='Planets:')\n text = widgets.Text(description='Text:')\n a.children = (metric,text)\n\n else:\n metric = widgets.Dropdown(options=['monday','tuesday','wednesday'],description='Days:')\n text2 = widgets.Textarea(description='Text2:')\n a.children = (metric,text2)\n\nchoice.observe(update,'value')\ndisplay(a)\n\n\nThe resulting widgets metric and text do change based whether A or B is selected, but the problem is that the \"Run func\" button goes away as soon as I change to B. I've tried adding the __manual attribute immediately before display(a), adding it within update, and several other places. How do I change the children of the widget box without overwriting the fact that I want to manually run the function?" ]
[ "widget", "ipython", "interactive" ]
[ "How can I display the contents of a txt file in a html file, WITH the requirement that I can format this text?", "I want to show the content of a txt file in an HTML page:\n\n<html>\n<head>\n\n <title><div style=\"font-family: verdana; font-size: 50px; color: blue\">\n blabla</div></title>\n <meta http-equiv=\"refresh\" content=\"5\">\n</head>\n\n<body>\n<div style=\"font-family: verdana; font-size: 50px; color: blue\">\n blabla</div>\n\n\n <p></p>\n <div style= \"font-family: verdana; font-size: 24px; color: blue\">blabla </div> \n <object data=\"file:///C:/number.txt\" type=\"text/plain\" width=\"200\" height=\"50\"></object>\n <div style = \"font-family: verdana; font-size: 24px; color: blue\"> blabla</div>\n\n\nThis works, but I cant change things like font or font-color. I tried div style, I tried it with CSS, also \"!important\" wasn't the solution. \n\nThe specific affected piece of code:\n\n<object data=\"file:///C:/number.txt\" type=\"text/plain\" width=\"200\" height=\"50\"></object>\n\n\nQ: How to I import the content of my txt file in my HTML page with the condition that I cant format the text?" ]
[ "javascript", "jquery", "css", "html" ]
[ "Replace 0 with data from another cell", "I have a sheet to track my revenue for my business, I want to make one cell that has this formula:\n\n=IF(J2=\"\",\"\",J2*C2)\n\n\nI use this formula to calculate the total revenue on my product, so if J2*C2 = 0 I want to change 0 with data from another cell B for example I spent 5$ on ads and didn't get any sale I want to get -$5 result in the cell that calculates the total revenue.\n\nCan someone help me to make it happen?" ]
[ "google-sheets", "google-sheets-formula" ]
[ "Slider using keyframes CSS", "This is a exercise from a course that I'm studying.\nThe objective is do a slider with 6 images. It needs to slide in X axis endlessly.\nThis is the keyframe code:\n@keyframes anim {\n 0% {\n margin-left: -513px;\n\n }\n 100% {\n margin-left: 1400px;\n }\n }\n\nMy idea is assign this keyframe for each image, using javascript, doing each one slides in your time.\nTo this I used this code:\nconst tagP = document.querySelectorAll('p') //All the images is on tags P\nfor(let i = 0;i < tagP.length; i++) {\n setInterval(function(){\n tagP[i].style.animation = 'anim 2s'\n }, i*2000)\n\nWith this code, the slider works perfectly, but with out the loop.\nI try use some codes but anyone work\nWith this, the slide starts to doesn't respect the interval between the images\nconst tagP = document.querySelectorAll('p')\n setInterval(function(){\n for(let i = 0;i < tagP.length; i++) {\n setInterval(function(){\n tagP[i].style.animation = 'anim 2s'\n }, i*2000) \n tagP[i].style.animation = ''// Here I clean the animation atribute to in the future I atribute it again.\n }\n }, 12000)\n\nIn this next, I try to do a function and call it endlessly, but it happens the same like the last one.\nconst tagP = document.querySelectorAll('p')\n function slider() {\n for(let i = 0;i < tagP.length; i++) {\n setInterval(function(){\n tagP[i].style.animation = 'anim 2s'\n }, i*2000) \n tagP[i].style.animation = ''\n }\n }\n setInterval(function(){slider()}, 12000)\n\nIf someone can explain a way to do this loop, I'll be thankful!\nPS: I'm learning english, disregard the errors rsrs." ]
[ "javascript", "css", "slider", "keyframe" ]
[ "(an alternative for) Creating dynamic CSS in a STYLE element per Svelte component", "I am learning Svelte by converting my existing (proof concept) Chess Custom Element/WebComponent.\n\nOne objective is to highlight the squares a dragging Chesspiece can move to\n\n\n\nIn my Custom Element it is fairly easy with a Stylesheet (inside Board shadowDOM !!! )\n\n<style id=\"moveFromSquare\"></style>\n\n\nThen a mousenter on a square creates the CSS with the correct squarename\n(for screenshot: local variables at='D5' and piece='black-knight')\n\nlet squareMouseEnter = () => {\n [boardcustomelement].root.querySelector('moveFromSquare').innerHTML=\n piece\n ? `div[at= \"{at}\" ]{\n box-shadow: inset 0 0 var(--boxshadow-size) var(--boxshadow-color);\n }\n div[defenders*= \"{at}\" ]{\n font-weight:bold;\n color:green;\n box-shadow: inset 0 0 var(--boxshadow-size) var(--boxshadow-color);\n }`\n : ''\n}\n\n\nNo need for looping over previous squares to clean classnames,\nNo need for looping over squares again to set classnames\n\nBut I am learning Svelte...\n\nEverything is a Svelte object: Board, Square, Piece (inside Square)\n\n\n\nThere can be multiple Boards on a page,\nsince there is no shadowDOM, to apply my CSS approach:\n\n\nI need to get the svelte-xxxxx className for one Board (what is the easier way?) \nthen create a (global) <STYLE> element for every board using the svelte-xxxxx className everywere required\n\n\nBut I wonder if there is a more (reactive) Svelte way of creating this?" ]
[ "custom-element", "svelte", "svelte-component" ]
[ "Display picture using PHP5 that is not located in www folder", "I have a wireless access point, that is on Raspberry Pi, with Apache and PHP.\n\nRaspberry Pi should use PHP to Display Images that are located on the USB drive(the drive is mounted).\n\nI have tried using direct routes to the file, from HTML. Example:\n\n<img src=\"/mnt/data/1.jpg\">\n\n\nBut the images are always shown as broken links.\n\nI have also tried using symbolic links from /var/www folder to /mnt/data folder, but that also didn't work.\n\nIs it even possible to show images from /mnt/data using PHP, and if it is, how it can be done?\n\nThanks" ]
[ "php", "html", "image", "raspberry-pi" ]
[ "Registration of backend webgl failed for tensorflowjs", "As suggested in tensorflowjs github, I post the question here. I am getting below error, in simplest example possible with tensorflow. \n\nError:\n\n\nCode: A simple html snippet with just tfjs loading. \n\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n <script src=\"https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js\"></script>\n <title>Testing Tfjs</title>\n</head>\n<body>\n <h2>Testing Tfjs</h2> \n</body>\n</html>\n\n\nBrowser: Chrome Version 72.0.3626.119\nOS: Win 10, GPU: GT 740M, version 397.44.\nChrome gpu show says : (because I disabled hw acceleration to avoid chrome blacking out at times)\n\nWebGL: Software only, hardware acceleration unavailable, \nWebGL2: Software only, hardware acceleration unavailable\n\n\nI have tried setting backend explicitly as cpu but it did not help. I have seen other posts in github talking about this error, but in vain." ]
[ "google-chrome", "tensorflow", "webgl" ]
[ "Is there a numeric keypad for jQuery Mobile?", "I have a peripheral for the iPad that needs to set the focus on a numeric field to allow the user to enter a qty.\n\nMy problem is: When my JavaScript sets the focus on the field, the keyboard doesn't slide up.\n\nOne possible solution would be to just throw 10 buttons up on the screen, but before I do that, I thought I would ask the community if a nicely styled keypad has already been done in jQuery mobile." ]
[ "ipad", "jquery-ui", "jquery-mobile" ]
[ "Change date in jQuery Countdown Timer", "I have a simple Countdown Timer on my website.\n\nI'd like to change the date from January 25th to October 24th at 9am GMT?\n\nDemo: http://codepen.io/anon/pen/xEWJpY\n\nI've done lot of Googling but very much confused about what needs to be changed.\n\n\r\n\r\n$(function () {\r\n var austDay = new Date();\r\n austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);\r\n $('#defaultCountdown').countdown({until: austDay});\r\n $('#year').text(austDay.getFullYear());\r\n});\r\n#defaultCountdown { width: 240px; height: 45px; }\r\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>\r\n<h1>jQuery Countdown Basics</h1>\r\n\r\n<p><strong>25th January</strong> == austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);</p>\r\n\r\n<div id=\"defaultCountdown\"></div>\r\n\r\n<hr>\r\n\r\n<p> </p>\r\n\r\n<p>What is October 24th at 9am?</p>\r\n\r\n\r\n\n\nAny help in this would be greatly appreciated." ]
[ "javascript", "jquery", "date", "simpledateformat", "countdowntimer" ]
[ "Initialize variable once to prevent \"10 $digest() iterations reached\"", "I'm doing a ng-repeat over a list returned by a function declared in the controller and I'm getting \"10 $digest() iterations reached. Aborting!\" message.\n\n<div ng-repeat element in list()></div>\n\n\nThe function:\n\nMyCtrl = ($scope)->\n ...\n $scope.list = ->\n list = {}\n for e in someArray\n .... #adding stuff to list\n list\n ...\n\n\nI discovered the problem is the $scope.list() function is being called several times and each time the function is called the local list variable is re-assigned so angular sees a different object each time and the ngRepeat element is redrawn. How can I avoid this?" ]
[ "angularjs" ]