id
stringlengths 5
27
| question
stringlengths 19
69.9k
| title
stringlengths 1
150
| tags
stringlengths 1
118
| accepted_answer
stringlengths 4
29.9k
⌀ |
---|---|---|---|---|
_vi.202 | I'm using Vim in a terminal, so scrolling with the scroll wheel uses the \e[A and \e[B syntax (where \e symbolizes \x1b, or escape).However, Vim interprets this by moving the cursor up or down a line. The desired behavior is that the screen is moved up or down, like <C-e> and <C-y> do.How can I tell Vim to move the screen when I used my scroll wheel, while keeping the cursor on the same line? This should work in all common modes (insert, normal, visual select).I've already tried, for example, :nnoremap <esc>[A <C-e> (replacing <esc> with a literal escape character inserted with Ctrl+V Esc), but this proved to be futile.I'm using Vim 7.4.52 on Ubuntu 14.04 with GNOME. | Scroll the screen, not the cursor, when using scrollwheel | mouse;scrolling;x11;terminal | As @Doorknob said in his comment, :set mouse=a fixes the problem. |
_webapps.17818 | Facebook Pages policy states that media auto-play is not allowed on a Facebook Page. Now I wonder what is considered media? JavaScript with setTimout/setInterval as well?If I put a jQuery carousel/slider/fader on my Page's custom tab that rotates some HTML text elements every 10 seconds and starts cycling the moment Facebook Page's loaded. Is this regarded as media? It's Javascript that rotates text so to me this is not media...See it here and tell me whether this can be considered media... | What is considered media when referring to Facebook Pages autoplay policy? | facebook pages | Media generally refers to video and audio elements. The auto play ban is in reference probably to when it was popular for people to throw audio and video clips on their site that played as soon as a user opened the page... which then and even more so now was considered to be bad design and bad for the user experience.What you are describing doesn't fit into that situation so you will be fine. |
_unix.333170 | I have an ASUS UX50V laptop. Both Linux Mint 18 32-bit and Linux Mint 18.1 64-bit identify the video card as NVIDIA Corporation: G98M [GeForce G 105M]. https://www.asus.com/Notebooks/UX50V/specifications/ concurs with the 105M designation.I add ppa:graphics-drivers/ppa as a software source, per https://johners.tech/2016/07/installing-the-latest-nvidia-graphics-drivers-on-linux-mint-18/, and then I see two nvidia options available to me:nvidia-304 (NVIDIA legacy binary driver - version 304.134)nvidia-340 (NVIDIA binary driver - version 340.101)Whenever I set it up to use either I get the following error message:Cinnamon just crashed. You are currently running in Fallback Mode.Do you want to restart Cinnamon?Here's /var/log/Xorg.0.log for the 32-bit install with the 304.xx driver:http://pastebin.com/fVfeKqfdHere's /var/log/Xorg.0.log for the 64-bit install with the 340.xx driver:http://pastebin.com/w8WS1WnuBoth logs have the same two errors:(EE) [drm] Failed to open DRM device for (null): -22(EE) Failed to initialize GLX extension (Compatible NVIDIA X driver not found)I've tried both drivers and get the same result. Is the GeForce G 105M simply not supported? If so then why would Driver Manager list both as a suitable drivers? | linux mint keeps crashing with official nvidia drivers | linux mint;nvidia;asus | null |
_softwareengineering.240613 | Consider the following problem:Description:There are n jobs J1...Jn with cycle times C1....Cn. Find a time quantum and a scheduling table considering that:any element of the table contains at most one jobthe job handler will process an element at a time, i.e. execute the job (if any) then, after a time quantum passes, moves to the next element.the job handler will loop-back, i.e. after the last element it will continue with the first.the ciclicity must be maintained, i.e. the distance between any two consecutive (including loop-back) occurances of job Jk (k = 1,n) must be equal to Ck / time quantum.the table must be as short as possible.Example:J1 - 4 seconds ciclicityJ2 - 6 seconds ciclicityJ3 - 8 seconds ciclicityExample solution:time quantum = 1s0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 seconds+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+|J1|J2|J3| |J1| | |J2|J1| |J3| |J1|J2| | |J1| |J3|J2|J1| | | |+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+My feeling is that this belongs to the family of scheduling problems and that it may be a special case of a more general problem. Is this so? I tried to search for it online but didn't find anything that looks similar. Since I don't have any experience with scheduling problems I'm not even sure what to search for.From what I see:the total duration of the schedluing table should be the smallest common multiple of C1...Cn.the time quantum should be at least GCD(C1,...,Cn) / n. - This is not necessarly the optimal solution.This leads me to believe that there is a straight forward solution and not one involving dynamic programming. Is this so?Can somebody point me to some resources, maybe even an algorithm, for this problem? I'm also curious about variations where there the jobs can be distributed between more than one scheduling tables.GCD = Greatest Common DividerEdit: I'm not asking how to schedule N jobs with given cycle times; I'm sure there are more dynamic ways to do this as some suggested. My problem is Find a time quantum and a scheduling table considering that:[...]. It's even possible that it may have it's roots in some parts of mathematics. | Does anybody recognize this scheduling problem? Is there an algorithm for it? | algorithms;problem solving;scheduling | null |
_webmaster.38635 | Hi all I'm in the process of finding out all about sprites and how they can speed up your pages.So I've used spriteMe to create a overall sprite image which is 130kb, this is made up of 14 images with a combined total size of about 65kbSo is it better to have one http request and a file size of 130kb or 14 requests for a total of 65kb?Also there is a detailed image which has been put into the spite which caused it's size to go up by about 60kb odd, this used to be a seperate jpg image which was only 30kb. Would I be better off having it seperate and suffering the additional request? | http requests, using sprites and file sizes - | http;page speed;sprite | At this point, you'll have to make a choice based on some aspects having both good and bad effects.Sending multiple HTTP requests isn't necessary evil. Having 1 for images is perfect and having 2 is very very good too. Rememberthat what makes HTTP request slow is the time when the browser andserver communicate before actually sending the image (or any otherfiles). This step takes about 100 to 200 milliseconds from what I'veseen in past tests (it depending on many factors like serverlocation, internet speed, etc.).Does all the images in your sprite are used on each page ? If not, you could have one main sprite for images used on every pageload and other images in other separated sprites. If yourdetailed jpg image is used on only one page, keep it separate ! Yougonna have 2 requests on only this page and every other pages gonnahave 1 request with a much optimized sprite.Do you really need transparency ? If you don't have things like rounded icons needing transparency, you could consider compressing your .png sprite to .jpg as it could decrease it's size if the sprite size is more than about 8kb.After having made decisions based on that, you could also consider using the browser cache at your advantage so visitors won't download your sprites on every page load. That will vanish the 100 to 200 milliseconds of browser<-->server communications time.If your website is on an Apache server, add this in an .htaccess file at the root of your site :#enable file compressionSetOutputFilter DEFLATE#enable caching of external files listed below for 1 year<FilesMatch \.(ico|pdf|flv|jpe?g|png|gif|js|css|swf)$> ExpiresActive On ExpiresDefault access plus 1 year</FilesMatch>After doing that, the browser will search for your sprites and files in his cache before asking the server. If he find it, he wont ask the server for it. This will raise a new problem unfortunately : If I modify my sprite, how does the browser gonna know it if he don't talk to my server no more ?, well to force him to talk to the server again you gonna have to change the sprite's URL.An automated method I use to do this is putting the file's last modification date at the end of it with this PHP function (it'll return the file's url with modification date or the date you want to add) :function prepare_for_cache($url,$date_to_add=){$p=strrpos($url,'.'); $b=strtolower(substr(strrchr($url,'.'),1)); $t=$date_to_add?$date_to_add:@filemtime($url); return substr($url,0,$p).'-cb'.($t?$t:time()).'.'.substr($url,$p+1,strlen($url));}and then using the Apache's *mod_rewrite* module to ignore that modification date and load the file with the correct URL (the one of the file on the server without the modification date).#put the file's url back to normalOptions +FollowSymlinksRewriteEngine onRewriteRule (.*)-cb\d+\.(.*)$ $1.$2 This way you never have to worry about visitors cache being outdated and you don't have to change file's name on every site update...Hope it helps ! :) |
_codereview.24907 | I was wondering if this is the correct implementation of a times task to destroy a thread after it overruns a predefined time period:It works by creating a getting the thread from runtime.getRuntime, which it then uses to create a new process to run a command with the exec() method (creates a sub process). This is the process I want to terminate if it overruns. The code then handles the outputs streams from the process. before using waitFor() to let it finish running. However, in the circumstance it overruns, I have added a timer instance which I want it to use to terminate if the process overruns a defined time (retrieved using getTimeout()). However, I am worried the way I have done it will stop the original code from running.Here is the timer code:timer = new Timer();timer.schedule(new TimerTask() {@Overridepublic void run(){ processWasKilledByTimeout = true; if(process != null){ process.destroy(); }}}, getTimeout();I call this just after calling the exec method to create the subprocess.Here is the full method:private Process process;private boolean processWasKilledByTimeout = false;public String executeCommand()throws Exception { InputStreamReader inputStreamReader = null; InputStreamReader inputErrorStreamReader = null; BufferedReader bufferedReader = null; BufferedReader bufferedErrorReader = null; StringBuffer outputTrace = new StringBuffer(); StringBuffer errorTrace = new StringBuffer(); String templine = null; Timer timer = null; Runtime runtime = Runtime.getRuntime(); try { // Running exec produces one of two streams- combine to produce common string. process = runtime.exec(getCommand()); timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run(){ processWasKilledByTimeout = true; if(process != null){ process.destroy(); } } }, getTimeout(); // The normal output stream InputStream inputStream = process.getInputStream(); inputStreamReader = new InputStreamReader(inputStream); bufferedReader = new BufferedReader(inputStreamReader); while (((templine = bufferedReader.readLine()) != null) && (!processWasKilledByTimeout)) { outputTrace.append(templine); outputTrace.append(\n); } this.setStandardOut(outputTrace); // The error output stream InputStream inputErrorStream = process.getErrorStream(); inputErrorStreamReader = new InputStreamReader(inputErrorStream); bufferedErrorReader = new BufferedReader(inputErrorStreamReader); while (((templine = bufferedErrorReader.readLine()) != null) && (!processWasKilledByTimeout)) { errorTrace.append(templine); errorTrace.append(\n); } this.setErrorTrace(errorTrace); //Wait for process to finish and return a code int returnCode = process.waitFor(); //Set the return code this.setReturnCode(returnCode); if (processWasKilledByTimeout) { //As process was killed by timeout just throw an InterruptedException throw new InterruptedException(Process was killed before the waitfor was reached.); } } catch(IOException ioe) { String error = Error executing this command - +getCommand() +. +ioe.getMessage(); throw new CommandExecuterException(error); }catch(IllegalArgumentException ile){ String error = Illegal argument encountered while executing this command - +getCommand() +. +ile.getMessage(); throw new CommandExecuterException(error); } catch(InterruptedException ie) { error = Process was killed after timeout by watchdog. +ie.getMessage()+. ; throw new CommandExecuterException(error); } finally { //cancel the timer not needed anymore if(timer!= null){ timer.cancel(); } try { if(bufferedReader != null){ bufferedReader.close(); } if(bufferedErrorReader != null){ bufferedErrorReader.close(); } if(inputStreamReader != null){ inputStreamReader.close(); } if(inputErrorStreamReader != null){ inputErrorStreamReader.close(); } } catch(IOException ioe) { String error = Error closing stream - +getCommand() +. +ioe.getMessage(); throw new CommandExecuterException(error); } if(mProcess != null) { mProcess.destroy(); } } //Assemble both the standardout and the errortrace String tmpReturnString = getStandardOut().toString()+\n+getErrorTrace().toString(); return tmpReturnString; }Will this implementation override the threads run method? | Timer/timertask to destroy a process that overruns a defined time limit | java;strings;multithreading;timer;child process | null |
_cogsci.3520 | All of you probably know what the human 'circadian cycle' is, and depending on your personality, you would either be a night-owl or a morning-lark.I am interested in understanding the patterns of alertness and tiredness throughout the entire day, between waking up and sleeping.Personally, my alertness gears up in the morning until 12.30 pm, after which I will, consciously or not, begin to feel very very drowsy. This happens even in the absence of lunch (lunch makes people feel tired because the body works to break down the carbohydrates). I will continue feeling tired and exhausted throughout the entire afternoon before I become alert again from 5 pm onwards. And then of course, in the night I am quite alert.Here are my questions:Has research been conducted on this?Are there strategies to alter the patterns?Does the tiredness have to do with eating patterns?What are the relationships between tiredness and our circadian cycles? | How do I change my tiredness patterns? | sleep;consciousness | null |
_vi.5711 | I was recently looking at a another users .vimrc and noticed that they had settings which we commented as secure, private editing; how does one accomplish this, and what do the settings in question mean?I noticed one of them was nobackup which seems to me to mean that you don't create that ~ file that always hangs around.Note: you may want to port this over to the security stackexchange as well, they could probably use it over there. | How to ensure private secure editing in vim? | vimrc;security | For each of those options, do::help 'option'For example::help 'nobackup' |
_unix.192619 | There are a bunch of files in a remote directory which I want to access over sshfs and then script some operations. In practice, I wish to access different files at different times, and perform different operations on those files.Option 1: Mount the whole directory (one script). Then, run any file-specific script of my choosing.Option 2: Bundle the process of mounting the directory together with the file-specific script.Disadvantage of option 1: Before running the file-specific script, I forget whether the folder is mounted at all. It takes only 10 seconds to check, but is a minor irritation. I don't want the folder to be mounted at all times, or by default.Disadvantage of option 2: When processing a second or third file, I end up using sshfs to mount a remote directory which is already mounted. Can this do any harm?With respect to option 2, I suppose it's possible to check whether the directory is already mounted, like this: Check if directory mounted with bash [closed]. Does that sound like the best solution? | Remount sshfs directory - how to handle this? | mount;sshfs | Talking about option 2, it's not a good idea to mount an already mounted remote directory. If you mount it on another mount point and depending on what is your processing, you'd lose the lock mechanism.Furthermore, by default, fuse won't make any mount if the mount point is not empty.IMHO, the best way to proceed is what you say: check if the remote directory is already mounted, and if not, then mount it. It's only a few lines to append in your script, so easy to manage. For example:REMOTE=user@remote:/some/dirMOUNTPOINT=$( mount | grep -E ^${REMOTE}/? | awk '{print $3}' )if [ -z $MOUNTPOINT ] ; then echo Mounting remote directory...else echo $REMOTE is already mounted on $MOUNTPOINTfi |
_unix.255203 | When using fgrep, the man page says it will Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched.In bash, what's the correct way to insert newlines into the PATTERN argument (i.e. such that it'll match any of the lines according to the man page).I've tried the following with no luck:fgrep word1\nword2fgrep word1\rword2fgrep word1\nword2fgrep word1\rword2I'd like the command to be all on one line if possible. | How to insert newlines into PATTERN when using fgrep / grep -F / grep --fixed-strings | bash;quoting;newlines | null |
_codereview.30112 | I am building my first real php web app. as many you know this requires building LOTS of pages.in attempting to streamline the repetitive stuff i placed most of my stuff within a content.php page which looks like this?php include_once ('config3.inc');?><?php if(isset($_GET['p'])){ $page = $_GET['p'];}else { $page ='';}?><!DOCTYPE html><html xmlns=http://www.w3.org/1999/xhtml dir=ltr lang=en><head><meta name=viewport content=width=device-width, initial-scale=1.0> <meta http-equiv=Content-Type content=text/html; charset=utf-8 /> <title><?php echo $_SERVER['PHP_SELF'];?></title> <?php include('styles.inc');?> <?php include('api.inc'); ?> <?php include('scripts.inc');?></head><body><div id=container> <?php include ('header.inc');?> <div><!-- Content --> <?php include ('./content/'.$page);?> </div></div><!-- end container --><!-- Footer --><?php include ('footer.inc');?></body></html>This way when I want to call up a page I go to www.domain.com/content.php?p=pagename.php and it will wrap everything in the correct style sheets container and footer etc.had been working well until I started making my CRUD pages requiring that pagename use POST data.Is there a better approach for this or do I need to scrap this approach entirely? | Attempting to build template but Having Issue with gets and posts | php;template | Well a more elegant approach would be to use an MVC pattern as a starter framework I would suggest you to use Laravel it's very clear written and also an easy catch for people who are general new to MVC. The way your currently writing the code, you include to much business logic inside of it. Which in the long term is terrible because the code becomes un-maintainable, for that the MVC Pattern is the best way to write clear and maintainable code, but check it out yourself. An good article to start with should be this one by Nettuts, called MVC for Noobs don't get irritated by the name the article is pretty good and should get you a basic understanding of the MVC pattern.Hope I could be a little help :) |
_unix.252136 | How can I substring a 1.2.3 from a 1.2.3-SNAPSHOT from bash?I tried echo '1.2.3-SNAPSHOT' | grep -o ^.*(?=(\-SNAPSHOT$))but it didn't workIdeally I'd like a command to return 1.2.3 in both cases if the input is 1.2.3 or 1.2.3-SNAPSHOT | bash extract a substring from 1.2.3-SNAPSHOT | bash;grep;regular expression | You could eg. use egrep like this: echo 1.2.3-SNAPSHOT | egrep -o '[0-9]+.[0-9]+.[0-9]'It cover the scenario you described:return 1.2.3 in both cases if the input is 1.2.3 or 1.2.3-SNAPSHOTBut I suspect the version could also be like : 3.1.33 (more digits in the third number), in this case just adding a * does workecho 3.12.32-SNAoiashfsof | egrep -o '[0-9]+.[0-9]+.[0-9]*' |
_unix.259870 | Suspend doesn't halt my old computer (DELL Precision T7400) since I updated to xubuntu 15.10.I have a black screen after suspending but the computer is still working (fan, led, ...)I suspect systemd to mess up with pm-suspend.I tried to suspend in different ways: pm-suspendxfce4-session-logout --suspendUswsusp (s2ram)dbus-send --system --print-reply --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend`I have all the times the same result: blank screen but still power.Any fixing ideas? | Suspend isn't working anymore after upgrade to xubuntu 15.10 | ubuntu;systemd;xfce;suspend;xubuntu | null |
_unix.76820 | We currently have our website and website's CMS hosted on a dedicated host which runs Red Hat. We want to remove Red Hat and install CentOS instead.My question: is there a straight forward way of replicating all the server settings, PHP, Apache, SQL data, website files, and CMS settings from the Red Hat install, and moving them over to a new CentOS install?To make things easier, I don't mind installing the equivalent version of CentOS, based on the Red Hat version we currently have. So if we have Red Hat 6.0, I am happy to install CentOS 6.0 if it makes things more straight forward.The CMS we use is Express Engine. | Copy website from RedHat to CentOS | centos;rhel;migration;duplicate;replication | null |
_webmaster.91501 | I recently removed the hash from the URLs of my website built with AngularJS. Now I would like to remove the old URLs from the Google search results to avoid duplicate content. Problem is, when I try to do this via the Webmaster Tools' URL removal tool, the hash gets removed from my input and Google tries to remove my root URL from the index.Also, when I add Disallow: /#/ to my robots.txt file, ALL requests are being blocked.Should I just be patient and wait until Google recognizes the change or is there a way to remove these URLs?PS: Calling the hash URLs will not lead to a 404, they are just forwarded to the non-hashed page automatically. But no hash URL is included in my sitemap nor linked anywhere on my page.PPS: I found a similar question here, but it's not exactly the same as I didn't switch to hashbang URLs but instead I'm taking advantage of Googles relatively new ability to query AngularJS pages properly. | Remove hash URLs from Google search results after removing the hash | seo;google search console;google search;url | null |
_webapps.54597 | I noticed this code from a thread I was reviewing as I needed the same functionality to provide a timestamp when a particular row is edited in a Google Spreadsheet; function onEdit() { var s = SpreadsheetApp.getActiveSheet(); var r = s.getActiveCell(); if( r.getColumn() != 18 ) { //checks the column var row = r.getRow(); var time = new Date(); time = Utilities.formatDate(time, GMT-08:00, MM/DD/yy, hh:mm:ss); SpreadsheetApp.getActiveSheet().getRange('B' + row.toString()).setValue(time); }; };It works perfectly I was able to determine how to modify it to place the timestamp in column R which suited my needs but is there a simple way to make it ignore Row 1 which is the column headers? | Help with a previous question you answered | google spreadsheets;google apps script | You just need to wrap an extra conditional around the stamping code. Check the row value and only execute the stamping part if the row is NOT 1.function onEdit() { var s = SpreadsheetApp.getActiveSheet(); var r = s.getActiveCell(); if( r.getColumn() != 18 ) { //checks the column var row = r.getRow(); if (row != 1) { var time = new Date(); time = Utilities.formatDate(time, GMT-08:00, MM/DD/yy, hh:mm:ss); SpreadsheetApp.getActiveSheet().getRange('B' + row.toString()).setValue(time); }; }; }; |
_webmaster.72536 | I can't understand what i need to change to fix this issue in google analytics, i was playing with filters there but this error is still on google analyticsProperty mysite.com is receiving hits with utm_term parameters of the same text but different letter cases.Campaign parameters are case sensitive,so hits with the same keyword text but different letter caseswill show up separately in reports. As an example,the keywords newsletter and Newsletter would be considereddifferent and would have separate rows in reports.Property mysite.com is receiving hits with utm_term parametersof the same text but different letter cases,such as MY SITE, My Site, MYSITE, Mysite.To avoid having data from the same keywords split across multiple rows in reports,you can set a case filter for Campaign Term on your views.GA Code:(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-6807150-XX', 'auto');ga('send', 'pageview');` | Duplicate Campaign Parameters Google analytics | google analytics | null |
_cs.16474 | I am well aware of the DP solution to the traveling salesman problem; also known as the Held and Karp algorithm for TSP.I have implemented it with bitmask, and it's something like this:int TSP(int pos, int bitmask) { if (bitmask == (1<<(K+1))-1) return dist[pos][0]; // Completing the round trip if (memo[pos][bitmask] != -1) return memo[pos][bitmask]; int answer = INF; for (int i = 0; i <= K; i++) { if (i != pos && (bitmask & (1 << i)) == 0) answer = Math.min(answer, dist[pos][i] + TSP(i, bitmask | (1 << i))); } return memo[pos][bitmask] = answer; // Storing the best dist for the set of traveled cities and untraveled ones.This algorithm is quite fast; computation of 15 cities is relatively fast enough. However, I notice that it could be further improved to accommodate around 20 cities.1) If the dist matrix is symmetrical, perhaps we can make use of this property to prevent repeated calculations. (e.g a->b->c->d->a == a->d->c->b->a)2) Using both a upper and lower bound to prune. The above algorithm is able to get its first possible optimal solution in a very short time, might be able to use that.I have tried to improve the algorithm based on the aforementioned two principles. However, I don't get a better algorithm.Am I making a futile attempt at improving something impossible? What do you think? | Traveling Salesman with Held and Karp Algorithm | graph theory;np complete;dynamic programming;traveling salesman | null |
_unix.340309 | I have a machine recently updated to Fedora 25, running openSSD 7.4. Ever since then, logging in via ssh takes 25-30 seconds on a LAN where it normally takes no more than 1 second.Running the client with -vvv, using public key authentication, the pause occurs here.debug1: Authentication succeeded (publickey).Authenticated to crystalline.kodiak ([192.168.0.22]:127).debug1: channel 0: new [client-session]debug3: ssh_session2_open: channel_new: 0debug2: channel 0: send opendebug3: send packet: type 90debug1: Requesting [email protected]: send packet: type 80debug1: Entering interactive session.debug1: pledge: networkThis looks identical to output to other (Fedora 23, openSSH 7.2) machines on the same network which do not have any problem.Watching top on the server side during the login, systemd flares up briefly -- a few seconds -- at the beginning of the pause, something not noticeable on the other machines. After that the system is completely idle. Likewise, there is no unusual activity on the client side.Once logged in everything is fine.I have watched the exchange from the client with wireshark and during the pause there are no packets exchanged. The client and server are on ethernet through a router, so I am also able to watch the server address for any traffic. There's nothing going on.Here's the sshd_config:Port 127HostKey /etc/ssh/ssh_host_rsa_keyHostKey /etc/ssh/ssh_host_ecdsa_keyHostKey /etc/ssh/ssh_host_ed25519_keyIgnoreRhosts yesSyslogFacility AUTHPRIVLogLevel INFOTCPKeepAlive yesClientAliveInterval 120ClientAliveCountMax 15PermitRootLogin yesStrictModes yesPubkeyAuthentication yesAuthorizedKeysFile .ssh/authorized_keysPasswordAuthentication noChallengeResponseAuthentication noKerberosAuthentication noGSSAPIAuthentication noUsePAM yesX11Forwarding noUsePrivilegeSeparation sandboxAcceptEnv LANG LC_*Subsystem sftp /usr/libexec/openssh/sftp-server As per Sato Katsura's suggestion in comments, I have tried with UseDNS no; this did not make any difference. | SSH 7.4 prolonged pause at pledge: network | ssh;fedora;systemd;raspberry pi;sshd | null |
_softwareengineering.349510 | I'm trying to ascertain whether the use of multiple references to the same property is code smell / an anti-pattern, based on the needs of the organisation.As an example, consider:abstract class Person { public string Title { get; set; } public string Forename { get; set; } public string MiddleNames { get; set; } public string Surname { get; set; } public string GivenName { get { return Forename; } set { Forename = value; } } public string FamilyName { get { return Surname; } set { Surname = value; } } public string FirstName { get { return Forename; } set { Forename = value; } } public string LastName { get { return Surname; } set { Surname = value; } }}As you can see, I have several other properties, (kind of) aliasing or giving alternate names to properties in the object, but basically repeating exactly the functionality of the base property without exception.The reasons behind this is down to the naming conventions utilised in different areas of the organisation; it's providing multiple ways of addressing the same information, allowing each different area to use their preferred method of access. Because each of the other properties reference the base property, any programmatic changes only need to be included in the said base property.And so to clarify...@GregBurghardt has kindly posted alternatives to my conundrums, but I feel that I must qualify one of my statements a little more.In VB.NET I can quite happily code interfaces into my classes but use alternative names in the actual member implementation, like so...Public Interface IPerson Property Forename() As String Property Surname() As StringEnd InterfacePublic Class BillingPerson Implements IPerson Public Property GivenName() As String Implements IPerson.Forename ... Public Property FamilyName() As Int32 Implements IPerson.Surname ....End ClassNotice, here, that I've used a different property name for the (VB) property, but still implemented the true name of the interface (e.g. Public Property GivenName () As String Implements IPerson.Forename). This means that I can reference my BillingPerson class, despite the obvious property name differences, using the interface...'Define our interface type object here...Dim myP As IPerson = New BillingPerson()'Assign values directly to the interface members...myP.Forename = FredmyP.Surname = Bloggs'Output the interface members...Console.WriteLine(myP.Forename & & myP.Surname)...or I can refer to the original class directly....'Define our BillingPerson object here...Dim myP As BillingPerson'Assign values directly to the interface members...myP.GivenName = FredmyP.FamilyName = Bloggs'Output the interface members...Console.WriteLine(myP.Forename & & myP.Surname)Using this methodology, my problem would be very short-lived , and I'd be able to create as many classes based on the interface as I need.This doesn't appear to work the same way in C#, however, where I can't directly alias the name of the interface members. | Multiple properties/methods giving the same result | c#;anti patterns;code smell;properties | Since your organization can't seem to agree on naming things, it feels like you need to architect your application assuming there will be lots of things they don't agree on. It sounds like it will only get worse.Maybe what you need instead is to adopt more of a facade or adapter pattern.So, here is your standard person:public class Person{ public string Title { get; set; } public string Forename { get; set; } public string MiddleNames { get; set; } public string Surname { get; set; } // Enterprise wide behavior goes here}And the Billing Department can have its own way:public class BillingDepartmentPerson{ private readonly Person person; public string GivenName { get { return person.Forename; } set { person.Forename = value; } } public string FamilyName { get { return person.Surname; } set { person.Surname = value; } } public string FirstName { get { return person.Forename; } set { person.Forename = value; } } public string LastName { get { return person.Surname; } set { person.Surname = value; } } public BillingDepartmentPerson(Person person) { this.person = person; } // Billing department specific behavior goes here}And so can the Shipping Department:public class ShippingDepartmentPerson{ private readonly Person person; public string Title { get { return person.Title; } set { person.Title = value; } } public string Forename { get { return person.Forename; } set { person.Forename = value; } } public string MiddleNames { get { return person.MiddleNames; } set { person.MiddleNames = value; } } public string Surname { get { return person.Surname; } set { person.Surname = value; } } public ShippingDepartmentPerson(Person person) { this.person = person; } // Shipping department specific behavior goes here}Yes, there is some repetition of code, but now you have a way of encapsulating the organization area specific functionality and separate it from the common, enterprise wide functionality in the Person class.It also means you can't accidentally invoke operations specific to the billing department in the context of the shipping department. It gives you a nice Separation of Concerns so refactoring these different areas can be isolated, and the effects of any refactoring jobs can be limited in scope (see also the Open/Closed Principal).Paul commented:if this had been VB.NET, it wouldn't have been a problem, I could have used an interface and aliased all the member names. But it isn't!... in VB.NET I can do something like: Public Function x() As Boolean Implements IY.a. I haven't seen anything in C# to allow this.C# does:public class MyItems : IEnumerable<int>{ public IEnumerator<int> GetEnumerator() { throw new NotImplementedException(); } // Implement an interface method explicitly System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw new NotImplementedException(); }}VB.NET and C# compile down to the same exact MSIL code that gets executed in the same exact Common Language Runtime.C# and VB.NET, as long as you compare Visual Studio and .NET framework versions, support the same features. |
_softwareengineering.177245 | In my project, I have a collection of classes. These classes for the most part contain data which is updated infrequently or not at all - that is they don't really do much - their purpose is to be passed around consumer objects that do do things, seperating data from functionality.I would like to continue this model, by allowing the user to treat them as such - i.e. they can be serialised/deserialised with no special code, can easily be used to compose larger classes, subclassed, etc.The catch is, as many control things like the GPU, they aren't really decoupled or stateless at all, because for every one there are a whole load of resources that need to be created and disposed of during the life of the application - but the user doesn't need to worry about that.I would like to know the preferred way to attach all the information to the simple object in a way that is safe, maintains the illusion of statelessness, but is also clear to anyone else looking at the code what is going on (also, the objects are defined in different assemblies).Q. Why not just put A in B and pass around Object B?A. Because the user creates Object A, and works with Object A only, and shouldn't need to know Object B exists at all.Q. Why not use factories and create Object C?A. Because then Assembly A can't contain classes composed of a whole load of Object-A-like-objects (because the factory would be defined in Assembly B so they wouldn't be able to be instantiated).Q. Then how is Object B created?A. Object B is created and populated on demand, when Object A is passed to a method that needs it.Note - I know this problem isn't 'hard' and there are many ways to do it (at the moment I have an abstract member added to all of them which is casted in the consumer and it works OK), I just want some new ideas/opinions on what is the best way - what would you like to see if you inherited the code? | What is the best way to compose an object with components across two assemblies? | c#;design patterns | null |
_webapps.37707 | Games on Facebook (such as Bejewelled Blitz, Diamond Dash) that I have been playing for a long time (and played this morning) now won't load. Clicking on a name makes the page jump to the Facebook sign-in page, but it keeps going in and out, flashing the log in page on and off. I have gone and clicked Facebook in my favorites bar to get it back to the news feed page.Any suggestions? | Games on Facebook keep sending me to the sign in page | facebook;facebook games | null |
_computerscience.4454 | I'm trying to load an array of float to a fragment shader using a uniform buffer object, but it doesn't work.In the fragment shader I declared the following uniform block:/// Spectrum samples.const int samples = 31;layout(std140) uniform SpectralDataBlock { float illuminant[samples]; float object[samples];};Then on client side in my C++ code:float illuminant[31] = { 82.754900,91.486000,93.431800,86.682300,104.865000,117.008000,117.812000,114.861000,115.923000,108.811000,109.354000, 107.802000,104.790000,107.689000,104.405000,104.046000,100.000000,96.334200,95.788000,88.685600,90.006200,89.599100, 87.698700,83.288600,83.699200,80.026800,80.214600,82.277800,78.284200,69.721300,71.609100};float object[31] = { 0.051, 0.05, 0.049, 0.049, 0.049, 0.049, 0.048, 0.047, 0.045, 0.044, 0.044, 0.044, 0.044, 0.044, 0.045, 0.047, 0.05, 0.057, 0.072, 0.109, 0.192, 0.332, 0.486, 0.598, 0.654, 0.686, 0.7, 0.707, 0.718, 0.724, 0.729};std::copy(illuminant, illuminant + 31, spectralData);std::copy(object, object + 31, spectralData + 31);blockId = glGetUniformBlockIndex(program, SpectralDataBlock);glUniformBlockBinding(program, blockId, bindingPoint);glGetActiveUniformBlockiv(program, blockId, GL_UNIFORM_BLOCK_DATA_SIZE, &blockSize);glGenBuffers(1, &bufferId);glBindBuffer(GL_UNIFORM_BUFFER, bufferId);glBufferData(GL_UNIFORM_BUFFER, blockSize, spectralData, GL_DYNAMIC_DRAW);glBindBufferBase(GL_UNIFORM_BUFFER, bindingPoint, bufferId);Unfortunately, the data doesn't get correctly loaded. Are there any limitation in OpenGL ES the prevent to use float[] in an uniform buffer object? Are there any error in my code above? | OpenGL ES 3 - Uniform buffer object with float array | opengl es;uniform buffer object | Let's review what the specification says about std140 layout of arrays:If the member is an array of scalars or vectors, the base alignment and array stride are set to match the base alignment of a single array element, according to rules (1), (2), and (3), and rounded up to the base alignment of a vec4. The array may have padding at the end; the base offset of the member following the array is rounded up to the next multiple of the base alignment.Emphasis added.So, if you have an array of float, the array stride shall be the same as the base alignment of a vec4. Also, each array will be padded at the end to the base alignment of a vec4. Yes, a float[] takes up the same room as a vec4[] of the same size.Welcome to the wonderful world of std140 layout.If you want to have a real array of floats in a UBO... well, it's best to avoid wanting that. But if you have absolutely no other choice, then I suggest making it an array of vec4. Obviously, the size of this array will be the size you actually want, divided by 4 and rounded up:const int samples = 31;const int arraySize = ((samples + 3) / 4);To fetch a single float from this array, use math:arrayOfVec4[index / 4][index % 4]Note that OpenGL ES 3.0 does allow non-constant array indexing of vec and mat types. It also allows the integer operations needed to pull this off. |
_webmaster.107456 | Why do I get different results when I search Google for our site?No space used.site:www.av-iq.com produces 747,000 resultsSpace after product.site: www.av-iq.com produces 17,000,000 results | Different results in searching Google site: using a space or not? | google | As you have found, these are two different searches. As per the Google help docs:Dont put spaces between the symbol or word and your search term. A search for site:nytimes.com will work, but site: nytimes.com won't.Without the space, the site: operator is applied to the stated domain, so only results within that domain are returned.Whereas, when space separated, you now have two search phrases site: and www.example.com. And the search clearly returns results from multiple websites, not limited to the stated domain. All sites that simply reference www.example.com (and many variations of) are returned in the search results.The results are even more exaggerated when literally using the example.com domain.No space used: site:www.example.com - no results!Space after operator: site: www.example.com - 1,142,000,000 results. |
_cs.30205 | Is the cardinality of the set of partially recursive functions greater than the cardinality of the set of recursive functions ? | Are there more partially recursive functions than and recursive functions? | computability;combinatorics | No they have the same cardinality. They have the cardinality $\aleph_0$. Both sets are infinite in size so we have to compare them based on their level of infiniteness, since as we know there are infinite levels of infinity. Both sets are countably infinite so we say they have the same cardinality.To expand on this and show why this is the case: The set of partially recursive functions are infinite by design. Also they are computable, so by the Church-Turing thesis they are solvable by a Turing machine. Since there are only countably infinite Turing machines there can only be countably infinite partial recursive functions. The same argument can be used on the set of recursive functions. |
_softwareengineering.234942 | I've been confused for a while about the differences between the patterns Factory Method and Abstract Factory. Been doing a lot of research, still confused.I have one question:Is the only difference between the two patterns, is that Factory Method produces one object, and Abstract Factory produces a family of objects? Or are there more differences?I read a lot on this site and the web about this, only confused me more. I know how to use the patterns, but am having trouble differentiating between the two. | Differentiating between Factory Method and Abstract Factory | design;design patterns;factory method | A factory method is essentially just a constructor with another name. This can be useful e.g. to guarantee correct initialization, registration, or to supply default values without having to subclass the product:private List<WeakReference<Product>> products = ...;public Product makeProduct(Param x) { Product instance = new Product(x, default value); instance.initialize(42); products.add(new WeakReference<>(instance)); return instance;}An abstract factory pattern is usually implemented in terms of factory methods, but here the aim is to leave the concrete type unspecified until runtime. So we have a set of products:interface Product {}class ConcreteProduct1 implements Product {}class ConcreteProduct2 implements Product {}And we have an abstract factory:interface Factory { public Product makeProduct();}Such a factory might be used by client code: factory.makeProduct(). Which concrete product is used is delayed to runtime.class ConcreteFactory1 implements Factory { public Product makeProduct() { return new ConcreteProduct1(); }}class ConcreteFactory2 implements Factory { public Product makeProduct() { return new ConcreteProduct2(); }}Typically, an abstract factory will have multiple factory methods for a set of related types, you can think of a factory instance as a theme. Abstract factories are also useful for dependency injection.The factory method pattern is a combination of factory methods with the strategy pattern. Here the idea is that our class needs to create some instance, but will let subclasses override the choice of the instance. In other words, the client and the factory are the same.class DomainSpecificStuff { public doDomainSpecificStuff() { Product p = this.makeProduct(); p.frobnicate(); } protected makeProduct() { return new ConcreteProduct1(); }}class OtherDomainSpecificStuff { @Override protected makeProduct() { return new ConcreteProduct2(); }}So the strategy pattern allows for limited dependency injection through the use of inheritance when used as the FMP.So what are the useful distinctions between the factory method pattern and abstract factory pattern?Client: The client of the factory method in the FMP is the factory itself it's just a spin on the strategy pattern, after all. The client of the AFP is some other class.Number of Objects: Typically, the FMP will only have a single factory method, whereas the AFP can be used to produce multiple related objects. It is not the case that an AFP must have at least two factory methods, although the creation of related, interdependent objects is where the AFP shines.Intent: The AFP is a collection of related factory methods which can be passed around in client code. The FMP allows subclasses to swap out a dependency. |
_computergraphics.5057 | In my real time ray tracer, I shoot primary rays from the eye, and at hit points, I trace to a single light source to determine if the object is shadowed or lit.Pretty straightforward stuff so far.However I have recently added perfect mirrors to my scene.The reflections work just fine.However, the shadow calculation breaks down!A shadowed point could still be lit by the light source via a mirror.Is there an easy way to handle shadow rays towards bounced light?NOTE: I am not talking about the projection visible in the mirror surface: this shows shadowed and lit objects. But the directly visible scene itself, there are more shadowed objects than there should be, as some of the scene is lit via a mirror. | Tracing shadow rays in a scene with mirrors | raytracing;shadow;reflection | It depends how you define easy and what kind of constraints you have. The general case of this is rendering caustics but that's probably not what you're looking for if real time is your target.If your mirrors are always flat as in your demo and you only want to support a single bounce, the easiest I can see would be to reflect your light sources on the other side of the mirror's plane, before you start a frame. Let's call each reflection a virtual light source. Then for each of these, test if the ray between whatever you're shading and the virtual light source hits inside the mirror (simple plane/ray test). If it does hit then you trace the actual shadow ray to the mirror and the rest of the shadow ray from the mirror to the actual light source.This obviously won't scale well to many mirrors. I think it could be adapted to 2-3 bounces if the mirror and light count is low. The number of virtual lights could quickly grow out of hand though. |
_unix.33315 | Possible Duplicate:What does etc stand for? What does it mean? All I can think is etcetera. By my teacher told me that there is a more appropriate meaning. | What is the meaning of /etc (as acronym) | etc | null |
_codereview.8358 | I'm fairly new to Python and currently building a small application to record loans of access cards to people in a company. I'm using wxPython for the GUI and SQLAlchemy for the CRUD. I'm loosely following Mike Driscoll's tutorial for a similar application but I want to add some extra things that he hasn't implemented (he has most controls in the same window, but I'm passing things a lot between dialogues and windows and it's starting to look messy).Particularly concerned about the following method in dialogs.py:def OnCardReturn(self, event): Call the controller and get back a list of objects. If only one object return then set that loan as returned. If none returned then error, no loans currently on that card. If more than one returned something has gone wrong somewhere, but present a list of the loans against that card for the user to pick the correct one to return. value = self.txtInputGenericNum.GetValue() loans = controller.getQueriedRecords(self.session, card, value) #returns a list of objects numLoans = len(loans) if numLoans == 1: controller.returnLoan(self.session, value) #returns nothing successMsg = Card + str(value) + has been marked as returned showMessageDlg(successMsg, Success!) elif numLoans == 0: failureMsg = Card + str(value) + is not currently on loan showMessageDlg(failureMsg, Failed, flag=error) elif numLoans > 1: failureMsg = More than one loan for + str(value) + exists. Please select the correct loan to return from the next screen. showMessageDlg(failureMsg, Failed, flag=error) selectReturnLoan = DisplayList(parent=self, loanResults=loans, returnCard=True) selectReturnLoan.ShowModal() selectReturnLoan.Destroy()The controller is still under construction, so no complete code yet, but I've commented in what is returned by the calls to it so it's still possible to see what the functionality is. | Recording loans of access cards to people in a company | python;beginner;mvc | null |
_unix.36998 | I'm using latexmk -pdf -pvc to keep compiling my LaTeX files to PDFs while they are displayed in evince. I'm doing that a lot with different files and I keep needing to zoom the PDF content, resize the window and enable always on top. I like to be able to do this automatically using the command line.Using -geometry doesn't work with evince (Unknown option) and the command line help doesn't say anything about it as well. I tried the preview -w option which gives me a nice sized window, but the automatic update feature I need seems to be disabled in this mode. I'm using Ubuntu 11.10 with the classic desktop and the default window manager.Is there a possibility to set both the size and position as well as always on top from the command line for evince (or similar PDF viewer with auto-update)? I think there might be some window manager control tool which can resize and configure windows from the command line.I'm aware of an evince feature request to add size and position arguments, which would be half the job already, but I don't think it will be implemented soon. | Open PDF previewer width specific size and position and always on top from command line | gnome;pdf;window;evince;metacity | Since evince lacks options to explicitly control its own window management (as do most applications), the next approach is to control evince externally from the window manager itself. Assuming GNOME with metacity as the window manager, you'll have to use devilspie to get the window matching features.Install devilspie from your official Ubuntu repositories.Configure latexmk to use evince --name LaTeX_evince (instead of the default which is evince). This distinguishes your LaTeX evince windows from other evince windows.Configure devilspie by adding the following to ~/.devilspie/latex_evince.ds (if (matches (window_class) ^LaTeX_evince) (begin (above) (geometry <width>x<height>+<x>+<y>)))Replace the geometry string with one for the actual size and positionyou want. Caveat: syntax not tested by me.Add devilspie to your autostarted application list under Applications > Preferences > Session.MiscellanyA good devilspie reference.Apparently in the next Ubuntu release, devilspie will be deprecated in favor of devilspie2. You'll have to update your configuration file syntax then. |
_codereview.143737 | The idea behind this problem is to represent a configuration of 8 queens with a one-dimensional array. So a[0] represents the first row, a[1] the second row etc. and a[row]=column position, where column position represents the row position of the queen.Is there anything I can improve?#include <iostream>#include <math.h>using namespace std;int main() { int a[7]; int m, b, i=0, x, y, k=0, c,u; for(u=0; u<8; u++){ cin>>a[u]; } for(m=0; m<7; m++){ for(b=m+1; b<=7; b++){ if(a[m]==a[b]) i++; } } for(x=0; x<7; x++){ c=0; for(y=x+1; y<=7; y++){ c++; if(abs(a[x]-a[y])==c) k++; } } if(i==0 && k==0) cout<<valid; else cout<<invalid;} | Eight queens in C++ | c++;chess | null |
_webapps.83018 | A faculty member accidentally created 2 profiles and has citations in both of them. How can the profiles be merged so that there is one profile with all the citations? | How to merge 2 Google Scholar profile, each with citations | google scholar | null |
_softwareengineering.133973 | I'm working on a client library to interface with my company's api, and we generate a user ticket when the user logs in using the api. Obviously I don't want to send the user ticket to the client for resubmission on subsequent requests - is it (relatively) safe for me to cache this value in $_SESSION for later calls? | How safe is it to cache a user ticket in SESSION | php;api;authentication | I don't see why it wouldn't be. The biggest consideration that I can see is you don't want your data being clobbered by the other code that is using the session. My common practice in this instance is to create a session key of __{$company_name} and store all of my bits there. This drastically reduces the chance that some other code will nuke my session variables. |
_unix.25642 | I am writing a Ruby script inside which I would like to invoke/execute some shell commands.The shell commands I would like to run should check if a directory named 'tmp' under /var/lib/mysql/ exists or not.if it exists, remove all the files (including sub-dirs & files) inside /var/lib/mysql/tmp/. If it does not exist, just create it.(P.S. only root user can access /var/lib/mysql/)I know mkdir will create directory, but I am not sure how to make a command to check if the directory exists or not. As a whole, I would like to have some shell commands to achieve the scenario described above, and the more elegant way the better, as I will run the shell commands in a ruby script.Anyone can Help me ? | shell commands to check & create dir | shell;directory;rm | null |
_cs.23662 | The original problem of Domino Tiling and Wang Tile has great theoretical interest on computability theory... However, the great emerging problem on application of Wang Tile in material science and physics requires the tiling to satisfy one more condition:The tiling should satisfy some proportionality, say, Tile 1 should appear with frequency 1/16, Tile 2 with frequency 9/16, Tile 3 with 6/16, Tile 4 with frequency 0...The most important decision problem is the following:Could a given set of Tile tile a grid of size NxN satisfying the frequency constraint within a error of +-epsilon.For example: could the set {Tile 1, Tile 2, Tile 3, Tile 4} tile the NxN grid with frequency 1/16+-0.01, 9/16+-0.01, 6/16+-0.01, 0+-0.01 respectively....From one of my previous post:Algorithms for NP complete problemI realize the decision problem of tiling without such constraint could be modeled by SAT... With this constraint the problem becomes ridiculously difficult and I eagerly seek for solutions towards this finite decidable problem.... (we could forget epsilon for a moment if the problem with epsilon is too hard)...So here is the question: how do we model this problem in MIP or SAT or any other optimization algorithm?For more detail why this problem is practical in material science and physics, see my previous post:coloring in latticereference for wang tileComputational approach deciding whether a set of Wang Tile could tile the space up to some sizeP.S. this is a bounty question from mathoverflow without yet a applicable solution...Application of Combinatorics, Logic and computability theory in physical science: Tiling of Wang Tile with proportionality | Application of Combinatorics, Logic and computability theory in physical science: Tiling of Wang Tile with proportionality | complexity theory;optimization;logic;satisfiability | Use a SAT solver that also allows you to express pseudo-Boolean constraints.Encoding the verification of the existence of the tiling of an NxN grid as a CNF formula is straightforward. Each grid position will have a set of variables associated with it of which only one will be set true if a particular tile occupies that position. Add clauses that force exactly one of each set of variables to be set true. Add other clauses that demand grid neighbors be the correct sort of tile out of the available choices.The epsilon requirement means requiring that only a fixed number of the grid position variables for each tile type be set true, or that the number set be within a certain range. This is complicated by the fact that the naive expression of such constraints in CNF takes a number of clauses exponential in the number of variables involved. There are more efficient encodings that involve adder and comparison circuits, but a solver that accepts pseudo-Boolean constraints directly will either work without such encodings or will save you the trouble of creating these circuit encodings yourself. |
_unix.42406 | I am using yaourt to automatically compile Apache from source every time theres an update available from extra. I am doing this so that I can have a custom suexec docroot (/srv/www rather than the default /srv/http). This has worked flawlessly for several updates, until now.$ yaourt -S apache==> Building apache from sources.==> Retrieving PKGBUILD and local sources...receiving file list ... done./PKGBUILDapache.conf.dapache.installapache.tmpfiles.confapachectl-confd.patcharch.layouthttpdhttpd.logrotatepcre_info.patchsent 199 bytes received 10416 bytes 7076.67 bytes/sectotal size is 9809 speedup is 0.92=> removes/replaces '--with-suexec-docroot=\/srv\/http' by '--with-suexec-docroot=\/srv\/www' in global--- ./PKGBUILD 2012-07-06 00:02:13.000000000 -0400+++ ./PKGBUILD.custom 2012-07-06 15:49:03.000000000 -0400@@ -102,7 +102,7 @@ --enable-so \ --enable-suexec \ --with-suexec-caller=http \- --with-suexec-docroot=/srv/http \+ --with-suexec-docroot=/srv/www \ --with-suexec-logfile=/var/log/httpd/suexec.log \ --with-suexec-bin=/usr/sbin/suexec \ --with-suexec-uidmin=99 --with-suexec-gidmin=99 \==> Edit PKGBUILD ? [y/N] (A to abort)==> ------------------------------------==> n==> apache dependencies: - openssl (already installed) - zlib (already installed) - apr-util (already installed) - pcre (already installed)==> Edit apache.install ? [y/N] (A to abort)==> ------------------------------------------==> n==> Continue building apache ? [Y/n]==> --------------------------------==> ==> Building and installing package==> Making package: apache 2.2.22-4 (Thu Jul 5 14:47:33 EDT 2012)==> Checking runtime dependencies...==> Checking buildtime dependencies...==> Retrieving Sources... -> Downloading httpd-2.2.22.tar.bz2... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 5252k 100 5252k 0 0 93231 0 0:00:57 0:00:57 --:--:-- 93283 -> Downloading httpd-2.2.22.tar.bz2.asc... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 835 100 835 0 0 5191 0 --:--:-- --:--:-- --:--:-- 10437 -> Downloading 02-rename-prefork-to-itk.patch... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- 0:01:06 --:--:-- 0curl: (7) couldn't connect to host==> ERROR: Failure while downloading 02-rename-prefork-to-itk.patch Aborting...==> ERROR: Makepkg was unable to build apache.==> Restart building apache ? [y/N]==> -------------------------------==> The problem seems to be that curl cant find 02-rename-prefork-to-itk.patch. I dont know what URL thats located at, in what file its specified, or how I might find an alternate location for it. Any idea what is going on/how to troubleshoot? | Arch Linux: Yaourt/Makepkg Can Not Build Apache | arch linux;apache httpd;pacman;yaourt | The host where some patches are located is down. But we can change it to another one.First. Just download the PKGBUILD with yaourt:yaourt -G apacheChange the following lines in PKGBUILD:_itkurl=http://mpm-itk.sesse.net/apache2.2-mpm-itk-2.2.17-01To:_itkurl=http://distfiles.alpinelinux.org/distfiles/Also, the patch 03-add-mpm-to-build-system.patch has a different md5, so we fix it. Just change the 4th line in the array md5sums'cdfa04985a0efa850976aef01c2a0c40'To:'131408ad4dc7b18547b4e062e7e495ab'The working PKGBUILD is here: http://pastebin.com/iK48xx8fYou can just replace it, if you want. And build apache with:makepkg -i |
_unix.335938 | I'm trying to generate a frequency count of each unique line in a file and apply that count to EACH line. The solutions I have seen using uniq rationalise >1 frequencies to one line.In other words, with the solutions I have seen up to now:bananabananaorangebananabecomes3 banana1 orangeWhat I WANT to see, however, is:3 banana3 banana1 orange3 bananaSo basically I don't want any fiddling around with the original lines, just the frequency count added. Any ideas ? | Count frequency of occurrence of each line and apply to each line | uniq | null |
_webmaster.20273 | Can you transfer a national domain (like .pl) to a foreign registrar, one that does not actually offer buying that type of domain? | Transfer a national domain to foreign registrar? | transfer | null |
_unix.226880 | Is there any way to archive a folder and keep the owners and permissions intact? I'm doing a backup of some files, which I want to move using a usb-stick, which has a FAT filesystem. So the idea was to keep all this information and file setting within an archive.I know that the -p option for tar keeps the permissions, but still not the ownership. | How do I archive a folder keeping owners and permissions intact? | permissions;tar;file copy | tar's default mode is to preserve ownership and permissions on archive creation; I don't believe there's even an option not to store the data. When you extract an archive, if you're a normal user, the default is to use stored permissions minus the umask and set the owner to whoever's extracting; if you're superuser, the default is to use stored permissions and ownership verbatim. There are options to control how these metadata are restored on extraction (see the man page). |
_codereview.45666 | This class encapsulates a List<KeyValuePair> (see List<T> implementation here, and KeyValuePair implementation here) and exposes a richer set of members than the typical Scripting.Dictionary, ..not to mention the anemic Collection class.The class enforces some type safety, in the sense that if you add a KeyValuePair<String, Integer>, then you'll only be allowed to add KeyValuePair<String, Integer> instances, the object will raise an error if you try adding, say, a KeyValuePair<String, Control>, or anything that's not a KeyValuePair<String, Integer>.The OptionStrict property enables allowing more flexibility and adding a KeyValuePair<String, Byte> to a Dictionary<String, Integer>, for example (but not the opposite).As with the List<T> implementation, this class uses procedure attributes (not shown) which make the Item property the default property (so myDictionary(i) returns the value at index i), and the NewEnum property enables iterating all values with a For Each loop construct.Private Type tDictionary Encapsulated As List TKey As String IsRefTypeKey As Boolean TValue As String IsRefTypeValue As BooleanEnd TypePrivate Enum DictionaryErrors TypeMismatchUnsafeType = vbObjectError + 1001End EnumPrivate this As tDictionaryOption ExplicitPrivate Sub Class_Initialize() Set this.Encapsulated = New List this.Encapsulated.OptionStrict = TrueEnd SubPrivate Sub Class_Terminate() Set this.Encapsulated = NothingEnd SubPublic Property Get Count() As Long Count = this.Encapsulated.CountEnd PropertyPublic Property Get Keys() As List Dim result As New List Dim kvp As KeyValuePair result.OptionStrict = this.Encapsulated.OptionStrict For Each kvp In this.Encapsulated result.Add kvp.Key Next Set Keys = resultEnd PropertyPublic Property Get Values() As List Dim result As New List Dim kvp As KeyValuePair result.OptionStrict = this.Encapsulated.OptionStrict For Each kvp In this.Encapsulated result.Add kvp.value Next Set Values = resultEnd PropertyPublic Property Get OptionStrict() As Boolean OptionStrict = this.Encapsulated.OptionStrictEnd PropertyPublic Property Let OptionStrict(value As Boolean) this.Encapsulated.OptionStrict = valueEnd PropertyPrivate Function ToKeyValuePair(k As Variant, v As Variant) As KeyValuePair Dim result As New KeyValuePair If IsObject(k) Then Set result.Key = k Else result.Key = k End If If IsObject(v) Then Set result.value = v Else result.value = v End If Set ToKeyValuePair = resultEnd FunctionPublic Property Get Item(k As Variant) As Variant Dim i As Long i = Keys.IndexOf(k) If i = -1 Then Err.Raise 9 'index out of range If this.IsRefTypeValue Then Set Item = Values(i) Else Item = Values(i) End IfEnd PropertyPublic Property Set Item(k As Variant, v As Variant) Dim kvp As KeyValuePair Dim i As Long i = Keys.IndexOf(k) If i <> -1 Then Set kvp = ToKeyValuePair(k, v) Set this.Encapsulated(i) = kvp Else Add k, v End IfEnd PropertyPublic Property Let Item(k As Variant, v As Variant) Dim kvp As KeyValuePair Dim i As Long i = Keys.IndexOf(k) If i <> -1 Then Set kvp = ToKeyValuePair(k, v) Set this.Encapsulated(i) = kvp Else Add k, v End IfEnd PropertyPublic Sub Add(k As Variant, v As Variant) Dim kvp As KeyValuePair Set kvp = ToKeyValuePair(k, v) If Keys.Contains(k) Then Err.Raise 457 'key already exists If ValidateItemType(kvp, ThrowOnUnsafeType:=True) Then this.Encapsulated.Add kvpEnd SubPrivate Function ValidateItemType(kvp As KeyValuePair, Optional ThrowOnUnsafeType As Boolean = False) As Boolean If this.TKey = vbNullString And this.TValue = vbNullString Then this.TKey = TypeName(kvp.Key) this.IsRefTypeKey = IsObject(kvp.Key) this.TValue = TypeName(kvp.value) this.IsRefTypeValue = IsObject(kvp.value) End If ValidateItemType = IsTypeSafe(kvp) If ThrowOnUnsafeType And Not ValidateItemType Then RaiseErrorUnsafeType ValidateItemType(), kvp.ToStringEnd FunctionPublic Function IsTypeSafe(kvp As KeyValuePair) As Boolean'Determines whether a value can be safely added to the List. IsTypeSafe = (this.TKey = vbNullString Or this.TKey = TypeName(kvp.Key)) _ And (this.TValue = vbNullString Or this.TValue = TypeName(kvp.value)) If IsTypeSafe Then Exit Function Select Case this.TKey Case String: IsTypeSafe = IsSafeKeyString(kvp.Key) If IsTypeSafe Then kvp.Key = CStr(kvp.Key) Case Boolean IsTypeSafe = IsSafeKeyBoolean(kvp.Key) If IsTypeSafe Then kvp.Key = CBool(kvp.Key) Case Byte: IsTypeSafe = IsSafeKeyByte(kvp.Key) If IsTypeSafe Then kvp.Key = CByte(kvp.Key) Case Date: IsTypeSafe = IsSafeKeyDate(kvp.Key) If IsTypeSafe Then kvp.Key = CDate(kvp.Key) Case Integer: IsTypeSafe = IsSafeKeyInteger(kvp.Key) If IsTypeSafe Then kvp.Key = CInt(kvp.Key) Case Long: IsTypeSafe = IsSafeKeyLong(kvp.Key) If IsTypeSafe Then kvp.Key = CLng(kvp.Key) Case Single IsTypeSafe = IsSafeKeySingle(kvp.Key) If IsTypeSafe Then kvp.Key = CSng(kvp.Key) Case Double: IsTypeSafe = IsSafeKeyDouble(kvp.Key) If IsTypeSafe Then kvp.Key = CDbl(kvp.Key) Case Currency: IsTypeSafe = IsSafeKeyCurrency(kvp.Key) If IsTypeSafe Then kvp.Key = CCur(kvp.Key) Case Else: IsTypeSafe = False End Select If Not IsTypeSafe Then Exit Function Select Case this.TValue Case String: IsTypeSafe = IsSafeValueString(kvp.value) If IsTypeSafe Then kvp.value = CStr(kvp.value) Case Boolean IsTypeSafe = IsSafeValueBoolean(kvp.value) If IsTypeSafe Then kvp.value = CBool(kvp.value) Case Byte: IsTypeSafe = IsSafeValueByte(kvp.value) If IsTypeSafe Then kvp.value = CByte(kvp.value) Case Date: IsTypeSafe = IsSafeValueDate(kvp.value) If IsTypeSafe Then kvp.value = CDate(kvp.value) Case Integer: IsTypeSafe = IsSafeValueInteger(kvp.value) If IsTypeSafe Then kvp.value = CInt(kvp.value) Case Long: IsTypeSafe = IsSafeValueLong(kvp.value) If IsTypeSafe Then kvp.value = CLng(kvp.value) Case Single IsTypeSafe = IsSafeValueSingle(kvp.value) If IsTypeSafe Then kvp.value = CSng(kvp.value) Case Double: IsTypeSafe = IsSafeValueDouble(kvp.value) If IsTypeSafe Then kvp.value = CDbl(kvp.value) Case Currency: IsTypeSafe = IsSafeValueCurrency(kvp.value) If IsTypeSafe Then kvp.value = CCur(kvp.value) Case Else: IsTypeSafe = False End SelectErrHandler: 'swallow overflow errors: If Err.number = 6 Then Err.Clear Resume Next ElseIf Err.number <> 0 Then RaiseErrorUnsafeType IsTypeSafe(), kvp.ToString End IfEnd FunctionPrivate Function IsSafeKeyString(value As Variant) As Boolean On Error Resume Next IsSafeKeyString = (this.TKey = vbNullString Or this.TKey = TypeName(value)) If IsSafeKeyString Or OptionStrict Then Exit Function Dim result As Boolean result = CStr(value) IsSafeKeyString = (Err.number = 0) Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeKeyDate(value As Variant) As Boolean On Error Resume Next IsSafeKeyDate = (this.TKey = vbNullString Or this.TKey = TypeName(value)) If IsSafeKeyDate Or OptionStrict Then Exit Function Dim result As Boolean result = CDate(value) IsSafeKeyDate = (Err.number = 0) 'If this.OptionTrace And IsSafeKeyString(Value) Then Debug.Print TRACE: IsSafeKeyDate( & CStr(Value) & ) : & IsSafeKeyDate Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeKeyByte(value As Variant) As Boolean On Error Resume Next IsSafeKeyByte = (this.TKey = vbNullString Or this.TKey = TypeName(value)) If IsSafeKeyByte Or OptionStrict Then Exit Function Dim result As Boolean result = CByte(value) IsSafeKeyByte = (Err.number = 0) 'If this.OptionTrace And IsSafeKeyString(Value) Then Debug.Print TRACE: IsSafeKeyByte( & CStr(Value) & ) : & IsSafeKeyByte Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeKeyBoolean(value As Variant) As Boolean On Error Resume Next IsSafeKeyBoolean = (this.TKey = vbNullString Or this.TKey = TypeName(value)) If IsSafeKeyBoolean Or OptionStrict Then Exit Function Dim result As Boolean result = CBool(value) IsSafeKeyBoolean = (Err.number = 0) 'If this.OptionTrace And IsSafeKeyString(Value) Then Debug.Print TRACE: IsSafeKeyBoolean( & CStr(Value) & ) : & IsSafeKeyBoolean Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeKeyCurrency(value As Variant) As Boolean On Error Resume Next IsSafeKeyCurrency = (this.TKey = vbNullString Or this.TKey = TypeName(value)) If IsSafeKeyCurrency Or OptionStrict Then Exit Function Dim result As Boolean result = CCur(value) IsSafeKeyCurrency = (Err.number = 0) 'If this.OptionTrace And IsSafeKeyString(Value) Then Debug.Print TRACE: IsSafeKeyCurrency( & CStr(Value) & ) : & IsSafeKeyCurrency Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeKeyInteger(value As Variant) As Boolean On Error Resume Next IsSafeKeyInteger = (this.TKey = vbNullString Or this.TKey = TypeName(value)) If IsSafeKeyInteger Or OptionStrict Then Exit Function Dim result As Boolean result = CInt(value) IsSafeKeyInteger = (Err.number = 0) 'If this.OptionTrace And IsSafeKeyString(Value) Then Debug.Print TRACE: IsSafeKeyInteger( & CStr(Value) & ) : & IsSafeKeyInteger Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeKeyLong(value As Variant) As Boolean On Error Resume Next IsSafeKeyLong = (this.TKey = vbNullString Or this.TKey = TypeName(value)) If IsSafeKeyLong Or OptionStrict Then Exit Function Dim result As Boolean result = CLng(value) IsSafeKeyLong = (Err.number = 0) 'If this.OptionTrace And IsSafeKeyString(Value) Then Debug.Print TRACE: IsSafeKeyLong( & CStr(Value) & ) : & IsSafeKeyLong Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeKeyDouble(value As Variant) As Boolean On Error Resume Next IsSafeKeyDouble = (this.TKey = vbNullString Or this.TKey = TypeName(value)) If IsSafeKeyDouble Or OptionStrict Then Exit Function Dim result As Boolean result = CDbl(value) IsSafeKeyDouble = (Err.number = 0) 'If this.OptionTrace And IsSafeKeyString(Value) Then Debug.Print TRACE: IsSafeKeyDouble( & CStr(Value) & ) : & IsSafeKeyDouble Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeKeySingle(value As Variant) As Boolean On Error Resume Next IsSafeKeySingle = (this.TKey = vbNullString Or this.TKey = TypeName(value)) If IsSafeKeySingle Or OptionStrict Then Exit Function Dim result As Boolean result = CSng(value) IsSafeKeySingle = (Err.number = 0) 'If this.OptionTrace And IsSafeKeyString(Value) Then Debug.Print TRACE: IsSafeKeySingle( & CStr(Value) & ) : & IsSafeKeySingle Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeValueString(value As Variant) As Boolean On Error Resume Next IsSafeValueString = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeValueString Or OptionStrict Then Exit Function Dim result As Boolean result = CStr(value) IsSafeValueString = (Err.number = 0) Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeValueDate(value As Variant) As Boolean On Error Resume Next IsSafeValueDate = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeValueDate Or OptionStrict Then Exit Function Dim result As Boolean result = CDate(value) IsSafeValueDate = (Err.number = 0) 'If this.OptionTrace And IsSafeValueString(Value) Then Debug.Print TRACE: IsSafeValueDate( & CStr(Value) & ) : & IsSafeValueDate Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeValueByte(value As Variant) As Boolean On Error Resume Next IsSafeValueByte = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeValueByte Or OptionStrict Then Exit Function Dim result As Boolean result = CByte(value) IsSafeValueByte = (Err.number = 0) 'If this.OptionTrace And IsSafeValueString(Value) Then Debug.Print TRACE: IsSafeValueByte( & CStr(Value) & ) : & IsSafeValueByte Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeValueBoolean(value As Variant) As Boolean On Error Resume Next IsSafeValueBoolean = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeValueBoolean Or OptionStrict Then Exit Function Dim result As Boolean result = CBool(value) IsSafeValueBoolean = (Err.number = 0) 'If this.OptionTrace And IsSafeValueString(Value) Then Debug.Print TRACE: IsSafeValueBoolean( & CStr(Value) & ) : & IsSafeValueBoolean Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeValueCurrency(value As Variant) As Boolean On Error Resume Next IsSafeValueCurrency = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeValueCurrency Or OptionStrict Then Exit Function Dim result As Boolean result = CCur(value) IsSafeValueCurrency = (Err.number = 0) 'If this.OptionTrace And IsSafeValueString(Value) Then Debug.Print TRACE: IsSafeValueCurrency( & CStr(Value) & ) : & IsSafeValueCurrency Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeValueInteger(value As Variant) As Boolean On Error Resume Next IsSafeValueInteger = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeValueInteger Or OptionStrict Then Exit Function Dim result As Boolean result = CInt(value) IsSafeValueInteger = (Err.number = 0) 'If this.OptionTrace And IsSafeValueString(Value) Then Debug.Print TRACE: IsSafeValueInteger( & CStr(Value) & ) : & IsSafeValueInteger Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeValueLong(value As Variant) As Boolean On Error Resume Next IsSafeValueLong = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeValueLong Or OptionStrict Then Exit Function Dim result As Boolean result = CLng(value) IsSafeValueLong = (Err.number = 0) 'If this.OptionTrace And IsSafeValueString(Value) Then Debug.Print TRACE: IsSafeValueLong( & CStr(Value) & ) : & IsSafeValueLong Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeValueDouble(value As Variant) As Boolean On Error Resume Next IsSafeValueDouble = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeValueDouble Or OptionStrict Then Exit Function Dim result As Boolean result = CDbl(value) IsSafeValueDouble = (Err.number = 0) 'If this.OptionTrace And IsSafeValueString(Value) Then Debug.Print TRACE: IsSafeValueDouble( & CStr(Value) & ) : & IsSafeValueDouble Err.Clear On Error GoTo 0End FunctionPrivate Function IsSafeValueSingle(value As Variant) As Boolean On Error Resume Next IsSafeValueSingle = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeValueSingle Or OptionStrict Then Exit Function Dim result As Boolean result = CSng(value) IsSafeValueSingle = (Err.number = 0) 'If this.OptionTrace And IsSafeValueString(Value) Then Debug.Print TRACE: IsSafeValueSingle( & CStr(Value) & ) : & IsSafeValueSingle Err.Clear On Error GoTo 0End FunctionPrivate Sub RaiseErrorUnsafeType(member As String, suppliedType As String) Err.Raise DictionaryErrors.TypeMismatchUnsafeType, _ StringFormat({0}.{1}, ToString, member), _ StringFormat(Type Mismatch. Expected: 'KeyValuePair<{0},{1}>', '{2}' was supplied., this.TKey, this.TValue, suppliedType)End SubPublic Sub Clear() this.Encapsulated.ClearEnd SubPublic Function Contains(v As Variant) As Boolean Contains = Values.Contains(v)End FunctionPublic Function ContainsKey(k As Variant) As Boolean ContainsKey = Keys.Contains(k)End FunctionPublic Property Get NewEnum() As IUnknown'Gets an enumerator that iterates through the values held in the Dictionary. Set NewEnum = this.Encapsulated.NewEnumEnd PropertyPublic Function Remove(v As Variant) As Boolean Dim i As Long i = Values.IndexOf(v) If i <> -1 Then this.Encapsulated.RemoveAt i Remove = True Else Remove = False End IfEnd FunctionPublic Function RemoveKey(k As Variant) As Boolean Dim i As Long i = Keys.IndexOf(k) If i <> -1 Then this.Encapsulated.RemoveAt i RemoveKey = True Else RemoveKey = False End IfEnd FunctionPublic Function TryGetValue(k As Variant, ByRef outValue As Variant) As Boolean Dim i As Long i = Keys.IndexOf(k) Dim kvp As KeyValuePair If i <> -1 Then Set kvp = this.Encapsulated(i) If IsObject(kvp.value) Then Set outValue = kvp.value Else outValue = kvp.value End If TryGetValue = True Else TryGetValue = False End IfEnd FunctionPublic Function ToList() As List Set ToList = this.EncapsulatedEnd FunctionPublic Function ToString() As String ToString = TypeName(Me) & < & IIf(this.TKey = vbNullString, Variant, this.TKey) & , & IIf(this.TValue = vbNullString, Variant, this.TValue) & >End FunctionI've written this a little while ago, in the mean time I've learned about CallByName, so now I wonder if there wouldn't be a really clever way to rework the IsTypeSafe method so as to avoid the Select Case blocks (CallByName doesn't seem to work for functions / methods with a return value). | Dictionary Implementation | dictionary;vb6 | Although CallByName doesn't seem to have a return value (from the parameter tooltip), it does. This means if IsSafeKeyXxxxxx methods were Public you could use CallByName instead of the Select..Case block.However exposing all these methods through your Dictionary interface would be rather ugly. How about extracting all these small methods into their own TypeValidator class?Private Type tValueTypeValidator TValue As String OptionStrict As BooleanEnd TypePrivate this As tValueTypeValidatorOption ExplicitPublic Property Get TValue() As String TValue = this.TValueEnd PropertyPublic Property Let TValue(ByVal value As String) this.TValue = valueEnd PropertyPublic Property Get OptionStrict() As Boolean OptionStrict = this.OptionStrictEnd PropertyPublic Property Let OptionStrict(ByVal value As Boolean) this.OptionStrict = valueEnd PropertyPublic Function ToString() As String ToString = TypeName(Me) & < & this.TValue & >End FunctionPublic Function IsSafeBoolean(value As Variant) As Boolean On Error Resume Next IsSafeBoolean = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeBoolean Or this.OptionStrict Then Exit Function Dim result As Boolean result = CBool(value) IsSafeBoolean = (Err.Number = 0) Err.Clear On Error GoTo 0End FunctionPublic Function IsSafeByte(value As Variant) As Boolean On Error Resume Next IsSafeByte = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeByte Or this.OptionStrict Then Exit Function Dim result As Boolean result = CByte(value) IsSafeByte = (Err.Number = 0) Err.Clear On Error GoTo 0End FunctionPublic Function IsSafeCurrency(value As Variant) As Boolean On Error Resume Next IsSafeCurrency = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeCurrency Or this.OptionStrict Then Exit Function Dim result As Boolean result = CCur(value) IsSafeCurrency = (Err.Number = 0) Err.Clear On Error GoTo 0End FunctionPublic Function IsSafeDate(value As Variant) As Boolean On Error Resume Next IsSafeDate = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeDate Or this.OptionStrict Then Exit Function Dim result As Boolean result = CDate(value) IsSafeDate = (Err.Number = 0) Err.Clear On Error GoTo 0End FunctionPublic Function IsSafeDouble(value As Variant) As Boolean On Error Resume Next IsSafeDouble = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeDouble Or this.OptionStrict Then Exit Function Dim result As Boolean result = CDbl(value) IsSafeDouble = (Err.Number = 0) Err.Clear On Error GoTo 0End FunctionPublic Function IsSafeInteger(value As Variant) As Boolean On Error Resume Next IsSafeInteger = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeInteger Or this.OptionStrict Then Exit Function Dim result As Boolean result = CInt(value) IsSafeInteger = (Err.Number = 0) Err.Clear On Error GoTo 0End FunctionPublic Function IsSafeLong(value As Variant) As Boolean On Error Resume Next IsSafeLong = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeLong Or OptionStrict Then Exit Function Dim result As Boolean result = CLng(value) IsSafeLong = (Err.Number = 0) Err.Clear On Error GoTo 0End FunctionPublic Function IsSafeSingle(value As Variant) As Boolean On Error Resume Next IsSafeSingle = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeSingle Or this.OptionStrict Then Exit Function Dim result As Boolean result = CSng(value) IsSafeSingle = (Err.Number = 0) Err.Clear On Error GoTo 0End FunctionPublic Function IsSafeString(value As Variant) As Boolean On Error Resume Next IsSafeString = (this.TValue = vbNullString Or this.TValue = TypeName(value)) If IsSafeString Or this.OptionStrict Then Exit Function Dim result As Boolean result = CStr(value) IsSafeString = (Err.Number = 0) Err.Clear On Error GoTo 0End FunctionAnd since that code was copy-pasted from an existing List class in the first place, there's already a case for reusing that TypeValidator class.That change would require the ValidateItemType method to be modified as such:Private Function ValidateItemType(kvp As KeyValuePair, Optional ThrowOnUnsafeType As Boolean = False) As Boolean If this.TKey = vbNullString And this.TValue = vbNullString Then this.TKey = TypeName(kvp.key) this.IsRefTypeKey = IsObject(kvp.key) this.TValue = TypeName(kvp.value) this.IsRefTypeValue = IsObject(kvp.value) this.KeyValidator.TValue = this.TKey '<<< here this.ValueValidator.TValue = this.TValue '<<< here End If ValidateItemType = IsTypeSafe(kvp) If ThrowOnUnsafeType And Not ValidateItemType Then RaiseErrorUnsafeType ValidateItemType(), kvp.ToStringEnd FunctionThe OptionStrict property setter would have to be affected as well:Public Property Let OptionStrict(value As Boolean) this.Encapsulated.OptionStrict = value this.KeyValidator.OptionStrict = value ' <<< here this.ValueValidator.OptionStrict = value ' <<< hereEnd PropertyAs well as the Class_Initialize method:Private Sub Class_Initialize() Set this.Encapsulated = New List Set this.KeyValidator = New TypeValidator ' <<< here Set this.ValueValidator = New TypeValidator ' <<< here this.Encapsulated.OptionStrict = True this.KeyValidator.OptionStrict = True ' <<< here this.ValueValidator.OptionStrict = True ' <<< hereEnd SubAnd of course the private type of this:Private Type tDictionary Encapsulated As List TKey As String IsRefTypeKey As Boolean TValue As String IsRefTypeValue As Boolean KeyValidator As TypeValidator ' <<< here ValueValidator As TypeValidator ' <<< hereEnd TypeThe IsTypeSafe method implementation could then be simplified to this - gone, the Select..Case blocks!Public Function IsTypeSafe(kvp As KeyValuePair) As Boolean'Determines whether a value can be safely added to the List. IsTypeSafe = (this.TKey = vbNullString Or this.TKey = TypeName(kvp.key)) _ And (this.TValue = vbNullString Or this.TValue = TypeName(kvp.value)) If IsTypeSafe Then Exit Function IsTypeSafe = CallByName(this.KeyValidator, IsSafe & this.TKey, VbMethod, kvp.key) If Not IsTypeSafe Then Exit Function IsTypeSafe = CallByName(this.ValueValidator, IsSafe & this.TValue, VbMethod, kvp.value)ErrHandler: 'swallow overflow errors: If Err.Number = 6 Then Err.Clear Resume Next ElseIf Err.Number <> 0 Then RaiseErrorUnsafeType IsTypeSafe(), kvp.ToString End IfEnd FunctionThis also leaves you with a much, much cleaner list of members, as a side-effect of separating the type validation concerns into their own class:Busted! Yes, I work with a French VB6 IDE! |
_unix.196715 | I have a file that I want to pad until it reaches 16 MiB (16777216 bytes). Currently it is 16515072 bytes. The difference is 262144 bytes.How do I pad it?This doesn't seem to be working: cp smallfile.img largerfile.imgdd if=/dev/zero of=largerfile.img bs=1 count=262144 | How to pad a file to a desired size? | dd | Drop the of=largerfile.txt and append stdout to the file:dd if=/dev/zero bs=1 count=262144 >> largerfile.txt |
_unix.382652 | From https://unix.stackexchange.com/a/381782/674declare behaves very differently when it's called in that global scope and when in a function (I'm not talking of the kind of separate scope that is introduced by subshells or associated with the environment).How do scopes and namespaces work in subshells and the original shell?Thanks. | How do scopes and namespaces work in subshells and the original shell? | bash;subshell | null |
_unix.104510 | Maybe there is a simple-obvious solution for this but I dont know how to make mc to be able to execute programs when I press enter/double click on it and I am not logged in as root... the executable has executable rights for all.I get this whenever I try to execute anything by hiting enter or double clicking or tryingto call a program from the command line. When I run the program to be executed with sudo it opens it up nicely, but I like the pressing enter method and would not like to type always the file name. Or how could I setup only some executables to execute from mc?Here is my /etc/mc folder:drwxr-xr-x. 121 root root 12288 Nov 14 10:59 ..-rw-r--r--. 1 root root 12278 Aug 22 2010 cedit.menu-rw-r--r--. 1 root root 788 Aug 22 2010 edit.indent.rc-rw-r--r--. 1 root root 247 Aug 22 2010 edit.spell.rcdrwxr-xr-x. 2 root root 4096 Oct 15 10:50 extfs-rw-r--r--. 1 root root 1024 Aug 22 2010 filehighlight.ini-rw-r--r--. 1 root root 226 Aug 22 2010 mc.charsets-rw-r--r--. 1 root root 17353 Aug 22 2010 mc.ext-rw-r--r--. 1 root root 7936 Aug 22 2010 mc.keymap-rw-r--r--. 1 root root 7936 Aug 22 2010 mc.keymap.default-rw-r--r--. 1 root root 7913 Aug 22 2010 mc.keymap.emacs-rw-r--r--. 1 root root 1979 Aug 22 2010 mc.lib-rw-r--r--. 1 root root 9556 Aug 22 2010 mc.menu-rw-r--r--. 1 root root 10126 Aug 22 2010 mc.menu.sr-rw-r--r--. 1 root root 6259 Aug 22 2010 SyntaxThe mc from /user/bin-rwxr-xr-x. 1 root root 988432 Aug 22 2010 mcFor example, here is a file I would like to execute through mc with normaluser:-rwxrwxr-x 1 root hUSERS 205780 Jun 11 16:03 DBU3LThese are the putty log's last lines:[44m*DBU3L[23;3H[1;1H[39m[49m[K[K[K[K[K[K[K[K[K[K[K[K[K[K[K[K[K[K[K[K[K[K[K[K[1;80H[?1002l[?1001r[?1l>[24;1H(B[m[39;49m[K[?1049l>[?47l8[m$ ./DBU3Lmv -v output:GNU Midnight Commander 4.7.0.2Virtual File System: tarfs, extfs, cpiofs, ftpfs, fish, mcfs, smbfsWith builtin EditorUsing system-installed S-Lang library with terminfo databaseWith subshell support as defaultWith support for background operationsWith mouse support on xterm and Linux consoleWith internationalization supportWith multiple codepages supportData types: char 8 int 32 long 64 void * 64 off_t 64 ecs_char 8I saw in a forum a program called sam that could be used to solve the problem, but wouldnot like to reinvent the wheel if this could be fixed by changing somerights or mc parameters. | executing any program in mc ends putty session if not logged in with root | permissions;putty;mc | The problem was that the user launching mc didn't had /bin/bash as its init script but a scpecific script. To keep the init script that is used I had to add into it this little bit of code to enable mc to execute:mc=`ps $PPID | grep mc`if [ ! -z $mc -a $mc!= ]then if [ ! -z admin ] then bash $1 $2 $3 $4 $5 exit fifiThis looks up if mc is launched and if it is, it lets the user's mc to execute commands with it's pass it over to bash mechanism - allows it only if the user is in an administrators group. |
_cstheory.7534 | Let $\bf X$ be a binary vector of $n$ (non-independent) random variables $X_1,\ldots, X_n$. Covariance of two random variables is defined as follows: $$\mathrm{cov}(X_i, X_j) = \mathrm{E}(X_i - \mu_i)(X_j - \mu_j),$$ where $\mu_i = \mathrm{E}(X_i).$ Covariance matrix for $\bf X$ is $n\times n$ symmetric matrix $C$, whose elements $c_{ij} = \mathrm{cov}(X_i, X_j)$.Given a matrix $C$, are there any known efficient sampling algorithms for distribution that is close to the distribution of $\bf X$ (= distribution with the same matrix $C$)?The same question for the case where $C$ is a correlation matrix:$$c_{ij} = \frac{\mathrm{cov(X_i, X_j)}}{\sigma(X_i)\sigma(X_j)},$$where $\sigma(X_i)$ is a standard deviation of $X_i$.Any hints on papers etc. are welcome!Thanks, Sasha | Sampling from a distribution with a given covariance matrix | ds.algorithms;pr.probability | null |
_codereview.13840 | I have a button group that looks like this:The user selects one of the options and they can search for a person based on that criteria.I wrote a switch statement that populates the URL to make the ajax call to get the data based on the option selected.However, the down side of this is that every time an option is added or removed, I have to modify the corresponding JavaScript.Should I re-factor the code to use data- attributes on the a tags, that contain the URL to use? <li><a href=# id=btUsername data-url=SearchByUsername>Username</a></li> <li><a href=# id=btLastName data-url=SearchByLastName>Last Name</a></li> <li><a href=# id=btStudentID data-url=SearchByStudentID>Student ID</a></li>Or is that considered bad mojo?What I have working:HTML<div id=go-btn-group class=btn-group> <a class=btn dropdown-toggle btn-success data-toggle=dropdown href=#> <img src=../../img/search.png alt=Search /> <span class=caret></span> </a> <ul id=btGo-dropdown class=dropdown-menu> <li><a href=# id=btUsername>Username</a></li> <li><a href=# id=btLastName>Last Name</a></li> <li><a href=# id=btStudentID>Student ID</a></li> </ul></div>JS // All of the list items in the drop down var $searchOptions = $('#btGo-dropdown li'); $searchOptions.click(function (e) { var searchBy = ''; // find all of the child links, which are // the options themselves var $lis = $searchOptions.find('a'); // remove the active class, if exists $lis.filter('.active').removeClass('active'); // add the active class to show the criteria selected var clickedOptionId = e.target.id; $('#' + clickedOptionId).addClass('active'); // depending on the option selected, populate // searchBy with the URL to make the ajax call to switch (clickedOptionId) { case btUsername: searchBy = 'SearchByUsername'; break; case btLastName: searchBy = 'SearchByLastName'; break; case btStudentID: searchBy = 'SearchByStudentID'; break; default: } // create an object that abstracts the search data var search = { url: searchBy, data: { criteria: $search.attr('value') } }; // make the call to the controller and get the raw Json var itemModels = $.ajax({ url: search.url, type: GET, contentType: application/json; charset=utf-8, dataType: json, data: search.data, async: false }).responseText; // Use knockout.js to bind the information to the page viewModel.rebindSearchItems(itemModels); }); | JavaScript switch statement to make an AJAX call | javascript;jquery;html5 | I don't really think putting the URL in your HTML is a good idea; Separating presentation from functionality and all that...However, instead of using a switch statement, you should be using an object literal to map the URLs to the clickedOptionId key:var searchURLs = { 'btUsername' : 'SearchByUsername', 'btLastName' : 'SearchByLastName', 'btStudentID' : 'SearchByStudentID'};var search = { url: searchURLs[clickedOptionId], data: { criteria: $search.attr('value') }}; |
_computergraphics.3641 | I'm building an engine, which has Vulkan for its primary rendering engine. But to have at least some backwards compatibility with devices that don't have drivers for it (mainly mobile) I want to implement an OpenGL fallback. Now, how do I check what API's are available in the current system?I want to check if Vulkan support exists, if not then if OpenGL support exists and if not that then crash. | How to check which API's are available on a given machine? | opengl;c++;vulkan | Basic Vulkan availability can be checked by the presence of the loader dynamic library. This will reside in a standard place where you can load it with dlopen or LoadLibrary. If it fails to load then vulkan is not installed. If it does load then you can get the vkGetInstanceProcAddr function pointer from it with dlsymor GetProcAddress. After that you can query the devices as normal and decide whether or not it's sufficient to support your app. |
_cs.63837 | Question: Given an array of positive integers and a target total of X, find if there exists a contiguous subarray with sum = X E.g: If array is [1, 3, 5, 18] and X = 8 Output: True, if X = 10, output is FALSE.Approach I can think of is to expand sub-array window, until you hit an index such that sum of sub-array == target or > target. If > target, decrease sub-array by moving first element to the right.It appears that in worst-case complexity is O(N) since I am moving either start or end index of sub-arrays, so int worst case I will just spend 2*N iterations. Is that correct analysis?BOOL checkIfArrHasSum(long *arr, size_t size; long target){ long currSum = [arr[0] longValue]; long startInd = 0; long nextIndToCheck = 1; while (nextIndToCheck < size) { if(currSum == target) return YES; if (currSum + arr[nextIndToCheck] == target) return YES; else if(currSum + arr[nextIndToCheck] < target) { currSum = currSum + arr[nextIndToCheck]; nextIndToCheck++; } else { currSum = currSum - arr[startInd]; startInd++; } if(startInd == nextIndToCheck) { nextIndToCheck = startInd+1; currSum = arr[nextIndToCheck]; } } return NO;} | Algorithmic complexity of Sub-array with sum = target algorithm | algorithm analysis;runtime analysis;search | null |
_cstheory.8047 | Wagner and Wagner, in Between min cut and graph bisection (MFCS 1993), studied a variant of minimum bisection problem where we seek a cut with minimum size such that each partition has at least $\log n$ verticies. They stated that the complexity of this variant is an open problem since they did not find an efficient algorithm nor NP-hardness proof.Has anyone setteled the complexity of $\log n $ balanced graph partition? | Complexity of balanced graph partition problem | cc.complexity theory;open problem | null |
_datascience.8266 | There is a package named segmented in R. Is there a similar package in python? | Is there a library that would perform segmented linear regression in python? | python;regression;linear regression | No, currently there isn't a package in Python that does segmented linear regression as thoroughly as those in R (e.g. R packages listed in this blog post). Alternatively, you can use a Bayesian Markov Chain Monte Carlo algorithm in Python to create your segmented model.Segmented linear regression, as implemented by all the R packages in the above link, doesn't permit extra parameter constraints (i.e. priors), and because these packages take a frequentist approach, the resulting model doesn't give you probability distributions for the model parameters (i.e. breakpoints, slopes, etc). Defining a segmented model in statsmodels, which is frequentist, is even more restrictive because the model requires a fixed x-coordinate breakpoint.You can design a segmented model in Python using the Bayesian Markov Chain Monte Carlo algorithm emcee. Jake Vanderplas wrote a useful blog post and paper for how to implement emcee with comparisons to PyMC and PyStan.Example:Segmented model with data:Probability distributions of fit parameters:Link to code for segmented model.Link to (large) ipython notebook. |
_softwareengineering.337268 | I'm building a Json REST API for my application, and have some doubts about the design itself. My application has organizations and also equipment which belongs to organizations. That would be an example of the organizations API:/organizations: Loads all the organizations from the application/organizations/{id}: Loads a specific organization by idThis seems quite clear. However now I want to access equipment, which is accessible by id or code. The id is unique for the application, whereas the code is unique per organization. Some choices:/organizations/{id}/equipment: Loads the equipment by organization. This seems quite clear to me/organizations/{idOrg}/equipment/{idEquip}: Equipment by id. Isn't the organization id quite redundant here?/organizations/{idOrg}/equipment/code/{code}: Seems it makes sense, but probably would be better to pass code as a parameter./organizations/{idOrg}/equipment?id={idEquip}: Best choice?/organizations/{idOrg}/equipment?code={code}: Best choice?In my opinion, the methods below look better just for grabbing equipment (even if the return a list, while the method is supposed to return a single value or nothing). However I still have more relations into equipment, which these methods don't seem proper to fit. For example how to extend the API to integrate the methods to load files for each equipment?UPDATEIt should be considered that organizations are structured hierarchically, so we've got organization trees and if org1 contains org2 and one equipment belongs to org2, it also belongs to org1. | Some doubts about a proper REST API design | design;rest;api | When considering REST it is important to understand and design it as you are taking actions against a resource at the location, and not like making a remote function call.I understand you are in doubt with your design for Equipment by id.I would like to be the api call like this - /organizations/{idOrg}/equipment/{idEquip}Reasons being - With this design, you are very clearly stating that you are looking for a particular equipment in an organization.Now you can also call other verbs like PUT, DELETE etc. against the same resource and adhere to the REST principles. For example, you would call the same api with delete to delete this resource or call it with put to updated it and send the updated data in request body.And as you said Id for organization looks redundant but actually it is not. What we are saying with this is that get me an organization with this id and give me its related entity i.e. an equipment. Probably, equipment in alone may not make sense to the API if any related information from organization is required. And in case you want to return just an equipment with it's id, then you should have a separate api for it, something like - /equipments/{idEquip}Query string parameters are suggested when you further want to drill down the resources with filter, paging or sorting etc. For example - /organizations/{idOrg}/equipments/?type=heavyUpdate (for updated Q. and comments) - Sometimes it becomes difficult when we visualize our api design in terms of our code. To keep it simple, if an equipment is part of any organization, then the api should get that equipment, of course in relation to that particular organization. To add a new equipment to org3 you will use put on org3 i.e. /organizations/3. To modify and equipment already in org3 you will use put on equipment i.e. /organizations/3/equipment/1. And if you need to add a new equipment independently, you would call post on equipment i.e. /equipmentYou can also consider your object hierarchy to make it more intuitive and logical if requiredSuggest to read this series on Restful Api design |
_softwareengineering.147128 | If I'm using a switch statement to handle values from an enum (which is owned by my class) and I have a case for each possible value - is it worth adding code to handle the default case?enum MyEnum{ MyFoo, MyBar, MyBat}MyEnum myEnum = GetMyEnum();switch (myEnum){ case MyFoo: DoFoo(); break; case MyBar: DoBar(); break; case MyBat: DoBat(); break; default: Log(Unexpected value); throw new ArgumentException() }I don't think it is because this code can never be reached (even with unit tests).My co-worker disagrees and thinks this protects us against unexpected behavior caused by new values being added to MyEnum.What say you, community? | switch statement - handling default case when it can't be reached | unit testing;maintenance;enum | Including the default case doesn't change the way your code works, but it does make your code more maintainable. By making the code break in an obvious way (log a message and throw an exception), you're including a big red arrow for the intern that your company hires next summer to add a couple features. The arrow says: Hey, you! Yes, I'm talking to YOU! If you're going to add another value to the enum, you'd better add a case here too. That extra effort might add a few bytes to the compiled program, which is something to consider. But it'll also save someone (maybe even the future you) somewhere between an hour and a day of unproductive head-scratching. |
_webapps.10645 | As a user of Google Calendar, I can set up my account to display a set of individual calendars (say 3 calendars... Ron's, Jeff's and Conf Room A's). Is there any way to encapsulate this set of calendars and expose it?The goal would be to be able to put a single link on a web page that, when clicked, would display a single view with the 3 calendars (Ron's, Jeff's and Conf Room A's)? | encapsulate a set of Google calendars | google calendar | I had a similar need, and was able to create an aggregate calendar from several individual calendars.This fellow has laid out the steps very nicely: http://murphymac.com/share-busy-free-info-for-multiple-google-calendars/ |
_softwareengineering.306872 | I'm reading this tutorial on Perlin noise:http://www.angelcode.com/dev/perlin/perlin.htmlwhich seems to be the clearest one but still not perfect. A lot of details are skipped and a lot of code unexplained.My general question is, why do we need vectors for Perlin noise (instead of just noise values at specific coordinates), why do they have to be unit vectors and how do we combine them with the given input point coordinates?Also, the article gives this piece of code as vector calculation which looks like trying to find out square cell coordinates (except 1 is subtracted instead of being added for some reason):// Computing vectors from the four points to the input pointfloat tx0 = x - floorf(x);float tx1 = tx0 - 1;float ty0 = y - floorf(y);float ty1 = ty0 - 1;This doesn't look like any vector operation. | In Perlin noise, why need vectors and how to use them exactly? | noise | null |
_softwareengineering.183982 | Some people run the bleeding edge of technologies - updating the day that something is updated. In production, this isn't as appropriate.Researching about if the current (Java 7) version is ready for production produces a significant amount of old material that might not be correct anymore (at the time of this writing Java 7 has been out for a year and a half which seems plenty long).What considerations do I need to make to determine if it is appropriate to upgrade the production environment to a later version of Java? | Considerations on which Java version to run in Production | java;software updates;production | The first question to ask is Is the version of Java supported on the machine? While updating the JRE is one thing, it may be that the underlying OS is not supported running the new version of Java (supported certifications and support contracts and the like that many enterprise environments like to have).Many java production environments are actually running on top of an application server. This would be the next consideration. Wikipedia comparison of Java EE App Servers shows what version of Java EE is supported. This can be further seen in Oracle's JavaEE compatibility overview. The tested configuration for JBoss Enterprise Application Platform 6 is against Java SE 6.0 update 6u30. Java SE 6.0 update 6u30 is also the tested configuration for JBoss Application Server 7.1.0 Final. These may work in Java 7, but they are not tested configurations.Expanding on the application server, there are live code analysis tools that are used to do debug after the fact. Omniscient Debugger (see also) and Dynatrace are two examples of this. These applications work by instrumenting (modifying) the live byte code of java running to report back to it. As these applications work by modifying the byte code, if the byte code changes in a way they are not capable of working with (such as in a new JRE), they won't work.Next down the line is the frameworks. One example of this is JAXB that comes with java and Spring which uses it. Changing to Java 7 updated JAXB which generated code that was incompatible with some frameworks (which requires them to be updated and their dependencies would need to be updated...).Build tools are next on the list. One would need to make sure that the build environment is using the proper version of Java. Writing code for Java 7 but not updating the version that Maven or Ant uses would then cause problems. There are times when the build tools themselves are strongly tied to one version with particular plugins.Testing tools. Things such as PMD, findbugs, and checkstyle may not recognize new structures in a new version of Java - these may get very confused with string switch statements or compound catches. Tools that get into instrumentation such as code coverage may not work in the new JVM. In the context of Java 7, Cobertura and Emma have not been updated to the new JRE (again, these applications modify the byte code to see which code is run and which isn't) (see open source code coverage libraries for jdk7). This could require a change to the build scripts to switch from one to another.Then there is the IDE. One would need to update the IDE to a version that is aware of the new structures in the language. Eclipse's announcement of support for Java 7 shows these issues.Last and certainly not least is the developer. It is up to the developer to write the new code and be aware of how code can be restructured. Going from Java 1.4 to 1.5, templates and annotations were introduced and it took time for the developers to get into the mindset of the new structures available. Likewise the collections rework back in 1.2 and getting developers away from using HashTable and Vector. Updating the version should be accompanied with some amount of training in the new language structures. |
_softwareengineering.168760 | In some cases, I want to use referentially transparent callables while coding in Python. My goals are to help with handling concurrency, memoization, unit testing, and verification of code correctness.I want to write down clear rules for myself and other developers to follow that would ensure referential transparency. I don't mind that Python won't enforce any rules - we trust ourselves to follow them. Note that we never modify functions or methods in place (i.e., by hacking into the bytecode).Would the following make sense?A callable object c of class C will be referentially transparent if:Whenever the returned value of c(...) depends on any instance attributes, global variables, or disk files, such attributes, variables, and files must not change for the duration of the program execution; the only exception is that instance attributes may be changed during instance initialization.When c(...) is executed, no modifications to the program state occur that may affect the behavior of any object accessed through its public interface (as defined by us).If we don't put any restrictions on what public interface includes, then rule #2 becomes:When c(...) is executed, no objects are modified that are visible outside the scope of c.__call__.Note: I unsuccessfully tried to ask this question on SO, but I'm hoping it's more appropriate to this site. | Guidelines for creating referentially transparent callables | python;functional programming | The goal of enforcing referential transparency (RP) may be a bit ambitious given the presence of file IO and global variables. Instead, you can make it a best practice, which basically seems like that you wish to do. Rules 1 and 2 will certainly push you into the direction of RP, but they are somewhat problematic. First of all, relying on the fact that a disk file doesn't change is risky. It is best to isolate IO to well defined parts of application code. The same holds for global variables. While it is true, that if global variables used by a function don't change, it would allow for RP, it may be too difficult to enforce. Instead, try to avoid global variables. Also, ensure that instance attributes are read-only. Given that Python is a multi-paradigm language, you can reap the benefits of functional programming as well as OOP. You can structure code such that there are purely functional parts which adhere to RP and there are imperative parts which glue everything together. OOP can be said to structure programs by encapsulating moving parts while FP can be said to reduce moving parts - use both paradigms. |
_unix.110700 | In this example I can get 00.expr match 00 foo 99.jpg '[^0-9]*\([0-9]\+\).*$'I want to know how to get last number from string, in this case 99 by using regular expression.The string may contain only a set of numbers like foo00.jpg, or several of them like 00 foo 11 bar 22 foo.jpg.How can I write the regular expression? | How to get numbers by using regular expression, but only last one | shell script;regular expression | file=00 foo 99.jpgexpr x$file : '.*[^0-9]\([0-9]\{1,\}\)'Don't use echo for arbitrary data, you can't use sed as sed works on lines and filenames can be made of several lines.match is not a standard operator of expr, : is the standard equivalent, so you might as well use it instead to avoid portability issues.Prefixing $file with x makes sure $file is not taken as an expr operator. (and in this case helps in cases where the numbers are not preceded by non-numbers).Note that the above has an unwanted side-effect that it returns a non-zero exit status if the returned number is 0 (or 00, 000...).\+ is not a standard basic regexp operator. \{1,\} is the standard equivalent (though you could also write it [0-9][0-9]*).You don't need to use expr here, you could also use the shell (any POSIX shell) parameter expansion:file=00 foo 99.jpgnumber=x${file}xnumber=${number%[!0-9]*}number=${number##*[!0-9]} |
_codereview.33684 | I have a working solution for the given problem of A/B Optimization, but you as an experienced Python (3) developer will agree with me, that this solution is not very pythonic at all.My Question here is: How do I make this code more pythonic?It's a very procedural process that one would expect from a Basic program, but not from a Python program. Please help me to become a better coder and make pythonic code by working through this example with me.Here's the problem and my solution. ProblemIn this test you will be given a CSV containing the results of a website's A/B homepage test. The site is simultaneously testing 5 design variables (A, B, C, D, and E) and tracking if users clicked on the signup button (Z). Each line of the CSV represents a visitor to the homepage, what they saw, and if they clicked or not. The A-E variables will have values of 1-5, representing which version of that design element was shown to the user. The Z variable will contain either a 1 to represent that the user clicked signup, or a 0 to represent that the user did not.A B C D E Z1 3 1 2 4 13 2 1 5 5 04 3 2 2 5 15 5 2 3 4 02 4 1 3 4 0...Your task will be to determine the single combination of A-E values that will make users most likely to click the signup button. Assume the effects of each A-E value are mutually exclusive. If two values of a variable are equally optimal, choose the lesser value. You will enter the answer in the form of a 5-digit number, the first digit being the optimal A value, the second being the optimal B value, the third being the optimal C value, etc.Solutionfrom urllib.request import urlopendef getBestDesign(url): data = urlopen(url).readlines() A = {}; B = {}; C = {}; D = {}; E = {}; A['1'] = 0 A['2'] = 0 A['3'] = 0 A['4'] = 0 A['5'] = 0 B['1'] = 0 B['2'] = 0 B['3'] = 0 B['4'] = 0 B['5'] = 0 C['1'] = 0 C['2'] = 0 C['3'] = 0 C['4'] = 0 C['5'] = 0 D['1'] = 0 D['2'] = 0 D['3'] = 0 D['4'] = 0 D['5'] = 0 E['1'] = 0 E['2'] = 0 E['3'] = 0 E['4'] = 0 E['5'] = 0 for row in data: row = row.decode(encoding='UTF-8').split('\t') if row[5].startswith('1'): A[str(row[0])] += 1 B[str(row[1])] += 1 C[str(row[2])] += 1 D[str(row[3])] += 1 E[str(row[4])] += 1 maxclicks_A = max(A.values()) maxclicks_B = max(B.values()) maxclicks_C = max(C.values()) maxclicks_D = max(D.values()) maxclicks_E = max(E.values()) for k, v in A.items(): if v == maxclicks_A: print('A: ', k) for k, v in B.items(): if v == maxclicks_B: print('B: ', k) for k, v in C.items(): if v == maxclicks_C: print('C: ', k) for k, v in D.items(): if v == maxclicks_D: print('D: ', k) for k, v in E.items(): if v == maxclicks_E: print('E: ', k)if __name__ == __main__: url = input('Url: ') getBestDesign(url) | How to turn this working A/B optimization program into more pythonic code? | python;optimization;python 3.x | null |
_softwareengineering.196477 | I need to implement some graph partitioning algorithms for my thesis. I have mostly Windows experience. I would like to know if it is hard to migrate c++ console program to Linux. I want to program it on Windows but I want to test and compile it on Linux as well. It will be pure cli application, with no use of windows APi or anything. I just need to use some external libraries. Specifically GNU linear programming kit and GNU scientific library GSL.I found out, there are windows versions of these libraries, what does it mean for me?, should I compile it on Windows with windows version package and on Linux with linux package. I would like someone to bring a bit clarity to this, I am really not very experienced programmer, so any advice will help. Also I would like to ask, if there is diference if I use Visual Studio for programming or some other IDE in matter of portability issues. Thanks in advance for any help. | How to port cli c++ program with GNU libraries from windows to Linux | c++;windows;linux;libraries;portability | null |
_webapps.92786 | I have a picture of a friend however I've lost contact with them and can't find them by name. Is there a way to use this picture to find their Facebook profile? | Find Facebook user from picture | facebook;facebook profile | null |
_unix.138776 | If I have numerous jobs that rely on environment variables, how can I submit them sequentially? Here is my attempt that has not been working, week 6 is always submitted (and finishes) before week 5. #!/bin/sh (export id=me; export pass=welcome; export week=5; sas -log $HOME/logs/log$week.log sasjob.sas > /dev/null; export week=6; sas -log $HOME/logs/log$week.log sasjob.sas > /dev/null; ) &I need the statements to run in exact sequential order on completion. | Submitting jobs with sequential completion | shell script;job control | null |
_cstheory.21990 | I have a set of polygons (convex, concave non-convex, not self-intersecting) in a plane. There may be intersections between polygons.Polygon is defined by points (cartesian coordinate system).Please see the example image:There is 2 polygons: the first is { A, B, C, D } and the second is { E, F, G }.QuestionHow can I detect bounding face by the given point?Solution for point 1 is { A, B, the intersection between |BD| and |EF|, F, the intersection between |FG| and |DC|, C, A }.My ideaI tried some alghoritmus for boolean operations on polygons, but I think that this is not the right approach.I can insert intersection points into original polygons and subdivided the original edge. After that, there is no intersection between polygon's edges.Can I use some graph theory algorithm or algorithm for space partitioning? | Locating a point inside a union of simple polygons | computational geometry | null |
_softwareengineering.206840 | I was asked this question How would you find weight of Aeroplane in an interview and I am not sure why this question was one of the two question asked in the interview.I tried to answer it using all possible ways but could not give the correct answer.(found the correct answer after google search)How much such questions decide your selection in the interview?Here was my approach:1. If measurement of plane is given then i will calculate volume and multiply by density, will consider fuel weight plus other dead weight.2. Using water displacement method if i can put plane in water and somehow measure how much water is displaced.But found using google search that right approach was to put place on a ship and mark the level of water on the hull, then remove plane and then ship will go up.And start putting weight on the ship till marked hull reaches the water level. | What is the intention behind asking weight of plane? | interview | Job Interview 2.0: Now With Riddles! would be an article from TheDailyWTF that notes some of these including the weight of a 747, which is a type of plane:Thankfully, Microsoft realized that the type of people who enjoy these riddles arent always good programmers, and good programmers arent always the type who enjoy these riddles. In fact, some of the folks who can solve these riddles are precisely the type of people you dont want as programmers. Would you want to work with the guy who builds a water-displacement scale/barge, taxis a 747 to the docks, and then weights the jumbo jet using that, instead of simply calling Boeing in the first place?Unfortunately, Microsofts realization came too late: a whole mini-industry has spawned around the concept of Job Interview 2.0. If Microsoft did it, it must work, right? There are books written on brainteasers in the interview, consultants who will help your company annoy the hell out candidates with your very own custom brainteasers, and now, everyone from small software firms to big ole banks are asking stupid riddle questions.The key point in these questions is that it isn't so much that there is a correct answer as much as it is how well can you communicate how you'd solve this problem and upon revisions to the problem, what alternative approaches would you take. For the weight of a plane, I'd probably look at specifications which should note this as part of the basics about the plane. Failing that, then there are a few other approaches one can take. |
_unix.194249 | My question is as stated above, on a FreeBSD system, what is the use of the kern.geom.debugflags ?I see it written before the command to write on to a disk.sysctl kern.geom.debugflags=16 What does it do and is there any Linux equivalent of the following command? | What is the purpose of flag kern.geom.debugflags in FreeBSD? | linux;filesystems;freebsd | null |
_softwareengineering.221539 | The problem is the following.There's a set of simple entities E, each one having a set of tags T attached. Each entity might have an arbitrary number of tags.Total number of entities is near 100 million, and the total number of tags is about 5000.So the initial data is something like this:E1 - T1, T2, T3, ... TnE2 - T1, T5, T100, ... Tk..Ez - T10, T12, ... TlThis initial data is quite rarely updated.Somehow my app generates a logical expression on tags like this:T1&T2&T3 | (T5&!T6)What I need to is to calculate a number of entities matching given expression (note - not the entities, but just the number). This one might be not totally accurate, of course. What I've got now is a simple in-memory table lookup, giving me a 5-10 seconds execution time on a single thread. I'm curious, is there any efficient way to handle this stuff? What approach would you recommend? Is there some common algorithms or data structures for this?UpdateA bit of clarification as requested.T objects are actually relatively short constant strings. But it doesn't actually matter - we can always assign some IDs and operate on integers.We definitely can sort them. | Algorithm for fast tag search | algorithms;optimization | null |
_webapps.56570 | I've read that you have to watch the video to be able to share, and like, there should be a share button, but on mine, there is no videos to watch. They're just photos, and if I click on them, it just takes me to the original place they were at.I also had refreshed the page multiple times, yet the button does not show. | How to Share the facebook Lookback? | facebook;facebook lookback | null |
_webapps.76710 | I created a button in Google Spreadsheet. When I push the button a custom window appears. In that window I have two buttons, one to close and one to see a new window. Everything goes well except the second button, to view a new window. I already programmed this. The button with value oefening 1 doesn't work. I want to see a new panel. When I test the function: oefeningshow() it is correct! Can you please help me?<form> <p><label id=naam> </label> uit <label id=klas></label> </p> <input type=button value=oefening 1 onclick=oefeningshow() /> <input type=button value=Close Sidebar click=google.script.host.close() /></form> <script> function onOpen() { SpreadsheetApp.getUi() // Or DocumentApp or FormApp. .createMenu('Dialog') .addItem('Open', 'openDialog') .addToUi(); } function oefeningshow() { var html = HtmlService.createHtmlOutputFromFile('oefening1') .setSandboxMode(HtmlService.SandboxMode.IFRAME).setWidth(400) .setHeight(300); SpreadsheetApp.getUi() // Or DocumentApp or FormApp. .showModalDialog(html, 'oefening1'); } | I created a button in a panel (dialogue window), when I push the button I'd like to appear a new panel (dialogue) window | google spreadsheets;google apps script | null |
_codereview.109786 | I have one window service. At any given time this window service runs 5-10 threads and each thread do some logging on text file. Logging can be exception or some information related to task/job. I have to make sure all the log should be in sequence with date and time. This is so important. Log file should create every day. If date change it should create new file and add log in new file. I have create one class which does this. Actually its two classes.I used static variables for file name, file path and others, because I don't want to read configuration or create/destroy object every time(in logging process). Do you see anything which may cause an issue, or how I can improve performance?class LoggingWorker{ class LogDetail { public string Data; public DateTime LogDate; public LogDetail(string _Data) { Data = _Data; LogDate = DateTime.Now; } } #region Private variables private static Object thisLock = new Object(); static string LogFileName = MyJobs.; static bool isVerboseMode; static string LogFilePath; static Thread thLogging; static StreamWriter ofileWrite; static Queue<LogDetail> _LogsQ; static bool runLogging; #endregion /// <summary> /// /// </summary> static LoggingWorker() { //Reading from Config file isVerboseMode = AppSettings.GetSettingBool(Logging.Verbose); LogFilePath = AppSettings.GetSetting(Logging.Path); _LogsQ = new Queue<LogDetail>(); if (!Directory.Exists(LogFilePath)) { Directory.CreateDirectory(LogFilePath); } CreateFile(); runLogging = true; thLogging = new Thread(StartLogging); thLogging.Start(); } ~LoggingWorker() { runLogging = false; } private static StringBuilder GetErrorTrace(ref Exception ex) { StackTrace objTrace = new StackTrace(ex, true); StringBuilder strError = new StringBuilder(); strError.Append(Source :: + ex.Source); strError.Append(\r\nError :: + DateTime.Now.ToString()); strError.Append(\r\nError Description : + ex.Message); strError.Append(\r\nInner Exception : + ex.InnerException + \r\n\r\n); StackFrame sf; for (int i = objTrace.FrameCount - 1; i > -1; i--) { sf = objTrace.GetFrame(i); if (sf.GetFileLineNumber() < 1) continue; strError.Append(Method Name : + sf.GetMethod() + \r\n); strError.Append(File Name : + sf.GetFileName() + \r\n); strError.Append(Line Number : + sf.GetFileLineNumber() + \r\n\r\n); } return strError; } protected static void AddInLogQ(string msg, Exception ex) { msg = msg + \t + GetErrorTrace(ref ex).ToString(); AddInLogQ(msg); } protected static void AddInLogQ(Exception ex) { AddInLogQ(GetErrorTrace(ref ex).ToString()); } protected static void AddInLogQ(string Data) { try { lock (thisLock) { _LogsQ.Enqueue(new LogDetail(Data)); } } catch (Exception ex) { EventLog.WriteEntry(AddInLogQ Failed., ex.Message + ex.StackTrace + \nOrignal Message: + Data, EventLogEntryType.Error); } } protected static void StartLogging() { LogDetail oTmp; string sFileName; while (runLogging) { if (_LogsQ.Count > 0) { lock (thisLock) { oTmp = _LogsQ.Dequeue(); } //When Date change create new file. sFileName = LogFilePath + \\ + LogFileName + DateTime.Today.ToString(yyyy_MM_dd) + .log; //File is not exist so create new file. if (!File.Exists(sFileName)) { FileStream fs = File.Create(sFileName); fs.Close(); if (ofileWrite != null) { ofileWrite.Close(); } ofileWrite = new StreamWriter(sFileName, true); } ofileWrite.WriteLine(oTmp.LogDate.ToString(hh:mm:ss:fff tt) + \t + oTmp.Data); ofileWrite.Flush(); } else { Thread.Sleep(500); } } if (ofileWrite != null) { ofileWrite.Close(); } } protected static void CreateFile() { //When Date change create new file. string sFileName = LogFilePath + \\ + LogFileName + DateTime.Today.ToString(yyyy_MM_dd) + .log; //File is not exist so create new file. if (!File.Exists(sFileName)) { FileStream fs = File.Create(sFileName); fs.Close(); if (ofileWrite != null) { ofileWrite.Close(); } ofileWrite = new StreamWriter(sFileName, true); } } protected static void _StopLogging() { runLogging = false; }}// This is the class which I used to Add Log from different threads/Jobs. internal class Logging : LoggingWorker{ public static void StopLogging() { _StopLogging(); } internal static void CreateLog(string msg, Exception ex) { AddInLogQ(msg, ex); } internal static void CreateLog(Exception ex) { AddInLogQ(ex); } internal static void CreateLog(string Data) { AddInLogQ(Data); }} | Daily Log file - Multithread with date and time | c#;multithreading;logging | null |
_webmaster.11728 | I have optimized a website and have included toggled content. By toggled content I mean content that becomes visible after clicking a link (Expand and Collaps). The code is as followings:<li id=article-1> <h3><a href= onClick=$('#article-1 p').not(':first').toggle(); return false;>Article title</a></h3> <p>First paragraph</p> <p>Second paragraph</p> <p>Third paragraph</p> </li>Would Google consider this content less valuable since it is not 'directly' visible? Are there any key concepts to keep in mind when working with toggled content? | Google on toggled content | seo;google;content | This content isn't special, good or bad, in any way. The only time hidden content becomes a problem is when it is hidden for sole purpose of manipulating the search results. |
_opensource.2449 | I wonder whether Open Source libraries used within firmware burnt (in flash or ROM) in an IC that is sold to customers building products with it requires the final manufacturer to give credits (attribution) to the OSS project.Perhaps this is better described with an example:IC Manufacturer A builds a new chip that contains an Open Source SPI library licensed under the 3-clause BSD license. Manufacturer A credits the OSS project on its webpage.Product Manufacturer B buys a reel of those chips and manufactures a new toy that contains the chip on the motherboard.Is Manufacturer B also obliged to credit the OSS project, even though it only indirectly redistributed the SPI library in binary form? | Open Source libraries inside IC firmware and attribution obligation | licensing;attribution;firmware | null |
_unix.111507 | I wanted the output of thinkfan -n output with a timestamp next to it so I can later analyse the patterns, and found this question: Prepending a timestamp to each line of output from a command, which had a seemingly good answer to this problem, namely using: thinkfan -n | tsExcept it doesn't work. ts works fine with all other programs I tried, just not with thinkfan. Why doesn't it work with thinkfan? Is there some way to get this to work? | Timestamp ts not working with thinkfan | shell;timestamps;thinkpad | There are two output streams from a programstandard output and standard error. | redirects standard output, leaving standard error going straight to your terminal.You can redirect both:thinkfan -n 2>&1 | ts # should work everywherethinkfan -n |& ts # newer versions of bash, maybe other shells |
_codereview.158391 | I try to improve my code so that I don't have to program a try - catch block all the time.e.g. at the moment I have to write many codeblocks like this:try { $login_feld = $SeleniumObj->driver->findElement(WebDriverBy::id(login_feld));} catch(NoSuchElementException $exception) { $SeleniumObj->setErrorMessage(1 ID login_feld does not exist., $exception, true, login_field); break;}try { $password_field = $SeleniumObj->driver->findElement(WebDriverBy::id(password_field));} catch(NoSuchElementException $exception) { $SeleniumObj->setErrorMessage(1 ID password_field does not exist., $exception, true, login_field); break;}try { $field3 = $SeleniumObj->driver->findElement(WebDriverBy::id(field3));} catch(NoSuchElementException $exception) { $SeleniumObj->setErrorMessage(1 ID field3 does not exist., $exception, true, login_field); break;}My goal is to reduce this to one line.Therefore I outsourced the whole driver->findElement(WebDriverBy::id(xy)); to a new function from the class Selenium called ById/** * * @param id $id * @param bool $takeScreenshot * @return void */public function ById($id, $takeScreenshot=false){ try { return $this->driver->findElement(WebDriverBy::id($id)); } catch(NoSuchElementException $exception) { $this->setErrorMessage(ID '$id' does not exist., $exception, $takeScreenshot, $id); //break; <- does not work in this context }}Now theoretically I can code the whole block like this:$login_feld = $SeleniumObj->ById('login_feld', true);$password_field = $SeleniumObj->ById('password_field', true);$field3 = $SeleniumObj->ById('field3', true);However, one problem still persist. I can't call break in the exception block in the function ById, otherwise I get break' not in the 'loop' or 'switch' contextNow to solve this I could instead return a status, e.g. false if the code reached in the exception block and then check this before proceeding /** * * @param id $id * @param bool $takeScreenshot * @return void */public function ById($id, $takeScreenshot=false){ try { return $this->driver->findElement(WebDriverBy::id($id)); } catch(NoSuchElementException $exception) { $this->setErrorMessage(ID '$id' does not exist., $exception, $takeScreenshot, $id); return false; }}-$login_field = $SeleniumObj->ById('login_field', true);if ($login_field == false) { break; }$pw_field = $SeleniumObj->ById('pw_field', true);if ($pw_field == false) { break; }$field3 = $SeleniumObj->ById('field3', true);if ($field3 == false) { break; }But now I need two lines per block instead of one. Is it possible to improve this even further? | Handling missing elements on login form in Selenium | php;error handling;form;authentication;selenium | null |
_unix.366209 | apt-get update command updates the package list of the repository in our systemapt-get upgrade upgrades the programs if the package version of the new program does not match the current installed version.apt-cache show shows the detailed information of the package but does not show the date it was released.But none of these mentions the exact date when the package was updated.Although we can note the version of the package and visit it's website to see when it was released but is there any way of finding out when the specific/current package version was released on the repository (terminal options would be more helpful)? | How to know when the package was updated in the repository | package management | You can search for the package on tracker.debian.org, under news you can see when things happened. |
_unix.105453 | I have certain modules which I need compiled into the kernel. Some of these modules require firmware, which used to be automatically included from /usr/src/linux/firmware/. However, no new firmware will be added to this directory, and kernel modules are gradually switching to firmware from /lib/firmware instead. Each time this happens, it appears I need to add the firmware name to CONFIG_EXTRA_FIRMWARE in Kconfig.Is there some way I can automatically collect the list of firmware blobs needed by my compiled-in modules and have them built into the kernel like the CONFIG_EXTRA_FIRMWARE option?To clarify: I could make a list of all drivers I'm building into the kernel, search their source code for references to firmware blobs, and then set CONFIG_EXTRA_FIRMWARE to this list of files. But this process would be time consuming and error prone. I want it to happen automatically and reliably. | How can I automatically include all firmware needed by selected Linux kernel modules | compiling;drivers;linux kernel;kernel modules;firmware | null |
_cogsci.1948 | I tried thinking about an apple and simultaneously an orange. (I was thinking about its appearance and taste). Despite my best efforts I was not able to do parallel processing to think about the apple and orange at the same time. What I was doing was concurrent processing, thinking about Apple and orange in time division multiplexing. I noticed that my brain (which is also responsible for thinking) was indeed able to manage my two hands simultaneously, and was able to help me understand sounds comings from multiple sources, so it was helping me to see many things at the same time, in parallel, not concurrently. I have asked a similar question here which compares processing by the brain with parallel processing by computers. How exactly we explain these differences of operation by brain in dealing with sensory data (for example touch which can be felt in parallel), and thinking or visualization? | How does the brain process concurrent visual or sensory data? | cognitive psychology;cognitive modeling | null |
_cogsci.17179 | Is it true that stimulants and the neurotransmitters they mimic, push into the synapse, or keep in the synapse (e.g. dopamine, norepinephrine, acetylcholine) make neurons fire more often, while inhibitory depressants (e.g. GABA) make them fire less often? | Is it true that stimulants make neurons fire more often, and depressants make them fire less often? | neurobiology;neurophysiology | null |
_webmaster.107766 | My website has poor speed both for desktops and mobile. We are not authorized to minimize images. What is the best option to speed this up? It is in WordPress. We have also used plugins like WordPress Total Cache. | Speeding up website | performance | null |
_cogsci.16224 | ...with computer models?( hacking the executive functions of something like this, for making the algorithm more impulsive, or inattentive.)...with animal models?( using SHR rat-like, animals with higher intellect, and more sociability. (apropos, the similarity is superficial only for me? ) | Best way to modeling ADHD? | neurobiology;computational modeling;adhd;genetics;executive function | The approach you would take will depend upon your level of analysis. For instance, one could choose to model an entire individual's behaviour (i.e. with heuristic models), the activity of neural circuits, the activity of a subset of neural populations, etc. By your question including traits such as impulsivity, I will assume that you are looking to model an individual's behaviour. I would suggest starting by using reinforcement learning models, where there exist parameters that can be directly interpreted as behavioural traits. For instance, in the following SARSA rule,$$\mathcal{Q}_t(s_t, a_t; \alpha, \gamma) = \mathcal{Q}_{t-1}(s_t, a_t) + \alpha \Big( r_t + \gamma \mathcal{Q}_{t-1}(s_{t+1}, a_{t+1})-\mathcal{Q}_{t-1}(s_t, a_t) \Big),$$the $\gamma$ parameter --- where $0 \leq \gamma \leq 1$ --- is representative of delay discounting, which is related but not equivalent to impulsivity. Note that I have omitted $\lbrace \alpha, \gamma \rbrace$ from the $\mathcal{Q}$ expressions on the right hand side for notational simplicity. Another potentially related measure of impulsivity could be the inverse softmax temperature $\beta$$$P(a_t | \mathcal{Q}_t(s_t, a_t; \alpha, \gamma), \beta) = \frac{e^{\beta \mathcal{Q}_t(s_t, a_t; \alpha, \gamma)}}{\sum_{a' \in \mathcal{A}}e^{\beta \mathcal{Q}_t(s_t, a'; \alpha, \gamma)} },$$where $\mathcal{A}$ is the space of all possible actions. The inverse softmax temperature can be thought of as a measure of decision randomness. The above were just some small points that might get you started. I can think of a few other ways to approach the problem (indeed there are some other necessary considerations), but won't outline them here to keep the answer parsimonious. Notwithstanding, I think you might be interested in the following paper:Hauser, T. U., Fiore, V. G., Moutoussis, M., & Dolan, R. J. (2016). Computational Psychiatry of ADHD: Neural Gain Impairments across Marrian Levels of Analysis. Trends in Neurosciences, 39(2), 6373. |
_codereview.3018 | Here is my program which creates a linked list and reverses it:#include<stdio.h>#include<stdlib.h>struct node { int data; struct node *next;};struct node *list=NULL;struct node *root=NULL;static int count=0;struct node *create_node(int);//function to create nodevoid travel_list(void);void create_list(int);void reverse_list(void);int main(){ int i, j, choice; printf(Enter a number this will be root of tree\n); scanf(%d, &i); create_list(i); printf(Enter 1 to enter more numbers \n 0 to quit\n); scanf(%d, &choice); while (choice!=0){ printf(Enter a no for link list\n); scanf(%d,&i);// printf(going to create list in while\n); create_list(i); travel_list(); printf(Enter 1 to enter more numbers \n 0 to quit\n); scanf(%d, &choice); } printf(reversing list\n); reverse_list(); travel_list(); }// end of function mainvoid create_list (int data){ struct node *t1,*t2; //printf(in fucntion create_list\n); t1=create_node(data); t2=list; if( count!=0) { while(t2->next!=NULL) { t2=t2->next; } t2->next=t1; count++; } else { root=t1; list=t1; count++; }}struct node *create_node(int data){ struct node *temp; temp = (struct node *)malloc(sizeof(struct node)); temp->data=data; temp->next=NULL; // printf(create node temp->data=%d\n,temp->data);// printf(the adress of node created %p\n,temp); return temp;}void travel_list(void ){ struct node *t1; t1=list; printf(in travel list\n); while(t1!=NULL) { printf(%d-->,t1->data); t1=t1->next; } printf(\n);}void reverse_list(void){ struct node *t1,*t2,*t3; t1=list; t2=list->next; t3=list->next->next; int reverse=0; if(reverse==0) { t1->next=NULL; t2->next=t1; t1=t2; t2=t3; t3=t3->next; reverse++; } while(t3!=NULL) { t2->next=t1; t1=t2; t2=t3; list=t1; travel_list(); t3=t3->next; } t2->next=t1; list=t2;}I am posting it for further review if there can be any improvements to the algorithm, etc. | Creating and reversing a linked list | c;linked list | null |
_cs.40067 | I've been trying to understand time complexity and space complexity by writing my own snippets of code and solving them. Can you see if I'm correct?for(int i=1 i<=n i*=2) c = i+8for(int j=n j>0 j/=2) a[j] = 8I think the time complexity is $O(log_2n)$ and the space complexity is $O(n)$.for(int i = 1 i<=ni*=2) for(int j=n j>0 j/=2) a[j] = 8In this case, the time complexity is $O((log_2n)^2)$ and the space complexity is $O(n)$.What do you think? | Runtime and space usage of a snippet of code | algorithm analysis;runtime analysis;space analysis | null |
_unix.220717 | I am running a Red Hat Enterprise Linux Server release 7.1 (Maipo) on Intel(R) Xeon(R) CPU X5690 @ 3.47GHz I keep getting this error in abrt-watch-log. root 888 1 0 Aug03 ? 00:00:00 /usr/bin/abrt-watch-log -F BUG: WARNING: at WARNING: CPU: INFO: possible recursive locking detected ernel BUG at list_del corruption list_add corruption do_IRQ: stack overflow: ear stack overflow (cur: eneral protection fault nable to handle kernel ouble fault: RTNL: assertion failed eek! page_mapcount(page) went negative! adness at NETDEV WATCHDOG ysctl table check failed : nobody cared IRQ handler type mismatch Machine Check Exception: Machine check events logged divide error: bounds: coprocessor segment overrun: invalid TSS: segment not present: invalid opcode: alignment check: stack segment: fpu exception: simd exception: iret exception: /var/log/messages -- /usr/bin/abrt-dump-oops -xtD | CPU warning - abrt-watch-log | linux;linux kernel | The process abrt-watch-log takes strings to watch for and then runs a command. So what you're seeing as an error is just the strings to look for in /var/log/messages, which if found, is then sent to /usr/bin/abrt-dump-oops.$ man abrt-watch-log:NAME abrt-watch-log - Watch log file and run command when it grows or is replacedSYNOPSIS abrt-watch-log [-vs] [-F STR] ... FILE PROG [ARGS] |
_unix.349868 | I have tried this: How to execute a shellscript when I plug-in a USB-device and have the following output for lsusb:Bus 002 Device 007: ID 046d:0825 Logitech, Inc. Webcam C270and in /etc/udev/rules.d/camset.rulesATTRS{idvendor}==046d, ATTRS{idproduct}==0825, RUN+=camset.shand camset.sh is located at the root directory. When I run sh camset.sh it runs fine so I don't think there is any problem with that. Thanks for the help | Trying to get sh to run when usb camera is connected | shell;usb;camera | null |
_unix.184891 | I was wondering, since it seems to be one of the only websites where I can seemingly legally download historic Unix documents. | Is Cat-v.org an official subsidiary website of Plan 9 from Bell Labs? | history;plan9 | null |
_cs.76660 | I am going through the book on lambda calculus by Hindley and Seldin .They introduce the syntactic equivalence of expressions and proving them by a technique named induction , which has not been directly defined in the book .(a) $[N/x]x \equiv N$(b) $[N/x]a \equiv a$ for all atoms $a \not \equiv x$(c) $[N/x](PQ) \equiv ([N/x]P)([N/x]Q)$(d) $[N/x](\lambda x.P) \equiv (\lambda x.P)$(e) $[N/x](\lambda y.P) \equiv P$ if $x \not \in FV(P)$.(f) $[N/x](\lambda y.P) \equiv \lambda y. [N/x]P$ if $x \in FV(P)$ and $y \not \in FV(N)$.(g) $[N/x](\lambda y.P) \equiv \lambda z. [N/x][z/y]P$ if $x \in FV(P)$ and $y \in FV(N)$.The above are the rules given for substitution in the book. I have some difficulty in understanding (d).Why is it so that $$ [N/x] ( \lambda x . p) = ( \lambda x . p) $$ ? How to justify this ? Why can't this be defined to be or equal to $$( \lambda N . p) $$ ? | Lambda calculus :difficulty in getting hang of induction and conversion | lambda calculus | In the definition of substitution $[N_1/ x]N$, we describe how to replace all free occurrences of the variable $x$ by the expression $N_1$ throughout the expression $N$.The formation rules defining the syntax of $\lambda$-calculus expressions $e$ are$$ N ::= x \mid \lambda x.P \mid N_1 N_2 $$where $x$ ranges over a set of variables. One should think of the abstraction $\lambda x.P$ as a function with argument $x$ and body $P$ or using standard programming terminology, we think of it as a procedure with formal parameter $x$ and body $P$.In $\lambda x.P$, the variable $x$ is not free within $P$, so a substitution $[N/x](\lambda x.P)$ cannot change anything.Moreover, writing $\lambda N.P$ does not make sense; the argument/formal parameter must be a variable.If you are still puzzled, think of an applied lambda-calculus with integer numerals and consider the expression $\lambda x. x +7$ that informally denotes a function that adds $7$ to its argument. Your proposed substitution rule would give us that $[14/x](\lambda x. x+7) = \lambda 14. x +7$. What would that even mean? (I have no idea.)By the way, the notion of induction is not esoteric at all. Induction is a central proof technique in mathematics and in computer science, and one cannot understand the lambda calculus without being familiar with it. See https://en.wikipedia.org/wiki/Mathematical_induction for an introduction. |
_unix.130833 | I have HDD with my data (partial backup of most important data available on other HDD), currently it's formatted as Ext4 over LVM over LUKS. I want to remove LUKS layer, but reformatting and data restore from backup is too long/no fun. Is there any possibility/chance to overwrite LUKS partition with it's content without using big buffer and without data corruption? | Can I overwrite LUKS partition with it's decrypted content? | hard disk;dd;luks | You're going to have to copy all the data around anyway. You should definitely have a backup at this point. Unless your backup device is significantly slower than your active disk, restoring from backup is as fast as it can go.A LUKS volume starts with a header (up to 2MB). If you lose the header, the data in the volume is lost. As long as the header is intact, you can access data in independent 512-byte sectors.A strategy like cat /dev/mapper/encrypted >/dev/sdz99 will work, because the ciphertext is located at a positive offset (the header size) relative to the plaintext. However, this may well be slower than restoring from backup, because it's a copy on the same disk (with a disk-to-disk copy, reading and writing are done in parallel). For a same-disk copy, dd with a large block size is only very slightly faster than cat. There is a major caveat with this strategy: if there is a power failure or other system crash during the copy, your whole partition will be hosed, because the header has been overwritten first thing.You can save the first 2MB of data elsewhere, and move the rest:dd if=/dev/mapper/encrypted of=/dev/sdz99 bs=2M skip=1 seek=1This way, you can resume after an interruption (don't try to assemble the logical volume though, let alone mount the filesystem!); however this requires knowing where you left off. This is practically impossible to determine (you'd have to use a copying tool that outputs a trail of the blocks it's copying and writes it to the disk, synchronously with the block copies).If your backup storage is very slow, then you can use this shifting strategy the plain cat shifting will do and fall back to restoring from backup if anything bad happens.If the backup storage is really unwieldy, then a different approach would be to:Shrink the filesystem (resize2fs).Shrink the logical volume (lvreduce).Shrink the physical volume (pvresize).Shrink the encrypted volume.Shrink the partition (fdisk or gdisk), and create a new partition in the freed space.Create a physical volume in the new partition (pvcreate) and add it to the volume group (vgextend).Move as many physical extents as possible off the encrypted volume (pvmove).If the encrypted volume isn't empty, repeat from step 1.Get rid of the now unused physical volume (vgreduce then pvremove).Long and tortuous? Yes. Again, my recommendation is to restore from backup. |
_unix.295510 | A few days ago, I formatted and encrypted (LUKS+Ext4) a solid state drive the lazy way (using gnome-disks). The disk was mounted and I moved some data to the disk from another drive that I was going to zero out and encrypt. Of course, this was literally the only bit of data that I don't have at least 3 copies (or even 1). The next day, I saw the partition was no longer mounted and seemed to be gone.fdisk -l /dev/sdbDisk /dev/sdb:...Disk identifier: 0x00000000Disk /dev/sdb doesn't contain a valid partition tablefile -s /dev/sdb/dev/sdb: dataI used hexdump to check that there is data on the drive (to rule out me accidentally zeroing it out).dd if=/dev/sdb bs=512 count=2048 | hexdump -Cshows zeros, but once I hit count=2049, I start seeing some data:dd if=/dev/sdb bs=512 count=2049 | hexdump -C00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|*00100000 4c 55 4b 53 ba be 00 01 61 65 73 00 00 00 00 00 |LUKS....aes.....|00100010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|00100020 00 00 00 00 00 00 00 00 78 74 73 2d 70 6c 61 69 |........xts-plai|00100030 6e 36 34 00 00 00 00 00 00 00 00 00 00 00 00 00 |n64.............|00100040 00 00 00 00 00 00 00 00 73 68 61 31 00 00 00 00 |........sha1....|00100050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|00100060 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 20 |............... |00100070 54 de 2e 44 8a 4e f7 04 e2 c5 90 f3 0b 46 37 5c |T..D.N.......F7\|00100080 69 56 f9 d0 3f f7 e8 b8 cf fa c6 18 0d c1 5e 8c |iV..?.........^.|00100090 4e 11 73 1c 2b c0 1d 71 7d bb 61 61 10 5d ea 8c |N.s.+..q}.aa.]..|001000a0 0a 10 96 bc 00 00 c5 44 34 35 38 65 33 34 30 34 |.......D458e3404|001000b0 2d 64 62 35 38 2d 34 62 38 30 2d 39 32 64 64 2d |-db58-4b80-92dd-|001000c0 30 38 37 63 30 33 61 36 39 38 38 64 00 00 00 00 |087c03a6988d....|001000d0 00 ac 71 f3 00 03 0a cf a3 c8 f9 1e 42 bb 99 b0 |..q.........B...|001000e0 9c 91 4c 66 fb 01 60 47 98 bc d0 b8 e3 3c 6f 64 |..Lf..`G.....<od|001000f0 9a cf 06 85 ef 1d 42 0c 00 00 00 08 00 00 0f a0 |......B.........|00100100 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 |................|00100110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|00100120 00 00 00 00 00 00 00 00 00 00 01 08 00 00 0f a0 |................|00100130 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 |................|00100140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|00100150 00 00 00 00 00 00 00 00 00 00 02 08 00 00 0f a0 |................|00100160 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 |................|00100170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|00100180 00 00 00 00 00 00 00 00 00 00 03 08 00 00 0f a0 |................|00100190 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 |................|001001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|001001b0 00 00 00 00 00 00 00 00 00 00 04 08 00 00 0f a0 |................|001001c0 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 |................|001001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|001001e0 00 00 00 00 00 00 00 00 00 00 05 08 00 00 0f a0 |................|001001f0 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 |................|00100200The only other thing I can think to note is that I think I may have accidentally gave another partition the same name later (I figured maybe this caused the unmount). Any input would be much appreciated.UPDATE:lsmod | grep dm_cryptdm_crypt 23216 2uname -r3.16.0-38-genericUPDATE 2:Not sure if this is helpful, but I compared the first part of the header with another encrypted partition's header and this was the result.diff -y <(dd if=/dev/sdb bs=512 skip=2048 count=1 | hexdump -C) <(dd if=/dev/sdc1 bs=512 skip=0 count=1 | hexdump -C)00000000 4c 55 4b 53 ba be 00 01 61 65 73 00 00 00 00 00 | 00000000 4c 55 4b 53 ba be 00 01 61 65 73 00 00 00 00 00 |00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |00000020 00 00 00 00 00 00 00 00 78 74 73 2d 70 6c 61 69 | 00000020 00 00 00 00 00 00 00 00 78 74 73 2d 70 6c 61 69 |00000030 6e 36 34 00 00 00 00 00 00 00 00 00 00 00 00 00 | 00000030 6e 36 34 00 00 00 00 00 00 00 00 00 00 00 00 00 |00000040 00 00 00 00 00 00 00 00 73 68 61 31 00 00 00 00 | 00000040 00 00 00 00 00 00 00 00 73 68 61 31 00 00 00 00 |00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |00000060 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 20 | | 00000060 00 00 00 00 00 00 00 00 00 00 10 01 00 00 00 20 |00000070 54 de 2e 44 8a 4e f7 04 e2 c5 90 f3 0b 46 37 5c | | 00000070 24 1a 58 e8 ce 91 4b ef db 9d d0 27 9c 27 3c 02 |00000080 69 56 f9 d0 3f f7 e8 b8 cf fa c6 18 0d c1 5e 8c | | 00000080 b7 27 35 b7 e5 ec 6d 6b 4f af 63 ab 06 03 4d da |00000090 4e 11 73 1c 2b c0 1d 71 7d bb 61 61 10 5d ea 8c | | 00000090 eb 05 49 29 4b be 98 73 6c 4b 2e 49 b3 75 14 a0 |000000a0 0a 10 96 bc 00 00 c5 44 34 35 38 65 33 34 30 34 | | 000000a0 69 ef 8a 53 00 00 c4 c7 64 63 64 35 66 65 32 35 |000000b0 2d 64 62 35 38 2d 34 62 38 30 2d 39 32 64 64 2d | | 000000b0 2d 34 31 34 31 2d 34 35 34 31 2d 39 32 37 39 2d |000000c0 30 38 37 63 30 33 61 36 39 38 38 64 00 00 00 00 | | 000000c0 37 35 31 38 34 66 64 61 37 39 63 31 00 00 00 00 |000000d0 00 ac 71 f3 00 03 0a cf a3 c8 f9 1e 42 bb 99 b0 | | 000000d0 00 ac 71 f3 00 03 09 9a eb 00 61 89 23 34 ff b7 |000000e0 9c 91 4c 66 fb 01 60 47 98 bc d0 b8 e3 3c 6f 64 | | 000000e0 cf 33 12 1e 5d a8 81 8c b6 3c e3 8b 18 b6 1f e5 |000000f0 9a cf 06 85 ef 1d 42 0c 00 00 00 08 00 00 0f a0 | | 000000f0 24 4b 5a 07 ca b3 49 8c 00 00 00 08 00 00 0f a0 |00000100 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 | 00000100 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 |00000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | 00000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |00000120 00 00 00 00 00 00 00 00 00 00 01 08 00 00 0f a0 | 00000120 00 00 00 00 00 00 00 00 00 00 01 08 00 00 0f a0 |00000130 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 | 00000130 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 |00000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | 00000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |00000150 00 00 00 00 00 00 00 00 00 00 02 08 00 00 0f a0 | 00000150 00 00 00 00 00 00 00 00 00 00 02 08 00 00 0f a0 |00000160 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 | 00000160 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 |00000170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | 00000170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |00000180 00 00 00 00 00 00 00 00 00 00 03 08 00 00 0f a0 | 00000180 00 00 00 00 00 00 00 00 00 00 03 08 00 00 0f a0 |00000190 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 | 00000190 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 |000001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | 000001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |000001b0 00 00 00 00 00 00 00 00 00 00 04 08 00 00 0f a0 | 000001b0 00 00 00 00 00 00 00 00 00 00 04 08 00 00 0f a0 |000001c0 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 | 000001c0 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 |000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | 000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |000001e0 00 00 00 00 00 00 00 00 00 00 05 08 00 00 0f a0 | 000001e0 00 00 00 00 00 00 00 00 00 00 05 08 00 00 0f a0 |000001f0 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 | 000001f0 00 00 de ad 00 00 00 00 00 00 00 00 00 00 00 00 |00000200 00000200 | Mounted drive disappears and is no longer a valid LUKS device | luks;dm crypt;disk encryption | null |
_datascience.616 | I have a matrix that is populated with discrete elements, and I need to cluster them (using R) into intact groups. So, for example, take this matrix:[A B B C A] [A A B A A] [A B B C C] [A A A A A] There would be two separate clusters for A, two separate clusters for C, and one cluster for B.The output I'm looking for would ideally assign a unique ID to each cluster, something like this:[1 2 2 3 4] [1 1 2 4 4] [1 2 2 5 5] [1 1 1 1 1]Right now I wrote a code that does this recursively by just iteratively checking nearest neighbor, but it quickly overflows when the matrix gets large (i.e., 100x100).Is there a built in function in R that can do this? I looked into raster and image processing, but no luck. I'm convinced it must be out there. | Identifying clusters or groups in a matrix | r;clustering | null |
_unix.214725 | I wondered if there are any known issues when Ubuntu and WIndows 7 are installed in Dualboot. I figured out that Ubuntu sometimes runs a bit slow. | Issues if Ubuntu and Windows 7 is installed in dualboot | ubuntu;windows;dual boot | null |
_unix.125865 | I have a form made it with a couple of text boxes, in which I input floating numbers and use this number to sum with other text box and put the result in a label.I then input the values of the text boxes to a variable (xbiz and xbder) and I sum itfor example I get then this result : xbiz = 5.2 xbder = 2.3My problem is when one of the text boxes is empty (in blank) the script give me an error of ILLEGAL FLOAT VALUE! I mean if I am not input a value in any od the two variablesHow can solve this problem?Here is my code:#FORMecho FG 999999 >> $gui_inecho FONT cbr18 >> $gui_inecho BG 901010 >> $gui_inecho LABEL LOCATINES >> $gui_inecho FG 101090 >> $gui_inecho FONT cbr18 >> $gui_inecho BG 708787 >> $gui_inecho TEXT xbiz X_BOT_IZQ >> $gui_inecho TEXT xbder X_BOT_DER >> $gui_in#Calculationset varx = `echo $xbder + $xbiz | bc -l`#After calculate the values of the two variables (xbder + xbiz) I use the result in the following line:COM display_layer,name=comp,display=yes,number=1COM add_pad,attributes=no,**x=${varx},y=${varx}**,symbol=${sizefido},polarity=positive,\angle=0,mirror=no,nx=1,ny=1,dx=0,dy=0,xscale=1,yscale=1 | Illegal float value error c-shell | shell script;csh | null |
_softwareengineering.262292 | I am trying to convince people in my company that we should switch to event sourcing. Our software is a product that consist of many modules - like a module for wiki, blogs, documents, etc. I would like to use event sourcing also to allow easy collaboration on artifacts (like blogs), to have a history of changes, to minimize concurrent modification issues and so on.There is also a feature of staging - where modules can be staged offline, so people can work on them; and then applied to online once when changes are finished. The one of the reasons why no one wants to go this direction is the amount of events needed to be persisted. The events needed to be very granular, since of variety of actions users can do. But, there is no other operation on events then: 1) adding them 2) reading them from one point in time to the other. More over, we can have the concept of 'applied' events; some modules do not need to keep track of the full history, just the most recent ones.So I wonder if there is any experience in how persisting events may influence the performance of the system? | Event sourcing - performance penalty? | domain driven design;event sourcing | null |
_unix.156465 | I have been trying to find the address of the SHELL environment variable in a program on a Ubuntu 12.04 machine. I have turned off ASLR.I found similar posts : SO question and blog postI have tried using the following in gdb (gdb) x/s *((char **)environ)but I get the message : (gdb) No symbol environ in current contextIs this not valid in Ubuntu 12.04 ? Is there any other way to inspect the address of an environment variable in a process using gdb ? | Using gdb to inspect environment variables | environment variables;gdb | Has your binary been stripped of its symbols? If so, there will be no symbol table and you will have no hope of finding this symbol. You can find out with readelf - here my hello binary does have its symbol table:$ readelf -S hello | grep -i symtab [28] .symtab SYMTAB 0000000000000000 000018f8$ Also when you run GDB, has your program actually started? It looks like this symbol is not resolvable until the symbol table has loaded. It won't be loaded when you first start GDB, but should be by the time you hit main(). You can simply put a breakpoint at main(), run the program, and then inspect the variable when you hit the main() breakpoint:Reading symbols from hello...(no debugging symbols found)...done.(gdb) x/s *((char **)environ)No symbol table is loaded. Use the file command.(gdb) b mainBreakpoint 1 at 0x4005c8(gdb) rStarting program: /home/ubuntu/hello Breakpoint 1, 0x00000000004005c8 in main ()(gdb) x/s *((char **)environ)0x7fffffffe38f: XDG_VTNR=7(gdb) |
_cstheory.3809 | This question is in the same vein as inspirational talk for final year high school pupils. My Ph.D. advisor asked me to give an inspirational talk for new M.Sc. students. The subject is foundations of cryptography, which is best illustrated by Goldreich's book. The talk will take about one hour, and I want to familiarize the students to the main constructs (like one-way functions/permutations, pseudor-random generators, zero-knowledge proofs, encryption/signature schemes, etc.), and solved and unsolved problems in the field.I want to keep the talk very motivating.The main problem is two-fold:Foundations of cryptography needs a very good understanding of the computational-complexity theory. Alas, the M.Sc. students have not passed any course related to this theory.I need to present some problems as possible topics for an M.Sc. thesis. While there are a lot of unsolved problems in the field, most of them are too hard for an M.Sc. student.Suggestions are most welcome. In addition, I'm very interested in pointers to similar talks.Edit: I found the list of Goldreich's students extremely inspiring. I'll be searching for other such lists, but you can help me if you know any similar lists. See also: Demystifying the Master Thesis and Research in General: The Story of Some Master Theses. | Motivating Talk on Foundations of Cryptography | reference request;soft question;cr.crypto security;teaching | Since you can't rely on a knowledge of complexity theory, you have to emphasize the change in paradigm from security by obscurity to security by intractability, by positing the idea that some problems are hard to solve efficiently. This of course elides the many problems associated with the Impagliazzo worlds of intractability, but it gives a flavor of the way modern crypto works. for ZKP, which are truly awesome, there are many ways to convey the basic ideas intuitively. See for example my answer on MO, as well as the hilarious Ali Baba and the 40 thieves story. While these were originally designed for a younger crowd, they work well at all ages to convey the right intuition. |
_unix.352757 | I recently bought a OrangePi Zero Single Board Computer. It works fine but i am facing an issue now, when i boot the Pi without Ethernet, router assigns the IP to the WiFi of the PI but i tried to ping it. It says connection time out and when i try to ssh in it, it doesn't connect.But if i boot my pi with Ethernet connected, both interfaces eth0 and wlan0 works fine and i can even ssh using both wlan0 and eth0.I even tried to disconnect the Ethernet in between and then tried to ping wlan0 interface, again the same problem persists. If i even connect the Ethernet again both interface works fine. I am using nmtui network manager. Therefore, my /etc/network/interfaces file is emptyroot@orangepizero:~# nano /etc/network/interfaces# This file intentionally left blank## All interfaces are handled by network-manager, use nmtui or nmcli on# server/headless images or the Network Manager GUI on desktop imagesHere is my ip routing table when eth0 and wlan0 is connectedroot@orangepizero:~# ip routedefault via 192.168.1.1 dev eth0 proto static metric 1024192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.120192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.130Here is my sshd_config file... Note : I am listening on all IP Addresses.root@orangepizero:/etc/ssh# nano sshd_config# Package generated configuration file# See the sshd_config(5) manpage for details# What ports, IPs and protocols we listen forPort 22# Use these options to restrict which interfaces/protocols sshd will bind to#ListenAddress ::ListenAddress 0.0.0.0Protocol 2# HostKeys for protocol version 2HostKey /etc/ssh/ssh_host_rsa_keyHostKey /etc/ssh/ssh_host_dsa_keyHostKey /etc/ssh/ssh_host_ecdsa_keyHostKey /etc/ssh/ssh_host_ed25519_key#Privilege Separation is turned on for securityUsePrivilegeSeparation yes# Lifetime and size of ephemeral version 1 server keyKeyRegenerationInterval 3600ServerKeyBits 1024# LoggingSyslogFacility AUTHLogLevel INFO# Authentication:LoginGraceTime 120PermitRootLogin yesStrictModes yesRSAAuthentication yesPubkeyAuthentication yes#AuthorizedKeysFile %h/.ssh/authorized_keys# Don't read the user's ~/.rhosts and ~/.shosts filesIgnoreRhosts yes# For this to work you will also need host keys in /etc/ssh_known_hostsRhostsRSAAuthentication no# similar for protocol version 2HostbasedAuthentication no# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthenticationHere is the dmesg log ...root@orangepizero:/home/mayank# dmesg[ 0.938512] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver[ 0.958710] sunxi-ehci sunxi-ehci.1: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver[ 0.958785] sunxi-ehci sunxi-ehci.1: new USB bus registered, assigned bus number 1[ 0.959878] sunxi-ehci sunxi-ehci.1: irq 104, io mem 0xf1c1a000[ 0.970075] sunxi-ehci sunxi-ehci.1: USB 0.0 started, EHCI 1.00[ 0.971318] hub 1-0:1.0: USB hub found[ 0.971364] hub 1-0:1.0: 1 port detected[ 0.992132] sunxi-ehci sunxi-ehci.2: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver[ 0.992193] sunxi-ehci sunxi-ehci.2: new USB bus registered, assigned bus number 2[ 0.993010] sunxi-ehci sunxi-ehci.2: irq 106, io mem 0xf1c1b000[ 1.010068] sunxi-ehci sunxi-ehci.2: USB 0.0 started, EHCI 1.00[ 1.011223] hub 2-0:1.0: USB hub found[ 1.011278] hub 2-0:1.0: 1 port detected[ 1.032097] sunxi-ehci sunxi-ehci.3: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver[ 1.032157] sunxi-ehci sunxi-ehci.3: new USB bus registered, assigned bus number 3[ 1.032993] sunxi-ehci sunxi-ehci.3: irq 108, io mem 0xf1c1c000[ 1.050070] sunxi-ehci sunxi-ehci.3: USB 0.0 started, EHCI 1.00[ 1.051154] hub 3-0:1.0: USB hub found[ 1.051205] hub 3-0:1.0: 1 port detected[ 1.071966] sunxi-ehci sunxi-ehci.4: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver[ 1.072026] sunxi-ehci sunxi-ehci.4: new USB bus registered, assigned bus number 4[ 1.072806] sunxi-ehci sunxi-ehci.4: irq 110, io mem 0xf1c1d000[ 1.090061] sunxi-ehci sunxi-ehci.4: USB 0.0 started, EHCI 1.00[ 1.091178] hub 4-0:1.0: USB hub found[ 1.091226] hub 4-0:1.0: 1 port detected[ 1.092013] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver[ 1.112150] sunxi-ohci sunxi-ohci.1: SW USB2.0 'Open' Host Controller (OHCI) Driver[ 1.112210] sunxi-ohci sunxi-ohci.1: new USB bus registered, assigned bus number 5[ 1.112278] sunxi-ohci sunxi-ohci.1: irq 105, io mem 0xf1c1a400[ 1.175168] hub 5-0:1.0: USB hub found[ 1.175210] hub 5-0:1.0: 1 port detected[ 1.195989] sunxi-ohci sunxi-ohci.2: SW USB2.0 'Open' Host Controller (OHCI) Driver[ 1.196051] sunxi-ohci sunxi-ohci.2: new USB bus registered, assigned bus number 6[ 1.196115] sunxi-ohci sunxi-ohci.2: irq 107, io mem 0xf1c1b400[ 1.255230] hub 6-0:1.0: USB hub found[ 1.255276] hub 6-0:1.0: 1 port detected[ 1.276126] sunxi-ohci sunxi-ohci.3: SW USB2.0 'Open' Host Controller (OHCI) Driver[ 1.276185] sunxi-ohci sunxi-ohci.3: new USB bus registered, assigned bus number 7[ 1.276249] sunxi-ohci sunxi-ohci.3: irq 109, io mem 0xf1c1c400[ 1.335058] hub 7-0:1.0: USB hub found[ 1.335097] hub 7-0:1.0: 1 port detected[ 1.355806] sunxi-ohci sunxi-ohci.4: SW USB2.0 'Open' Host Controller (OHCI) Driver[ 1.355865] sunxi-ohci sunxi-ohci.4: new USB bus registered, assigned bus number 8[ 1.355928] sunxi-ohci sunxi-ohci.4: irq 111, io mem 0xf1c1d400[ 1.415077] hub 8-0:1.0: USB hub found[ 1.415116] hub 8-0:1.0: 1 port detected[ 1.415828] Initializing USB Mass Storage driver...[ 1.416301] usbcore: registered new interface driver usb-storage[ 1.416324] USB Mass Storage support registered.[ 1.416445] usbcore: registered new interface driver ums-alauda[ 1.416567] usbcore: registered new interface driver ums-cypress[ 1.416690] usbcore: registered new interface driver ums-datafab[ 1.416788] usbcore: registered new interface driver ums_eneub6250[ 1.416886] usbcore: registered new interface driver ums-freecom[ 1.416991] usbcore: registered new interface driver ums-isd200[ 1.417090] usbcore: registered new interface driver ums-jumpshot[ 1.417192] usbcore: registered new interface driver ums-karma[ 1.417290] usbcore: registered new interface driver ums-onetouch[ 1.417420] usbcore: registered new interface driver ums-realtek[ 1.417525] usbcore: registered new interface driver ums-sddr09[ 1.417632] usbcore: registered new interface driver ums-sddr55[ 1.417740] usbcore: registered new interface driver ums-usbat[ 1.418184] uinput result 0 , vmouse_init[ 1.419446] mousedev: PS/2 mouse device common for all mice[ 1.419915] sunxikbd_init failed.[ 1.419938] sunxikbd_init failed.[ 1.419961] ls_fetch_sysconfig_para: ls_unused.[ 1.419978] ltr_init: ls_fetch_sysconfig_para err.[ 1.420679] [RTC] WARNING: Rtc time will be wrong!![ 1.420699] [RTC] WARNING: use *internal OSC* as clock source[ 1.421225] sunxi-rtc sunxi-rtc: rtc core: registered sunxi-rtc as rtc0[ 1.421333] i2c /dev entries driver[ 1.422157] sunxi cedar version 0.1[ 1.422246] [cedar]: install start!!![ 1.422622] [cedar]: install end!!![ 1.422990] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x18)[ 1.423206] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x19)[ 1.423410] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x1a)[ 1.423613] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x29)[ 1.423815] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x2a)[ 1.424020] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x2b)[ 1.424222] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x4c)[ 1.424450] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x4d)[ 1.424670] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x4e)[ 1.424917] sunxi_i2c_do_xfer()985 - [i2c1] incomplete xfer (status: 0x20, dev addr: 0x18)[ 1.425155] sunxi_i2c_do_xfer()985 - [i2c1] incomplete xfer (status: 0x20, dev addr: 0x19)[ 1.425393] sunxi_i2c_do_xfer()985 - [i2c1] incomplete xfer (status: 0x20, dev addr: 0x1a)[ 1.425630] sunxi_i2c_do_xfer()985 - [i2c1] incomplete xfer (status: 0x20, dev addr: 0x29)[ 1.425868] sunxi_i2c_do_xfer()985 - [i2c1] incomplete xfer (status: 0x20, dev addr: 0x2a)[ 1.426107] sunxi_i2c_do_xfer()985 - [i2c1] incomplete xfer (status: 0x20, dev addr: 0x2b)[ 1.426344] sunxi_i2c_do_xfer()985 - [i2c1] incomplete xfer (status: 0x20, dev addr: 0x4c)[ 1.426581] sunxi_i2c_do_xfer()985 - [i2c1] incomplete xfer (status: 0x20, dev addr: 0x4d)[ 1.426818] sunxi_i2c_do_xfer()985 - [i2c1] incomplete xfer (status: 0x20, dev addr: 0x4e)[ 1.426849] sunxi_wdt_init_module: sunxi WatchDog Timer Driver v1.0[ 1.427189] sunxi_wdt_probe: devm_ioremap return wdt_reg 0xf1c20ca0, res->start 0x01c20ca0, res->end 0x01c20cbf[ 1.427511] sunxi_wdt_probe: initialized (g_timeout=16s, g_nowayout=0)[ 1.427538] wdt_enable, write reg 0xf1c20cb8 val 0x00000000[ 1.427560] timeout_to_interv, line 167[ 1.427577] interv_to_timeout, line 189[ 1.427597] wdt_set_tmout, write 0x000000b0 to mode reg 0xf1c20cb8, actual timeout 16 sec[ 1.428429] device-mapper: ioctl: 4.22.0-ioctl (2011-10-19) initialised: [email protected][ 1.428829] calibrat: max_cpufreq 1008Mhz Type 1![ 1.428855] [cpu_freq] ERR:get cpu extremity frequency from sysconfig failed, use max_freq[ 1.429484] [mmc]: SD/MMC/SDIO Host Controller Driver(v1.111 2015-4-13 15:24) Compiled in Feb 23 2017 at 19:53:48[ 1.429553] [mmc]: get mmc0's sdc_power is null![ 1.429612] [mmc]: get mmc1's sdc_power is null![ 1.429631] [mmc]: get mmc1's 2xmode ok, val = 1[ 1.429651] [mmc]: get mmc1's ddrmode ok, val = 1[ 1.429684] [mmc]: MMC host used card: 0x3, boot card: 0x0, io_card 2[ 1.434389] [mmc]: sdc0 power_supply is null[ 1.437189] no blue_led, ignore it![ 1.437669] Registered led device: red_led[ 1.437903] Registered led device: green_led[ 1.437936] no led_0, ignore it![ 1.437952] no led_1, ignore it![ 1.437967] no led_2, ignore it![ 1.437982] no led_3, ignore it![ 1.437997] no led_4, ignore it![ 1.438012] no led_5, ignore it![ 1.438026] no led_6, ignore it![ 1.438041] no led_7, ignore it![ 1.439742] usbcore: registered new interface driver usbhid[ 1.439767] usbhid: USB HID core driver[ 1.448220] asoc: sndcodec <-> sunxi-codec mapping ok[ 1.450721] [DAUDIO]sunxi-daudio cannot find any using configuration for controllers, return directly![ 1.451109] [I2S]snddaudio cannot find any using configuration for controllers, return directly![ 1.451138] [DAUDIO0] driver not init,just return.[ 1.458288] asoc: sndhdmi <-> sunxi-hdmiaudio.0 mapping ok[ 1.461109] oprofile: using arm/armv7-ca7[ 1.461461] u32 classifier[ 1.461481] Performance counters on[ 1.461497] input device check on[ 1.461512] Actions configured[ 1.461896] IPv4 over IPv4 tunneling driver[ 1.463190] TCP: bic registered[ 1.463213] TCP: cubic registered[ 1.463230] TCP: westwood registered[ 1.463246] TCP: highspeed registered[ 1.463262] TCP: hybla registered[ 1.463277] TCP: htcp registered[ 1.463293] TCP: vegas registered[ 1.463309] TCP: veno registered[ 1.463324] TCP: scalable registered[ 1.463340] TCP: lp registered[ 1.463356] TCP: yeah registered[ 1.463372] TCP: illinois registered[ 1.463387] Initializing XFRM netlink socket[ 1.463837] NET: Registered protocol family 10[ 1.466221] NET: Registered protocol family 17[ 1.466284] NET: Registered protocol family 15[ 1.466374] Registering the dns_resolver key type[ 1.467531] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5[ 1.467576] ThumbEE CPU extension supported.[ 1.467619] Registering SWP/SWPB emulation handler[ 1.468734] registered taskstats version 1[ 1.470417] cmdline,disp=[ 1.470791] [DISP] disp_init_tv,line:539:screen 0 do not support TV TYPE![ 1.470830] [DISP] bsp_disp_tv_register,line:990:'ptv is null[ 1.470853] tv registered!![ 1.470980] [DISP] disp_device_attached_and_enable,line:159:attched ok, mgr1<-->device1, type=2, mode=11[ 1.480565] ths_fetch_sysconfig_para: type err device_used = 1.[ 1.483260] CPU Budget:corekeeper enabled[ 1.483749] CPU Budget:Register notifier[ 1.483775] CPU Budget:register Success[ 1.483800] sunxi-budget-cooling sunxi-budget-cooling: Cooling device registered: thermal-budget-0[ 1.490595] [rf_pm]: Did not config module_power1 in sys_config[ 1.490623] [rf_pm]: Did not config module_power2 in sys_config[ 1.490645] [rf_pm]: Did not config module_power3 in sys_config[ 1.490666] [rf_pm]: mod has no chip_en gpio[ 1.490684] [rf_pm]: regulator on.[ 1.490717] [rf_pm]: set losc_out 32k out[wifi_pm]: set wl_reg_on 1 ![ 1.549430] mmc0: new high speed SDHC card at address aaaa[ 1.550522] mmcblk0: mmc0:aaaa SS08G 7.40 GiB[ 1.553946] mmcblk0: p1[ 1.554969] mmcblk mmc0:aaaa: Card claimed for testing.[ 1.554999] mmc0:aaaa: SS08G 7.40 GiB[ 1.591339] [wifi_pm]: get wifi_sdc_id failed[ 1.592912] [mmc]: sdc1 power_supply is null[ 1.648738] mmc1: new high speed SDIO card at address 0001[ 1.691419] [wifi_pm]: wifi gpio init is OK !![ 1.691532] [rfkill]: init no bt used in configuration[ 1.691555] ALSA device list:[ 1.691571] #0: audiocodec[ 1.691587] #1: sndhdmi[ 1.693346] Freeing init memory: 332K[ 1.776600] systemd-udevd[96]: starting version 215[ 2.613445] Btrfs loaded[ 3.084545] EXT4-fs (mmcblk0p1): mounted filesystem with writeback data mode. Opts: (null)[ 4.290630] systemd[1]: systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)[ 4.291299] systemd[1]: Detected architecture 'arm'.[ 4.335894] systemd[1]: Set hostname to <orangepizero>.[ 4.766400] systemd[1]: Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory.[ 4.771956] systemd[1]: Expecting device dev-ttyGS0.device...[ 4.790320] systemd[1]: Expecting device dev-ttyS0.device...[ 4.810269] systemd[1]: Starting Forward Password Requests to Wall Directory Watch.[ 4.810757] systemd[1]: Started Forward Password Requests to Wall Directory Watch.[ 4.810903] systemd[1]: Starting Remote File Systems (Pre).[ 4.830253] systemd[1]: Reached target Remote File Systems (Pre).[ 4.830450] systemd[1]: Starting Encrypted Volumes.[ 4.850252] systemd[1]: Reached target Encrypted Volumes.[ 4.850439] systemd[1]: Starting Dispatch Password Requests to Console Directory Watch.[ 4.850864] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.[ 4.850987] systemd[1]: Starting Paths.[ 4.870256] systemd[1]: Reached target Paths.[ 4.870515] systemd[1]: Starting Arbitrary Executable File Formats File System Automount Point.[ 4.890269] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.[ 4.890460] systemd[1]: Starting Root Slice.[ 4.910246] systemd[1]: Created slice Root Slice.[ 4.910384] systemd[1]: Starting /dev/initctl Compatibility Named Pipe.[ 4.930263] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.[ 4.930400] systemd[1]: Starting Delayed Shutdown Socket.[ 4.950245] systemd[1]: Listening on Delayed Shutdown Socket.[ 4.950379] systemd[1]: Starting Journal Socket (/dev/log).[ 4.970251] systemd[1]: Listening on Journal Socket (/dev/log).[ 4.970392] systemd[1]: Starting User and Session Slice.[ 4.990253] systemd[1]: Created slice User and Session Slice.[ 4.990426] systemd[1]: Starting udev Control Socket.[ 5.010256] systemd[1]: Listening on udev Control Socket.[ 5.010419] systemd[1]: Starting udev Kernel Socket.[ 5.030245] systemd[1]: Listening on udev Kernel Socket.[ 5.030417] systemd[1]: Starting Journal Socket.[ 5.050253] systemd[1]: Listening on Journal Socket.[ 5.050505] systemd[1]: Starting System Slice.[ 5.070262] systemd[1]: Created slice System Slice.[ 5.070580] systemd[1]: Starting Increase datagram queue length...[ 5.211363] systemd[1]: Starting Restore / save the current clock...[ 5.311898] systemd[1]: Starting Create list of required static device nodes for the current kernel...[ 5.411594] systemd[1]: Mounting POSIX Message Queue File System...[ 5.500987] systemd[1]: Starting udev Coldplug all Devices...[ 5.592076] systemd[1]: Mounting Debug File System...[ 5.701113] systemd[1]: Mounted Huge Pages File System.[ 5.707746] systemd[1]: Started Set Up Additional Binary Formats.[ 5.707959] systemd[1]: Starting LSB: Set keymap...[ 5.841077] systemd[1]: Starting system-serial\x2dgetty.slice.[ 5.860404] systemd[1]: Created slice system-serial\x2dgetty.slice.[ 5.860649] systemd[1]: Starting system-getty.slice.[ 5.880314] systemd[1]: Created slice system-getty.slice.[ 5.887902] systemd[1]: Starting Load Kernel Modules...[ 5.981417] systemd[1]: Started File System Check on Root Device.[ 5.981693] systemd[1]: Starting Slices.[ 6.000630] systemd[1]: Reached target Slices.[ 6.020368] systemd[1]: Mounted Debug File System.[ 6.040517] systemd[1]: Mounted POSIX Message Queue File System.[ 6.101352] [XRADIO] Driver Label:L34M.01.08.0002 Feb 23 2017 19:54:01 [ 6.101470] [XRADIO] Allocated hw_priv @ d6e67240 [ 6.102300] [SBUS] XRadio Device:sdio clk=50000000 [ 6.102625] xradio wlan power on [ 6.102656] gpio wl_reg_on set val 1, act val 1 [ 6.130373] systemd[1]: Started Increase datagram queue length. [ 6.152709] gpio wl_reg_on set val 0, act val 0 [ 6.154738] gpio wl_reg_on set val 1, act val 1 [ 6.210296] systemd[1]: Started Restore / save the current clock. [ 6.254812] [XRADIO] Detect SDIO card 1 [ 6.310257] systemd[1]: Started Create list of required static device nodes for the current kernel. [ 6.470510] systemd[1]: Started LSB: Set keymap. [ 6.590308] systemd[1]: Started udev Coldplug all Devices. [ 6.596253] systemd[1]: Time has been changed [ 6.597349] systemd[1]: Starting Create Static Device Nodes in /dev... [ 6.601474] [XRADIO_ERR] xradio_load_firmware: can't read config register, err=-110. [ 6.601501] [XRADIO_ERR] xradio_load_firmware failed(-110). [ 6.731413] systemd[1]: Starting Syslog Socket. [ 6.750529] systemd[1]: Listening on Syslog Socket. [ 6.750859] systemd[1]: Starting Journal Service... [ 6.890437] systemd[1]: Started Journal Service. [ 6.938024] xradio wlan power off [ 6.938078] gpio wl_reg_on set val 0, act val 0 [ 6.988261] [XRADIO] Remove SDIO card 1 [ 6.988579] mmc1: card 0001 removed [ 6.989029] [mmc]: sdc1 power_supply is null [ 7.063734] ep_matches, wrn: endpoint already claimed, ep(0xc097afbc, 0xd6a30cc0, ep1in-bulk) [ 7.063778] ep_matches, wrn: endpoint already claimed, ep(0xc097afbc, 0xd6a30cc0, ep1in-bulk) [ 7.063807] ep_matches, wrn: endpoint already claimed, ep(0xc097b008, 0xd6a30cc0, ep1out-bulk) [ 7.063830] gadget_is_softwinner_otg is not -int [ 7.063846] gadget_is_softwinner_otg is not -int [ 7.063880] g_serial gadget: Gadget Serial v2.4 [ 7.063913] g_serial gadget: g_serial ready [ 7.074002] [XRADIO_ERR] xradio_host_dbg_init failed=2599 [ 7.074032] [XRADIO] Driver Label:L34M.01.08.0002 Feb 23 2017 19:54:01 [ 7.074150] [XRADIO] Allocated hw_priv @ d6e5d240 [ 7.074761] xradio wlan power on [ 7.074798] gpio wl_reg_on set val 1, act val 1 [ 7.124840] gpio wl_reg_on set val 0, act val 0 [ 7.126865] gpio wl_reg_on set val 1, act val 1 [ 7.166700] systemd-udevd[172]: starting version 215 [ 7.226966] [XRADIO] Detect SDIO card 1 [ 7.228536] [mmc]: sdc1 power_supply is null [ 7.279737] mmc1: new high speed SDIO card at address 0001 [ 7.280968] [SBUS] XRadio Device:sdio clk=50000000 [ 7.282400] [XRADIO] XRADIO_HW_REV 1.0 detected. [ 7.449751] [XRADIO] Bootloader complete [ 7.648793] [XRADIO] Firmware completed. [ 7.652052] [WSM] Firmware Label:XR_C01.08.0043 Jun 6 2016 20:41:04 [ 7.667293] [XRADIO] Firmware Startup Done. [ 7.669691] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht' [ 7.747359] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x77) [ 7.747431] bmp085: probe of 0-0077 failed with error -70 [ 7.760504] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x48) [ 7.760844] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x48, dev addr: 0x48) [ 8.399751] EXT4-fs (mmcblk0p1): re-mounted. Opts: commit=600,errors=remount-ro [ 8.775241] Adding 131068k swap on /var/swap. Priority:-1 extents:1 across:131068k SS [ 10.538125] systemd-journald[171]: Received request to flush runtime journal from PID 1 [ 12.991199] Registered IR keymap rc-empty [ 12.992787] rc0: sunxi-ir as /devices/virtual/rc/rc0 [ 13.031684] IR RC5(x) protocol handler initialized [ 13.158761] rc s_cir0: lirc_dev: driver ir-lirc-codec (sunxi-ir) registered at minor = 0 [ 13.269608] gmac0: probed [ 13.270238] gmac0 gmac0: eth0: eth0: PHY ID 00441400 at 0 IRQ poll (gmac0-0:00) [ 15.060372] [STA] !!!xradio_vif_setup: id=0, type=2, p2p=0 [ 15.102065] ADDRCONF(NETDEV_UP): wlan0: link is not ready [ 15.270361] PHY: gmac0-0:00 - Link is Up - 100/Full [ 16.581088] wlan0: authenticate with 60:e3:27:fe:c3:60 [ 16.581151] [STA_WRN] Freq 2437 (wsm ch: 6). [ 16.620255] wlan0: send auth to 60:e3:27:fe:c3:60 (try 1/3) [ 16.710994] wlan0: authenticated [ 16.720147] wlan0: associate with 60:e3:27:fe:c3:60 (try 1/3) [ 16.724399] wlan0: RX AssocResp from 60:e3:27:fe:c3:60 (capab=0x431 status=0 aid=1) [ 16.725922] [AP_WRN] [STA] ASSOC HTCAP 11N 58 [ 16.727653] wlan0: associated [ 16.727929] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes readyUpdate : i removed some initial part of dmesg log due to word limit in stack exchange | Can't able to ssh through WiFi without Ethernet connected | ssh;boot;routing;ethernet;wlan | null |
_reverseengineering.11462 | I am using OllyDbg 2.1.0.4 and I cant get any plugins to work. I have tried ODbgScript.1.82, OllyDump v2.1.0.2 and Advanced Labels v1.3.0.9. When I tried the first two I got Plugins tab greyed out. Advanced Labels makes OllyDbg crash.I have set the plugin path to ..\OllyDbg 2.01\Plugins in the .ini file. What is there that I am missing? | OllyDbg plugins not working | ollydbg | null |
_codereview.171780 | My code below takes the following data lines:2017:06:29T14:12:06,0,0,00,000,0.000,0.000,000,000,040,040,040,0,00,000,0.000,0.000,000,000,040,040,040,0,00,000,0.000,0.000,000,000,040,040,040,0,00,000,0.000,0.000,000,000,040,040,040,2017:06:29T14:12:07,0,1013,02,000,0.000,0.000,000,000,040,040,040,1014,02,000,0.000,0.000,000,000,040,040,040,1015,02,000,0.000,0.000,000,000,040,040,040,1008,02,000,0.000,0.000,000,000,040,040,040,2017:06:29T14:12:08,0,1013,00,153,-0.102,12.748,000,000,38,34,33,1014,00,199,-0.108,12.734,000,000,38,35,33,1015,00,171,-0.113,12.741,000,000,37,35,33,1008,00,153,-0.114,12.751,000,000,37,35,33,2017:06:29T14:12:09,0,1013,00,154,-0.100,12.760,000,000,38,34,33,1014,00,200,-0.106,12.732,000,000,38,35,33,1015,00,172,-0.112,12.737,000,000,37,35,33,1008,00,154,-0.107,12.748,000,000,37,35,33,2017:06:29T14:12:10,0,1013,00,155,-0.111,12.744,000,000,38,34,33,1014,00,201,-0.105,12.743,000,000,38,35,33,1015,00,173,-0.117,12.725,000,000,37,35,33,1008,00,155,-0.110,12.739,000,000,37,35,33,2017:06:29T14:12:11,0,1013,00,156,-0.112,12.751,000,000,38,34,33,1014,00,202,-0.102,12.734,000,000,38,35,33,1015,00,174,-0.105,12.755,000,000,37,35,33,1008,00,156,-0.110,12.741,000,000,37,35,33,2017:06:29T14:12:12,0,1013,00,157,-0.102,12.758,000,000,38,34,33,1014,00,203,-0.105,12.744,000,000,38,35,33,1015,00,175,-0.103,12.757,000,000,37,35,33,1008,00,157,-0.107,12.757,000,000,37,35,33,2017:06:29T14:12:13,0,1013,00,158,-0.113,12.737,000,000,38,34,33,1014,00,204,-0.094,12.760,000,000,38,35,33,1015,00,176,-0.117,12.748,000,000,37,35,33,1008,00,158,-0.109,12.744,000,000,37,35,33,2017:06:29T14:12:14,0,1013,00,159,-0.103,12.753,000,000,38,34,33,1014,00,205,-0.103,12.720,000,000,38,35,33,1015,00,177,-0.108,12.732,000,000,37,35,33,1008,00,159,-0.110,12.758,000,000,37,35,33,2017:06:29T14:12:15,0,1013,00,160,-0.112,12.757,000,000,38,34,33,1014,00,206,-0.095,12.734,000,000,38,35,33,1015,00,178,-0.118,12.729,000,000,37,35,33,1008,00,160,-0.115,12.755,000,000,37,35,33,and separates the date and time 2017:06:29T14:12:15, then rest of the data separated by comas.As my title says, the data above is only a taste of the actual data that I will be getting. So when I run this code with upto like 10,000 lines of data, excel freezes because the code takes about 7-10 minutes to run. When I have more than that, excel freezes completely for much longer and when it comes back, the graphs that the code is supposed to generate are missing or inaccurate. I assume this is because there is alot of data but I have no idea how to fix that. I am very new to Excel VBA and I would very much like to learn.Sub SeparateData()'Purpose: This macro take the data in the worksheet and separates the data in a readable fashion for the user.' This macro also plots and reports any errors that it has caught both in separate sheets named accordingly.'Define variablesDim i As VariantDim j As VariantDim k As VariantDim data As VariantDim data2 As VariantDim count As VariantDim shiftDown As VariantDim monitorNum As VariantDim errorCount As VariantDim dataSheet As WorksheetDim plotSheet As WorksheetDim errorSheet As WorksheetDim battChart As ChartObjectDim currChart As ChartObjectDim tempChart As ChartObject'For code performanceApplication.ScreenUpdating = FalseApplication.Calculation = xlCalculationManual'Rename the first sheetActiveSheet.Name = DataSet dataSheet = Sheets(Data)'Rename the second sheetSheets(Sheet2).Name = PlotsSet plotSheet = Sheets(Plots)'Rename the third sheetSheets(Sheet3).Name = ErrorsSet errorSheet = Sheets(Errors)'Enter the number of monitorsmonitorNum = 4'Variable to shift down the data so that te headers will fit (recommended 2)shiftDown = 2'Variable to count the number of errors the program thinks occurederrorCount = 0'Count how many data point there are in the sheetcount = dataSheet.Cells(1, 1).CurrentRegion.Rows.count'Iterate through the points separating the DataFor i = 0 To count - 1 'Start of the Data sheet usage With dataSheet 'First separate the date from the rest data = .Cells(count - i, 1).Value data = Split(data, T) For j = 0 To UBound(data) .Cells(count - i + shiftDown, j + 1).Value = data(j) Next j 'Now separate the rest of the data data2 = data(1) data2 = Split(data2, ,) For j = 0 To UBound(data2) .Cells(count - i + shiftDown, j + 2).Value = data2(j) Next j 'Check for key switch error If .Cells(count - i + shiftDown, 3).Value > 20 Or IsNumeric(.Cells(count - i + shiftDown, 3).Value) = False Then 'increment the number of errors found errorCount = errorCount + 1 'Save the row number and the monitor number where the error was found errorSheet.Cells(errorCount, 1).Value = Key switch error in row errorSheet.Cells(errorCount, 2).Value = count - i + shiftDown errorSheet.Cells(errorCount, 3).Value = in column errorSheet.Cells(errorCount, 4).Value = 3 errorSheet.Cells(errorCount, 7).Value = The recorded data was .Cells(count - i + shiftDown, 3).Copy errorSheet.Cells(errorCount, 8) errorSheet.Range(errorSheet.Cells(errorCount, 1), errorSheet.Cells(errorCount, 8)).Interior.Color = RGB(200, 200, 0) 'Clear the contents of the error .Cells(count - i + shiftDown, 3).ClearContents End If For k = 0 To monitorNum - 1 'Check for voltage error If .Cells(count - i + shiftDown, (k * 10) + 8).Value > 20 Or IsNumeric(.Cells(count - i + shiftDown, (k * 10) + 8).Value) = False Then 'increment the number of errors found errorCount = errorCount + 1 'Save the row number and the monitor number where the error was found errorSheet.Cells(errorCount, 1).Value = Voltage error in row errorSheet.Cells(errorCount, 2).Value = count - i + shiftDown errorSheet.Cells(errorCount, 3).Value = in column errorSheet.Cells(errorCount, 4).Value = (k * 10) + 8 errorSheet.Cells(errorCount, 5).Value = in Monitor errorSheet.Cells(errorCount, 6).Value = k + 1 errorSheet.Cells(errorCount, 7).Value = The recorded data was .Cells(count - i + shiftDown, (k * 10) + 8).Copy errorSheet.Cells(errorCount, 8) errorSheet.Range(errorSheet.Cells(errorCount, 1), errorSheet.Cells(errorCount, 8)).Interior.Color = RGB(110, 160, 180) 'Clear the contents of the error .Cells(count - i + shiftDown, (k * 10) + 8).ClearContents End If 'Check for current error If .Cells(count - i + shiftDown, (k * 10) + 7).Value > 80 Or IsNumeric(.Cells(count - i + shiftDown, (k * 10) + 7).Value) = False Then 'increment the number of errors found errorCount = errorCount + 1 'Save the row number and the monitor number where the error was found errorSheet.Cells(errorCount, 1).Value = Current error in row errorSheet.Cells(errorCount, 2).Value = count - i + shiftDown errorSheet.Cells(errorCount, 3).Value = in column errorSheet.Cells(errorCount, 4).Value = (k * 10) + 7 errorSheet.Cells(errorCount, 5).Value = in Monitor errorSheet.Cells(errorCount, 6).Value = k + 1 errorSheet.Cells(errorCount, 7).Value = The recorded data was .Cells(count - i + shiftDown, (k * 10) + 7).Copy errorSheet.Cells(errorCount, 8) errorSheet.Range(errorSheet.Cells(errorCount, 1), errorSheet.Cells(errorCount, 8)).Interior.Color = RGB(240, 150, 150) 'Clear the contents of the error .Cells(count - i + shiftDown, (k * 10) + 7).ClearContents End If 'Check for temperature error If .Cells(count - i + shiftDown, (k * 10) + 13).Value > 83 Or IsNumeric(.Cells(count - i + shiftDown, (k * 10) + 13).Value) = False Then 'increment the number of errors found errorCount = errorCount + 1 'Save the row number and the monitor number where the error was found errorSheet.Cells(errorCount, 1).Value = Temperature error in row errorSheet.Cells(errorCount, 2).Value = count - i + shiftDown errorSheet.Cells(errorCount, 3).Value = in column errorSheet.Cells(errorCount, 4).Value = (k * 10) + 13 errorSheet.Cells(errorCount, 5).Value = in Monitor errorSheet.Cells(errorCount, 6).Value = k + 1 errorSheet.Cells(errorCount, 7).Value = The recorded data was .Cells(count - i + shiftDown, (k * 10) + 13).Copy errorSheet.Cells(errorCount, 8) errorSheet.Range(errorSheet.Cells(errorCount, 1), errorSheet.Cells(errorCount, 8)).Interior.Color = RGB(255, 190, 0) 'Clear the contents of the error .Cells(count - i + shiftDown, (k * 10) + 13).ClearContents End If Next k 'End of Dats sheet usage End WithNext i'The next block uses the Data sheetWith dataSheet'Erase the data that has been duplicatedFor i = 1 To shiftDown .Cells(i, 1).Value = Next i'Write and color the headers'For the Date.Range(.Cells(shiftDown - 1, 1), .Cells(shiftDown, 1)).Merge.Range(.Cells(shiftDown - 1, 1), .Cells(shiftDown, 1)).Value = Date.Range(.Cells(shiftDown - 1, 1), .Cells(count + shiftDown, 1)).Interior.Color = RGB(200, 190, 150)'For the Time.Range(.Cells(shiftDown - 1, 2), .Cells(shiftDown, 2)).Merge.Range(.Cells(shiftDown - 1, 2), .Cells(shiftDown, 2)).Value = Time.Range(.Cells(shiftDown - 1, 2), .Cells(count + shiftDown, 2)).Interior.Color = RGB(150, 140, 80)'For the Key Switch.Range(.Cells(shiftDown - 1, 3), .Cells(shiftDown, 3)).Merge.Range(.Cells(shiftDown - 1, 3), .Cells(shiftDown, 3)).Value = Key Switch.Range(.Cells(shiftDown - 1, 3), .Cells(count + shiftDown, 3)).Interior.Color = RGB(200, 200, 0)For i = 1 To monitorNum .Range(.Cells(shiftDown - 1, ((i - 1) * 10) + 4), .Cells(shiftDown - 1, (i * 10) + 3)).Merge .Range(.Cells(shiftDown - 1, ((i - 1) * 10) + 4), .Cells(shiftDown - 1, (i * 10) + 3)).Value = Monitor & i 'color the headers If i Mod 4 = 0 Then .Range(.Cells(shiftDown - 1, ((i - 1) * 10) + 4), .Cells(shiftDown - 1, (i * 10) + 3)).Interior.Color = RGB(100, 255, 100) ElseIf i Mod 3 = 0 Then .Range(.Cells(shiftDown - 1, ((i - 1) * 10) + 4), .Cells(shiftDown - 1, (i * 10) + 3)).Interior.Color = RGB(255, 100, 10) ElseIf i Mod 2 = 0 Then .Range(.Cells(shiftDown - 1, ((i - 1) * 10) + 4), .Cells(shiftDown - 1, (i * 10) + 3)).Interior.Color = RGB(100, 100, 255) Else .Range(.Cells(shiftDown - 1, ((i - 1) * 10) + 4), .Cells(shiftDown - 1, (i * 10) + 3)).Interior.Color = RGB(255, 75, 75) End IfNext iFor i = 0 To monitorNum - 1 'Monitor ID .Cells(shiftDown, 1 + (i * 10) + 3).Value = MONITOR_NUM 'Monitor status .Cells(shiftDown, 2 + (i * 10) + 3).Value = MONITOR_STATUS 'Heart Beat count .Cells(shiftDown, 3 + (i * 10) + 3).Value = HB_COUNT 'For Current .Cells(shiftDown, 4 + (i * 10) + 3).Value = CURRENT .Range(.Cells(shiftDown, 4 + (i * 10) + 3), .Cells(count + shiftDown, 4 + (i * 10) + 3)).Interior.Color = RGB(240, 150, 150) 'For Voltage .Cells(shiftDown, 5 + (i * 10) + 3).Value = VOLTAGE .Range(.Cells(shiftDown, 5 + (i * 10) + 3), .Cells(count + shiftDown, 5 + (i * 10) + 3)).Interior.Color = RGB(110, 160, 180) 'State of Charge .Cells(shiftDown, 6 + (i * 10) + 3).Value = SOC 'State of Health .Cells(shiftDown, 7 + (i * 10) + 3).Value = SOH 'Chip temperature .Cells(shiftDown, 8 + (i * 10) + 3).Value = TEMP_CHP 'Internal temperature .Cells(shiftDown, 9 + (i * 10) + 3).Value = TEMP_INT 'For Temperature of the terminal .Cells(shiftDown, 10 + (i * 10) + 3).Value = TEMP_EXT .Range(.Cells(shiftDown, 10 + (i * 10) + 3), .Cells(count + shiftDown, 10 + (i * 10) + 3)).Interior.Color = RGB(255, 190, 0)Next i'Data sheet'Add borders all around the data.Cells(shiftDown, 1).CurrentRegion.Borders.LineStyle = xlContinuous'Autofit all the columns.Cells(shiftDown, 1).CurrentRegion.EntireColumn.AutoFit'End of the Data sheet usage for nowEnd With'Error sheet'Add borders all around the dataerrorSheet.Cells(1, 1).CurrentRegion.Borders.LineStyle = xlContinuous'Autofit all the columnserrorSheet.Cells(1, 1).CurrentRegion.EntireColumn.AutoFit'Plotting'Add a new plotSet battChart = plotSheet.ChartObjects.Add(0, 0, 1200, 300)'Plot the battery dataWith battChart.Chart .SetSourceData Source:=dataSheet.Range(dataSheet.Cells(shiftDown + 5, 8), dataSheet.Cells(count + shiftDown, 8)) .SeriesCollection(1).Name = Battery 1 .ChartWizard Title:=Voltage, HasLegend:=True, CategoryTitle:=Time (s), ValueTitle:=Voltage (V), Gallery:=xlXYScatterLinesNoMarkers For i = 2 To monitorNum .SeriesCollection.NewSeries .SeriesCollection(i).Values = dataSheet.Range(dataSheet.Cells(5, ((i - 1) * 10) + 8), dataSheet.Cells(count + shiftDown, ((i - 1) * 10) + 8)) .SeriesCollection(i).Name = Battery & i Next iEnd With'Add a new plotSet currChart = plotSheet.ChartObjects.Add(0, 300, 1200, 300)'Plot the current dataWith currChart.Chart .SetSourceData Source:=dataSheet.Range(dataSheet.Cells(shiftDown + 5, 7), dataSheet.Cells(count + shiftDown, 7)) .SeriesCollection(1).Name = Battery 1 .ChartWizard Title:=Current, HasLegend:=True, CategoryTitle:=Time (s), ValueTitle:=Current (A), Gallery:=xlXYScatterLinesNoMarkers For i = 2 To monitorNum .SeriesCollection.NewSeries .SeriesCollection(i).Values = dataSheet.Range(dataSheet.Cells(5, ((i - 1) * 10) + 7), dataSheet.Cells(count + shiftDown, ((i - 1) * 10) + 7)) .SeriesCollection(i).Name = Battery & i Next iEnd With'Add a new plotSet tempChart = plotSheet.ChartObjects.Add(0, 600, 1200, 300)'Plot the current dataWith tempChart.Chart .SetSourceData Source:=dataSheet.Range(dataSheet.Cells(shiftDown + 5, 13), dataSheet.Cells(count + shiftDown, 13)) .SeriesCollection(1).Name = Battery 1 .ChartWizard Title:=Temperature, HasLegend:=True, CategoryTitle:=Time (s), ValueTitle:=Temperature (F), Gallery:=xlXYScatterLinesNoMarkers For i = 2 To monitorNum .SeriesCollection.NewSeries .SeriesCollection(i).Values = dataSheet.Range(dataSheet.Cells(5, ((i - 1) * 10) + 13), dataSheet.Cells(count + shiftDown, ((i - 1) * 10) + 13)) .SeriesCollection(i).Name = Battery & i Next iEnd With'For code performanceApplication.Calculation = xlCalculationAutomaticApplication.ScreenUpdating = True'Indicate that the macro has finished its jobBeepEnd SubIf there is anything that is unclear or inaccurate, please ask and I will be more than happy to answer. | Separating hundreds of thousands of points using vba | performance;vba;excel | null |
_webmaster.71677 | I'm using a blog that automatically nofollows links in spite of manually dofollowing links in the HTML code. so I decided to put this code:<meta name=robots content=index,follow,noodp,noydir/>in the head of the blog to enable following for my link.My question is that will that code override each link's rel=nofollow rule and let search engine crawl and count those links for SEO? | Overriding nofollow rules with meta tag | seo;links;meta tags;nofollow;dofollow | Search engines crawlers follow the most restrictive rule. If you use nofollow in your meta tag, no link will be followed. If you use follow in your meta tag, all links will be followed except those with rel=nofollow.So answer to your question is no, meta tag with follow doesn't override individual rel=nofollow.http://googlewebmastercentral.blogspot.co.nz/2007/03/using-robots-meta-tag.htmlhttps://support.google.com/webmasters/answer/96569?hl=en |
_unix.309224 | [kenneth@kyb0rg ~]$ uname -r4.7.2-101.fc23.x86_64When I start VMWare a box appears!I click installSee log file /tmp/vmware-root/vmware-14992.log for details.[root@kyb0rg kenneth]# /tmp/vmware-root/vmware-14992.logbash: /tmp/vmware-root/vmware-14992.log: Permission denied[root@kyb0rg kenneth]# open /tmp/vmware-root/vmware-14992.log[root@kyb0rg kenneth]# cat /tmp/vmware-root/vmware-14992.log2016-09-11T11:32:52.140-05:00| vthread-4| I125: Log for VMware Workstation pid=14992 version=12.1.1 build=build-3770994 option=Release2016-09-11T11:32:52.140-05:00| vthread-4| I125: The process is 64-bit.2016-09-11T11:32:52.140-05:00| vthread-4| I125: Host codepage=UTF-8 encoding=UTF-82016-09-11T11:32:52.140-05:00| vthread-4| I125: Host is Linux 4.7.2-101.fc23.x86_64 Fedora release 23 (Twenty Three)2016-09-11T11:32:52.140-05:00| vthread-4| I125: DictionaryLoad: Cannot open file /usr/lib/vmware/settings: No such file or directory.2016-09-11T11:32:52.140-05:00| vthread-4| I125: PREF Optional preferences file not found at /usr/lib/vmware/settings. Using default values.2016-09-11T11:32:52.140-05:00| vthread-4| I125: DictionaryLoad: Cannot open file /root/.vmware/config: No such file or directory.2016-09-11T11:32:52.140-05:00| vthread-4| I125: PREF Optional preferences file not found at /root/.vmware/config. Using default values.2016-09-11T11:32:52.140-05:00| vthread-4| I125: PREF Unable to check permissions for preferences file.2016-09-11T11:32:52.140-05:00| vthread-4| I125: DictionaryLoad: Cannot open file /root/.vmware/preferences: No such file or directory.2016-09-11T11:32:52.140-05:00| vthread-4| I125: PREF Failed to load user preferences.2016-09-11T11:32:52.155-05:00| vthread-4| W115: Logging to /tmp/vmware-root/vmware-14992.log2016-09-11T11:32:52.159-05:00| vthread-4| I125: Obtaining info using the running kernel.2016-09-11T11:32:52.159-05:00| vthread-4| I125: Created new pathsHash.2016-09-11T11:32:52.159-05:00| vthread-4| I125: Setting header path for 4.7.2-101.fc23.x86_64 to /lib/modules/4.7.2-101.fc23.x86_64/build/include.2016-09-11T11:32:52.159-05:00| vthread-4| I125: Validating path /lib/modules/4.7.2-101.fc23.x86_64/build/include for kernel release 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.159-05:00| vthread-4| I125: Failed to find /lib/modules/4.7.2-101.fc23.x86_64/build/include/linux/version.h2016-09-11T11:32:52.159-05:00| vthread-4| I125: /lib/modules/4.7.2-101.fc23.x86_64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.2016-09-11T11:32:52.159-05:00| vthread-4| I125: using /usr/bin/gcc for preprocess check2016-09-11T11:32:52.165-05:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.165-05:00| vthread-4| I125: The header path /lib/modules/4.7.2-101.fc23.x86_64/build/include for the kernel 4.7.2-101.fc23.x86_64 is valid. Whoohoo!2016-09-11T11:32:52.275-05:00| vthread-4| I125: found symbol version file /lib/modules/4.7.2-101.fc23.x86_64/build/Module.symvers2016-09-11T11:32:52.275-05:00| vthread-4| I125: Reading symbol versions from /lib/modules/4.7.2-101.fc23.x86_64/build/Module.symvers.2016-09-11T11:32:52.290-05:00| vthread-4| I125: Read 17372 symbol versions2016-09-11T11:32:52.290-05:00| vthread-4| I125: Reading in info for the vmmon module.2016-09-11T11:32:52.290-05:00| vthread-4| I125: Reading in info for the vmnet module.2016-09-11T11:32:52.290-05:00| vthread-4| I125: Reading in info for the vmblock module.2016-09-11T11:32:52.290-05:00| vthread-4| I125: Reading in info for the vmci module.2016-09-11T11:32:52.290-05:00| vthread-4| I125: Reading in info for the vsock module.2016-09-11T11:32:52.290-05:00| vthread-4| I125: Setting vsock to depend on vmci.2016-09-11T11:32:52.290-05:00| vthread-4| I125: Invoking modinfo on vmmon.2016-09-11T11:32:52.292-05:00| vthread-4| I125: /sbin/modinfo exited with status 256.2016-09-11T11:32:52.292-05:00| vthread-4| I125: Invoking modinfo on vmnet.2016-09-11T11:32:52.293-05:00| vthread-4| I125: /sbin/modinfo exited with status 256.2016-09-11T11:32:52.293-05:00| vthread-4| I125: Invoking modinfo on vmblock.2016-09-11T11:32:52.294-05:00| vthread-4| I125: /sbin/modinfo exited with status 256.2016-09-11T11:32:52.294-05:00| vthread-4| I125: Invoking modinfo on vmci.2016-09-11T11:32:52.296-05:00| vthread-4| I125: /sbin/modinfo exited with status 256.2016-09-11T11:32:52.296-05:00| vthread-4| I125: Invoking modinfo on vsock.2016-09-11T11:32:52.298-05:00| vthread-4| I125: /sbin/modinfo exited with status 0.2016-09-11T11:32:52.306-05:00| vthread-4| I125: to be installed: vmmon status: 02016-09-11T11:32:52.306-05:00| vthread-4| I125: to be installed: vmnet status: 02016-09-11T11:32:52.315-05:00| vthread-4| I125: Obtaining info using the running kernel.2016-09-11T11:32:52.315-05:00| vthread-4| I125: Setting header path for 4.7.2-101.fc23.x86_64 to /lib/modules/4.7.2-101.fc23.x86_64/build/include.2016-09-11T11:32:52.315-05:00| vthread-4| I125: Validating path /lib/modules/4.7.2-101.fc23.x86_64/build/include for kernel release 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.315-05:00| vthread-4| I125: Failed to find /lib/modules/4.7.2-101.fc23.x86_64/build/include/linux/version.h2016-09-11T11:32:52.315-05:00| vthread-4| I125: /lib/modules/4.7.2-101.fc23.x86_64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.2016-09-11T11:32:52.315-05:00| vthread-4| I125: using /usr/bin/gcc for preprocess check2016-09-11T11:32:52.321-05:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.321-05:00| vthread-4| I125: The header path /lib/modules/4.7.2-101.fc23.x86_64/build/include for the kernel 4.7.2-101.fc23.x86_64 is valid. Whoohoo!2016-09-11T11:32:52.431-05:00| vthread-4| I125: found symbol version file /lib/modules/4.7.2-101.fc23.x86_64/build/Module.symvers2016-09-11T11:32:52.431-05:00| vthread-4| I125: Reading symbol versions from /lib/modules/4.7.2-101.fc23.x86_64/build/Module.symvers.2016-09-11T11:32:52.445-05:00| vthread-4| I125: Read 17372 symbol versions2016-09-11T11:32:52.446-05:00| vthread-4| I125: Kernel header path retrieved from FileEntry: /lib/modules/4.7.2-101.fc23.x86_64/build/include2016-09-11T11:32:52.446-05:00| vthread-4| I125: Update kernel header path to /lib/modules/4.7.2-101.fc23.x86_64/build/include2016-09-11T11:32:52.446-05:00| vthread-4| I125: Validating path /lib/modules/4.7.2-101.fc23.x86_64/build/include for kernel release 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.446-05:00| vthread-4| I125: Failed to find /lib/modules/4.7.2-101.fc23.x86_64/build/include/linux/version.h2016-09-11T11:32:52.446-05:00| vthread-4| I125: /lib/modules/4.7.2-101.fc23.x86_64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.2016-09-11T11:32:52.446-05:00| vthread-4| I125: using /usr/bin/gcc for preprocess check2016-09-11T11:32:52.451-05:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.451-05:00| vthread-4| I125: The header path /lib/modules/4.7.2-101.fc23.x86_64/build/include for the kernel 4.7.2-101.fc23.x86_64 is valid. Whoohoo!2016-09-11T11:32:52.452-05:00| vthread-4| I125: Found compiler at /usr/bin/gcc2016-09-11T11:32:52.454-05:00| vthread-4| I125: Got gcc version 5.3.1.2016-09-11T11:32:52.454-05:00| vthread-4| I125: The GCC version matches the kernel GCC minor version like a glove.2016-09-11T11:32:52.454-05:00| vthread-4| I125: Using user supplied compiler /usr/bin/gcc.2016-09-11T11:32:52.457-05:00| vthread-4| I125: Got gcc version 5.3.1.2016-09-11T11:32:52.457-05:00| vthread-4| I125: The GCC version matches the kernel GCC minor version like a glove.2016-09-11T11:32:52.458-05:00| vthread-4| I125: Trying to find a suitable PBM set for kernel 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.458-05:00| vthread-4| I125: No matching PBM set was found for kernel 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.458-05:00| vthread-4| I125: The GCC version matches the kernel GCC minor version like a glove.2016-09-11T11:32:52.458-05:00| vthread-4| I125: Validating path /lib/modules/4.7.2-101.fc23.x86_64/build/include for kernel release 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.458-05:00| vthread-4| I125: Failed to find /lib/modules/4.7.2-101.fc23.x86_64/build/include/linux/version.h2016-09-11T11:32:52.458-05:00| vthread-4| I125: /lib/modules/4.7.2-101.fc23.x86_64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.2016-09-11T11:32:52.458-05:00| vthread-4| I125: using /usr/bin/gcc for preprocess check2016-09-11T11:32:52.464-05:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.464-05:00| vthread-4| I125: The header path /lib/modules/4.7.2-101.fc23.x86_64/build/include for the kernel 4.7.2-101.fc23.x86_64 is valid. Whoohoo!2016-09-11T11:32:52.465-05:00| vthread-4| I125: The GCC version matches the kernel GCC minor version like a glove.2016-09-11T11:32:52.465-05:00| vthread-4| I125: Validating path /lib/modules/4.7.2-101.fc23.x86_64/build/include for kernel release 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.465-05:00| vthread-4| I125: Failed to find /lib/modules/4.7.2-101.fc23.x86_64/build/include/linux/version.h2016-09-11T11:32:52.465-05:00| vthread-4| I125: /lib/modules/4.7.2-101.fc23.x86_64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.2016-09-11T11:32:52.465-05:00| vthread-4| I125: using /usr/bin/gcc for preprocess check2016-09-11T11:32:52.470-05:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.470-05:00| vthread-4| I125: The header path /lib/modules/4.7.2-101.fc23.x86_64/build/include for the kernel 4.7.2-101.fc23.x86_64 is valid. Whoohoo!2016-09-11T11:32:52.470-05:00| vthread-4| I125: Using temp dir /tmp.2016-09-11T11:32:52.471-05:00| vthread-4| I125: Obtaining info using the running kernel.2016-09-11T11:32:52.471-05:00| vthread-4| I125: Setting header path for 4.7.2-101.fc23.x86_64 to /lib/modules/4.7.2-101.fc23.x86_64/build/include.2016-09-11T11:32:52.471-05:00| vthread-4| I125: Validating path /lib/modules/4.7.2-101.fc23.x86_64/build/include for kernel release 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.471-05:00| vthread-4| I125: Failed to find /lib/modules/4.7.2-101.fc23.x86_64/build/include/linux/version.h2016-09-11T11:32:52.471-05:00| vthread-4| I125: /lib/modules/4.7.2-101.fc23.x86_64/build/include/linux/version.h not found, looking for generated/uapi/linux/version.h instead.2016-09-11T11:32:52.471-05:00| vthread-4| I125: using /usr/bin/gcc for preprocess check2016-09-11T11:32:52.476-05:00| vthread-4| I125: Preprocessed UTS_RELEASE, got value 4.7.2-101.fc23.x86_64.2016-09-11T11:32:52.476-05:00| vthread-4| I125: The header path /lib/modules/4.7.2-101.fc23.x86_64/build/include for the kernel 4.7.2-101.fc23.x86_64 is valid. Whoohoo!2016-09-11T11:32:52.586-05:00| vthread-4| I125: found symbol version file /lib/modules/4.7.2-101.fc23.x86_64/build/Module.symvers2016-09-11T11:32:52.586-05:00| vthread-4| I125: Reading symbol versions from /lib/modules/4.7.2-101.fc23.x86_64/build/Module.symvers.2016-09-11T11:32:52.600-05:00| vthread-4| I125: Read 17372 symbol versions2016-09-11T11:32:52.600-05:00| vthread-4| I125: Invoking modinfo on vmmon.2016-09-11T11:32:52.602-05:00| vthread-4| I125: /sbin/modinfo exited with status 256.2016-09-11T11:32:52.602-05:00| vthread-4| I125: Invoking modinfo on vmnet.2016-09-11T11:32:52.604-05:00| vthread-4| I125: /sbin/modinfo exited with status 256.2016-09-11T11:32:52.692-05:00| vthread-4| I125: Setting destination path for vmmon to /lib/modules/4.7.2-101.fc23.x86_64/misc/vmmon.ko.2016-09-11T11:32:52.692-05:00| vthread-4| I125: Extracting the vmmon source from /usr/lib/vmware/modules/source/vmmon.tar.2016-09-11T11:32:52.699-05:00| vthread-4| I125: Successfully extracted the vmmon source.2016-09-11T11:32:52.699-05:00| vthread-4| I125: Building module with command /usr/bin/make -j4 -C /tmp/modconfig-gLvcSL/vmmon-only auto-build HEADER_DIR=/lib/modules/4.7.2-101.fc23.x86_64/build/include CC=/usr/bin/gcc IS_GCC_3=no2016-09-11T11:32:54.104-05:00| vthread-4| W115: Failed to build vmmon. Failed to execute the build command.2016-09-11T11:32:54.105-05:00| vthread-4| I125: Setting destination path for vmnet to /lib/modules/4.7.2-101.fc23.x86_64/misc/vmnet.ko.2016-09-11T11:32:54.105-05:00| vthread-4| I125: Extracting the vmnet source from /usr/lib/vmware/modules/source/vmnet.tar.2016-09-11T11:32:54.108-05:00| vthread-4| I125: Successfully extracted the vmnet source.2016-09-11T11:32:54.108-05:00| vthread-4| I125: Building module with command /usr/bin/make -j4 -C /tmp/modconfig-gLvcSL/vmnet-only auto-build HEADER_DIR=/lib/modules/4.7.2-101.fc23.x86_64/build/include CC=/usr/bin/gcc IS_GCC_3=no2016-09-11T11:32:55.414-05:00| vthread-4| W115: Failed to build vmnet. Failed to execute the build command. | Problem with VMware Workstation 12. on Fedora 23 | fedora;vmware | null |
_unix.341436 | I have the following script #!/bin/bashfor dir in /home/marius/data/LibriSpeech/train-clean-100/*/*do for file in $dir/* do if [[ -f $file ]] then $name=$(echo $filename | cut -f 1 -d '.') ffmpeg -i $file $name.wav rm $file fidonedoneBasically I want to descend 2 subdirectories deep in the train-clean-100 folder and change all .flac files to .wav, then delete the .flac files. Somehow this is not working. | A script to convert flac files to wav is not working | bash;shell script | As ridgy said, I suggest using find to get the files you want to convert:#!/bin/bashfolder=/home/marius/data/LibriSpeech/train-clean-100for file in $(find $folder -type f -iname *.flac)do name=$(basename $file .flac) dir=$(dirname $file) echo ffmpeg -i $file $dir/$name.wav #ffmpeg -i $file $dir/$name.wav #rm $filedoneAlso use quotes when expanding variables for possible problems with whitespaces, and for this kinds of scripts check with echo if it does what you want before executing. |
_cs.76966 | This question is about modern CPU architectures and multi-threading. I'm mainly interested in personal computers or servers having 2, 4, 8, 16... cores like for example an Intel core i7. I mean not a NASA supercomputer or GPU vector processing.You have N cores.You write an algorithm in a low level language such as C, C++, Java, C#... using essentially arithmetic (+/x/and/or...), basic for loops, floating point and arrays. It is mono threaded and your algorithm takes say 1 minute to complete.Now you start N threads, and run the same algorithm on each of these threads INDEPENDENTLY : no lock (semaphores) or write access to common objects. Does each thread take 1 minute to complete, so that the total running time is 1 minute ?What prevents this from being as good as it ? I know for example that if the threads write on the same parts of the memory (even without needing locks), the CPU caches of each processor need to refresh and the whole thing can be slowed down a lot.Do you know some of the classical cases where the situation might be significantly different from each thread one minute and explain what about the architecture causes this ?Note : Intel (for example) often uses hyperthreading so that 4 cores appear to be 8 logical processors. I don't want to focus on hyperthreading and I would like to simplify my question as if hyperthreading didn't exist. Imagine that each core can process the instructions of a single thread at a time.I'm of course interested by things I might not be aware of in modern CPU architecture. | Multi-threading : N cores = N times one core? | computer architecture;cpu;threads | If I understood your question correctly, you are essentially asking:Given a piece of sequential code, if we run N instances of it in parallel on N cores (on real, modern, typical, and not-particularly-high-end CPU models), should we expect any slowdown versus running only a single instance of that program on a single core?As usual, the answer is: it depends. However, the answer will often be yes indeed, you should expect a slowdown. It will often take more than one minute per instance.How and why? Intuitively, since you've got shared (and limited) resources, your threads will naturally compete for them.For instance, main memory will be shared. Thus, if your program is bandwidth-bound (which is very common across many applications), few threads can easily fully saturate your limited memory bandwidth (essentially, they can request data from memory at a faster pace than your hardware can support) and you may notice degradation in performance (given your one minute measure) beyond that limit. You may want to look up the bandwidth-wall problem. For another similar instance, many modern CPU models will have a shared last-level cache per chip/socket. These (typically L3) caches will often provide significantly higher bandwidth and lower latency for any thread (on the chip) accessing any cached data, in comparison to directly accessing main memory. Once threads start competing for this shared resource, the total working set size of all thread may exceed the cache capacity -- even though a single thread was running within cache. They effectively thrash the cache for each other.You may want to contrast these cases to the case where the program is compute-bound and CPU-intensive yet can work with high locality in the smaller, private (i.e., not shared) caches. There are probably non-memory-hierarchy reasons as well (unlike the two above), although the reasons above are perhaps among the most obvious and most significant (or, at least, that is what I would expect). |
_unix.238877 | I have an application that utilizes ALT_R+ENTER to perform a function. When using this application in Xmonad, the combination Mod1+ENTER triggers the function swap the current window with the master window. By default, ALT_L and ALT_R are mapped to Mod1.In my .xinitrc, before I start Xmonad, I've altered my key map with xmodmap such that ALT_R is not part of the Mod1 definition. Despite this, Xmonad still performs the window swapping behavior when entering ALT_R+ENTER. Xmonad seems to be unaware that Mod1 no longer includes ALT_R.Here is my .xinitrc# Java's GUI can't handle some non-reparenting window managers like# Xmonad without being told how to behaveexport _JAVA_AWT_WM_NONREPARENTING=1# The right Alt key is useful in IntelliJ, tell Xmonad to ignore itxmodmap ~/.Xmodmap# Start XmonadxmonadHere is the output of xmodmap after Xmonad starts.xmodmap: up to 4 keys per modifier, (keycodes in parentheses):shift Shift_L (0x32), Shift_R (0x3e)lock Caps_Lock (0x42)control Control_L (0x25), Control_R (0x69)mod1 Alt_L (0x40), Meta_L (0xcd)mod2 Num_Lock (0x4d)mod3 mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)I've recorded the sequence with xev and confirmed that the ENTER is never registered. Instead, several FocusIn/FocusOut events occur after the ALT_R is recorded.KeyPress event, serial 32, synthetic NO, window 0x1200001, root 0xc0, subw 0x0, time 1432589, (92,374), root:(93,375), state 0x0, keycode 108 (keysym 0xffea, Alt_R), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: FalseFocusOut event, serial 32, synthetic NO, window 0x1200001, mode NotifyGrab, detail NotifyAncestorPropertyNotify event, serial 32, synthetic NO, window 0x1200001, atom 0x155 (WM_STATE), time 1433760, state PropertyNewValueFocusOut event, serial 32, synthetic NO, window 0x1200001, mode NotifyUngrab, detail NotifyPointerFocusIn event, serial 32, synthetic NO, window 0x1200001, mode NotifyUngrab, detail NotifyAncestorKeymapNotify event, serial 32, synthetic NO, window 0x0, keys: 0 0 0 0 0 0 0 0 0 0 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 KeyRelease event, serial 32, synthetic NO, window 0x1200001, root 0xc0, subw 0x0, time 1434117, (92,374), root:(93,375), state 0x8, keycode 108 (keysym 0xffea, Alt_R), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: FalseAnother interesting observation is that xev reports the state of each key event as 8, regardless of whether ALT_L or ALT_R is being pressed. The constant Mod1Mask in /usr/include/X11/X.h is defined as 8. The following sequence is ALT_L+f followed by ALT_R+f.KeyPress event, serial 32, synthetic NO, window 0x1000001, root 0xc0, subw 0x0, time 4126632, (85,488), root:(86,489), state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: FalseKeyPress event, serial 32, synthetic NO, window 0x1000001, root 0xc0, subw 0x0, time 4126850, (85,488), root:(86,489), state 0x8, keycode 41 (keysym 0x66, f), same_screen YES, XLookupString gives 1 bytes: (66) f XmbLookupString gives 1 bytes: (66) f XFilterEvent returns: FalseKeyRelease event, serial 32, synthetic NO, window 0x1000001, root 0xc0, subw 0x0, time 4126930, (85,488), root:(86,489), state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: FalseKeyRelease event, serial 32, synthetic NO, window 0x1000001, root 0xc0, subw 0x0, time 4126969, (85,488), root:(86,489), state 0x0, keycode 41 (keysym 0x66, f), same_screen YES, XLookupString gives 1 bytes: (66) f XFilterEvent returns: FalseKeyPress event, serial 32, synthetic NO, window 0x1000001, root 0xc0, subw 0x0, time 4127907, (85,488), root:(86,489), state 0x0, keycode 108 (keysym 0xffea, Alt_R), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: FalseKeyPress event, serial 32, synthetic NO, window 0x1000001, root 0xc0, subw 0x0, time 4128123, (85,488), root:(86,489), state 0x8, keycode 41 (keysym 0x66, f), same_screen YES, XLookupString gives 1 bytes: (66) f XmbLookupString gives 1 bytes: (66) f XFilterEvent returns: FalseKeyRelease event, serial 32, synthetic NO, window 0x1000001, root 0xc0, subw 0x0, time 4128164, (85,488), root:(86,489), state 0x8, keycode 108 (keysym 0xffea, Alt_R), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: FalseKeyRelease event, serial 32, synthetic NO, window 0x1000001, root 0xc0, subw 0x0, time 4128203, (85,488), root:(86,489), state 0x0, keycode 41 (keysym 0x66, f), same_screen YES, XLookupString gives 1 bytes: (66) f XFilterEvent returns: FalseSo the question now becomes, if xmodmask says that ALT_R is not mod1, why is X reporting ALT_R+f as if it was? | Can Xmonad treat left and right alt differently? | keyboard shortcuts;xmodmap;xmonad | The reason Xmonad is treating ALT_R+ENTER as if it was mod1+ENTER is because X is setting the mod1Mask bit in the state field of the KeyEvent, as shown in the xev output in the question. Xmonad is unaware that ALT_R is the key being pressed because X tells it that ENTER was pressed with state = mod1Mask.Why X is not respecting xmodmap is a separate question, asked here:Why isn't X treating ALT_L and ALT_R differently w/r/t Mod1 |
_ai.2404 | A single neuron is capable of forming a decision boundary between linearly seperable data. Is there any intuition as to how many, and in what configuration, would be necessary to correctly approximate a sinusoidal decision boundary?Thanks | How many nodes/hidden layers are required to solve a classification problem where the boundary is a sinusoidal function? | neural networks;hidden layers;neurons;artificial neuron | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.