source
sequence
text
stringlengths
99
98.5k
[ "stackoverflow", "0053375110.txt" ]
Q: c3.js - hide tooltip for specific data sets I have a c3.js chart which has 4 datasets. Is it possible to set the tooltop only to display for 1 set of data? From the code below I only want the tooltip to display for data4. var chart = c3.generate({ bindto: '#chart3', data: { //x: 'x1', xFormat: '%d/%m/%Y %H:%M', // how the date is parsed xs: { 'data1': 'x1', 'data2': 'x2', 'data3': 'x3', 'data4': 'x4' }, columns: [ x1data, y1data, x2data, y2data, x3data, y3data, x4data, y4data, ], types: { data1: 'area', }, }, legend: { show: false } }); There is the tooltip option for show:false but that disables them all. Can it display for just 1 dataset? A: The tooltip.position() function can be used to control the position of the tooltip, and we can set the tooltip position way off the canvas as a quick hack to hide it when we do not want to see it. However, I do not know how to return the default which is not documented - maybe someone else can elaborate on that. tooltip: { grouped: false, position: (data, width, height, element) => { if (data[0].id === 'data2'){ // <- change this value to suit your needs return { top: 40, left: 0 }; } return { top: -1000, left: 0 }; } } EDIT: After digging around for a solution I found that Billboard.js (a fork of C3.js on github) provides a tooltip.onshow() function that the API docs say is 'a callback that will be invoked before the tooltip is shown'. So it would appear that Billboard.js already has the a potential solution where you could intercept the data and hide the tooltip.
[ "stackoverflow", "0024090595.txt" ]
Q: CSS Animation doesn't work with inline display property? As the title says, my CSS Animation doesn't work properly with the display: inline property...What am I doing wrong here? I have narrowed it down to this bit of css code provided below that is giving me the troubles. If I provide all the code, it would literally take forever to look through as it's quite lengthy - however, if you need more let me know. Anyway, in the HTML part, I have the class navcontent with style="display: none;" which looks like this: <div id="all" class="navcontent" style="display: none;"></div> I need that bit of html to be hidden as the navcontent class also acts as tabs that once you click upon, the data/content within will appear in a specific container that's fixed (which any tab clicked the data/content appears/disappears in the same specific container)... So with that being said, I have also applied some animation to that specific container but am having troubles making the animation work with display: inline... Without the display: inline, the animation works great, but if you click on another tab, the content that is supposed to appear - isn't there. So I guess you can say I'm in a catch22 situation... With the display: inline, the animation doesn't work, BUT the tabs work and appear like they should. CSS: .navcontent ul { width: 554px; height: 299px; padding: 0; margin: 0; list-style: none; -moz-perspective: 400px; -webkit-perspective: 400px; -ms-perspective: 400px; -o-perspective: 400px; perspective: 400px; position: relative; overflow-x: hidden; overflow-y: auto; z-index: 9997; } .navcontent ul li { width: 536px; height: 140px; margin: 5px auto 10px auto; /* display: inline; */ /* Issues - If display is off, works as intended but other tabs do not show up at all if clicked. If display is enabled, animation doesn't work... */ -moz-transform: translateZ(0); -webkit-transform: translateZ(0); -ms-transform: translateZ(0); -o-transform: translateZ(0); transform: translateZ(0); position: relative; z-index: 2; } .navcontent ul li:nth-child(odd) { background: rgba(204, 204, 204, 0.07); background: -moz-linear-gradient(transparent, rgba(204, 204, 204, 0.07)); background: -webkit-gradient(linear, left top, left bottom, from(transparent), to(rgba(204, 204, 204, 0.07))); background: -webkit-linear-gradient(transparent, rgba(204, 204, 204, 0.07)); background: -o-linear-gradient(transparent, rgba(204, 204, 204, 0.07)); } Any Ideas -or- thoughts? UPDATE: JS $(function () { $('#options ul li a').on('click', function (e) { e.preventDefault(); if ($(this).hasClass('active')) { return; } else { var currentitm = $('#options ul li a.active').attr('id'); if (currentitm == 'division_all_link') { var currentlist = $('#division_all'); } if (currentitm == 'division_latest_link') { var currentlist = $('#division_latest'); } if (currentitm == 'division_featured_link') { var currentlist = $('#division_featured'); } if (currentitm == 'division_popular_link') { var currentlist = $('#division_popular'); } var newitm = $(this).attr('id'); if (newitm == 'division_all_link') { var newlist = $('#division_all'); } if (newitm == 'division_latest_link') { var newlist = $('#division_latest'); } if (newitm == 'division_featured_link') { var newlist = $('#division_featured'); } if (newitm == 'division_popular_link') { var newlist = $('#division_popular'); } $('#options ul li a').removeClass('active'); $(this).addClass('active'); $(currentlist).fadeOut(320, function () { $(newlist).fadeIn(200); }); } }); }); A: You cannot transform elements with display: inline; - use inline-block instead: .navcontent ul li { display: inline-block; /* .. */ transform: translateZ(0); } This is stated clearly in the related specification: transformable element A transformable element is an element in one of these categories: an element whose layout is governed by the CSS box model which is either a block-level or atomic inline-level element, or whose display property computes to table-row, table-row-group, table-header-group, table-footer-group, table-cell, or table-caption [CSS21] an element in the SVG namespace and not governed by the CSS box model which has the attributes transform, ‘patternTransform‘ or gradientTransform [SVG11]. Note that atomic inline-level element is referring to inline-block
[ "stackoverflow", "0034915403.txt" ]
Q: How to add launch screen for iPhone 5 using Xcode 7 I'm trying to make launch screens for my app with its target as iOS 9.2 in Xcode 7.2. The new way of making the launch screen for iPhones 6 and 6s is to use launch files which I am doing. I would like to support iPhone 5 and 4s as well. Apple says in their guide that for those two phones I need to use images with the specified requirements: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html I tried to use the asset catalog to add images for the older iPhones. But the templates are not based on iPhone model like 5 or 4s, they are based on the iOS version like iOS 8, 7, and 6. I don't know which template to use for iPhone 5 and 4s. In other words which iOS target would be the right choice for those phones. Thanks! A: If you want to support all devices and your deployment target is iOS 8.0 or later, all you need is a single launch screen file. You do not need any launch images. The launch screen file will signal iOS that your app supports all iPhone sizes and if it is a Universal app (or an iPad app) it signals iOS that is supports all iPad sizes.
[ "chess.stackexchange", "0000019854.txt" ]
Q: Where to download a 6 man Nalimov endgame tablebase? Can anyone tell me whereabouts I can download a 6 man Nalimov endgame tablebase? I've seen some websites with 6 man Nalimov (case in point: http://contentdb.emule-project.net/view.php?pid=1630). However, so far all I have come across is dead links. Can someone able to point me to some working link(s)? A: From the ICCF site: Players who wish to have access to the 7 men tablebases may purchase any of the following programs: ChessOK Aquarium 2017, Houdini Aquarium 2017, Houdini PRO Aquarium 2017, Chess Assistant 17 with Houdini 5 and Chess Assistant 17 PRO with Houdini 5 PRO. Free Android application One more way to access 7-man tablebases without having a key is to use Android application. Search for Lomonosov Tablebases or use https://play.google.com/store/apps/details?id=com.convekta.android.lomonosovtb Alternatively, if players only want access to 6 men tablebases they may visit this page to use the 6-piece Nalimov tablebases: http://chessok.com/?page_id=361
[ "superuser", "0000434626.txt" ]
Q: Automatically deleting old files from recycling bin while keeping the new ones? I want an explorer add-on which will delete old files from recycling bin after a time period. For example, I want to set the time limit to 30 days. When I delete a file in Windows, the software will keep a record of its delete-time. Every day, it will scan for deleted file whose age has reached to 30 days, and delete if there is any. Is there any software like this? A: I don't know of any Explorer add-ons, but like most things in Windows, this can be done with PowerShell: ForEach ($Drive in Get-PSDrive -PSProvider FileSystem) { $Path = $Drive.Name + ':\$Recycle.Bin' Get-ChildItem $Path -Force -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-30) } | Remove-Item -Recurse } Save this script as a text file with a .ps1 extension. You can then use Task Scheduler to run this at regular intervals. First, though, you need to permit the execution of PowerShell scripts, because by default you can only execute commands typed directly into the PowerShell prompt. To do this, open PowerShell and type in the following command: Set-ExecutionPolicy RemoteSigned Type in "y" or "yes" when prompted. See Get-Help Set-ExecutionPolicy for more information. Now open Task Scheduler and create a new task with the following parameters: Under the "General" tab, enter a name and check the "Run with highest privileges" option Under the "Triggers" tab, add a new trigger and set the task to run daily Under the "Actions" tab, add a new action: leave the type as "Start a program" set the "Program/script" field to C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe set the "Add arguments" field to -NonInteractive -File "C:\path\to\script.ps1" Under the "Conditions" tab, uncheck "Start the task only if the computer is on AC power" Line-by-line explanation of the script: ForEach ($Drive in Get-PSDrive -PSProvider FileSystem) { This gets a list of all drives in the computer and loops through them one by one. The -PSProvider FileSystem parameter is required to only return disk drives, because PowerShell also has pseudodrives for various other things like registry hives. For more information, see Get-Help Get-PSDrive and this tutorial on loop processing in PowerShell. $Path = $Drive.Name + ':\$Recycle.Bin' This constructs the path to the Recycle Bin folder on the current drive. Note the use of single quotes around the second part, to prevent PowerShell from interpreting $Recycle as a variable. Get-ChildItem $Path -Force -Recurse -ErrorAction SilentlyContinue | This returns all files and subfolders under the given path (the one we constructed with the previous command). The -Force parameter is needed to go into hidden and system folders, and the -Recurse parameter makes the command recursive, ie. loop through all subdirectories as well. -ErrorAction is a standard parameter for most PowerShell commands, and the value SilentlyContinue makes the command ignore errors. The purpose of this is to prevent errors for drives that have been configured to delete files immediately. The | symbol at the very end pipes the results to the next command; I split it up to several lines for better readability. For more information, see Get-Help Get-ChildItem. Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-30) } | This simply filters the results from the previous command and returns only those that are older than 30 days. $_ refers to the object currently being processed, and the LastWriteTime property in this case refers to the date and time that the file was deleted. Get-Date returns the current date. For more information, see Get-Help Where-Object and Get-Help Get-Date. Remove-Item -Recurse This simply deletes the items passed to it by the previous command. The -Recurse parameter automatically deletes the contents of non-empty subfolders; without it, you'd be prompted for such folders. For more information, see Get-Help Remove-Item. A: RecycleBinEx is a simple application for Windows that does exactly what you ask. See: http://www.fcleaner.com/recyclebinex On Mac OSX, Hazel does the same thing (among the others): http://www.noodlesoft.com/ KDE Plasma ships this feature as default, so if you're running Kubuntu, Arch, Chackra Linux or any other distro with KDE, you already have this feature. Just look at Dolphin configuration window. On Ubuntu Unity, Gnome or any other gnu/linux desktop environment providing a standard FreeDesktop.org Trash feature you can use AutoTrash to do this thing: http://www.logfish.net/pr/autotrash/ Similar behaviour can be accomplished also with trash-cli, that could be used also to send files to trash can right from the command line. See: https://github.com/andreafrancia/trash-cli Most email apps out there also have this feature for their "trash can". On Android there isn't any "trash can" by default (when you delete it, it's gone forever), but you can install apps like Dumpster to (somehow) get similar features: http://www.dumpsterapp.mobi/ As said above, I think that automatically removing old files from trash can is a great feature to make it more usable, since it reduces clutter (are those files you trashed 3 months ago still relevant to you? And ALL those old revisions of the same file?) and makes easier to find what you want to recover (this is the reason for having a "trash can" on our computers, after all), still being safe. It's even more useful if you work a lot with text files (code or prose), that most of the time are small and don't need a lot of space (so may never reach your trash can quota). This way you won't even need to periodically "empty your trash can". You just know that you have a window of time for recovering your "trashed" files if you need to. Looking at most cloud services out there (Dropbox, Google Drive, Simplenote, ...), most of them seem to have a similar policy for deleted files. I really think it's the right thing to do with your files, and they seems to think so. A: The Windows Recycle Bin automatically deletes older files when it reaches it's maximum size: What happens when Recycle Bin uses up its allocated space? You can control this from the properties of the Recylce Bin
[ "unix.stackexchange", "0000488021.txt" ]
Q: How can I list tmux windows in collapsed view by default? When I press Ctrl+b, W, tmux shows the list of all current windows and their panes as a tree. The problem is that this is very long when using many windows. I can collapse a window in the list by pressing Left, such that the list only shows the window but not its panes. This makes is easier to get an overview of available windows, but takes time since I need to collapse the list items one by one. How can I configure tmux to show all windows in collapsed view by default? A: Prefix+w runs choose-tree -Zw. From tmux(1): choose-tree [-GNswZ ] [-F format ] [-f filter ] [-O sort-order ] [-t target-pane ] [template ] Put a pane into tree mode, where a session, window or pane may be chosen interactively from a list. -s starts with sessions collapsed and -w with windows collapsed. -Z zooms the pane. So with default settings, the windows are already collapsed (ie. you can't see individual panes in the initial view). If you want the initial view to be collapsed further, you could rebind it to use -s, so that each session only gets one line. bind-key 'w' choose-tree -Zs The -Z flag was introduced in tmux 2.7. If you're using version 2.6, the binding was simply choose-tree -w, so you should change it to choose-tree -s.
[ "stackoverflow", "0023497225.txt" ]
Q: Adding bidirectional error bars to points on scatter plot in ggplot I am trying to add x and y axis error bars to each individual point in a scatter plot. Each point represents a standardized mean value for fitness for males and females (n=33). I have found the geom_errorbar and geom_errorbarh functions and this example ggplot2 : Adding two errorbars to each point in scatterplot However my issue is that I want to specify the standard error for each point (which I have already calculated) from another column in my dataset which looks like this below line MaleBL1 FemaleBL1 BL1MaleSE BL1FemaleSE 3 0.05343516 0.05615977 0.28666600 0.3142001 4 -0.53321642 -0.27279609 0.23929438 0.1350793 5 -0.25853484 -0.08283566 0.25904025 0.2984323 6 -1.11250479 0.03299387 0.23553281 0.2786233 7 -0.14784506 0.28781883 0.27872358 0.2657080 10 0.38168220 0.89476555 0.25620796 0.3108585 11 0.24466921 0.14419021 0.27386482 0.3322349 12 -0.06119015 1.42294820 0.32903199 0.3632367 14 0.38957538 1.66850680 0.30362671 0.4437925 15 0.05784842 -0.12453429 0.32319116 0.3372879 18 0.71964923 -0.28669563 0.16336556 0.1911489 23 0.03191843 0.13955703 0.34522310 0.1872229 28 -0.04598340 -0.35156017 0.27001451 0.1822967 'line' is the population (n=10 individuals in each) from where each value comes from my x,y variables are 'MaleBL1' & 'FemaleBL1' and the standard error for each populations for males and females respectively 'BL1MaleSE' & 'BL1FemaleSE' So far code wise I have p<-ggplot(BL1ggplot, aes(x=MaleBL1, y=FemaleBL1)) + geom_point(shape=1) + geom_smooth(method=lm)+ # add regression line xmin<-(MaleBL1-BL1MaleSE) xmax<-(MaleBL1+BL1MaleSE) ymin<-(FemaleBL1-BL1FemaleSE) ymax<-(FemaleBL1+BL1FemaleSE) geom_errorbarh(aes(xmin=xmin,xmax=xmax))+ geom_errorbar(aes(ymin=ymin,ymax=ymax)) I think the last two lines are wrong with specifying the limits of the error bars. I just don't know how to tell R where to take the SE values for each point from the columns BL1MaleSE and BL1FemaleSE Any tips greatly appreciated A: You really should study some tutorials. You haven't understood ggplot2 syntax. BL1ggplot <- read.table(text=" line MaleBL1 FemaleBL1 BL1MaleSE BL1FemaleSE 3 0.05343516 0.05615977 0.28666600 0.3142001 4 -0.53321642 -0.27279609 0.23929438 0.1350793 5 -0.25853484 -0.08283566 0.25904025 0.2984323 6 -1.11250479 0.03299387 0.23553281 0.2786233 7 -0.14784506 0.28781883 0.27872358 0.2657080 10 0.38168220 0.89476555 0.25620796 0.3108585 11 0.24466921 0.14419021 0.27386482 0.3322349 12 -0.06119015 1.42294820 0.32903199 0.3632367 14 0.38957538 1.66850680 0.30362671 0.4437925 15 0.05784842 -0.12453429 0.32319116 0.3372879 18 0.71964923 -0.28669563 0.16336556 0.1911489 23 0.03191843 0.13955703 0.34522310 0.1872229 28 -0.04598340 -0.35156017 0.27001451 0.1822967", header=TRUE) library(ggplot2) p<-ggplot(BL1ggplot, aes(x=MaleBL1, y=FemaleBL1)) + geom_point(shape=1) + geom_smooth(method=lm)+ geom_errorbarh(aes(xmin=MaleBL1-BL1MaleSE, xmax=MaleBL1+BL1MaleSE), height=0.2)+ geom_errorbar(aes(ymin=FemaleBL1-BL1FemaleSE, ymax=FemaleBL1+BL1FemaleSE), width=0.2) print(p) Btw., looking at the errorbars you should probably use Deming regression or Total Least Squares instead of OLS regression.
[ "stackoverflow", "0061630773.txt" ]
Q: Angular - Difference between "optimization" and "buildOptimizer" in the build config (angular.json) Can someone explain me exactly the difference between those two flags (optimization and buildOptimizer) defined in the build config angular.json during the build process when I execute ng build --prod? The official build documentation isn't clear to me. A: buildOptimizer optimizes the transpilation of TS to JS (remove unused code, add tslib,..) More detailed explanation in the readme of the package https://www.npmjs.com/package/@angular-devkit/build-optimizer optimization flag I think this one indicates the execution of some Webpack plugins. As in what to do with the JS after the buildOptimizer
[ "stackoverflow", "0024897851.txt" ]
Q: Why does my distributed app look different than it did while debugging in xcode? I 'completed' an app and submitted it to the app store. The app was rejected because they couldn't get the app to start. They sent me images and they look different than anything that I have seen while debugging. I created an ad hoc .ipa and loaded it onto my device and then I was able to see the same symptoms. Some images are missing, including the 'start' button. It does not cause a crash, so I can't use crash reports to debug the problem. Are there certain settings that I need to modify to make sure that a distributed app and a debugged app are the same? I am using Xcode 5.1.1 and Cocos2D. (Some of the images that are missing are images whose zOrder I modified; I don't know if this is relevant or not). One of the missing images is 'tower_blank.png' shown in the project navigator in the screen shot below: A: I found a solution that fixed the problem. I would love to get some feedback as to whether this is a good idea or not. Under 'Build Settings->Apple LLVM 5.1 - Code Generation->Optimization Level' I changed the Release setting from 'Fastest,Smallest' to 'None'
[ "stackoverflow", "0010392787.txt" ]
Q: how to submit form from jQuery and navigate to the page? I have two php pages. Page 1 contains one form which i submitted with jQuery. Page 2 is form query page. I want to read all the data from Page 2 after submitting from page 1 through navigation. My following code does not work as I expected. Page 1: $.ajax({ type: "POST", url: "requestProcessor.php", data: "fname="+ fname +"&amp; lname="+ lname, success: function(){ window.location.href = "requestProcessor.php"; } }); Page 2: requestProcessor.php <?php require("db/phpsql_info.php"); echo htmlspecialchars(trim($_POST['fname'])); echo htmlspecialchars(trim($_POST['lname'])); ?> Thanks in advance.. A: First, change your data parameter to: data: { fname: fname, lname: lname } It's more readable. 2nd, it does not make sense what you are doing. You are posting data to requestProcessor.php, then after that you send the user to requestProcessor.php (which is then a GET). This loses all the POST data from before of course as it's the equivalent of just typing requestProcessor.php into your URL bar. If you want to go from page 1 to page 2 and see the data POSTed then just submit your form on page 1 to requestProcessor.php directly. Else, if you want to show the result of page 2 after the POST, then send the response to some div on the current page. success: function(response) { $("#some-div").html(response); } Not sure what you are trying to achieve though if I am honest.
[ "stackoverflow", "0048973635.txt" ]
Q: Are there any ways to re-use subquery in SELECT FROM (query) syntax in JOIN part? I have simple test table CREATE TABLE test ( id INT NOT NULL PRIMARY KEY ); INSERT INTO test (id) VALUES (1), (2), (3), (6), (8), (9), (12); And I'm trying to use subselect to add row numbers for each row (can't use ROW_NUMBER() or other hacks because of mysql version). SELECT tlist.id as `from`, tlist1.id as `to` FROM ( SELECT t1.id as id, @row_num := IFNULL(@row_num+1, 1) as num FROM test as t1 ) as tlist INNER JOIN ( SELECT test.id as id, @row_num1 := IFNULL(@row_num1+1, 1) as num FROM test ) as tlist1 ON tlist.num + 1 = tlist1.num WHERE tlist.id + 1 < tlist1.id The problem is that I forced to create new subselect for each row in INNER JOIN query because I can't do INNER JOIN tlist as tlist1 since tlist isn't real database table. Are there any ways to re-use tslit subquery? A: Are there any ways to re-use tslit subquery - No this is a way to simulate row_number functionality in mysql although the ifnull bit is more often expressed as a cross join like this - SELECT tlist.id as `from`, tlist1.id as `to` FROM ( SELECT t.id as id, @row_num := @row_num+1 as num FROM t cross join (select @row_num:=0) r ) as tlist INNER JOIN ( SELECT t.id as id, @row_num1 := @row_num1+1 as num FROM t cross join(select @row_num1:=0) r1 ) as tlist1 ON tlist.num + 1 = tlist1.num WHERE tlist.id + 1 < tlist1.id; But in this case SELECT T1.ID T1ID ,(SELECT MIN(T2.ID) FROM T T2 WHERE T2.ID > T1.ID) T2ID FROM T T1 HAVING T1.ID + 1 < T2ID; might suffice. But I guess what you are really trying to establish is if there are any gaps in the id (assuming id increments by 1)?
[ "stackoverflow", "0024875632.txt" ]
Q: Custom GIF through UIImageView on Xcode not appearing? I am a beginning programmer trying to create a custom GIF using the UIImageView on iOS's Xcode. I have the code below, but it is not displaying at all. I feel like the solution is very simple and right in front of me but I've been hitting my head all day trying to figure out what's wrong with no success. I am doing almost all of this game in sprite kit and am doing this in the MyScene class (not the view controller). UIImageView *testGIF= [[UIImageView alloc] initWithFrame:CGRectMake(self.size.width/2,self.size.height/4,100,100)]; NSMutableArray *GIFImageArray = [@[] mutableCopy]; NSString *GIFImageNames[15]; for (int i = 1; i <=15; i++) { UIImage *GIFImage = [UIImage imageNamed:[NSString stringWithFormat:@"DragAndMatch-%i.png", i]]; GIFImageNames[i-1]=[NSString stringWithFormat:@"DragAndMatch-%i.png", i]; [GIFImageArray addObject:GIFImage]; } testGIF.animationImages = GIFImageArray; testGIF.animationRepeatCount = 1; testGIF.animationDuration = 5; [self.view addSubview: testGIF]; [testGIF startAnimating]; A: I think the answer is hidden in your question - you mentioned "am doing this in the MyScene class (not the view controller)." what do you think is in self.view then? if self.view is not the view of the controller, then its not going to show. Add the testGIF to your VC's self.view and you should be good to go
[ "stackoverflow", "0037889173.txt" ]
Q: Filter combobox dropdown options using textbox value in Access 2013 I have a form in Access with a textbox and a combobox, and need to filter the combobox dropdown options using the value in the textbox. The textbox contains a Category for the choices. I've done this using SELECT Options.Choice FROM Options WHERE (((Options.Category)=[forms]![FormName]![Text10].Value)); Is there a way to refer to the value in Text10 without explicitly referring to FormName? I'll need to duplicate this form within the same Access file and changing all combobox row sources for a new form is not feasible. I can't hard code the Category value for each combobox because there are many comboboxes per form, and the value in the textbox will be different on every form. Any help is appreciated. A: You can refer to whatever form you're currently on in Access using Screen.ActiveForm. So in your case you'd have: SELECT Options.Choice FROM Options WHERE (((Options.Category)=[Screen].[ActiveForm]![Text10].Value)); As long as the field name stays constant this should work.
[ "stackoverflow", "0001640238.txt" ]
Q: innerHTML Isn't working in Firefox and IE I have a feeling that I'm missing something simple here but can't seem to find it. I'm using SwfUpload and on its uploadSuccess() event, I'm showing a "success" message on the screen while hiding the progress image. Below is the snippet: swfu.uploadSuccess = function(file, serverData, response) { document.getElementById("progressImg").display = "none"; var uploadMessage = document.getElementById("UploadMessage"); uploadMessage.style.display = "block"; uploadMessage.innerHTML("The file, " + file.name + ", was uploaded successfully."); }; Everything works fine up until the last line when I'm attempting to set the text of the uploadMessage object. The object refers to a <span> tag though I've also tried it as a <div> just in case. IE8 says that innerHTML is not supported and FF3.5.4 doesn't show any errors (haven't added firebug yet). I've also tried to just put set static text instead of a concatenated string to no avail either. This is a trivial task that I've done countless times w/ and w/o a framework; however, it's not working at this time. What am I missing? Thanks EDIT: Since someone may wonder, current doctype is set to HTML 4.0 Transitional. A: It's a property: uploadMessage.innerHTML = "..."; On a side note, have you considered what happens if name of file contains an ampersand?
[ "stackoverflow", "0004334353.txt" ]
Q: how to use rake db:migrate I just want to roll one version back, But I don't know the current VERSION, Is there a command to check it? A: First, it's worth taking the time to read the Rails Guide regarding migrations. Then regarding your specific question: ... to roll back one version: rake db:rollback STEP=1 ... to see the current version: rake db:version
[ "tex.stackexchange", "0000316788.txt" ]
Q: Arrows between parts of two brackets Source: Better solution to display the Distributive Property Question: When i came across the answer given by Peter Grill, i am very interesting to know that how we can extend(modify) this codes for this type of multiplication (a+b)(c+d)=ac+ad+bc+bd I mean how can we draws arrows between the parts of these two brackets. I tried lot at my best level but couldn't find the appropriate corrections. CODE: \documentclass{article} \usepackage{amsmath} \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \usetikzlibrary{calc,shapes} \newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};} \newcommand{\DrawBox}[2]{% \begin{tikzpicture}[overlay,remember picture] \draw[->,shorten >=5pt,shorten <=5pt,out=70,in=130,distance=0.5cm,#1] (MarkA.north) to (MarkC.north); \draw[->,shorten >=5pt,shorten <=5pt,out=50,in=140,distance=0.3cm,#2] (MarkA.north) to (MarkB.north); \end{tikzpicture} } \begin{document} \LARGE \[\tikzmark{MarkA}(a+b)(c\tikzmark{MarkB}+d\tikzmark{MarkC})=ac+ad+bc+bd \DrawBox{OrangeRed,distance=1cm,in=110,shorten >=10pt}{Cerulean,out=115,in=70,distance=1.5cm}\] \end{document} A: \documentclass{article} \usepackage{amsmath} \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \usetikzlibrary{calc,shapes} \newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};} \begin{document} \[(\tikzmark{MarkA}a+\tikzmark{MarkB}b)(c\tikzmark{MarkC}+d\tikzmark{MarkD})=ac+ad+bc+bd \begin{tikzpicture}[overlay,remember picture] \draw[->,shorten >=5pt,shorten <=5pt,out=70,in=110,distance=0.75cm,OrangeRed,] (MarkA.north) to (MarkD.north); \draw[->,shorten >=5pt,shorten <=5pt,out=60,in=110,distance=0.5cm,Cerulean] (MarkA.north) to (MarkC.north); \draw[->,shorten >=1pt,shorten <=2pt,out=-70,in=-110,distance=0.5cm,OrangeRed,] (MarkB.south) to (MarkD.south); \draw[->,shorten >=1pt,shorten <=2pt,out=-60,in=-110,distance=0.25cm,Cerulean] (MarkB.south) to (MarkC.south); \end{tikzpicture} \] \end{document}
[ "superuser", "0001111959.txt" ]
Q: Get coordinates of intersecting point of two trend lines Given this table, chart and trend lines in Excel. I want to find the coordinates of the intersecting point. How can I do this? A: You can either configure the chart such that the linear expressions for the trend lines are shown or use the LINEST function to calculate constant part and slope for both lines. To get the intersection point, you have to solve the resulting system of two linear equations as explained here. A: Small solution for dummies like me Right click each trendline » Format trendline » Display equation on chart Open wolframalpha's sub site for Intersection points of two curves/lines Back in Excel copy both formulas by double clicking them and paste them over to wolframalpha. (Note to me: Replace commas through dots) You get the x-coordinate and calculate the y-coordinate yourself by taking one of your two trendline formulas and insert your just calculated x value y = 1.64 x 0.52245 + 0.034 = 0.890818
[ "stackoverflow", "0002459780.txt" ]
Q: Best way to remove an object from an array in Processing I really wish Processing had push and pop methods for working with Arrays, but since it does not I'm left trying to figure out the best way to remove an object at a specific position in an array. I'm sure this is as basic as it gets for many people, but I could use some help with it, and I haven't been able to figure much out by browsing the Processing reference. I don't think it matters, but for your reference here is the code I used to add the objects initially: Flower[] flowers = new Flower[0]; for (int i=0; i < 20; i++) { Flower fl = new Flower(); flowers = (Flower[]) expand(flowers, flowers.length + 1); flowers[flowers.length - 1] = fl; } For the sake of this question, let's assume I want to remove an object from position 15. Thanks, guys. A: You may also want to consider using ArrayList which has more methods available than a plain array. You can remove the fifteenth element by using myArrayList.remove(14) A: I think that your best bet is to use arraycopy. You can use the same array for src and dest. Something like the following (untested): // move the end elements down 1 arraycopy(flowers, 16, flowers, 15, flowers.length-16); // remove the extra copy of the last element flowers = shorten(flowers);
[ "superuser", "0000821816.txt" ]
Q: How to diagnose short freezes/apnea on my Mac I'm using a late-2011 MacBookPro running OSX 10.9.5. For the last couple of days, I'm experiencing short periods (1-2 seconds) of unresponsiveness where everything freezes, including display, mouse & keyboard. These freezes usually happen in bursts, go away and come back later... Not sure if it's related, but sometimes the screen flickers like it's getting back from a full-screen app (very short fade back from black). I've tried to understand if it could be software-related. It happens even if there is no app running, and the activity monitor doesn't show anything special (I was expecting to see CPU spikes when freezes happen but no, the activity monitor just freezes like the rest and resumes). So far, my Googling has found that this is a usual symptom of a failing hard-disk (which could be probable, it's nearly 3 years old and had a bad drop on the floor once). But the Disk Utility's verify doesn't report any issue. And I had a look at the system.log where no disk error could be found. Any help would be greatly appreciated. Thanks in advance! EDIT: A more detailed look at the system.log shows a constant looping (every 10 seconds or less) through the following: Oct 7 13:13:32 Thomass-MacBook-Pro.local WindowServer[186]: Received display connect changed for display 0x4280142 Oct 7 13:13:32 Thomass-MacBook-Pro.local WindowServer[186]: Found 1 modes for display 0x04280142 [1, 0] Oct 7 13:13:40 Thomass-MacBook-Pro.local WindowServer[186]: Received display connect changed for display 0x4280142 Oct 7 13:13:40 Thomass-MacBook-Pro.local WindowServer[186]: Found 16 modes for display 0x04280142 [16, 0] Oct 7 13:13:40 Thomass-MacBook-Pro.local WindowServer[186]: CGXMuxAcknowledge: Posting glitchless acknowledge Oct 7 13:13:40 Thomass-MacBook-Pro.local WindowServer[186]: Received display connect changed for display 0x4280142 Oct 7 13:13:40 Thomass-MacBook-Pro.local WindowServer[186]: Found 1 modes for display 0x04280142 [1, 0] Oct 7 13:13:40 Thomass-MacBook-Pro.local WindowServer[186]: Received display connect changed for display 0x3f003f Oct 7 13:13:40 Thomass-MacBook-Pro.local WindowServer[186]: Found 1 modes for display 0x003f003f [1, 0] Oct 7 13:13:40 Thomass-MacBook-Pro.local WindowServer[186]: Received display connect changed for display 0x3f0040 Oct 7 13:13:40 Thomass-MacBook-Pro.local WindowServer[186]: Found 1 modes for display 0x003f0040 [1, 0] Oct 7 13:13:48 Thomass-MacBook-Pro.local WindowServer[186]: Received display connect changed for display 0x4280142 Oct 7 13:13:48 Thomass-MacBook-Pro.local WindowServer[186]: Found 45 modes for display 0x04280142 [45, 0] Oct 7 13:13:48 Thomass-MacBook-Pro.local WindowServer[186]: Received display connect changed for display 0x3f003f Oct 7 13:13:48 Thomass-MacBook-Pro.local WindowServer[186]: Found 1 modes for display 0x003f003f [1, 0] Oct 7 13:13:48 Thomass-MacBook-Pro.local WindowServer[186]: Received display connect changed for display 0x3f0040 Oct 7 13:13:48 Thomass-MacBook-Pro.local WindowServer[186]: Found 1 modes for display 0x003f0040 [1, 0] Oct 7 13:13:48 Thomass-MacBook-Pro.local WindowServer[186]: MPAccessSurfaceForDisplayDevice: Set up page flip mode on display 0x04280142 device: 0x7f989a6024e0 isBackBuffered: 1 numComp: 3 numDisp: 3 Oct 7 13:13:48 Thomass-MacBook-Pro.local WindowServer[186]: CGXMuxAcknowledge: Posting glitchless acknowledge Would that issue come from the WindowServer process? It happens even after a restart... A: Puzzled about these 'display connect changed' log entries, I plugged an external monitor. This is something I do a lot, but hadn't done since the issue started. I must mention that my external monitor adapter is a little bit wiggly and sometimes I have to plug/unplug it a couple of times before the external monitor gets a signal. Don't know if it comes from the adapter or the Mac's socket. From the time I plugged it in, the issue disappeared and the repeating log entries stopped! I've just unplugged it, and everything remained normal. So my best guess is that the last time I unplugged the external monitor adapter, something went wrong and the system kept on receiving plug/unplug events (even after reboots!). I hope this may help somebody else in the future, although I guess this is a very rare thing to happen!
[ "stackoverflow", "0009352373.txt" ]
Q: Linq query with table joins,case statements, count, group by clauses I want to run a linq query that will return values to my custom DTO. This particular linq query will need to take into account joins from multiple tables, using switch case statements, count (*) and group by This is the SQL version sample of the query I will need a LinQ equivalent of... select slm.SLType, count(c.EStatID) as EStat, COUNT(cpd.TrId) as Training, COUNT( CASE WHEN cpd.TrStat= 44 THEN 1 WHEN cpd.TrStat!= 44 THEN NULL WHEN cpd.TrStat IS NULL THEN NULL END) as TrainingComplete, COUNT( CASE WHEN cpd.CndAssess = 44 THEN 1 WHEN cpd.CndAssess != 44 THEN NULL WHEN cpd.CndAssess IS NULL THEN NULL END) as AssessmentComplete from TabC c , TabCPD cpd, TabSLM slm where cpd.SLid = slm.SLid and c.Id= cpd.CID and c.O_Id = 1 group by slm.SLType It returns records in the following format. I have put each record as a new line with fields separated by commas. The numbers below are just as an example TypeA, 0 , 1 , 1, 0 TypeB, 1 , 0 , 1, 0 I am trying to create a linq query in the format like the one below without much luck var query = from c in TabC, ...... select new MyCustomTableC_DTO { DTOproperty = c.MatchingTable property,.... } MyCustomTableC_DTO will have a property for each field in the query. Any idea how to accomplish this? The query I will use to build a list of type MyCustomTableC_DTO Thanks for your time... A: When you try to convert that SQL statement to LINQ line by line, you would get something like this: from row in ( from c in db.TabC from cpd in db.TabPD from slm in db.TabSLM where cpd.SLid == slm.SLid where c.Id == cpd.CID where c.O_Id == 1 select new { c, cpd, slm }) group row in row.slm.SLType into g select new { SLType = g.Key, EStat = g.Count(r => r.c.EstatID != null), Training = g.Count(r => r.cpd.TrId != null), TrainingComplete = g.Count(r => r.cpd.TrStat == 44), AssessmentComplete = g.Count(r => r.cpd.CndAssess == 44) }; This query however, over complicates things and completely ignores that fact that Entity Framework knows much more about the model and generates all foreign keys as properties on the entities. Besides that, with LINQ, you must often approach things the other way around. In your case for instance, don't start with the TabC or TabSLM entity, but TabPD, since that table is the cross-table. With this knowledge, we can write the LINQ query like this: from cpd in db.TabCPDs where cpd.TabC.O_Id == 1 group cpd by cpd.TabSLM.SLType into g select new { SLType = g.Key, EStat = g.Count(r => r.TabC.EstatID != null), Training = g.Count(r => r.TrId != null), TrainingComplete = g.Count(r => r.TrStat == 44), AssessmentComplete = g.Count(r => r.CndAssess == 44) }; This is much simpler and (if I'm not mistaking) has the same result.
[ "stackoverflow", "0023051339.txt" ]
Q: How to avoid end of URL slash being removed when ResolveReference in Go In the following example, end of URL / is removed, is there a way to keep the /? package main import ( "fmt" "net/url" "path" ) func main() { u, _ := url.Parse("http://localhost:5100") relative, _ := url.Parse(path.Join("hello/")) fmt.Println(u.ResolveReference(relative)) } Output: http://localhost:5100/hello A: I figured out the answer, which is not to use path.Join: package main import ( "fmt" "net/url" ) func main() { u, _ := url.Parse("http://localhost:5100") relative, _ := url.Parse("hello/") fmt.Println(u.ResolveReference(relative)) } Output: http://localhost:5100/hello/
[ "stackoverflow", "0003673592.txt" ]
Q: How to share libraries without using the GAC? I have a library that is meant to be used by many websites. The way I am doing it now is in the library's properties, I set the "Post-build event command line" to: copy "$(TargetPath)" "$(SolutionDir)\MyWebsite\bin\$(TargetFileName)" Every time I want a new website to use the shared library, I add a new line like this: copy "$(TargetPath)" "$(SolutionDir)\MyWebsite2\bin\$(TargetFileName)" Is there an easy or better way to do this besides using the GAC? A: In my opinion your problem here is a lack of control about how this library is produced and used by other projects. If I were you (which I'm not :) I'd set about developing the library through a unit test co-project where new functionality can be developed and tested independently. Once that functionality has been implemented and tested to be working within your unit test parameters manually copy the assembly into a "library" folder of the web project that the required the extension of the library in the first place (this folder holds all your compiled assemblies used by that project). Even better would be to maintain a version system in which you tag the new version of the library so as to keep track of the exact source revision that it's using. The reason I suggest what may seem like a cumbersome methodology of working is that your current practice makes your existing websites quite brittle as a change made in the library for one site may in fact break one of the other sites... and as the amount of sites you have increases you can't be forever retro testing new versions of the shared library against the existing sites. It's also for these reasons that I don't recommend using the GAC either.
[ "tex.stackexchange", "0000500343.txt" ]
Q: Beamer frametitle unexpected behavior In beamer if some content follows the frame title in curly brackets, then the content will be also a part of the title. It happens only when the title is given without explicitly calling \frametitle. Is it a bug or a feature? If the latter, why is it good? See the difference between the three frames. \documentclass{beamer} \begin{document} \begin{frame}\frametitle{Title} {content} \end{frame} \begin{frame}{Title} %Without calling \frametitle {content} \end{frame} \begin{frame}{Title} %Only content \end{frame} \end{document} A: According to the beamer documentation, the frame environment accepts the following arguments: \begin{frame}<⟨overlay specification⟩>[<⟨default overlay specification⟩>][⟨options⟩]{⟨title⟩}{⟨subtitle⟩} Therefore, {content} in your second slide is interpreted as the framesubtitle and \begin{frame}{Title} {contents} \end{frame} is actually equivalent to \begin{frame} \frametitle{Title} \framesubtitle{contents} \end{frame} To overcome this, you can use the following: \begin{frame}{Title}{} {content} \end{frame}
[ "stackoverflow", "0013003820.txt" ]
Q: How to retrieve the value of an element within an element in XML I have the following XML: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Project> <Site Address="0" Connect="COM1,9600"> </Site> </Project> I am trying to get the value of 'Connect' I have this code: var doc = XDocument.Load(xml); var q = from x in doc.Root.Elements() where x.Name.LocalName == "Connect" select x; ClientTB.Text = q.FirstOrDefault().ToString(); But when I run this I get the error Object reference not set to an instance of an object. If I change the where statement to: where x.Name.LocalName == "Site" Then my text contains <Site Address="0" Connect="COM1,9600"></Site> What do I need to do to get the value of Connect? A: var q = from x in doc.Root.Elements() where x.Name.LocalName == "Site" select x.Attribute("Connect"); Alternative var q = from x in doc.Descendants("Site").Attributes("Connect") select x;
[ "stackoverflow", "0027059701.txt" ]
Q: JavaFx: In TreeView Need Only Scroll to Index number when treeitem is out of View I need to do a simple thing. I have a large TreeView. and a menu item Next and Previous. on Next I have to select next Tree Item. Tree List Look like this -Root(set visible hide is true for root) --Parent 1 ----Child 1 ----Child 2 ----Child 3 --Parent 2 ----Child 1 ----Child 2 Now By pressing Next or previous menu item i call myTreeView.getSelectionModel().clearAndSelect(newIndex); By This I have manage to select next item and by myTreeView.getSelectionModel().scrollTo(newIndex) i have manage to scroll to selected treeitem. Problam: Let I select the first item manually. after this i press next button. Now This cause a weird behavior that it always scrolls weather new selected treeitem is in view (bounds of view able area) or out of view. let assume i have large list of tree items. and my requirement is just i only want scroll happened only when new selected tree item go out of view. can any body suggest how to achieve this?? Thanks. A: This simple thing is not so simple. It is a known issue in JavaFX; see issue RT-18965. Based on the comment in the issue, I have made it work with my own TreeView. Please note that - as in the issue comment - I have relied on internal classes within JavaFX to get my end result. There is no guarantee that these internal classes will continue to be. First, create a new Skin that is derived from an internal class (again: dangerous): import javafx.scene.control.TreeView; import com.sun.javafx.scene.control.skin.TreeViewSkin; import com.mycompany.mymodel.DataNode; /** * Only done as a workaround until https://javafx-jira.kenai.com/browse/RT-18965 * is resolved. */ public class FolderTreeViewSkin extends TreeViewSkin<DataNode> { public FolderTreeViewSkin(TreeView<DataNode> treeView) { super(treeView); } public boolean isIndexVisible(int index) { if (flow.getFirstVisibleCell() != null && flow.getLastVisibleCell() != null && flow.getFirstVisibleCell().getIndex() <= index && flow.getLastVisibleCell().getIndex() >= index) return true; return false; } } Second, apply that skin to the TreeView instance you are concerned about. myTreeView.setSkin(new FolderTreeViewSkin(myTreeView)); Finally, use the new method as a condition before scrollTo: if (!((FolderTreeViewSkin) myTreeView.getSkin()).isIndexVisible( intThePositionToShow )) myTreeView.scrollTo( intThePositionToShow ); This is what worked for me; I hope it can help you or anyone else.
[ "stackoverflow", "0026980721.txt" ]
Q: Windows Forms user controls on localizable forms cause display issues in Designer I have a simple user control (just an example): it is 40x100, but resizable. It has two buttons, one anchored at the top, one anchored at the bottom. It put this control on a form and stretch it to 40x400. This works fine. But as soon as I switch the form to Localizable = True and change the language to translate any strings, the Designer shows the user control as if it was 40x100 for both the default an the translated language, i.e. the bottom button is not anchored. Or better: the bottom button is displayed as if it was not anchored. The control occupies the correct amount of space (40x400), though (see selection highlight). And it displays fine during runtime, this is just a Designer issue. A picture showing the issue. Did I miss something here? Is this how it is supposed to work? Im on VS2010 at the moment, tried the old VS2005 but it's the same there. Thanks... A: I could easily repro this problem by anchoring the second button to the bottom. The Anchor property has a few oddish failure modes, layout isn't always recalculated when it should be. You found one such case. I think the underlying issue is that the Size property is a localizable property as well and the designer fails to fire the required events when it starts a new localization set. Something like that, nothing very trivial. You'll need to punt this problem and not rely on the Anchor property to get the button positioned correctly. That just takes a one-liner in your UserControl code, like: protected override void OnResize(EventArgs e) { button2.Top = this.ClientSize.Height - button2.Height; base.OnResize(e); }
[ "stackoverflow", "0019620637.txt" ]
Q: Service controller class I have a windows service running on a remote machine. I need to control it through a C# web application. Is it possible to use Service controller class to control remote windows service? Is there a better way to doing this? A: Use the overload of ServiceController that takes two parameters. The first is the service name and the second is the computer name. ServiceController Constructor (String, String) http://msdn.microsoft.com/en-us/library/ssbk2tf3.aspx public ServiceController( string name, string machineName ) The active identity will need permissions on the remote machine. If your application is not running with these permissions but you have credentials for a user with the permissions, you can use impersonation. WindowsIdentity.Impersonate Method http://msdn.microsoft.com/en-us/library/w070t6ka.aspx
[ "softwareengineering.stackexchange", "0000137057.txt" ]
Q: Do gantt charts have a role in agile software development? I've heard it said that gantt charts are a relic of waterfall project management techniques. I typically use an agile-like approach to project planning and tracking progress which provides good visibility into feature-time trade-offs as the project progresses. We're at the outset of a project in in which, while the exact front-end user interaction design is somewhat unclear at this early stage, the back-end requirements are fairly clear (components that communicate with various third-party APIs, the server infrastructure, etc). We'll be going through a process to develop good user interaction design for the front-end (starting with user stories and working forward from there), but we also wanted to get an idea of how long the back-end would take. I decided the best approach was to break it down into sub-components, where each component consisted of tightly coupled code that should probably be worked on in a contiguous period of time. I assigned rough time estimates to each component and sub-component, typically ranging from 1 to 10 days. I then used OmniPlan to indicate dependencies between these various components, and assigned developers to each task, with the goal of distributing effort as equally as possible. I then used OmniPlan's leveling tool. All, I think, a fairly standard way to use OmniPlan, and I thought reasonable way to come up with a rough time estimate. I should clarify that the intention was not to come up with a rigid blueprint about who would work on what and when, but more come up with at least one plausible way that we could build what we needed to build in a two month period. The gantt chart suggested that this was feasible. To my surprise, I received quite strong pushback from another team-member familiar with the agile development process, who accused me of adopting a waterfall methodology. Their more specific criticism was that the gantt chart was specified in terms of architectural components, rather than on user-visible features. They were frustrated that it didn't lend itself to saying "we should have functionality X by Y date". Where, if anywhere, did I go wrong? A: The big issue that I have with using Gantt charts is this. They don't do a good job of illustrating how the total amount of work left on a project changes with each iteration. That being said, most of the business owners in our organization are familiar with Gantt charts. This makes them an easier medium for communicating progress than the preferred (in my opinion) burn-up chart. The burn-up does show the both the progress of the team as well as the change in scope of the project throughout it's lifecycle. So I think there is room for compromise, but I would always have a burn-up at the ready to help fill in some of the missing information from the Gantt chart. If you are just using it for an initial estimate, I don't see a big issue with that. Using it to track progress does seem dated and "waterfally" to me.
[ "diy.stackexchange", "0000002527.txt" ]
Q: What is the best plastic to make a see through 'whiteboard' with? Over the past few months I've slowly been converting my garage into a DIY/project/man zone by adding lighting, work benches, storage and tools. Next I'd like to mount a piece of transparent plastic to the wall to use as a 'whiteboard' I know that I'd like to use a plastic, rather than glass, so that it wont easily shatter and will have more give to it. Other than that I'd like a material that I can draw on and wipe clean, won't flex too much when I write on it and be as cheap as possible (whilst being up to the task) Suggestions? A: Markee Dry-Erase Paint is clear, so it won't even look like you've got a dry erase surface at all. You may want to put up an outline though, since I could see running off the edge of the painted surface being a problem. It's also a bit pricey, at $59/quart or $127/gal. (I haven't used this product myself, so no guarantees on how well it works.) Another option is Opti-White dry erase film, also in clear. It's $26/ft for a 5' wide sheet. (So a 3'x5' sheet will run you $78 - it would be cheaper to go with the paint-on option, unless you don't want to deal with the mess.) If you want to go the 'board' route instead of a wall covering, you could try Lexan. It's fairly lightweight and you should be able to get it at most home improvement stores. Lowes has it for about $70 for a 3'x4' sheet.
[ "stackoverflow", "0026239636.txt" ]
Q: Reading from inner JSON Object JAVA I think, I have the understanding of JSON down, but I am having a slight issue with reading inner objects, for example Cover in this situation. { "id": "19292868552", "about": "Build, grow, and monetize your app with Facebook.\nhttps://developers.facebook.com/", "can_post": false, "category": "Product/service", "checkins": 1, "company_overview": "Visit https://developers.facebook.com for more information on how to build, grow, and monetize your app.\n\nIf you have questions about using Facebook or need help with general inquiries, visit https://www.facebook.com/facebook or our Help Center at http://www.facebook.com/help.\n\nIf you need to report bugs, appeal apps, or ask detailed technical questions, visit the following:\nAppeal Apps: https://developers.facebook.com/appeal\nReport Bugs: http://developers.facebook.com/bugs\nTechnical Questions: http://facebook.stackoverflow.com/", "cover": { "cover_id": "10152004458663553", "offset_x": 0, "offset_y": 0, "source": "https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-xap1/v/t1.0-9/s720x720/1466030_10152004458663553_1984809612_n.jpg?oh=97b895edc21d21c0f40a67a6de6077bd&oe=54BBD66C&__gda__=1422540117_30f73303c987294f8ffccd193d190941" }, "has_added_app": false, "is_community_page": false, "is_published": true, "likes": 3262128, "link": "https://www.facebook.com/FacebookDevelopers", "name": "Facebook Developers", "parking": { "lot": 0, "street": 0, "valet": 0 }, "talking_about_count": 10066, "username": "FacebookDevelopers", "website": "http://developers.facebook.com", "were_here_count": 0 } I was hoping to have this read from the JSON, it all works until I hit the Cover part. I have not tried to access the parking object yet, but I assume the issue will be the same. public FacebookCover createFacebookCoverObject (String json) throws JSONException { FacebookCover facebookCover = new FacebookCover(); JSONObject obj = new JSONObject(json); facebookCover.setAbout(obj.getString("about")); facebookCover.setCategory(obj.getString("category")); facebookCover.setCompanyOverview(obj.getString("company_overview")); facebookCover.setId(obj.getString("id")); facebookCover.setIsPublished(obj.getBoolean("is_published")); facebookCover.setLikes(obj.getInt("likes")); facebookCover.setLink(obj.getString("link")); facebookCover.setName(obj.getString("name")); facebookCover.setTalkingAboutCount(obj.getInt("talking_about_count")); facebookCover.setUserName(obj.getString("username")); facebookCover.setWebsite(obj.getString("website")); facebookCover.setWereHereCount(obj.getInt("were_here_count")); Cover theCover = new Cover(); JSONObject obj2 = new JSONObject(); theCover.setCoverId((obj2.getString("cover_id"))); theCover.setOffSetX(obj2.getInt("offset_x")); theCover.setOffSetY(obj2.getInt("offset_y")); theCover.setSource(obj2.getString("source")); return facebookCover; } Here is also my test method. public void testCreateFavebookCoverObject() throws Exception { System.out.println("createFavebookCoverObject"); String url = "https://graph.facebook.com/19292868552/"; InputStream is = new URL(url).openStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); String s = null; s = rd.readLine(); System.out.println(s); FacebookCover instance = new FacebookCover(); FacebookCover result = instance.createFacebookCoverObject(s); } A: It should do the trick : JSONObject obj2 = obj.getJSONObject("cover");
[ "stackoverflow", "0006463580.txt" ]
Q: How to print the data in byte array as characters? In my byte array I have the hash values of a message which consists of some negative values and also positive values. Positive values are being printed easily by using the (char)byte[i] statement. Now how can I get the negative value? A: How about Arrays.toString(byteArray)? Here's some compilable code: byte[] byteArray = new byte[] { -1, -128, 1, 127 }; System.out.println(Arrays.toString(byteArray)); Output: [-1, -128, 1, 127] Why re-invent the wheel... A: If you want to print the bytes as chars you can use the String constructor. byte[] bytes = new byte[] { -1, -128, 1, 127 }; System.out.println(new String(bytes, 0)); A: Well if you're happy printing it in decimal, you could just make it positive by masking: int positive = bytes[i] & 0xff; If you're printing out a hash though, it would be more conventional to use hex. There are plenty of other questions on Stack Overflow addressing converting binary data to a hex string in Java.
[ "stackoverflow", "0050607970.txt" ]
Q: AngularJS ng-repeat not display my data My ng-repeat does not display my data. But in console.log it displays normally. I am using laravel with backend. What am I doing wrong? <!DOCTYPE html> <html ng-app="myApp"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> <body> <div ng-controller="myCtrl"> <tr ng-repeat="t in teste"> <td>{{t.id}}</td> <td>{{t.total}}</td> </tr> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope, $http) { $http.get("//localhost:8000/angular") .then(function(response) { $scope.teste = response.data; console.log($scope.teste); }); }); </script> </body> </html> A: Here is your code updated, I think that you only need to wrap tr tag in in table tag. Hope it helps... Also I put call to fake API for data because in your example is used localhost link <!DOCTYPE html> <html ng-app="myApp"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> <body> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope, $http) { $http.get("https://jsonplaceholder.typicode.com/posts") .then(function(response) { setTimeout(function () { $scope.$apply(function () { $scope.teste = response.data; }); }, 0); }); }); </script> <div ng-controller="myCtrl"> <table > <tr style="text-align : left"> <th>Id</th> <th colspan="2">Title</th> </tr> <tr ng-repeat="t in teste track by $index"> <td>{{t.id}}</td> <td>{{t.title}}</td> </tr> </table> </div> </body> </html>
[ "stackoverflow", "0001844337.txt" ]
Q: AjaxControlToolkit confirm button extender asks twice I've added a confirm button extender to a button, which is working except it's asking the question twice, regardless of if i click OK or cancel. Both OK and CANCEL code executes as expected. What can be causing it to pop up twice ? A: Changed "ConfirmOnFormSubmit" to True" on the extended control properties and it seems to have resolved this issue
[ "stackoverflow", "0056569892.txt" ]
Q: Dynamic Sp_Executesql failing on datetime conversion error I have a very simple dynamic SQL query that specifically needs to be called using sp_executesql with parameters. This query works fine in regular dynamic SQL, but fails when using sp_executesql on a conversion error. I have tried many combinations of dynamic SQL, but none of them seem to work specifically for datetime conversions related to sp_executesql. declare @sql_nvarchar nvarchar(max), @datetime datetime = GETDATE(), @sqlparams nvarchar(max), @tablename nvarchar(max) = 'SomeTableName' Set @sql_nvarchar = N' Select * from ' + @tablename + ' where Date > ''' + convert(nvarchar(23), @datetime, 101) + ''' ' Set @sqlparams = N' @datetime datetime, @tablename nvarchar(max) ' EXEC(@sql_nvarchar) EXEC [sp_executesql] @sql_nvarchar,@sqlparams, @datetime, @tablename The first exec correctly returns the desired query, the second EXEC throws an error: 'Error converting data type nvarchar(max) to datetime.' A: You cannot parameterize an identifier, such as a table name. So, phrase this as: Set @sql_nvarchar = N' Select * from ' + @tablename + ' where Date > @datetime '; Set @sqlparams = N'@datetime datetime' exec sp_executesql @sql_nvarchar, @sqlparams, @datetime=@datetime
[ "stackoverflow", "0011082454.txt" ]
Q: Permalink not work when admin not login I had configured premalink on my wordpress. It works fine when I login in as a admin. However, if I log out, all of the links cannot be opened. Instead, it gives me a 404 page. Has anyone met this problem before and tell me how to solve it? Thanks. A: Double check your page properties. May be it is password protected/private or may be it is not published. To check page properties: Login to Dashboard. Click Pages on left side. Hover on the page which you getting 404 and click Quick Edit This will show all the details about your page. Check the password field, private and the Status field. The status should be published. Check it.
[ "parenting.stackexchange", "0000004344.txt" ]
Q: Ideas for dealing with a 16 month old toddler who likes to climb things? My wife and I are frazzled with a little boy who has not only mastered the walk and the run, he has now started into climbing every available vertical surface. We thought we had the house baby-proof, at least the living room. Other than standing over him every moment, we're wondering if anybody has any ideas for dealing with this. For example, he's a perfectly healthy boy with a perfectly healthy skull. Better to let him fall a bit and learn or what? We have a bicycle helmet. I half jokingly suggested to my wife that we put a helmet on him and strap some pillows on him. We know he needs to explore and learn, and we have surfaces like book-shelves, coffee tables, and furniture, that he seems to know how to get up and into, but not down from. I guess we've just got to hover for the next while. Any tips at all, including ways to reduce the chance of your baby climbing up and falling on his head and breaking his neck, appreciated. A: Our daughter does the same thing. She had a couple of days where she decided she wanted to jump off the couch head-first onto the hardwood floor. She was told no, no, no, no - until she understood that she may not do that. She didn't do it again. So we did it on a case-by-case basis. Some places, like our bed, which is pretty high - we let her climb. And then we teach her how to get down (turn around, slide down). So you have two options: define places that are off-limits, and for places that are not, teach her how to climb or get down. (My husband taught our daughter how to climb our bed and how to get down from the bed.) So be firm. Be strict. Say no - and only say it - when you absolutely mean it. Some things are never okay, and she has to learn that. A: You may have guessed from my answers to other questions, but I strongly support the idea of letting kids try everything so they do learn what hurts while at a young enough age to avoid breaking themselves, so I recommend the following: Do a wee bit of babyproofing (eg. don't let them climb on the fireplace, remove glass from shelves etc) but aside from that, let them climb. If you find there is something you really don't want them to climb on, tell them no and offer an alternative. In our case, we didn't want them to climb on the mantelpiece (it had a fire underneath, and had some valuable antiques on it) so we provided a couple of tree trunks in the garden to climb on instead. This also had the advantage of being set in soil so when they did fall off they didn't hurt themselves that much. Other than that, all babies fall and bash their heads. Better to do it when they are small and not very far off the ground. If they haven't had the chance to do it at this age, they will be far less capable of understanding the risks in later life. A: I agree with Rory to a point. Kids need to learn natural consequences, and falling is a natural consequence of climbing on things. However, there is a safety element that you can't ignore. My son was a climber, and there were many times I caught him trying to climb one of our bookshelves. Bookshelves for me are a big no-no. These are big bookshelves and if he pulled one over on him it would really, really injure him. So the bookshelves are screwed to the wall. I'm sure you know about this, but you can buy little kits pretty inexpensively to do this. The reality is that you can't possibly watch your son every second of the day. For those situations where you simply don't want him climbing on something because falling could hurt him, that's more of a discipline issue. Certainly, teaching him to safely climb down from a bed is important, and providing him with ample opportunities for safe climbing, but if there's something that you don't want him climbing on at all then you might need to institute a time-out policy. Just so you know, my husband was once carrying my son on his shoulders and dropped him to a hardwood floor where he hit his head. He had to fall in excess of five and a half feet. A quick trip to the ER showed that, other than being scared (and my husband feeling awful), he was fine. Kids are way more resilient than we give them credit for.
[ "stackoverflow", "0024423007.txt" ]
Q: Show ProgressDialog while Using AsynTAsk to parse JSON and populate a list I have two AsyncTasks. In the first one Iam fetching data from the server in JSON form and converting it into a String. In the second one Iam parsing the String into objects. ALl this happens after the user clicks on a button in AlertDialog. While this is happening i want to show a ProgressDialog. But currently the ALertDialog dismisses after the button click which is fine. but the progress dialog does not show. Here is my code:- private void PostString(String postedString) { // TODO Auto-generated method stub String postUrl = EndPoints.PostURL; try { String Response = new Post().execute(postUrl).get(); String getRequesturl= url String items = new FetchItems().execute(getRequesturl).get(); ArrayList<HashMap<String, String>> updatedPostList = new GetList().execute(items).get(); } private class Post extends AsyncTask<String, String, String> { @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub HttpResponse response =null; String resultString = ""; String myResponseBody = "" ; // Creating HTTP client HttpClient httpClient = new DefaultHttpClient(); // Creating HTTP Post HttpPost request = new HttpPost(params[0]); List<NameValuePair> nameValuePair =nameValuePairs try { request.setEntity(new UrlEncodedFormEntity(nameValuePair)); response = httpClient.execute(request); if(response.getStatusLine().getStatusCode()== 200) { HttpEntity entity = response.getEntity(); if (entity != null) { InputStream inputStream = entity.getContent(); myResponseBody = convertToString(inputStream); } } } catch(Exception e) { e.printStackTrace(); } return myResponseBody; } private class FetchItems extends AsyncTask<String, String, String> { // TODO Auto-generated method stub @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub HttpResponse response =null; String resultString = ""; String myResponseBody = "" ; // Creating HTTP client HttpClient httpClient = new DefaultHttpClient(); // Creating HTTP Post HttpGet request = new HttpGet(params[0]); try { response = httpClient.execute(request); if(response.getStatusLine().getStatusCode()== 200) { HttpEntity entity = response.getEntity(); if (entity != null) { InputStream inputStream = entity.getContent(); myResponseBody = convertToString(inputStream); } } } catch(Exception e) { } return myResponseBody; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); if(pd!=null && pd.isShowing()) pd.dismiss(); } @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); } private class GetList extends AsyncTask<String, String, ArrayList<HashMap<String, String>>> { @Override protected ArrayList<HashMap<String, String>> doInBackground(String... params) { // TODO Auto-generated method stub myCList.clear(); try { JSONObject jsonResponse = new JSONObject(new String(params[0])); JSONArray mtUsers = jsonResponse.getJSONArray("ListOfC"); for (int i = 0; i < mtUsers.length(); i++) { JSONObject menuObject = mtUsers.getJSONObject(i); //Parsing map = new HashMap<String,String>(); map.put(My items here) myCommentsList.add(map); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } Collections.reverse(myList); return myList; } } case R.id.btnAdd: scrollNews.fullScroll(v.FOCUS_DOWN); btnAddComms.setPressed(true); builder = new AlertDialog.Builder(NewsDetails.this); builder.setTitle("Post Comment"); builder.setIcon(R.drawable.post_comment_button); final EditText input1 = new EditText(NewsDetails.this); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); input1.setLayoutParams(lp); builder.setView(input1); builder.setPositiveButton("Post", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { pd = new ProgressDialog(Details.this); pd.setMessage("Posting.."); pd.show(); pd.setCancelable(true); postedString= input1.getText().toString(); dialog.dismiss(); if(postedString.length()>0) { Post(postedString); } else { Toast.makeText(Details.this, "Please enter a text.", Toast.LENGTH_LONG).show(); input1.findFocus(); } } A: Create a ProgressDialog as an instance variable. pDialog = new ProgressDialog(this); pDialog.setMessage("Fetching data"); inside onPreExecute() method of AsyncTask : pDialog.show(); inside onPostExecute() method of AsnycTask : pDialog.dismiss(); Note 1 : you don't need multiple AsyncTasks, you can complete the whole fetch and parsing inside the first AsyncTask alone, since you're calling one AsyncTask after the other. String Response = new Post().execute(postUrl).get(); String getRequesturl= url; String items = new FetchItems().execute(getRequesturl).get(); ArrayList<HashMap<String, String>> updatedPostList = new GetList().execute(items).get(); Note 2 : when you do a asyncTask.execute.get() on the UI Thread, your UI will be blocked, which is not encouraged. So, just call asyncTask.execute() and show the progress dialog while everything happens in the background.
[ "stackoverflow", "0018047982.txt" ]
Q: How to identify a button touch event from other touch events I have an app in which the user can interact with many objects. These are several UIButtons, a few UILabels and a lot of UIImageViews. The focus of all interaction centers around touching the UIImageView objects. With a touch I can move the images around, tell them to do this or that. However, my current obstacle is in knowing how to properly have the app distinguish touches that occur when I touch a UIButton. Why? Well the logic within the Touches Began event is meant to be only for the UIImageViews, however the moment that I touch a button, or any other object, the app is interpreting the touch as if it occurred for a UIImageView object. So, my approach boils down to: is there a good way of identifying if a touch occurred for a UIButton, UIImageView, UILabel object? That way I can filter out the irrelevant touches in my app from the relevant ones. EDIT: The code below outlines how I capture the touch event, however I do not know how to know from the touch event whether it is a button or a view that I touched. touch = [touches anyObject]; touchLocation = [touch locationInView:[self view]]; A: To know whether UIButton is pressed follow this: -(void) touchBegan : (NSSet *) touches withEvent : (UIEvent *) even { UITouch *touch = [touched anyObject]; UIView *touchedView = [touch view]; if([touchedView isMemberofClass : [UIButton class]) { //do something when button is touched } }
[ "stackoverflow", "0019461065.txt" ]
Q: Run-time injection: how do I get the most-childish Injector with Guice? basically my question boils down to how do I get this test to pass: private static class DefaultModule extends AbstractModule { @Override protected void configure() { } } private static class ParentModule extends DefaultModule{} private static class ChildModule extends DefaultModule {} private static class DependsOnInjector{ @Inject public Injector depdendency; } @Test public void when_instancing_a_class_that_depends_on_an_injector_it_should_yield_the_most_childish(){ //childish :p Injector parent = Guice.createInjector(new ParentModule()); Injector child = parent.createChildInjector(new ChildModule()); DependsOnInjector objectWithInjector = child.getInstance(DependsOnInjector.class); assertThat(objectWithInjector.depdendency).isSameAs(child); } But then perhaps I'm missing the point: stack overflow would have you believe its a sin to do what I'm doing (introducing factories that have a reference to an injector, to which they simply forward you when you ask them to make a product), and that what I'm doing is verging on service-locator, which is a bad move. But I don't see a way around this. I've got an interface called 'Visualization' that has 7 implementers. When you run, depending on your data set we select a set of these visualizers to create and render. With a factory that has an Injector field, I simply add a method public <TVis extends Visualization> TVis makeVisualization(Class<TVis> desiredVisualizationType){ return injector.getInstance(desiredVisualizationType); } the only alternative I see to having the factory keep an IOC container as a field, is to have 7 of guice's assisted-inject factories, one for each implementation, selected by a switch. That's pretty nasty. that is one of a couple examples. I'd really just like a nice way to get the most local injector. edit, to clarify: There are a number of places where it's convenient to wrap the injector in some kind of decoder. The visualizer was one instance, but there are several more. Thanks for the tip on Map bindings. The problem I have now is that our visualizers (for better or worse... worse I suspect) expect to be instanced every time we need one. So even with the map binding, I'd still need to inject an injector into my visualizer-decoding logic class wouldn't I? Regarding how many modules I have: I currently have 4 guice modules: a shared one that's got many of my big (truely) singleton services registered with it, then one for our "hosting" UI, then one for our "Problem Setup" UI, and another for our "External tool" UI (In fact there's one more for our testing environment). There's an arbitrary number of the latter two UI modules hanging around, and each of them has a couple objects that are created very late. Meaning without using child modules I believe I'd be left with several map binders, each with bindings being added to them at run-time (and then, presumably for the sake of memory leakage, some kind of removal logic on dispose). It seems to me to be much cleaner to have my (composed!) guice module tree (read: not inheritance tree!) Thanks for any help, and thanks for the existing suggetsions. A: I've got an interface called 'Visualization' that has 7 implementers. When you run, depending on your data set we select a set of these visualizers to create and render. If your set of visualizers is fixed, consider using plain binding annotations. This is the most simple way intended exactly for distinguishing between multiple implementations of the same interface. You do not need multiple injectors for this. If your set of visualizers is not fixed (e.g. these visualizers are plugins), then your task is solved neatly with MapBinder. With it you also do not need multiple injectors, you can define all your Visualizations inside single injector: public class VisualizationsModule extends AbstractModule { @Override protected void configure() { MapBinder<Class<Visualization>, Visualization> binder = MapBinder.newMapBinder(binder(), new TypeLiteral<Class<Visualization>>() {}, TypeLiteral.get(Visualization.class)); binder.addBinding(Visualization1.class).to(Visualization1.class); binder.addBinding(Visualization2.class).to(Visualization2.class); // etc } } Then you can inject a Map<Class<Visualization>, Visualization>: @Inject public SomeClass(Map<Class<Visualization>, Visualization> visualizers) { ... } You can select arbitrary key, not only Class<Visualizer>, it depends on your business requirements. If visualizers are plugins, you should probably use some kind of plugin identifier as a key. A: To answer your first question, you can get the desired injector by adding an explicit bind(DependsOnInjector.class); to ChildModule. Otherwise, "just-in-time bindings created for child injectors will be created in an ancestor injector whenever possible."
[ "stackoverflow", "0031241770.txt" ]
Q: BigQuery can run query in console but not launch it as a job I have a problem launching following query as a job: SELECT COUNT(*) FROM ( SELECT field_name FROM [dataset.table] WHERE time BETWEEN DATE_ADD(CURRENT_TIMESTAMP(), -30, "DAY") AND CURRENT_TIMESTAMP() AND GROUP EACH BY field_name ) AS cur_month JOIN EACH ( SELECT field_name FROM [dataset.table] WHERE time BETWEEN DATE_ADD(CURRENT_TIMESTAMP(), -60, "DAY") AND DATE_ADD(CURRENT_TIMESTAMP(), -30, "DAY") AND GROUP EACH BY field_name ) AS prev_month ON cur_month.field_name = prev_month.field_name Running this query in the console succeeds, but running it with the following java code fails JobConfigurationQuery queryConfig = new JobConfigurationQuery() .setQuery(query) .setDestinationTable(new TableReference() .setProjectId(projectId) .setDatasetId(toDataset) .setTableId(toTableId)) .setAllowLargeResults(true) .setCreateDisposition("CREATE_IF_NEEDED") .setWriteDisposition("WRITE_TRUNCATE") .setPriority("BATCH") .setFlattenResults(false); The error I get is { "errorResult": { "location": "query", "message": "Ambiguous field name 'field_name' in JOIN. Please use the table qualifier before field name.", "reason": "invalidQuery" }, "errors": [ { "location": "query", "message": "Ambiguous field name 'field_name' in JOIN. Please use the table qualifier before field name.", "reason": "invalidQuery" } ], "state": "DONE" } Does anyone have an idea why? A: The question is a duplicate of: BigQuery - same query works when submitted from UI and reports SQL syntax error from batch Setting flatten results to true solved my problem.
[ "apple.stackexchange", "0000053662.txt" ]
Q: After a Time Machine restore, now it won't do incremental back up Due to the Thunderbolt 1.2 update, I had to restore from a Time Machine Backup, but after that, Time Machine won't do incremental back up any more. The hard drive has 250GB of free space... It was 1TB and is used for backing up the iMac 27 inch which has about 700GB for the Mac partition (the other 300GB is for Bootcamp). So after the restore, it won't incrementally back up any more. It would try to back up everything from scratch and will fail because it tries to back up about 600GB into the 250GB free space and will stop. Is there a way to make it work again? A: Four options are available for you - none of them is a clear winner that works in all cases: Try to force the issue with the command line tmutil inheritbackup command Ditch the backup history and start over (not good, but quick) Use a tool like BackupLoupe and see if you can thin space on the drive to make enough room for the "estimated" amount of storage for the next backup. Baby sit the backup, by excluding most of the drive and unexcluding it in less than 250 GB chunks. This last option has gotten me over the hump several times when clients cannot afford to lose their backup. I image their backup drive before starting (just in case) and then use the Time Machine System Preference options to exclude most of the drive. The first option is the most precise if you are comfortable with the terminal application and command line tools. By excluding everything except perhaps /Library and /System you should be between 10 and 30 GB for the estimated size of a Full Backup and Time Machine will let you make a new backup. Then the trick is to slowly remove items from the exclusion list in stages to not have the next backup estimate exceed the remaining free space on your backup volume.
[ "stackoverflow", "0005638513.txt" ]
Q: Selecting an option element from a dropdown by its text value Given an HTML form element like: <select id='mydropdown'> <option value='foo'>Spam</option> <option value='bar'>Eggs</option> </select> I know I can select the first option with document.getElementById("mydropdown").value='foo' However, say I have a variable with the value "Spam"; can I select a dropdown item by its text rather than by its value? A: var desiredValue = "eggs" var el = document.getElementById("mydropdown"); for(var i=0; i<el.options.length; i++) { if ( el.options[i].text == desiredValue ) { el.selectedIndex = i; break; } }
[ "superuser", "0000954794.txt" ]
Q: Installed updates bundled into ISO of Windows 10 created with Media Creation Tool? Microsoft supports creating an offline installer of Windows 10 from a DVD or a USB flash drive, using the Media Creation Tool. Does the Media Creation Tool bundle Windows Updates -- installed on the media-creating PC -- into the offline media it creates? In other words, if Windows Update A01 is installed on my PC, and I create offline media on that same PC, then use that media to install Windows on another PC, will the other PC already have Update A01? A: The short answer is no, the Media Creation Tool will NOT bundle Windows Updates -- installed on the media-creating PC -- into the offline media it creates. This would be 'slip-streaming' but all the Media Creation Tool does is make the DVD/USB media bootable for the offline Windows 10 ISO file.
[ "math.stackexchange", "0001865378.txt" ]
Q: Clarify and justify how get the derivative of the Laplace transform of the Buchstab function I would like to justify that the derivative with respect to $s$ of the Laplace transform of the Buchstab function is $$\int_1^\infty u\omega(u)e^{-su}du=\frac{e^{-s}}{s}\exp\left(\int_0^\infty \frac{e^{-t}}{t}dt\right)$$ for $s>0$. Question. Was my deduction right? Please can you justify it rigorously? Thanks in advance. You can take the definiton of Buchstab function, and its Laplace transform from Tao What's new? I say Exercise 28 of 254A, Supplement 4: Probabilistic models and heuristics for primes, and take required theorems from Wikipedia Differentiation under the integral sign. I¡ve computed the derivative $$\frac{d}{ds}\int_0^\infty \frac{e^{-t}}{t}dt$$ with Wolfram Alpha because I had doubts of how work with the upper limit, since there is infinite (also with calculus, I say the rule chain, and LHS by other theorem). I need these calculations since I would like to study more calculations for this function, like to try the integration by parts (notice that it is possible a simplification if one uses the related differential equation). Then can you help to justify the right statement, I say both sides of previous derivative of the Laplace transform of this special function with respect $s$. Also if you want clarify, if in LHS the interval of integration is $\int_0^\infty$ or $\int_1^\infty$ A: The Laplace transform that you are looking for is given, of course, by the formula $$\mathcal L (\omega) (s) = \int \limits _0 ^\infty \omega (u) \ \Bbb e ^{-su} \ \Bbb d u .$$ The problem is that the definition of Buchstab's function (the series in Tao's Ex. 28.i) is almost useless for computations. Fortunately, there comes Ex. 28.iii which gives the following formula: $$u \omega (u) = 1_{(1,\infty)} (u) + \int \limits _0 ^u 1_{(1,\infty)} (t) \ \omega (u-t) \ \Bbb d t .$$ We have, therefore, to produce an $u \omega (u)$ inside Laplace's transform, and the obvious way to to this is to derive with respect to $s$: $$\mathcal L (\omega) ' (s) = \int \limits _0 ^\infty -u \omega (u) \ \Bbb e ^{-su} \ \Bbb d u = - \int \limits _0 ^\infty \left( 1_{(1,\infty)} (u) + \int \limits _0 ^u 1_{(1,\infty)} (t) \ \omega (u-t) \ \Bbb d t \right) \ \Bbb e ^{-su} \ \Bbb d u = \\ - \int \limits _1 ^\infty \Bbb e ^{-su} \ \Bbb d u - \int \limits _0 ^\infty \left( \int \limits _0 ^u 1_{(1,\infty)} (t) \ \omega (u-t) \ \Bbb d t \right) \ \Bbb e ^{-su} \ \Bbb d u = \\ - \frac {\Bbb e ^{-s}} s - \int \limits _1 ^\infty \left( \int \limits _1 ^u \omega (u-t) \ \Bbb d t \right) \ \Bbb e ^{-su} \ \Bbb d u = - \frac {\Bbb e ^{-s}} s - \int \limits _1 ^\infty \left( \int \limits _t ^\infty \omega (u-t) \ \Bbb d u \right) \ \Bbb e ^{-su} \ \Bbb d t = \\ - \frac {\Bbb e ^{-s}} s - \int \limits _1 ^\infty \left( \int \limits _0 ^\infty \omega (v) \ \Bbb d v \right) \ \Bbb e ^{-s(t+v)} \ \Bbb d t = - \frac {\Bbb e ^{-s}} s - \int \limits _1 ^\infty \Bbb e ^{-st} \ \Bbb d t \ \mathcal L (\omega) (s) = \\ - \frac {\Bbb e ^{-s}} s \big( \mathcal L (\omega) (s) + 1 \big) .$$ This is an elementary differential equation which can be rewritten as $$\frac {\mathcal L (\omega) ' (s)} {\mathcal L (\omega) (s) + 1} = - \frac {\Bbb e ^{-s}} s ,$$ whence it follows that, for arbitrary but fixed $\sigma > 0$, $$\ln \big( \mathcal L (\omega) (s) + 1 \big) - \ln \big( \mathcal L (\omega) (\sigma) + 1 \big) = - \int \limits _\sigma ^s \frac {\Bbb e ^{-t}} t \ \Bbb d t $$ so finally, after exponentiating and rearranging a bit, $$\mathcal L (\omega) (s) = \exp \left( - \int \limits _\sigma ^s \frac {\Bbb e ^{-t}} t \ \Bbb d t \right) \big( \mathcal L (\omega) (\sigma) + 1 \big) - 1 .$$ It is now easy to derive with respect to $s$ and get $$\mathcal L (\omega) ' (s) = - \frac {\Bbb e ^{-s}} s \ \exp \left( - \int \limits _\sigma ^s \frac {\Bbb e ^{-t}} t \ \Bbb d t \right) \big( \mathcal L (\omega) (\sigma) + 1 \big) .$$ Your own result is very close to being correct, having the following errors: the minus sign missing from the fraction (both inside and outside the exponential) the endpoints of your integral in the RHS are $0$ and $\infty$; $0$ clearly cannot be, because $\frac 1 s$ is not integrable close to $s=0$ (the numerator $\Bbb e ^{-s}$ not raising any problem) the factor $\mathcal L (\omega) (\sigma) + 1$ has to be there, playing the role of the initial condition for that differential equation; unfortunately, with $\omega$ being so ugly, there is no obvious $\sigma$ for which $\mathcal L (\omega) (\sigma)$ could have a simple value, therefore we have to leave it there.
[ "stackoverflow", "0019225617.txt" ]
Q: Customizing Back Stack in Android Activities Consider there is one activity, named Activity S. Then there will be many activities, say 10 activities, named A, B, C, ..., J. How can I achieve this: From those A--J activities, when the back button is pressed, always go back to activity S. Regardless of the ordering or how the activities are created. For example: Starting from S, go to B, then D, then G. In activity G, press back button, and will go back to S. == EDIT == Should I use Activity.finish() method when leaving all A--J activities ? A: You could accomplish this in different ways depending on the exact result you desire. You could add the following line to your <activity> tags in your manifest.xml for those Activities android:noHistory="true" or use an Intent flag when overrdiing onBackPressed() in each @Override public void onBackPressed() { Intent i = new Intent(CurrentActivity.this, S.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);` startActivity(i); super.onBackPressed(); } this will clear the other Activities from the stack and return you to S. If you want to keep the Activities on the stack while returning to S then you can change the flag used @Override public void onBackPressed() { Intent i = new Intent(CurrentActivity.this, S.class); i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);` startActivity(i); super.onBackPressed(); } The last way will bring S to the front and keep the other Activities on the stack which I don't think is what you want but just another option. You will probably want one of the first two ways.
[ "stackoverflow", "0038078405.txt" ]
Q: What is the effect of setting meta viewport tag with `height=device-height`? I understand that the default behavior of iOS regarding device-width might be to try to render websites using a viewport width of 980px, and setting width=device-width might be useful (particularly if you are developping a Cordova/mobileApp/SPA. However I'm not sure to understand when should we set height=device-height. Does adding this line have any effect? Isn't it the default behavior to use the device height as the viewport height? I have a mobile app, that is available both as a mobile website and a cordova native app. There are 2 separate index.html pages with different settings (legacy): // Mobile website has: // Cordova has: I'd like to know the risks I encounter of using the same content value for both cases (which seems like it's mostly arround device-height) I didn't find the online documentation to be really helpful on that subject. Any idea? A: The online documentation you linked does point to the specs: https://drafts.csswg.org/css-device-adapt/#width-and-height-properties device-width and device-height translate to 100vw and 100vh respectively
[ "stackoverflow", "0046608069.txt" ]
Q: About malloc() and globals variables I'm wondering what this code sample means. And how can I be sure my structure called "my_struct" can be safely allocated in memory ? Thanks for your help. MyStructType_t my_struct; int main(void) { MyStructType_t *p; p = malloc (sizeof(MyStructType_t )); my_struct= *p; [...] } I try this code (because compiler doesn't warn me) and even if it makes no sense it seems to solve my issue which is I have some fields of my_struct that are erased with no reason as I try to explain. int main(void) { // my main struct have many fields which are initialized my_struct.flag1 = 1; my_struct.flag2 = 2; memset(my_struct.buffer, 0, 10); [..] } void timer_callback( void ) { // Here i try to parse my buffer to get data from UART if(my_struct.buffer[0] == 2) { // we are ok // Then I exectute random code to write in eeprom values from the buffer EEPROM_write(buffer[1]); ... // If I check the value of flag1, the value has changed to 0. [...] } } A: The first line declares the variable my_struct in the static storage. The first two lines of main declare a pointer and allocates memory for it in the dynamic storage. The third line copies the content of the memory allocated in the first two line of main (in dynamic storage) to the memory allocated in the first line (in static storage). The content itself is unknown and is garbage, so this code is meaningless. It will work, but nothing meaningful will be in my_struct when it's done.
[ "stackoverflow", "0022401979.txt" ]
Q: Crystal Reports Cross-Tab Column Totals as Variables I have a report within Crystal 2008 that has 2 subreports, each of which is a Crosstab. I have split them into different reports as their selection and database queries are unrelated. What i need to be able to to is to create a variable for each of the Column Totals and be able to pass this onto a third report for each of the two cross Tabs. The Layout of each cross tab is formatted the same, with the columns being the PO Number and the rows being charges against each PO. It is the total of the columns that I need to perform a further calculation on. Total of Crosstab1 Column1 - Total of Crosstab2 Column1 for each column that is displayed by the selection query to give me a difference between the two crosstabs. I have tried using the CurrentFieldValue but this only appears to set the total of the very last record to the variable. I hope that there is a way to do this and that i have provided enough information for you to be able to assist me. A: I think its hard to get the value from crosstab but one workaround would be. Create a shared variable in both subreports and assign the summary value to the shared variable. Suppose cross tab is showing employee salary sum then in the formula assign the value to the shared variable as Shared Numbervar report1; report1:=Sum(employee.salary) similarly do in the second subreport aswell. Now in main report create a formula Shared NumberVar report1; Shared NumberVar report2; report1+report2; let me know how it goes.
[ "stackoverflow", "0015169432.txt" ]
Q: Elapsed time between I’m being sent two datetime strings. $StartDateTime = '2012-12-25T23:00:43.29'; $EndDateTime = '2012-12-26T06:50:43.29'; I need to perform a timediff to yield elapsed time as well as assign the date component to one column and time component to another column. What I am doing is this: $d1 = new DateTime(); $d2 = new DateTime(); list($year,$month,$day) = explode('-',mb_strstr($StartDateTime,'T', TRUE)); list($hour,$minute,$second) = explode(':',trim(mb_strstr($StartDateTime,'T', FALSE),'T')); $d1->setDate($year,$month,$day); $d1->setTime($hour,$minute,$second); list($year,$month,$day) = explode('-',mb_strstr($EndDateTime,'T', TRUE)); list($hour,$minute,$second) = explode(':',trim(mb_strstr($EndDateTime,'T', FALSE),'T')); $d2->setDate($year,$month,$day); $d2->setTime($hour,$minute,$second); $diff = $d1->diff($d2); Now, I can get $diff in whatever formats I want with: $thisformat = $diff->format('%H:%I:%S'); $thatformat = $diff->format('%H%I%S'); And, I could get the separate DATE and TIME components into their respective object properties (both string) with: $somedateproperty = $d1->format('Y-m-d'); $sometimeproperty = $d1->format('H:i:s'); $anotherdateproperty = $d2->format('Y-m-d'); $anothertimeproperty = $d2->format('H:i:s'); Keep thinking there should be something easier to convert those strings rather than all that parsing every time. And, that is my question. How could I do this more easily? A: Using DateTime::createFromFormat as suggested by jeroen makes it very simple:- $StartDateTime = \DateTime::createFromFormat("Y-m-d\TH:i:s.u", '2012-12-25T23:00:43.29'); $EndDateTime = \DateTime::createFromFormat("Y-m-d\TH:i:s.u", '2012-12-26T06:50:43.29'); var_dump($StartDateTime->diff($EndDateTime)); Gives the following output:- object(DateInterval)[3] public 'y' => int 0 public 'm' => int 0 public 'd' => int 0 public 'h' => int 7 public 'i' => int 50 public 's' => int 0 public 'invert' => int 0 public 'days' => int 0
[ "stackoverflow", "0003908904.txt" ]
Q: Turkish character problem in select query - SQL Server SELECT [ID] ,[Name] ,[Markup] ,[Status] FROM [dbxyz].[dbo].[Block] WHERE Name = 'Hakkımızda' Linq2Sql sends this query to SQL Server 2005 but because of the character problem (ı) it does not get the right dataset as a response. No rows returns. I can not change the collation of database because it is a hosted service and I have no right to do so. I tried to change collation in column level but it did not work. What can I do? Thanks A: Is the column Block in the database declared with the proper collation? Introduce the Turkish I issue. Note that the collation must be declared even for Unicode Nchars.
[ "askubuntu", "0000691455.txt" ]
Q: How to install latest Spotify testing version? The stable Spotify client on Linux has not been updated for a while. Is there a way to install the latest (testing) version which includes some new features ? A: Do not forget that this is a testing version, you may encounter bugs that do not occur in the stable version ! Use the testing PPA of Spotify (source and release notes): sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D2C19886 echo deb http://repository.spotify.com testing non-free | sudo tee /etc/apt/sources.list.d/spotify.list sudo apt-get update sudo apt-get install spotify-client Note : This version includes the libgcrypt11 libraries which are missing in Ubuntu 15.04 & 15.10 and prevent Spotify to launch.
[ "stackoverflow", "0001689326.txt" ]
Q: How to inflate core/res/res/layout/simple_dropdown_item_2line.xml There is this xml file under frameworks/base. /frameworks/base/core/res/res/layout/simple_dropdown_item_2line.xml How can I inflate that in my own android application? Thank you. A: View view = activity.getLayoutInflater().inflate( android.R.layout.layout.simple_dropdown_item_2line, null); If you are doing this inside Activity code you can use this instead of activity which implies that you set the variable somewhere
[ "stackoverflow", "0001100523.txt" ]
Q: Portable PostgreSQL for development off a usb drive In order to take some development work home I have to be able to run a PostgreSQL database. I don't want to install anything on the machine at home. Everything should run off the usb drive. What development tools do you carry on your USB drive? That question covers pretty much everything else, but I have yet to find a guide to getting postgresql portable. It doesn't seem easy if it's even possible. So how do I get PostgreSQL portable? Is it even possible? EDIT: PostgreSQL Portable works. It's very slow on the usb-drive I have, but it works. I can't recommend doing constant development with it but for what I need it's great. Perhaps if I pick up a full speed external drive I'll try out virtualization. Given the poor performance of just running the database off this drive, a full virtual OS running off of it would be unusable. A: Here's how you can do this on your own: http://www.postgresonline.com/journal/archives/172-Starting-PostgreSQL-in-windows-without-install.html A: An alternate route would be to use something like VirtualBox and just install your development environment (database, whatever) on there. A: There are 2 projects to try in 2014: http://sourceforge.net/projects/pgsqlportable/ and http://sourceforge.net/projects/postgresqlportable/?source=recommended. I can't vouch for the second, but I'm using the first and it works right out of the box. After unzipping using 7-zip (http://www.7-zip.org/download.html): 1) Run "start service without usuario.bat" ( english translation ) 2) Then run "pgadmin3.bat" The only minimal problem for me was that its in spanish. I've been able to change the language to english by following Change language of system and error messages in PostgreSQL. Using google translate the instructions are: Description This is a zip to automatically run postgresql 9.1.0.1 for windows. This version already has pgagent and pldebugger. To run must: 1) unzip the zip 2) run the "start service without usuario.bat" found in the pgsql directory within the folder you just unzipped. 3) Optional. If you want to run the agent works postgresql (pgagent) should only run the "start pgagent.bat" found in the pgsql directory inside the folder you just unzipped. 4) Optional. To manage and / or develop the bd you can run the pgadmin3.bat 5 files) Optional. To stop and / or restart the server correctly use file "service without stopping usuario.bat" usuario.bat or restart service without depending on the case. Now option for Linux (file. Tar.gz). Postgresql portable Linux 9.2 Please use the tickets for your answer bugs. Username: postgres Password: 123 Just a Note : on a new computer , to get pgadminIII working you may need to add a db. The settings are in attached screenshot. Hope it helps.
[ "stackoverflow", "0036944056.txt" ]
Q: excel - how to fill column b with values if value of column a is the same I need some help populating Column M with the existing value on the blank rows while Column L is the same. Any help would be greatly appreciated. I am not too familiar with excel. please see image attached. please click here to see image attached. A: Use a helper column. In C1 put: =INDEX($B$1:$B$8,MATCH(1,INDEX(($A$1:$A$8=A1)*($B$1:$B$8<>""),),0)) Then copy down. Then you can copy and paste the value back into B.
[ "stackoverflow", "0044187315.txt" ]
Q: Add css class to dropdown menu on menu item click I have bootstrap 3 menu. And I want to add class to "dropdown" menu if usre click on "caret" ( parent menu item ) <ul id="menu-testing-menu" class="nav navbar-nav sf-js-enabled" style="touch-action: pan-y;"> <li class="menu-item menu-item-has-children dropdown"> <a class="sf-with-ul" data-toggle="dropdown">Home<span class="caret"></span></a> <ul class="dropdown-menu" style="display: none;"> <li class="menu-item"> <a href="#">Lorem Ipdum</a> </li> <li class="menu-item"> <a href="#">Lorem Ipdum</a> </li> <li class="menu-item"> <a href="#">Lorem Ipdum</a> </li> </ul> </li> </ul> So I try to use js $('#menu-testing-menu li a .caret').click(function(e){ e.preventDefault(); $(this).find('.dropdown-menu').toggleClass('dd-menu-show'); }); but it doesn't work. How to solve thise problem? A: $(this).find('.dropdown-menu') is not possible when clicking .caret because $(this) is looking inside the current element and it is empty. You might also want to consider adding the click event to the entire <a>. Try this $('#menu-testing-menu li a .caret').click(function(e){ e.preventDefault(); var parent = $(this).closest('.dropdown'); parent.find('.dropdown-menu').toggleClass('dd-menu-show'); });
[ "stackoverflow", "0026498306.txt" ]
Q: td valign="top" not working - CSS overriding somewhere ANSWERED! I have some css overriding my tables but I don't know how to find it. I simply need images in my table to be at the top of the table. I use the code: <td valign="top"><img src="../../../images/site/orangeBanner.png" alt="" width="259" height="62" class="imagePic"/></td> But it does not work and produces this image of the orange bar in the middle. It should be at the top at the same height as "INSPIRE". Here is the link to my full code: FULL CODE Can anyone see why my valign="top" is not working? Is there anything to override the css? A: Your td originally has vertical-align: middle specified inside the CSS. You can override it by using style="vertical-align: top;" inline inside the <td> tag containing your image. This should work perfectly: <td valign="top" style="vertical-align: top;"><img src="../../../images/site/orangeBanner.png" alt="" width="259" height="62" class="imagePic"/></td>
[ "stats.stackexchange", "0000390652.txt" ]
Q: $\pi(\beta,\sigma^2)l(\beta,\sigma^2\vert Y)\iff\pi(\sigma^2\vert Y)\pi(\beta\vert\sigma^2, Y)?$ How do you pass from $$\pi(\beta,\sigma^2\vert Y)\propto\pi(\beta,\sigma^2)l(\beta,\sigma^2\vert Y)$$ to $$\pi(\beta,\sigma^2\vert Y)\propto\pi(\sigma^2\vert Y)\pi(\beta\vert\sigma^2, Y)$$ ? I know one needs to use the multiplicative law of probability: $P(A\cap B)=P(B\vert A)P(A)$ I tried to apply to the prior $P(\beta,\sigma^2)=P(\sigma^2\vert\beta)P(\beta)$ though does not looks too much like $\pi(\sigma^2\vert Y)\pi(\beta\vert\sigma^2, Y)$ A: There is no benefit in trying to pass through the first equation. Proceeding directly using the rules of conditional probability gives you: $$\begin{equation} \begin{aligned} \pi(\beta,\sigma^2\vert Y) &= \frac{p(\beta,\sigma^2, Y)}{p(Y)} \\[6pt] &= \pi(\beta|\sigma^2, Y) \cdot \frac{p(\sigma^2, Y)}{p(Y)} \\[6pt] &= \pi(\beta|\sigma^2, Y) \cdot \pi(\sigma^2 \vert Y) \\[6pt] \end{aligned} \end{equation}$$ Note that this result does not depend on any prior assumptions - it is a direct consequence of the rules of conditional probability.
[ "judaism.stackexchange", "0000018738.txt" ]
Q: When can you turn a dispute into a safek? In this answer, I proposed that since there is a machlokes rishonim on a certain issue, it counts as a safek (doubt), although the Shulchan Aruch rules strictly. DoubleAA commented, saying that he didn't believe that every machlokes rishonim is a safek. I gave an example where a machlokes rishonim counts as a safek even though the Shulchan Aruch rules otherwise. DoubleAA gave other examples to the contrary. My question is when you can say that a machlokes counts as a safek. (I thought I had asked this in June, but apparently I forgot.) A: It seems to me that a disagreement among rabbis can very well acquire the status of a safek. The Gemara in Avodah Zarah (7a) says: היו שנים אחד מטמא ואחד מטהר אחד אוסר ואחד מתיר אם היה אחד מהם גדול מחבירו בחכמה ובמנין הלך אחריו ואם לאו הלך אחר המחמיר ר' יהושע בן קרחה אומר בשל תורה הלך אחר המחמיר בשל סופרים הלך אחר המיקל א"ר יוסף הלכתא כרבי יהושע בן קרחה If there are two sages present and one declares unclean and the other clean; one forbids and the other permits; if one of them is superior to the other in wisdom and in numbers, his opinion should be followed. Otherwise, the one holding the stricter view should be followed. R. Joshua ben Korcha says: In laws of the Torah, follow the stricter view. In those of the rabbis, follow the more lenient view. Said R. Joseph, the Halacha is according to R. Joshua ben Korcha. The Rambam (Mamrim 1:5) rules this way as well, and incidentally this is the same way we rule on every matter of safek; i.e. in questions of biblical law we are strict and in questions of rabbinic law we are lenient. To me, the simplest explanation is that these two rulings are one and the same, for every matter of doubt based on conflicting opinions is actually a safek. However, there are certain considerations one needs to take into account. Most basically, everyone has the right to an educated opinion. If someone is confident about their opinion and has the requisite knowledge to be this confident then it is certainly not Halachically considered a safek to them, regardless of who disagrees, as long as this opinion works within the Halachic system. For this reason the Rambam (ibid) qualifies the above ruling by saying it only applies "when you do not know which way the law leans." This is why the Shulchan Aruch will often rule in accordance with one opinion and not the other without mentioning that it is a matter of doubt, because to him it simply wasn’t. He ruled that way because in his opinion that view carried more weight logically. A spinoff of this consideration is the fact that everyone has the right to have a specific rabbi one always follows when one does not know the Halacha. The Gemara’s ruling is only to prevent picking and choosing in a Halachically arbitrary fashion, but one who says “I always follow Rabbi X” can follow him even when he is a lenient minority and it is a question of biblical law. As the Gemara itself (Eruvin 6b) says: והרוצה לעשות כדברי בית שמאי עושה, כדברי בית הלל עושה, מקולי ב"ש ומקולי ב"ה רשע, מחומרי ב"ש ומחומרי ב"ה עליו הכתוב אומר (קהלת ב:יד) הכסיל בחשך הולך, אלא אי כב"ש כקוליהון וכחומריהון, אי כב"ה כקוליהון וכחומריהון One who wishes to follow the words of the House of Shammai may do so. The words of the House of Hillel; may do so. The leniencies of the House of Shammai and the leniencies of the House of Hillel; is wicked. The stringencies of the House of Shammai and the stringencies of the House of Hillel; upon him Scripture (Ecc. 2:14) says “the fool walks in darkness.” Rather either the House of Shammai with their leniencies and their stringencies, or the House of Hillel with their leniencies and their stringencies. As the Gemara elaborates, the specific application mentioned in the passage does not apply anymore; for reasons not relevant to this discussion. The point is that one does have the right to choose an opinion even though one is not sufficiently educated and knowledgeable to have one, as long as one always follows the opinions of this individual and is therefore not acting recklessly and wickedly. On this authority we can theoretically follow the decisions of the Shulchan Aruch even when we do not feel confident enough deciding ourselves which of the Rishonim got it right. The idea is, simply put: the Shulchan Aruch is our rabbi. When we don’t know, we always follow him. Or the Rema. Or the Aruch HaShulchan. Or the Mishna Berura. This can apply to anyone, and is really the concept known as posek acharon, final Halachic authority. It isn’t that we truly believe that any particular person has the final word, but there are certain people we hang our hats on, so to speak, in all cases where we aren’t confident to have our own opinion. Doing so is of great benefit to us for this very reason – it takes care of a lot of doubts and precludes them from acquiring safek status. In summary: Every disagreement is potentially a safek, but in actuality if one has a confident, educated opinion, or if one consistently relies on someone else who has a confident, educated opinion, then said opinion does not have the status of safek at all (unless one has an educated, reasonable doubt about the particular opinion that is not simply translated as "but someone else said...").
[ "stackoverflow", "0034699368.txt" ]
Q: function not detecting variable I currently have an index.php file and on the top i have $pagetitle == "home"; function isThisHome(){ if($pagetitle == "home"){ $output = $output . 'this is home!'; }else{ $output = $output . 'this is not home!'; } return $output; } echo isThisHome(); I'd expect that it would echo "this is home!" but instead it's echoing "this is not home!". Can someone help correct me to make it say "this is home"? A: To access variables outside the scope of a function, you need to qualify the global variable with global qualifier inside the function. Also the assignment operator is ASSIGN (=), so IS_EQUAL (==) is not the same. $pagetitle = "home"; function isThisHome(){ global $pagetitle; if($pagetitle == "home"){ $output = $output . 'this is home!'; } else{ $output = $output . 'this is not home!'; } return $output; } echo isThisHome();
[ "stackoverflow", "0042790362.txt" ]
Q: How to handle long SQL query in Flask? I have a Flask web app that might need to execute some heavy SQL queries via Sqlalchemy given user input. I would like to set a timeout for the query, let's say 20 seconds so if a query takes more than 20 seconds, the server will display an error message to user so they can try again later or with smaller inputs. I have tried with both multiprocessing and threading modules, both with the Flask development server and Gunicorn without success: the server keeps blocking and no error message is returned. You'll find below an excerpt of the code. How do you handle slow SQL query in Flask in a user friendly way? Thanks. from multiprocessing import Process @app.route("/long_query") def long_query(): query = db.session(User) def run_query(): nonlocal query query = query.all() p = Process(target=run_query) p.start() p.join(20) # timeout of 20 seconds if p.is_alive(): p.terminate() return render_template("error.html", message="please try with smaller input") return render_template("result.html", data=query) A: I would recommend using Celery or something similar (people use python-rq for simple workflows). Take a look at Flask documentation regarding Celery: http://flask.pocoo.org/docs/0.12/patterns/celery/ As for dealing with the results of a long-running query: you can create an endpoint for requesting task results and have client application periodically checking this endpoint until the results are available. A: As leovp mentioned Celery is the way to go if you are working on a long-term project. However, if you are working on a small project where you want something easy to setup, I would suggest going with RQ and it's flask plugin. Also think very seriously about terminating processes while they are querying the database, since they might not be able to clean up after themselves (e.g. releasing locks they have on the db) Well if you really want to terminate queries on a timeout, I would suggest you use a database that supports it (PostgreSQL is one). I will assume you use PostgreSQL for this section. from sqlalchemy.interfaces import ConnectionProxy class ConnectionProxyWithTimeouts(ConnectionProxy): def cursor_execute(self, execute, cursor, statement, parameters, context, executemany): timeout = context.execution_options.get('timeout', None) if timeout: c = cursor._parent.cursor() c.execute('SET statement_timeout TO %d;' % int(timeout * 1000)) c.close() ret = execute(cursor, statement, parameters, context) c = cursor._parent.cursor() c.execute('SET statement_timeout TO 0') c.close() return ret else: return execute(cursor, statement, parameters, context) Then when you created an engine you would your own connection proxy engine = create_engine(URL, proxy=TimeOutProxy(), pool_size=1, max_overflow=0) And you could query then like this User.query.execution_options(timeout=20).all() If you want to use the code above, use it only as a base for your own implementation, since I am not 100% sure it's bug free.
[ "stackoverflow", "0030964279.txt" ]
Q: how to install shelled in eclipse luna I am trying to install shelled in the latest Eclipse Luna and I am getting the following error: An error occurred while collecting items to be installed session context was:(profile=epp.package.cpp, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). No repository found containing: osgi.bundle,org.eclipse.egit,3.7.1.201504261725-r No repository found containing: osgi.bundle,org.eclipse.egit.core,3.7.1.201504261725-r No repository found containing: osgi.bundle,org.eclipse.egit.doc,3.7.1.201504261725-r No repository found containing: osgi.bundle,org.eclipse.egit.ui,3.7.1.201504261725-r No repository found containing: osgi.bundle,org.eclipse.jgit,3.7.1.201504261725-r No repository found containing: osgi.bundle,org.eclipse.jgit.archive,3.7.1.201504261725-r No repository found containing: org.eclipse.update.feature,org.eclipse.egit,3.7.1.201504261725-r No repository found containing: org.eclipse.update.feature,org.eclipse.jgit,3.7.1.201504261725-r No repository found containing: osgi.bundle,org.eclipse.jgit.java7,3.7.1.201504261725-r No repository found containing: org.eclipse.update.feature,org.eclipse.jgit.java7,3.7.1.201504261725-r No repository found containing: osgi.bundle,org.slf4j.impl.log4j12,1.7.2.v20131105-2200 I have tried to install it locally from archive and also Bash script plugin for Eclipse?, but and all of this failed. Any ideas? A: Finally I managed to install it by deleting eclipse luna and downloading it again from scratch... I still don't understand why I got the errors in my old eclipse... It is rather annoying since I had a lot of plugins installed in my old eclipse and I had to re-install them all over again (this time I installed shelled first to eliminate the possibility that one of the plugins interfering with shelled installation...). Looks like a bug in eclipse (or one of its plugins) to me.
[ "stackoverflow", "0025899632.txt" ]
Q: Spring Bean object marshaling depends on the order given in the XML? I have a simple example program here: package com.test; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.support.FileSystemXmlApplicationContext; public class Main { public static void main(String[] args) throws InterruptedException { try { FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext("TestBeanFile.xml"); Object o = context.getBean("AInstance"); } catch (Throwable e) { e.printStackTrace(); } Thread.sleep(Long.MAX_VALUE); } private static class A implements InitializingBean { private B myB; public A() { System.out.println("A constructor"); } public void setB(B aB) { myB = aB; } @Override public void afterPropertiesSet() throws Exception { System.out.println("A aps"); } } private static class B implements Runnable, InitializingBean { private C myC; private volatile boolean exit = false; public B() { System.out.println("B constructor"); } public void setC(C aC) { myC = aC; } @Override public void afterPropertiesSet() throws Exception { System.out.println("B aps"); if (myC == null) throw new IllegalArgumentException("C cannot be null"); new Thread(this).start(); } public void exit() { exit = true; } @Override public void run() { while (!exit) { System.out.println(myC.getValue()); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } private static class C implements InitializingBean { private String value = "C's value"; public C() { System.out.println("C constructor"); } public String getValue() { return value; } @Override public void afterPropertiesSet() throws Exception { System.out.println("C aps"); } } } And here is a simple XML to bean load them which intentionally has an incorrect fully qualified name to the A class. This should mean that C B and A dont get constructed. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-stream="http://www.springframework.org/schema/integration/stream" xmlns:int-ip="http://www.springframework.org/schema/integration/ip" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.1.xsd http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.1.xsd http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip-2.1.xsd"> <bean id="CInstance" class = "com.test.Main.C" /> <bean id="BInstance" class = "com.test.Main.B"> <property name="C" ref="CInstance" /> </bean> <bean id="AInstance" class = "com.test.Main.A1"> <property name="B" ref="BInstance"/> </bean> </beans> When you run this application using the above XML C and B DO get constructed but A doesnt. It will produce the following output (omitting the stack trace when the exception is thrown, but I assure you A does not get constructed): C constructor C aps B constructor B aps C's value C's value C's value ....... // one a second If you modify the XML to look like this: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-stream="http://www.springframework.org/schema/integration/stream" xmlns:int-ip="http://www.springframework.org/schema/integration/ip" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.1.xsd http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.1.xsd http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip-2.1.xsd"> <bean id="AInstance" class = "com.test.Main.A1"> <property name="B" ref="BInstance"/> </bean> <bean id="BInstance" class = "com.test.Main.B"> <property name="C" ref="CInstance" /> </bean> <bean id="CInstance" class = "com.test.Main.C" /> </beans> The only output you get is the stack trace, and the B and C objects dont get constructed at all. This seems like its a bug in spring. I dont understand why the marshaling of the objects, and the constructors / afterpropertiesSet methods which are run depend on the order of their appearance in the XML. What this means for me, is that when I have classes which construct threads in their constructors / after properties set methods, if I'm not careful about how I order the elements in the XML I can end up leaking resources if my only reference to them is, in this example, the A class. Because it fails construction in both cases. So, is this a bug, or is this some feature that I dont understand? If this is a feature, what reason would they have to make the order of marshaling dependent on the XML file, instead of the object graph of the bean definitions? A: Spring first reads the <bean> and other elements in the XML configuration and creates appropriate BeanDefinition objects defining them. It then has to initialize them. To do this, it has to decide on an order. The order of initialization is undefined, unless a bean depends on another or there is a mix of @Order, implementations of Ordered and a few others (depends on the case). In your first example, CInstance is initialized first. Then BInstance is initialized. Part of its initialization involves invoking its afterPropertiesSet() method which launches a non-daemon thread. Then Spring attempts to initialize AInstance and fails. In your second example, Spring attempts to initialize AInstance first. It fails immediately, with no change to start a second thread. Note that in a declaration like <bean id="AInstance" class="com.example.Spring.A1"> <property name="B" ref="BInstance" /> </bean> although AInstance depends on BInstance, the actual instance needs to be initialized before any property setters can be invoked to assign BInstance to B. So Spring begins the initialization of AInstance by instantiating the class. If it fails, the entirety of context refresh fails. If it passes, it will then initialize the BInstance bean and use it to set the B property.
[ "stackoverflow", "0004406206.txt" ]
Q: How to swap position of HTML tags? If I have the HTML: <div id="divOne">Hello</div> <div id="divTwo">World</div> Is it possible with CSS/JS/jQuery to swap it around so the contents of divTwo appears in the position of divOne and vice-versa ? I'm just looking to change the position of each div, so I don't want any solution that involves setting/swapping the HTML of each. The idea is to let a user customise the order content appears on the page. Is what I'm trying to do a good way of going about that, or is there a better way of achieving it ? A: You'll be relieved to know it's not hard at all using jQuery. $("#divOne").before($("#divTwo")); Edit: If you're talking about implementing drag-and-drop functionality for ordering the divs, take a look at jQuery UI's sortable plugin... http://jqueryui.com/demos/sortable/
[ "unix.stackexchange", "0000290149.txt" ]
Q: linux + dose each security kernel rpm will install the relevant initrd and vmlinuz files under /boot I just print the kernel rpms that need to install on my redhat machine (version 6.5) # yum list-security --security | grep kernel-[0-9] RHSA-2014:1143 security kernel-2.6.18-371.12.1.el5.x86_64 RHSA-2014:1959 security kernel-2.6.18-400.el5.x86_64 RHSA-2014:2008 security kernel-2.6.18-400.1.1.el5.x86_64 RHSA-2015:0164 security kernel-2.6.18-402.el5.x86_64 RHSA-2015:0783 security kernel-2.6.18-404.el5.x86_64 RHSA-2015:1042 security kernel-2.6.18-406.el5.x86_64 RHSA-2016:0045 security kernel-2.6.18-408.el5.x86_64 RHSA-2016:0450 security kernel-2.6.18-409.el5.x86_64 in case I want to install all security kernel rpms ( as displayed ) is that mean that all 8 initrd & vmlinuz kernels files will be installed under /boot ? I am asking this question because I have small free available size on /boot remark - the yum command that installed all the security packages is: yum -y update --security example what I have now under /boot: # ls /boot System.map-2.6.18-371.11.1.el5 grub lost+found vmlinuz-2.6.18-371.11.1.el5 config-2.6.18-371.11.1.el5 initrd-2.6.18-371.11.1.el5.img symvers- 2.6.18-371.11.1.el5.gz A: in case I want to install all security kernel rpms ( as displayed ) is that mean that all 8 initrd & vmlinuz kernels files will be installed under /boot ? I am asking this question because I have small free available size on /boot Basically yum would only install the latest kernel security update, as there's no point in installing older updates. And depending what you have configued for installonlypkgs and installonly_limit options in /etc/yum.conf it will only install the new kernel, then remove the old kernel package. Although the default is to keep the newest 3 kernels, if I remember correctly.
[ "stackoverflow", "0004110855.txt" ]
Q: Java SOAP proxy initialization exception I am deploying a set of Java-based AMF web services to GlassFish v3. This all works fine in the development environment, but fails in the staging environment where it is currently being setup: Dev: GlassFish 3.0.1 Web Profile, Java JDK 1.6.0u22. Staging: GlassFish 3.0, Java JDK 1.6.0u22. I realize the GlassFish version and edition is different, and I have requested it to be updated to match the development environment. Because I have a hard time imagining this to be the cause of the problem though, I thought I'd ask here if anyone had any ideas. The Java-based AMF service interacts with a .NET-based SOAP service. The Java-service has proxies generated off the SOAP service using wsimport. The error occurs when trying to initialize the SOAP proxy as far as I can tell. The stack trace is as follows: org.granite.messaging.service.ServiceException: Could not initialize class com.sun.xml.internal.ws.spi.ProviderImpl at org.granite.messaging.service.AbstractServiceExceptionHandler.getServiceException(AbstractServiceExceptionHandler.java:42) at org.granite.messaging.service.DefaultServiceExceptionHandler.handle(DefaultServiceExceptionHandler.java:33) at org.granite.messaging.service.ServiceInvoker.invoke(ServiceInvoker.java:121) at org.granite.messaging.amf.process.AMF3RemotingMessageProcessor.process(AMF3RemotingMessageProcessor.java:56) at org.granite.messaging.amf.process.AMF0MessageProcessor.process(AMF0MessageProcessor.java:79) at org.granite.messaging.webapp.AMFMessageServlet.doPost(AMFMessageServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) [..cut..] Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.internal.ws.spi.ProviderImpl at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:31) at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:128) at javax.xml.ws.spi.Provider.provider(Provider.java:83) at javax.xml.ws.Service.<init>(Service.java:56) [..cut..] Any ideas? A: The solution was to install the full GlassFish Server instead of GlassFish Server Web Profile. Despite the development environment being setup with Web Profile it had remnants of the full GlassFish (specifically the JAXB and JAXWS jar files) that were being picked up there. The staging environment was clean and only ever had Web Profile installed and thus failed because of the missing dependencies.
[ "stackoverflow", "0053265020.txt" ]
Q: C# Async await deadlock problem gone in .NetCore? In .NetFramework there was a high risk of a deadlock occuring when synchronizing to the synchronization context using: var result = asyncMethod().Result; var result = asyncMethod().GetAwaiter().GetResult(); instead of var result = await asyncMethod(); (read Stephen Cleary blogpost for more info) Since the synchronization context has been removed in .NetCore. Does this mean that the above methods are now safe to use? A: Yes and no. It's true that there's no synchronization context in .NET Core, and thereby, one of the major sources of deadlock issues has been eliminated. However, this doesn't mean that deadlocks are totally impossible. Regardless, you should not let good programming practices slide, just because it may not be a big issue in one circumstance any more. ASP.NET Core, in particular, is fully async, so there is no reason to ever use a sync version of a method or simply block on an async task. Use await as you always would and should. A: You Can Block on Async Code - But You Shouldn’t The first and most obvious consequence is that there’s no context captured by await. This means that blocking on asynchronous code won’t cause a deadlock. You can use Task.GetAwaiter().GetResult() (or Task.Wait or Task.Result) without fear of deadlock. However, you shouldn’t. Because the moment you block on asynchronous code, you’re giving up every benefit of asynchronous code in the first place. The enhanced scalability of asynchronous handlers is nullified as soon as you block a thread. There were a couple of scenarios in (legacy) ASP.NET where blocking was unfortunately necessary: ASP.NET MVC filters and child actions. However, in ASP.NET Core, the entire pipeline is fully asynchronous; both filters and view components execute asynchronously. In conclusion, ideally you should strive to use async all the way; but if your code needs to, it can block without danger. -Extract from blogpost by Stephen Cleary Credit to GSerg for finding the post However, you might encounter thread pool starvation http://labs.criteo.com/2018/10/net-threadpool-starvation-and-how-queuing-makes-it-worse/
[ "superuser", "0001122925.txt" ]
Q: %windir% not recognized error I am trying to run the command %windir% in a command prompt, but I am getting an below error: A: %windir% is a variable and should be used in conjunction with standard commands or actions. For example CD %WINDIR% will take you to the windows directory... A: Strangely enough, no one has explained the entire story, i.e. the error. Indeed %windir% is an variable, and its contents on your system are C:\Windows. So when you 'execute' %windir% its contents are substituted and your command is C:\Windows, which, as Windows informs you is not recognized as an internal or external command, operable program or batch file. A fun experiment would be to place an executable named windows.exe in your C:\ root ;-) A: You must be used to a different shell (in particular 4DOS/4NT/TakeCommand) where a directory name is treated as a command to change to that directory. That’s not the case with CMD, and you have to use CD before it (if it is already on the same drive. I don’t know if CMD has cdd command to change drive and directory).
[ "stackoverflow", "0012670304.txt" ]
Q: ruby on rails tutorial, sign in - duplicate email control I am following ruby on rails tutorial . And I have few questions: 1.Hier it is showed that >> "a" * 51 => "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" so we try to compare if our user has a name of 51 "a"'s and not of 51 charachters by typing this code: before { @user.name = "a" * 51 } It is showed as well that ("a" * 51).length is 51. so why dont we write before { @user.name = ("a" * 51).length } It is more logical, so that the user name consist of 51 charachters and not 51 a's. 2.And as well this moment seems very strange. The explanation is as well odd. describe "when email address is already taken" do before do 1. user_with_same_email = @user.dup 2. user_with_same_email.save end it { should_not be_valid } end in 1. we duplicate our original user (for example foo=User.new(name:"Piks", email:"piks@piks.com") and put the copie of the foo in the variable user_with_same_email. in 2. we save the copie of the foo and it returns us "true", so that we have saved the copie and the original foo has the email address that already exists in the database and threfore should be invalid. But how can the original foo can be invalid it I want to save it? It is not logically at all to save the copie of the user and the original user is then invalid. I guess I misunderstand the "before block". The "before block", namely the method user_with_same_email.save should return "false". Why?Because for instance, we have our database full of emails(there are as well logins) and then I try to register myself with the email that already exists in the database. So, the system makes a copy of me and save it in the user_with_same_email and try to save it, but it cannot because another user with my email already exists in the database. So, the method user_with_same_email.save will return false and hence I am considered to be an invalid user. In this very example the "before block" should return "true" in roder to proceed to it { should_not be_valid } or am I wrong? I will appreciate if somebody helps me. Thank you A: You misunderstood the whole stuff. It is not the model code, it is a test for it. The tutorial tries to force test driven development. The idea is basically to specify statements about your system which are forced to be implemented, like "the name can't be longer than 50 character". You create a test for it where you try to break this statement, and if you can break it, then the system is faulty. Look it like this: before { @user.name = "a" * 51 } it { should_not be_valid } One test is to set the user's name to a string more than 50 character long. This is guaranteed to be that long. And it should be invalid, as it is. The test system will notify you if you forgot to add the length constraint in your model. before do 1. user_with_same_email = @user.dup 2. user_with_same_email.save end it { should_not be_valid } This is just another test. It creates a dummy user, duplicates it, and tries to save both. This should fail as well. If it fails the test is successful and it means your code is good. One more thing, you asked why not just use before { @user.name = ("a" * 51).length }. This is clearly invalid, you just try to set the user's name to be 51, a number, not a string 51 characters long.
[ "stackoverflow", "0045878957.txt" ]
Q: Running a block of code in until loop Robot Framework I have a problem in writing a loop in Robot Framework for a block of code. This code firstly check some values (Minimum and Current), then compare them, and then increase another value (Quantity) by input text. I would like this block of code to be executed UNTIL the condition that Current is greater than Minimum is fulfilled. How should I write such kind of condition? Thanks in advance. ${Minimum}= Get Table Cell xpath=... 5 3 ${Current}= Get Table Cell xpath=... 5 4 ${status} ${value}= Run Keyword And Ignore Error ... Should be true ${Current} > ${Minimum} ${quantity}= Get Value xpath= ... Run Keyword If '${status}' == 'FAIL' ... Input Text xpath=${quantity+10} A: Ok, I manage to do this with simple FOR loop and EXIT FOR LOOP in ELSE condition. : FOR ${i} IN RANGE 1 999 ${BoxesMinimum}= Get Table Cell xpath=//someid 5 3 ${BoxesCurrent}= Get Table Cell xpath=//someid 5 4 ${status} ${value}= Run Keyword and Ignore Error ... Should be true ${BoxesCurrent} > ${BoxesMinimum} ${quantity}= Get Value xpath=//someid Run Keyword If '${status}' == 'FAIL' ... Input Text xpath=//someid ${quantity+10} ... ELSE Exit for loop
[ "stackoverflow", "0009264107.txt" ]
Q: CSS3 rotation in Chrome for Linux I was trying out some CSS3 features such as rotation... I looked at some tutorial and I put together the following simple example: <html> <head> <style> .example { color: red; -webkit-transform:rotate(45deg); /* Chrome & Safari */ -moz-transform:rotate(45deg); /* Firefox */ -o-transform:rotate(45deg); /* Opera */ -ms-transform:rotate(45deg); /* IE 9+ */ filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678, sizingMethod='auto expand'); /* IE 7-8 */ } </style> </head> <body> <dic class="example">Text</div> </body> </html> That works in Firefox but not in Chrome for Linux. I couldn't test it in any other OS/browser. Where am I doing wrong? A: I believe there is no <dic> HTML element - should be <div>
[ "webmasters.stackexchange", "0000010494.txt" ]
Q: Pay for Graphic Designer vs Programmer In a corporate web-design setup, who typically makes more per hour, the graphic designer or the programmer? By graphic designer, I mean somebody who builds mockups probably in photoshop, selects font-styles, colors, etc. Most things layout-wise are near pixel-perfect, but likely after the initial implementation by the programmer, there will be a lot of small changes directed by the graphic designer. By programmer, I mean somebody who is coding the CSS, the HTML, and light backend support, probably in PHP. The programmer will attempt to duplicate the mockups given the limitations of the medium, and consult with the graphic designer afterwards on what changes are tangible and which are not. Both probably have an undergraduate degree from a respected four-year institution. A: Here's a good chart from a couple of years ago:
[ "stackoverflow", "0026351442.txt" ]
Q: Phonegap 2.1.0 to Cordova 3.5.1 loadurl not working A few weeks ago I got the email from Google advising me to upgrade me app to 3.5.1 or risk the app being taken down. My app is android specific and I'm building it in Android Studio so I've included the updated .jar file and updated the .js and all that stuff. Everything seems to be fine when navigating around my included html pages but I'm running into trouble when opening an external webpage. public class MyActivity extends CordovaActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); loadUrl(getString(R.string.indexURL)); } @Override public void init() { final String os = "Android"; final String version = getVersion(); CordovaWebView webView = new CordovaWebView(this); init(webView, new CordovaWebViewClient(this, webView) { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { super.onPageFinished(view, url); boolean redirected = false; //If the page you're accessing is the root or login page if (url.endsWith("/Login")) { //redirect to root page with query string appView.loadUrl((getString(R.string.mainURL) + "?os=" + os + "&version=" + version)); redirected = true; } return redirected; } }, new CordovaChromeClient(this, webView)); } As soon as I upgraded I commented out a few things to do with the Google analytics plugin I'm using and tested and my external urls didn't load. MyActivity was extending from DroidGap so I updated it to extend from CordovaActivity instead but same issue is applying. I can see it hitting the Url redirecting code ut it doesn't do anything afterwards. 10-14 12:28:46.166 10958-10958/com.example.Example D/CordovaWebView﹕ >>> loadUrl(https://www.MyWebsite.com.au/Login/?os=Android&version=2.0.0) 10-14 12:28:46.166 10958-10958/com.example.Example D/PluginManager﹕ init() 10-14 12:28:46.166 10958-10958/com.example.Example D/CordovaWebView﹕ >>> loadUrlNow() 10-14 12:29:06.166 10958-10958/com.example.Example E/CordovaWebView﹕ CordovaWebView: TIMEOUT ERROR! Does anything stand out as wrong? Thanks in advance. A: Issue was a combination of the config.xml being in the wrong format with <plugin> tags rather than <feature> tags. also changed if (url.endsWith("/Login")) { //redirect to root page with query string appView.loadUrl((getString(R.string.mainURL) + "?os=" + os + "&version=" + version)); redirected = true; } to if (url.endsWith("/Login")) { //redirect to root page with query string loadUrl((getString(R.string.mainURL) + "?os=" + os + "&version=" + version)); redirected = true; }
[ "stackoverflow", "0011483353.txt" ]
Q: floating a div with texts inside a parent div I have a <div> that I want to float inside a parent <div>. The parent div contains some HTML entries like texts, images, tables If I make the HTML like this then it gives the result I want <div class="parent-div"> <div class="child-div"> Child div content </div> Parent div HTML content </div> Result +---------- parent div --------------+ |Parent HTML content... +-----------+| |...................... | child div || |...................... | child div || |...................... +-----------+| |....................................| |....................................| +------------------------------------+ My problem is I don't want to put the second (child) div content before the parent content. I want to make the HTML like this <div class="parent-div"> Parent div HTML content <div class="child-div"> Child div content </div> </div> and if I make the HTML like the one show above it renders the child div after the complete parent HTML Result for the above +---------- parent div --------------+ |Parent HTML content.................| |....................................| |....................................| |....................................| | +-----------+| | | child div || | | child div || | +-----------+| +------------------------------------+ I'm using these styles for the child div <div style="width:200px; float:right;"> Is it possible to float the child div with the parent texts if I post the child div after the parent texts ends A: No float, just margin-left:auto and margin-right:0: http://jsfiddle.net/tovic/2QVX8/21/ EDIT: As the comment below: Set the original box with absolute position, then create a floated fake element as a space for the original box: http://jsfiddle.net/tovic/2QVX8/22/
[ "stackoverflow", "0030767781.txt" ]
Q: How do I configure my index.html with Systemsj to use an existing bundle? I have a small TypeScript helloworld application that uses the aurelia.io framework from a bundle file and configured using SystemJS. When I run my app, the compiled typescript version of my helloworld.ts throws an error which reads: TypeError: define is not a function at System.register.execute (http://localhost:9000/src/helloworld.js!eval:31:13) at t ... Seems to me like the function define is in declared by SystemJS, so perhaps this is a configuration issue. The framework seems to load fine, but I find it quite odd that the systemjs function is not recognized. Here is my project hierarchy and my configuration files. What am I doing wrong? My folder structure looks like this: ./jspm_packages/... ./scripts/aurelia/aulrelia-bundle.js ./src/main.ts ./src/main.js (compiled ts) ./src/app.ts ./src/app.js (compiled ts) ./src/helloworld.ts ./src/helloworld.js (compiled ts) ./index.html ./config.js I have installed jspm, and followed the prompts to create a default config.js files. The only option I changed from default was to use babel as the transpiler. My config.js looks like this: System.config({ "baseURL": "/", "transpiler": "babel", "babelOptions": { "optional": [ "runtime" ] }, "paths": { "*": "*.js", "github:*": "jspm_packages/github/*.js", "npm:*": "jspm_packages/npm/*.js" } }); System.config({ "map": { "babel": "npm:babel-core@5.5.6", "babel-runtime": "npm:babel-runtime@5.5.6", "core-js": "npm:core-js@0.9.15", "github:jspm/nodelibs-process@0.1.1": { "process": "npm:process@0.10.1" }, "npm:babel-runtime@5.5.6": { "process": "github:jspm/nodelibs-process@0.1.1" }, "npm:core-js@0.9.15": { "fs": "github:jspm/nodelibs-fs@0.1.2", "process": "github:jspm/nodelibs-process@0.1.1", "systemjs-json": "github:systemjs/plugin-json@0.1.0" } } }); My index.html looks like this: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Hello World</title> <link rel="stylesheet" type="text/css" href="styles/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="styles/fontawesome/css/font-awesome.min.css"> <link href="styles/styles.css" rel="stylesheet" /> </head> <body aurelia-app> <div class="splash"> <div class="message">Welcome...</div> </div> <script src="jspm_packages/system.js"></script> <script src="config.js"></script> <script> System.config({ "paths": { "*": "*.js" } }); //Project uses bundles System.bundles["scripts/aurelia/aurelia-bundle"]=["aurelia-bootstrapper"]; System.import('aurelia-bootstrapper'); </script> </body> </html> My helloword.ts looks like this: import {bindable} from 'aurelia-framework'; export class HelloWorld{ @bindable hello="Hello!"; } The full error: TypeError: define is not a function at System.register.execute (http://localhost:9000/src/helloworld.js!eval:31:13) at t (http://localhost:9000/jspm_packages/es6-module-loader.js:7:19798) at v (http://localhost:9000/jspm_packages/es6-module-loader.js:7:20180) at u (http://localhost:9000/jspm_packages/es6-module-loader.js:7:19856) at s (http://localhost:9000/jspm_packages/es6-module-loader.js:7:19737) at http://localhost:9000/jspm_packages/es6-module-loader.js:7:22064 at O (http://localhost:9000/jspm_packages/es6-module-loader.js:7:7439) at K (http://localhost:9000/jspm_packages/es6-module-loader.js:7:7071) at y.7.y.when (http://localhost:9000/jspm_packages/es6-module-loader.js:7:10745) at v.7.v.run (http://localhost:9000/jspm_packages/es6-module-loader.js:7:9781) at a.3.a._drain (http://localhost:9000/jspm_packages/es6-module-loader.js:7:1740) at 3.a.drain (http://localhost:9000/jspm_packages/es6-module-loader.js:7:1394) at MutationObserver.b (http://localhost:9000/jspm_packages/es6-module-loader.js:7:3302)(anonymous function) @ aurelia-bundle.js:16334run @ aurelia-bundle.js:1602(anonymous function) @ aurelia-bundle.js:1613module.exports @ aurelia-bundle.js:2906queue.(anonymous function) @ aurelia-bundle.js:3416run @ aurelia-bundle.js:3404listner @ aurelia-bundle.js:3408 A: You should let jspm create the config.js file automatically and don't modify it manually. You can then use aurelia-cli to automatically create your bundle based on what packages you've downloaded via jspm with something like: aureliafile.js var bundleConfig = { js: { "scripts/aurelia-bundle-latest": { modules: [ 'github:aurelia/*' ], options: { inject: true, minify: true } } } }; This will automatically modify config.js to include the files needed for the bundle and where to find them at runtime when you run aurelia bundle ---force (the force is to overwrite previous bundle). After that, your index.html will look something like: Index.html <body aurelia-app="path/to/main"> <script src="jspm_packages/system.js"></script> <script src="config.js"></script> <script> System.import('aurelia-bootstrapper'); </script> </body>
[ "drupal.stackexchange", "0000001412.txt" ]
Q: module_invoke() and the performance I am using module_invoke() many times in the front page to invoke lots of block. Does this effect the site performance? Thank you. A: module_invoke() is essentially using three functions: function_get_args(), function_exists() and call_user_func_array(). As it doesn't invoke any database API function, it doesn't influence the performance a lot. Using module_invoke() allows to write code that is compatible with future versions of the module or Drupal. There is a feature report on drupal.org which asks to use a different schema for the hook names; if that would be implemented (it could happen in Drupal 8), then the code that invokes directly the hooks should be changed. In specific cases, where (for example) you are invoking the same hook implemented by the same module many times in row, it is possible to change the code to do something similar to: verify the module implements the hook you need, once, at the beginning call the hook directly when you need the value returned by the hook This should be done if the module is really invoking the same hook implemented from the same module many times in row (which doesn't exclude the hook is being invoked in a loop). To notice that module_invoke() cannot be used when one of the parameters needs to be passed by reference. There are specific functions that invoke hook implementations in that cases (e.g. comment_invoke_comment(), but those functions invoke the hook implemented by all the modules.
[ "stackoverflow", "0018903906.txt" ]
Q: I can't find options for Select Master Page or Place code in separate file in VS2012 I installed VS 2012 on my work PC, and for the life of me when I go to add a new web form, I cannot see or find the 2 options for Select Master Page or Place code in separate file. Any ideas on how i can find them? A: I've just been fooled by just that for the past hour. What I've found is that the 'old' method of using the menu option 'Add web page using master' (or similar) has vanished, and been replaced by 'Content Page'. When you select this, you're then given the option of choosing a master page. Incidentally, I don't get the option of starting a web site project, which may be why I'm not seeing this either. A: You should have web form with master page in the add items? Placing code in separate file is a different concept called code-behind. You will have an ASPX file and a cs / vb file which handles the events. e.g. Default.aspx Default.aspx.cs EDIT: Based on comment. You may be using a Web Site on your laptop, but a Web Application in work. See Web Application Projects v's Web Site Projects. Take a look at ASP.NET Web Site or ASP.NET Web Application?, this might also help in deciding which to use. Generally, I always go for Web Application. You can use VS to convert from a Web Site to a Web Application, but AFAIK, you can't do it the other way round unless you create a new project and copy across the relevant parts - which could be a big job depending on the size of the site.
[ "stackoverflow", "0042780767.txt" ]
Q: PostgreSQL WHERE clause on ts_rank Error I'm trying to execute the following simple query: SELECT "Documents", "Sentences"."sentence","Sentences"."VectorValue", ts_rank("Sentences"."VectorValue", plainto_tsquery('Video provides a powerful way to help you prove your point. ')) as sim FROM "Documents", "Sentences" Where sim > 0.5 And "Documents"."Id" = "Sentences"."DID" LIMIT 10; But I keep getting this ERROR: column "sim" does not exist I tried this and it worked but doesnt look efficient, it took 5 secs to execute : SELECT ...., .... , ts_rank("Sentences"."VectorValue", plainto_tsquery('Video provides a powerful way to help you prove your point. ')) FROM "Documents", "Sentences" Where ts_rank("Sentences"."VectorValue", plainto_tsquery('Video provides a powerful way to help you prove your point. ')) > 0.5 And "Documents"."Id" = "Sentences"."DID" LIMIT 10; Usually, ts_rank gives results from 0-0.99 based on how relevant documents are to a specific query! Any Ideas? Also, Can this be improved? A: try this query: select exe.* from ( SELECT "Documents", "Sentences"."sentence","Sentences"."VectorValue", ts_rank("Sentences"."VectorValue", plainto_tsquery('Video provides a powerful way to help you prove your point. ')) as sim FROM "Documents", "Sentences" And "Documents"."Id" = "Sentences"."DID" ) exe where sim > 0.5 LIMIT 10;
[ "english.stackexchange", "0000399349.txt" ]
Q: "Will I open this box?" - "No, you mustn't." I'm struggling with "will I" in this sentence. Is it grammatically correct? I know that "shall I" would be fine, but does "will I" work too? A: In first person questions, use shall I for things you have control over, and will I for things you don't. Shall I go to church? Will I go to jail? Unless there are some very unusual circumstances connected with opening the box, you should use shall I. I perceive shall I? as less tentative than should I?. If I say: Shall I open the box? I'm essentially suggesting that I open the box, and asking whether you agree. If I say: Should I open the box? it's less of a suggestion, and more asking your opinion one way or the other.
[ "superuser", "0000308067.txt" ]
Q: Cancel a cronjob or an automatically loaded process on OS X I'm currently being bugged by Mail.app popping open every friday at the same time and simultaniously I receive mails from an app iBackup which I used to have installed. I would like to get rid of it for good but I can't find the process or cronjob that launches Mail.app. Things I tried: Terminal crontab -l sudo crontab -l for user in $(dscl . list /users); do sudo crontab -u $user -l; done Searched all available locations listed by man launchd for a reference to Mail (grepped) Where are crontabs listed in OS X? Are there any other places I can search for a script that launches every friday at the same time? A: Although Mac OS X still has cron, since Tiger (10.4) the preferred program for automatically starting processes is launchd. It replaces cron, init, watchdogd and others. A well-written and reasonably recent Mac program would be expected to use launchd rather than cron for scheduling a periodic job. This article is a good overview, but to address your problem more directly, have a look in ~/Library/LaunchAgents, /Library/LaunchAgents and /Library/LaunchDaemons for launchd property lists. These property lists are generally named in a reverse-domain fashion, so com.ibackup.ibackup.plist would be a good thing to start looking for. Once you find the offending file(s) do [sudo] launchctl unload /path/to/file to deactivate it. Move or delete it to prevent it being automatically reloaded on reboot.
[ "stackoverflow", "0063510398.txt" ]
Q: Excel - Loop through table out of bounds error my code is to run through a table and store the cell color of column D while also storing the value of in column C as another variable. These variables are used to find a shape on another the "main" tab and update that color to the color that was stored in CellColor. When I added the loop part of the code I get an out of bounds error (-2147024809 (80070057)). Sub Update() Dim CellColor As Long Dim ShapeColor As Variant Dim rng As Range, Cell As Range Dim i As Integer Worksheets("Sheet1").Select Set rng = Range("C2:C100") For i = 2 To rng.Rows.Count CellColor = rng.Cells(RowIndex:=i, ColumnIndex:="D").DisplayFormat.Interior.Color ShapeColor = rng.Cells(RowIndex:=i, ColumnIndex:="C").Value Worksheets("main").Shapes(ShapeColor).Fill.ForeColor.RGB = CellColor i = i + 1 Next Worksheets("main").Select End Sub A: Perhaps use a For Each loop here and Offset: Set rng = Worksheets("Sheet1").Range("C2:C100") Dim cell As Range For Each cell In rng ShapeColor = cell.Value CellColor = cell.Offset(,1).DisplayFormat.Interior.Color Worksheets("main").Shapes(ShapeColor).Fill.ForeColor.RGB = CellColor Next A brief explanation of your problem: rng.Cells(RowIndex:=i, ColumnIndex:="C") rng.Cells(RowIndex:=i, ColumnIndex:="D") are not the cells you think they are, because they are offsetting but starting from column C. They are actually referring to columns E and F. As an example: ? Range("C2").Cells(1, "C").Address returns $E$2, not $C$2. Other points: Remove the i = i + 1. Next is what increments i. Avoid using Select: Set rng = Worksheets("Sheet1").Range("C2:C100").
[ "stackoverflow", "0038949725.txt" ]
Q: How to make a pop to appear gradually using jquery and bootstrap? My goal is after a user has signed up, then it will redirect that user to another page that is a profile page. On profile page, I want to make a pop up screen gradually appear so that user could enter an email or something. I know how to make a modal appear in bootstrap, but how to make it appear gradually? A: You can trigger a modal with JQuery in the following way. $('#myModal').modal('show'); Just put it in your $(document).ready(....); if you want it to show immediately on page load.
[ "stackoverflow", "0032172943.txt" ]
Q: What does a higher clock signal frequency actually mean? I've got an Arduino with an ATmega328 processor. It can be operated at 3.3V which nets a clock signal frequency of about 12 MHz respectively 16 Mhz at 5V. I connected an IMU to the Arduino which runs an AHRS algorithm turning accelerometer, gyroscope and magnetometer data into orientation data. What does the higher frequency of 16 MHz actually mean in this context? Will the AHRS be calculated faster so I get a lower latency? Can I poll the sensors more often? I want a deeper understanding of what I'm doing here. A: Higher frequency means more clock cycles per second which means more operations are done during the same duration of time. This means AHRS runs faster and you will achieve a lower latency and if you are repeatedly reading values from the IMU, you will be able to poll more often.
[ "stackoverflow", "0035116502.txt" ]
Q: Sum of array in a different way Let assume I have an MxN array and I should sum this array like in image as shown below; Array sum I should sum all x's , all y's , all z's and all g's. I need an approach. My_Brain.exe has stopped and I couldn't find any approach to solve this problem. A: SumColumnZigZag(column) { Sum = 0 for row = 0; row < rows; row++ { sum += array[row][column + (row % 2)*(1 - 2*(column % 2))] } return sum } % is the modulo operator
[ "cogsci.stackexchange", "0000023927.txt" ]
Q: Chomskian view on grammar The Chomskian view asserts that certain structural components of grammar are innate to all humans. To support the Chomskian view, the observation that we are able to omit certain pronouns in the English language without ever being taught the grammatical rules necessary is used to support the view. However, my question is, what would an example of the above observation be? A: Summary: It's worth noting that all languages have an oral origin so concerning the biological origins of grammar we must look for neurological structures involved in speech processing/production. However, it's worth first clarifying Chomsky's view that there are two levels of innateness: at the level of genetics i.e. biological heredity and at the level of neurological structures i.e. morphology and morphogenesis. Based on the available evidence, it appears that specific genes and neurological structures that aid language acquisition do exist but these aren't necessarily specific for language.  Chomsky's view: Chomsky has historically held firm to the view expressed in 1983 [1]: QUESTION: Is the role of heredity as important for language as it is for embryology? CHOMSKY: I think so. You have to laugh at claims that heredity plays no significant role in language learning because exactly the same kind of genetic arguments hold for language learning as hold for embryological development. I’m very much interested in embryology but I’ve got just a layman’s knowledge of it. I think that recent work, primarily in molecular biology, however, is seeking to discover the ways that genes regulate embryological development. The gene-control problem is conceptually similar to the problem of accounting for language growth. In fact, language development really ought to be called language growth because the language organ grows like any other body organ. However, Chomsky also recognised that there was little neurobiological evidence to support this view at the time beyond reasonable hunches: QUESTION: Is there a special place in the brain and a particular kind of neurological structure that comprises the language organ? CHOMSKY: Little enough is known about cognitive systems and their neurological basis; so caution is necessary in making any direct claims. But it does seem that the representation and use of language involve specific neural structures, though their nature is not well understood. Chomsky's particular hypotheses: From the above interview we may derive two hypotheses: That there might be genes for linguistic ability. That the development of language may rely on neurological structures that are specific for language. The first hypothesis is partially validated by research on the FOXP2 gene [3]. In 2001 it was found that in humans the mutation of this gene significantly disrupts speech and language skills. That said, we must note that FOXP2 has other roles: ...FOXP2 is also expressed in defined regions of other tissues during embryo development, including the lung, the gut and the heart, as well as in several tissues of the adult organism. Given that the heart, gut and lung developed prior to linguistic ability it's more likely that FOXP2 was initially useful for heart and lung function, and was exploited for linguistic ability rather than the other way around. This gene is actually present in other animals. The authors of [3] clarify this point: the presence of FOXP2 in other animals does not diminish its relevance for speech and language, but rather represents another example of recruitment and modification of existing pathways in evolution. The possibility of specific neurological structures: Regarding the second hypothesis, this is the subject of ongoing investigation that combines AI research, cognitive science, neuroscience and morphogenesis. How language develops is a very complex and fascinating subject. In a pioneering robot experiment [2], the linguist and cognitive scientist, Pierre-Yves Oudeyer showed that with basic neural equipment for adaptive holistic vocal imitation, coupling directly motor and perceptual representations in the brain, it was possible to generate spontaneously shared combinatorial systems of vocalizations in a society of babbling individuals: ...the transition from inarticulated vocalization systems to human-like speech codes may have been largely due to a modest biological innovation. Indeed, the model indicates that neuronal structures that encode a priori and specifically phonemic organization, as well as typical regularities of speech, do not need to be innately generated to allow the formation of such speech code. This is the second contribution of this work: it allows us to understand how the self-organizing properties of simple neural structures may have constrained the space of biological vocalization structures and how speech codes may have been generated and selected during phylogenesis. These new hypothesis may not have been identified without the use of computer models and simulations, because the underlying dynamics are complex and difficult to anticipate through uniquely verbal reasoning. This illustrates the potential importance of these new methodological tools in human and biological sciences. Pierre-Yves' research on robot languages suggests that: The specific neurological structures that aid acquisition aren't necessarily specific for language. Cognitive scientists should investigate the development of the vocal tract during language acquisition. Concerning specific neurological structures, today we know that Broca's area is heavily used for speech production but similar regions are present in other apes that have limited linguistic ability [6]. So it's important to consider the causal influence of Broca's region within cortical networks involved in speech production. In [7] the authors share that: Using direct cortical surface recordings in neurosurgical patients, we studied the evolution of activity in cortical neuronal populations, as well as the Granger causal interactions between them. We found that, during the cued production of words, a temporal cascade of neural activity proceeds from sensory representations of words in temporal cortex to their corresponding articulatory gestures in motor cortex. Broca’s area mediates this cascade through reciprocal interactions with temporal and frontal motor regions. For this reason in the discussion section they infer: ...Broca’s area is not the seat of articulation per se, but rather is a key node in manipulating and forwarding neural information across large-scale cortical networks responsible for key components of speech production. So far there is a lot of neurological evidence supporting Oudeyer's conjecture that specific neurological structures that aid acquisition aren't necessarily specific for language. As for Oudeyer's second suggestion there's still a lot we don't know. You might be interested in the work of the Max Planck Department for the Neurobiology of Language[4,5].  References: Noam Chomsky. Things No Amount of Learning Can Teach. Interviewed by John Gliedman. 1983. Pierre-Yves Oudeyer. Self-Organization and Complex Dynamical Systems in the Evolution of Speech. 2013. Gary F. Marcus and Simon E. Fisher. FOXP2 in focus: what can genes tell us about speech and language? Elsevier. 2003. Hagoort, P., & Beckmann, C. F. (in press). Key issues and future directions: the neural architecture for language. In P. Hagoort (Ed.), Human Language: From Genes and Brains to Behavior. Cambridge, MA: MIT Press. Hagoort, P. (in press). Introduction. In P. Hagoort (Ed.), Human Language: From Genes and Brains to Behavior. Cambridge, MA: MIT Press. Claudio Cantalupo and William D. Hopkins. Asymmetric Broca’s area in great apes. NIH Public Access. 2001. Adeen Flinker, Anna Korzeniewska, Avgusta Y. Shestyuk, Piotr J. Franaszczuk, Nina F. Dronkers, Robert T. Knight, and Nathan E. Crone. Redefining the role of Broca’s area in speech. PNAS. 2015.
[ "stackoverflow", "0015694202.txt" ]
Q: jQuery.each() build set of jQuery Objects, append after I want to run one single .append() after my .each() for efficiency. I tried to build out my set of objects and it won't run. It's similar to this question, except I'm building a jQuery object instead of a string. JQuery append to select with an array HTML <select></select> jQuery var items = ['apple','pear','taco','orange'], options = ''; jQuery.each(items, function(i, fruit){ options += jQuery('<option/>', { value: fruit, text: fruit }); }); //added missing ');' jQuery('select').append(options); A: You should not concatenate objects, your code results in [object Object][object Object]... Also you are missing ) for closing each method. $.each(items, function (i, fruit) { options += '<option value=' + fruit + '>' + fruit + '</option>'; }); $('select').append(options); http://jsfiddle.net/NxB6Z/ Update: var items = ['apple', 'pear', 'taco', 'orange'], options = []; jQuery.each(items, function (i, fruit) { options.push($('<option/>', { value: fruit, text: fruit })); }); jQuery('select').append(options); http://jsfiddle.net/HyzWG/
[ "ux.stackexchange", "0000095865.txt" ]
Q: Are there any design patterns for positioning controls and other items on the round screen of smartwatch? I am designing the smartwatch application for the round smartwatch screen and have problems in deciding, how to position elements on it. For the simple item-by-item list, the round shape forces huge horizontal margins and lots of unused space. Should I rotate the numbers along the edges of the screen? Has anybody tried to address professional design guidelines for these small round screens? Looks like nothing similar before. A: Great question h22! First up, this depends on the platform you're developing /designing the app for. If it's Tizen, the new Samsung Gear 2 is designed for a round smartwatch. So, developing for Tizen will allow you to do that. You can see that in the Design Documentation for Tizen, it is catered towards the round watch face and proudly showcases the usages of the bezel as well. As you can see in the screenshot, Tizen isn't afraid to use the circular space of the watch and make the list easily scrollable, but display one item at a time. Android, on the other hand, advises you to be wary of the square watch face as well. You should design for the Square watch face on Android and it'll automatically handle the complexities to adjust it on the round smartwatch. The Design documentation for Android Wear heavily showcases the Square watch face. A list on Android Wear consists of 3 list items on the screen out of which the one in the center is focused on. It offers a very minimal and spacious alternative to Tizen. So, depending on your wristful decision of choosing the Wearable OS, Tizen will allow you to rotate the numbers and get away with it, but Android might be a little complicated since restricting Square watch users to your app isn't really the way designers should go about. Regarding the white space and margins: It is perfectly fine to have large margins on the Wearable. Since the screen size is small, you need information to be loud and concise. Showing a lot of data could get very overwhelming and hard to read. So to answer your question, Yes, you can guide the user using rotating numbers on a Samsung Tizen smartwatch i.e. Gear 2. You should read more information on the circular design here.
[ "stackoverflow", "0025707079.txt" ]
Q: nano will not work in chroot folder I run a chroot on a /var/www/ everything is OK but nano wont work I copied it's binary to /var/www/bin and libreries to /var/www/lib but when nano some file i got this error : Error opening terminal: xterm. What should I do A: This is just a hunch but try running which xterm outside of the chroot and make sure that binary is accessible inside the chroot. For example, on my Mac the path is: bash-4.3$ which xterm /opt/X11/bin/xterm
[ "sharepoint.stackexchange", "0000062620.txt" ]
Q: Why is the ribbon different for users with the same permissions? I have a published site. I have given 2 users Read permissions to that site. On user can see the browse and page tabs (tho most options are disable {like the should be}), the other user does not have that tab. I know there must be security settings somewhere for this but since I am new to this I am not sure where to look. Thanks A: If this is a publishing site (like i think you said it is), each user can decide whether to hide or display the ribbon. Maybe one user has selected to show it and the other one has decided to hide it. See this old question for some screenshots: automatically show ribbon on publishing site EDIT: Are both users in the Site Members group? See this link: http://www.dummies.com/how-to/content/site-actions-menu-in-sharepoint-2010.html
[ "stackoverflow", "0052746300.txt" ]
Q: Asking for User Name or Unique Identity before OAUTH/OpenID-Connect I am building a website that uses OAuth2.0 and OpenId-Connect (of some third party vendor) to authenticate user. Before redirecting the user to the vendor's OAuth page, I am not asking the user to enter a unique UserID on my website, I was thinking of using the user's emailid that I receive as a part of IDToken after the Authorization process is done, as the user's User Name(unique identity) for my Website. But the OpenID specification here https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims says that emailid is optional and may not be returned. So the questions is, is it a standard practice to ask the User to provide with a unique name (that I can use as user's identity on my website), before I initiate the OAUTH/OpenID-Connect process? A: The sub claim must be unique per issuer. Required Claims will always be present. You can use the iss + sub to uniquely identify users.
[ "stackoverflow", "0027151448.txt" ]
Q: Dynamically create and append ul after existing ul in div in jquery I have a menu and I need to dynamically add another ul.nav.navbar-nav.navbar-right with one li. Here is my actual HTML: <div id="menu navbar" class="collapse navbar-collapse"> <ul class="level1 static nav navbar-nav"> <li>...</li> <li>...</li> </ul> </div> and after that ul I need to append another ul via jQuery (this is result what I need after run script) <div id="menu navbar" class="collapse navbar-collapse"> <ul class="level1 static nav navbar-nav"> <li>...</li> <li>...</li> </ul> **<ul class="nav navbar-nav navbar-right"> <li> <a href="/Profile.aspx" class="img-nav-link">Profil</a> </li> </ul>** </div> A: You can do it like this: $('#menu').append($('<ul/>').addClass('nav navbar-nav navbar-right'))
[ "stackoverflow", "0012490969.txt" ]
Q: How to Get Selected Sheet Names in Excel I am trying to get names of the selected sheets in Excel. I have 4-5 worksheets in my excel file. User is supposed to select two of them and then my application scans specific columns and compare values. However I could not find a way in C# to get names of the worksheets when user selects more than one sheet. User can also delete these selected worksheets via the application. Any ideas? A: Using VSTO: var sheets = Application.ActiveWindow.SelectedSheets; var names = new List<string>(); foreach (Excel.Worksheet sh in sheets) { names.Add(sh.Name); }
[ "stackoverflow", "0012454399.txt" ]
Q: posh-git doesn't show branch in package manager console I installed posh-git for Windows PowerShell and it works great in the shell. However, it is supposed to work in the package manager console as well. It does work but it doesn't show the current branch like the normal powershell window does. I followed this tutorial and everything went fine except for my package manager console doesn't look like his with the branch name. All you can see is PM> in the VS 2012 package manager console. But it works fine in the powershell. A: Nuget has a separate profile (~\Documents\WindowsPowerShell\NuGet_profile.ps1), so it's not picking up the posh-git installed in your default profile. The easiest way to get posh-git working is to run install.ps1 from the Package Manager Console. Or if you always want your profiles to match, you can load your default profile in the Nuget one: $PROFILEDIR = (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent) Push-Location $PROFILEDIR . .\Microsoft.PowerShell_profile.ps1 Pop-Location (Edited to include switching to profile directory; capturing location in $PROFILEDIR is optional, but I find it handy.)
[ "hinduism.stackexchange", "0000036175.txt" ]
Q: Which yajna was performed by Prajapati Daksha? Which yajna was it which was performed by Prajapati Daksha in which he didn't invite Lord Shiva and suffered with consecutive events ? A: Which yajna was it which was performed by Prajapati Daksha in which he didn't invite Lord Shiva ? The answer is provided in Mahabharata-Shanti Parva-Moksha Dharma Parva- Chapter-283 , where this story of Daksha yajna is narriated by Maharshi Veda Vyasa. When Goddess Uma came to know about all the gods leaving for Daksha Prajapatis yajna , she was curious and asked lord Shiva about that. Then Lord Mahadeva himself answered to Devi Uma that Daksha prajapati is performing Ashwamedha yajna. Following is the shloka of that conversation. महेश्वर उवाच दक्षो नाम महाभागो प्रजानां पतिरुत्तम : | हयमेधेन यजते तत्र यान्ति दिवौकस: || 24 || P. 311 - Maheswara said, 'O lady that art highly blessed, the excellent Prajapati Daksha is adoring the gods in a Horse-sacrifice. These denizens of heaven are proceeding even thither. So Daksha Prajapati was performing Ashwamdha yajna at the time , when devi Uma asked Mahadeva about the Yajna and why he is not invited to the Yajna . Here is Hindi Translation with Shlokas. A: It seems that the Yajna is called "Devi Yajna". As per Devi Bhagavatam: He is not to return any more. He who bathes in all the Tîrthas and makes a journey round the whole world, gets Nirvâna. He is not reborn. He who performs the Horse-Sacrifice in this holy land Bhârata enjoys half the Indraship for as many years as there are hairs on the body of the horse. He who performs a Râjasûya Sacrifice, gets four times the above result. Of all the sacrifices, the Devî Yajñâ, or the Sacrifice before the Devî is the Best. O Fair One! Of old, Visnu, Brahmâ, Indra and when Tripurâsura was killed, Mahâ Deva did such a sacrifice. O Beautiful One! This sacrifice before the S’akti is the highest and best of all the sacrifices. There is nothing like this in the three worlds. This Great Sacrifice was done of yore by Daksa when he collected abundant sacrificial materials of all sorts. And a quarrel ensued on this account between Daksa and S’ankara. The Brâhmins conducting the sacrifice cursed the Nandî and others. And Nandî cursed the Brâhmanas. Mahâdeva, therefore, disallowed the going on of sacrifice and brought it to a dead stop. Of yore the Prajâpati Daksa did this Devî Yajñâ; it was done also by Dharma, Kas’yapa; Ananta, Kardama, Svâyambhuva Manu, his son Priyavrata, S’iva, Sanat Kumâra, Kapila and Dhruva Book 9, Chapter 30 Therefore, it is the Devi Yajna which Daksha was performing and which was eventually destroyed by Lord Shiva's troops.
[ "tex.stackexchange", "0000010397.txt" ]
Q: How to include picture in original size into document page on center? I have a picture that I'd like to include in the center of the page. I don't want the picture to scale. So I tried this (among a lot of other variations): \begin{figure}[htb] \centering \includegraphics{overview_pyramid.png} \caption{Overview pyramid}\label{fg:overview_pyramid} \end{figure} Why isn't this working? I center the image and I don't set a specific size. Nevertheless the picture is scaled (but don't know the factor) and is on the left end of the page. A: Your PNG probably doesn't have the correct resolution information set in its metadata. If you have ImageMagick on your system, you can run identify -verbose overview_pyramid.png to see the metadata of the image. If the output contains Units: Undefined and/or a Resolution: that is incorrect, you need to add the information. You can do this using the command convert overview_pyramids.png -density 300 -units PixelsPerCentimeter overview_pyramids.png to set the resolution to 300 pixels per centimetre, for instance; or just convert overview_pyramids.png -units PixelsPerInch overview_pyramids.png if the value of the "Density" field is correct but the unit is missing. A: Images are not scaled, if you don't set any scaling options. Bitmap images like PNG and JPEG, have a "natural" pixel density. This is often 72DPI or 96DPI, but can be changed by softwares. On the other hand, PDF readers has its own video pixel density, it may be 96DPI, 110DPI or any other value you set. If the density of image and the PDF reader match, and in PDF reader you set the 100% scaling, you'll find the image looks unscaled.
[ "stackoverflow", "0001588589.txt" ]
Q: Firefox does not preserve custom headers during Ajax request redirect: an ASP.NET MVC solution I use ajaxForm with jQuery, and there's one problem with Firefox - for some reason it does not preserve X-Requested-With custom header (which is used to detect IsAjaxRequest()). This leads to my controller action returning full view instead of partial since IsAjasxRequest() returns false after redirect. This bug only happens in Firefox, it works fine in Chrome for example. You can see this bug mentioned here. A pretty old post so I wonder why it still happens to me (I use Firefox 3.5.3). Anyway, here's the solution I invented - in my base controller class: protected override void OnActionExecuting(ActionExecutingContext filterContext) { var ajaxRequestBeforeRedirect = TempData["__isajaxrequest"] as string; if (ajaxRequestBeforeRedirect != null) Request.Headers.Add("X-Requested-With", ajaxRequestBeforeRedirect); } private bool IsRedirectResult(ActionResult result) { return result.GetType().Name.ToLower().Contains("redirect"); } protected override void OnActionExecuted(ActionExecutedContext filterContext) { base.OnActionExecuted(filterContext); if (IsRedirectResult(filterContext.Result) && Request.Headers["X-Requested-With"] != null) TempData["__isajaxrequest"] = Request.Headers["X-Requested-With"]; } It works; however, I have two questions here: Is this bug really not fixed in Firefox or I don't understand something? Is it a good solution? Is there any better? I can't believe noone had this issue before. UPDATE: for those who is interested in this issue, Request.Headers.Add has problems with IIS6 (or maybe IIS5, but anyway). So the correct way would be to store this "isAjaxRequest" flag in TempData/HttpContext.Items/base controller. A: Just in case somebody else stumbles on this question after wondering why their header-based dispatching fails in Firefox, this is not fixed as of 2010-10-11, tested in Firefox 3.6.10 https://bugzilla.mozilla.org/show_bug.cgi?id=553888 is the corresponding bug, and from the latest comments as of today (by Jonas, made on 2010-09-16) this issue will not be fixed in Firefox 4. Furthermore, this bug seems to extend to standard settable headers such as Accept, meaning an Accept: application/json will disappear after a redirect and your xhr engine will very likely get an HTML response instead.
[ "stackoverflow", "0035845234.txt" ]
Q: Deleting the last octets of an IP address This is my code: ip = ("192.143.234.543/23 192.143.234.5/23 192.143.234.23/23") separateOct = (".") ipNo4Oct = line.split(separateOct, 1) [0] print (ipNo4Oct) The IPs come from a text file and I have done my for loops right. The result I get is: 192 192 192 But I want this result: 192.143.234 192.143.234 192.143.234 How do I get the result I want? A: With ip = ("192.143.234.543/23", "192.143.234.5/23", "192.143.234.23/23") for line in ip: separator = "." ipNo4Oct = separator.join(line.split(separator, 3)[:-1]) print (ipNo4Oct) you re-join your 3 parts using the separator.
[ "stackoverflow", "0006809084.txt" ]
Q: Android - Convert Arch to Decimal I'm creating a feet and inches calculator. I want the user to be able to enter the information in various ways such as 1'-4-5/8" or 1 4 5/8. When performing math, the above numbers will have to be converted to decimal (1'-4-5/8" is 16.625 in decimal inches). The final result will be in either decimal inches or then converted back to feet and inches. How would I go about parsing the architectural measurement and converting it into decimal inches? Any help would be greatly appreciated! Thank you! edit: After way too much time and trying many different things, I think I got something that will work. I'm ultimately going to limit the way the user can enter the length so I think the following is going to work. It may not be optimized but it's the best I can get right now. public class delim_test_cases { public static void main(String[] args) { double inches = 0; double feet = 0; double fract = 0; String str = "2'-3-7/8"; String[] TempStr; String delimiter = ("[-]+"); TempStr = str.split(delimiter); for(int i=0; i< TempStr.length ; i++ ) { for(int z=0; z< TempStr[i].length() ; z++ ) { if (TempStr[i].charAt(z) == '\'') { String[] FeetStr; String feetdelim = ("[\']+"); FeetStr = TempStr[i].split(feetdelim); feet = Integer.parseInt(FeetStr[0]); } else if (TempStr[i].charAt(z) == '/') { String[] FracStr; String fracdelim = ("[/]+"); FracStr = TempStr[i].split(fracdelim); double numer = Integer.parseInt(FracStr[0]); double denom = Integer.parseInt(FracStr[1]); fract = numer/denom; } else if (TempStr[i].indexOf("\'")==-1 && TempStr[i].indexOf("/")==-1) { String inchStr; inchStr = TempStr[i]; inches = Integer.parseInt(inchStr); } } } double answer = ((feet*12)+inches+fract); System.out.println(feet); System.out.println(inches); System.out.println(fract); System.out.println(answer); } } A: Why not just split on either the '-' or a space, then you have an array of possibly 3 strings. So, you look at the last character, if it is a single quote, then multiply that by 12. If a double quote, then split on '/' and just calculate the fraction, and for a number that is neither of these it is an inch, just add it to the total. This way you don't assume the order or what if you just have fractional inches. Just loop through the array and then go through the algorithm above, so if someone did 3'-4'-4/2" then you can calculate it easily. UPDATE: I am adding code based on the comment from the OP. You may want to refer to this to get more ideas about split. http://www.java-examples.com/java-string-split-example But, basically, just do something like this (not tested, just written out): public double convertArchToDecimal(String instr, String delimiter) { String[] s = instr.split(delimiter); int ret = 0; for(int t = 0; t < s.length; t++) { char c = s[t].charAt(s[t] - length); switch(c) { case '\'': //escape single quote String b = s[t].substring(0, s[t].length - 1).split("/"); try { ret += Integer.parse(s[t].trim()) * 12; } catch(Exception e) { // Should just need to catch if the parse throws an error } break; case '"': // may need to escape the double quote String b = s[t].substring(0, s[t].length - 1).split("/"); int f = 0; int g = 0; try { f = Integer.parse(b[0]); g = Integer.parse(b[1]); ret += f/g; } catch(Exception e) { } break; default: try { ret += Integer.parse(s[t].trim()); } catch(Exception e) { // Should just need to catch if the parse throws an error } break; } } return ret; } I am catching more exceptions than is needed, and you may want to use the trim() method more than I did, to strip whitespace before parsing, to protect against 3 / 5 " for example. By passing in a space or dash it should suffice for your needs. You may also want to round to some significant figures otherwise rounding may cause problems for you later.
[ "stackoverflow", "0017213799.txt" ]
Q: Simple socket forwarding in linux The scenario is pretty simple: Using TCP/IP I have a client which connects to me (server) I want to forward the data the socket sends me to another socket which I opened and the data I received from that socket backwards.Just like a proxy. Right now I have 1 thread one who listens from incoming connection and spawns another 2 when a connection from the client is established. I must use a mechanism for communicating in the threads. Is there anything simpler which I can use to act as a TCP/IP proxy ? Does Linux have socket forwarding or some kind of mechanism ? A: You can use iptables to do port forwarding. It's not a c solution, but it is a 2-line that has good performance and which will have minimal debugging. From the second link: iptables -A PREROUTING -t nat -i eth1 -p tcp \ --dport 80 -j DNAT --to 192.168.1.50:80 iptables -A INPUT -p tcp -m state --state NEW \ --dport 80 -i eth1 -j ACCEPT The first line forward from port 80 to port 80 on 192.168.1.50 and the second accepts the connection, keeping iptables from dropping it. You can add additional constraints with other iptables flags such as -s 10.0.3.0/24 would catch all the addresses with a source of 10.0.3.0 to 10.0.3.255 A: One user level solution is using socat. For example, to accept connections on port 8080 and forward them to 192.168.1.50:9090 you can use: socat TCP-LISTEN:8080,fork TCP:192.168.1.50:9090 The fork option makes socat permit multiple connections. A: You don't need threads. Take a look at select(), epoll() or kqueue() in order to manage multiple sockets without any thread (if you're on Windows, it's the completion port). This is an example of a select-based server, it will be a good start.
[ "drupal.stackexchange", "0000022736.txt" ]
Q: Profile Completion e-mail to user in Drupal Hi in drupal(6) how to send reminder e-mail to the user whoever did not complete the profile information? Is there any module available to do this? i think we can do using rules/trigger. but not exactly. I need similar to that what cron job do in php. Help me out. A: Use Rules, I actually have the below working for an Intranet site I manage. ON - Choose your event, maybe "User has logged in" IF - "Content Profile's field 'field_NAME' has value" DO - "Send a mail to the user" Replace the field_NAME with the field you would like to check, In the IF I just check for a NULL value on a required field. return array( 0 => array('value' => ''), );
[ "stackoverflow", "0020009091.txt" ]
Q: why and how does jQuery use an undeclared variable as an ID Where is the documentation that explains why/how this works? jQuery interprets an undeclared variable as an id. I find this odd, and encountered by chance. How does it work? HTML <div id="wrapper"> <input id="a" value="click" type="button" /> </div> JS $(wrapper).on("click", "#a", function(){ alert("test"); }); JSBIN A: It doesn't. Javascript/the DOM does. The id attribute is used to create a global variable that points to each element with an id. This behaviour has been in Internet Explorer for years, and is now standardised in HTML5.