How to make facebook comment box width 100% and responsive?

Question: The same question http://stackoverflow.com/questions/10862256/how-to-make-facebook-comment-box-width-100
I tried all the answers, but it doesn't work anymore. Looks like Facebook changed some stuff a little bit.
Comment: I liked 2014 in your question...
Comment: well explained .. :D :D
Comment: :) I tried all the answers from http://stackoverflow.com/questions/10862256/how-to-make-facebook-comment-box-width-100 :) It doesn't work anymore :) so I add 2014 )
Comment: I'm wondering the same. It stopped working.
Answer: This is was a facebook bug, check it out here:
https://developers.facebook.com/x/bugs/256568534516879/
The only available workaround is just using javascript.
Later edit: Bug fixed: You have to write: data-width="100%"

The width of the plugin. Either a pixel value or the literal 100% for
  fluid width. The mobile version of the Comments plugin ignores the
  width parameter, and instead has a fluid width of 100%.
  https://developers.facebook.com/docs/plugins/comments
Comment: Bug fixed! Just add data-width="100%"
Comment: Weird - not working for me. If I use 100% for fluid, the comments box doesn't show up at all. I've had to use javascript to resize it.
Comment: I get this issue randomly, sometimes would load at 100% and other times very narrow.. havent been able to fix it
Answer: With reference to https://developers.facebook.com/support/bugs/173395380238318/
Facebook comment plugin, they keep on updating new stuff but sometimes it ends up to a new bug.
So simple CSS will resolve the width issues.
/*Fb Comments Width Fix*/
.fb_iframe_widget_fluid_desktop, .fb_iframe_widget_fluid_desktop span, .fb_iframe_widget_fluid_desktop iframe {
            max-width: 100% !important;
            width: 100% !important;
 }

Note: Make sure you use !important. Without important, it will not work as excepted.
Answer:  $(".fb-comments").attr("data-width", $(".fb-comments").parent().width());
        $(window).on('resize', function () {
            resizeiframe();
        });

    function resizeiframe() {
        var src = $('.fb-comments iframe').attr('src').split('width='),
            width = $(".fb-comments").parent().width();

        $('.fb-comments iframe').attr('src', src[0] + 'width=' + width);
    }

Jquery Workaround,
Source : https://developers.facebook.com/x/bugs/256568534516879/
Comment by : Milap Bhojak
Answer: Facebook added another width 550px on .pluginSkinLight > div
add this to your css
.pluginSkinLight > div {width: 100% !important;}
Answer: I have posted a solution in response to the same question here: https://stackoverflow.com/a/22328835/2544386
The issue is that within the iframe, Facebook can change the CSS, classes, add fixed widths etc.
But if you use JS in a smart way by manipulating the tag in your HTML before it is parsed by Facebook, I believe it really reduces the chances of it being broken again if Facebook change something at their end.
Answer: facebook changed fb-comments plug in and now you can use data-width="100%"
you dont need any of style or js code.

Answer: If you are looking for the simplest way without programming. No complications.
You just do it like always (with the facebook's code box), then open Inspect Element on the browser (right-click any element on the page and select this option) and click on the like box  and copy it on your code (only the iframe!). It works exactly like the other code.
Now remove the width of the iframe, or write width:100% on it.
Just like this:

It works fine for me.
Answer: A simple JS workaround
1) Add id ("fb_chat" in this sample) to the FB comments div:

2) Use this JS block (replace 'chat_body' to your comments parent container):

Answer: Adding data-width="100%" does make the comments 100% width, but still not exactly fluid like you would expect. They will fill a container, but only on load and will not resize when the window is resized. In order to do that add this to your css:
.fb_iframe_widget_fluid span, iframe.fb_ltr {
    width: 100% !important;
}
Answer: For solve this problem remove "data-width" from <div class="fb-comments"...
FB automaticly will put 100%
or delete data-mobile="auto"


Importing X, Y, Z data with a know datum

Question: I am an archaeologist and I need help. I want to make a 3-D model of archaeological structures that I have x,y and Z data for. The xyz data are in CSV file format. I could also make a shapefile in ArcMap. I would like to try and load the coordinates in but I am not sure if there is a way. If I have to do it manually that is okay. Is there a quick way to do this?
Thanks
Jacque
Comment: Depends on what format you have this data and how it is stored. Could you elaborate? Please edit your question and add more information.What do you mean by X,Y,Z data, is it a spreadsheet like format like Excel? CSV data, a list of points in a text file, JSON? My guess is this can be easily done, but not directly through the UI, only using blender's API and python scripting
Comment: Related: http://blender.stackexchange.com/q/27536/599. You'll need some python for this. If you haven't already, you might also want to look into trying something like [meshlab](https://en.wikipedia.org/wiki/MeshLab) for importing/skinning pointclouds
Comment: [Related](https://blender.stackexchange.com/questions/34307/gis-data-import)
Comment: It is unclear to me what you mean with "a known datum" could you elaborate on that?
Answer: Don't know if you need this anymore, but as another archaeologist who just went through this, I'm gonna answer it.
For importing a point list into blender, you're looking for this add-on: https://blenderartists.org/forum/showthread.php?211735-A-Script-to-Import-a-CSV-File-and-Create-Meshes-(for-Blender-2-5x-or-later).  It has multiple options when importing, such as making a line from the sequence of points in the file or just importing the vertices without adding edges.
As it sounds like you're coming from geospatial data, you may need to re-project your data before bringing it into blender.  Blender (and other 3D programs like Unity3D and Meshlab) don't play well if your coordinates are over 1,000,000.  I work in a projected national grid that has eastings and northings that are all over 1 million and any time I forget to re-project into a local coordinate system before importing, things get VERY wonky.
Another concern you may need to address (that I'm still fiddling with) is the fact that geospatial data uses a right-handed z-up coordinate system while many 3D applications use a left-handed y-up coordinate system.  Depending on what you want to do with your models after blender, this may or may not be an issue.  It is for me, as I'm bringing each model individually into unity and need them to all match-up with one another.
Comment: Great first answer! And welcome to Blender.SE!


Old Blockchain Wallet App Not Working (android)

Question: I have the Blockchain wallet app most recent version (yet, years old) everytime I try to login it says "error connecting to server" And I have the internet and 4 digit pin, and this app is not available anymorr om play store (they changed app name and apk) i have tons of btc i dont have phrase, please help if you know how to access old blockchain app wallet, regards amanda.
Answer: If the app is a custodial wallet the only people who can help are the wallet's custodians (blockchain.com).
If the app is a non-custodial wallet (arguably the safest kind) - you should restore from backups or seed phrase or use seed-phrase or master private keys in a different still-supported non-custodial wallet app. If you didn't make a safe copy of the seed-phrase or master private key and have no backups then all money is lost and cannot ever be retrieved.


How do I export event video from iMovie 9.0.4 to my external hard drive?

Question: I need to export video events to my external hard drive. I am using iMovie version 9.0.4. How do I do this.  All the instructions I'm finding on the web are for later versions of imovie.
Answer: Are you referring to an exported movie (i.e. all the bits stitched together) or just the events that you've collected that you would make up a movie project with?
If it is the former, then it is simply right clicking on the project and there should be an "Export movie..." option. I believe there is a menu bar item for this as well.
If you're referring to the latter, then I think it is as easy as just making a copy of the actual events from your hard drive to the external drive. You should be able to go to an individual event, right click and there should be a "Reveal in Finder" or some such option. You should then be able to just drag this event to the external hard drive (either as a move or a copy).
From memory, iMovie '09 doesn't care if you move the events or projects around on your hard drives. The only thing that might need attending to is that you'll have to re-launch iMovie for it to recognize that there is a movie or event on the other hard drive. You probably need to have the folders 'iMovie Events' or 'iMovie Projects' (can't remember how they're named right now, but you'll see them in your home directory) on those drives for iMovie to recognize it.
In short, you should be able to create a directory on your USB external drive like:
<code>/Volumes/USB_External/iMovie Events
</code>
...and then copy whatever subdirectory from your <code>/Users/myusername/iMovie Events/</code> folder to the external one.


What is this tiny pink flower in lawn?

Question: What is this tiny pink flower? Found in my mother's lawn in Norfolk, Virginia. It's so small, but they're showing up randomly here and there. Stalk appears to be greener at the top near the bloom and reddish pink below that all the way into the ground. Cute little booger. I do not wish to get rid of them, but they'll most likely end up being mowed down; not sure if it's worth transplanting them yet, as they're so tiny  and delicate looking. You even see the little buds in the pic, looking like a deeper pink almost purple.
Answer: The term 'wood violet' is somewhat vague - this is actually one of the Oxalis varieties, so not a Viola at all; it's probably Oxalis latifolia, maybe Oxalis violacaea, often commonly known as wood sorrel (in the UK anyway). The easily identified foliage is not actually visible in the photograph with your question. Image of Oxalis latifolia here, but it's a Spanish site http://botanicmontserrat.blogspot.co.uk/2010/10/aleluya.html.
Oxalis have a collection of little brown bulbils at the base of the stems, usually underground, and often a larger, opaque white oval shaped bulb beneath - in order to get rid of it, or transplant it to a more suitable spot, you must ensure you get all parts of the plant out. It spreads widely, and probably isn't something you want taking over your lawn, but, though it is invasive, it's a pretty plant and will grow in shady areas. A better option though, if you want to grow it in the border in a semi shaded spot, is Oxalis debilis, which is similar but has larger flowers.
Comment: Great @Bamboo ! I looked up some if the pics and this appears to be a perfect match. Some other bunches were found with the clover like leaves so this seems right, thanks
Answer: Looks like a wood violet. Lots of variations of purple, pinks and blues.wood violet
Comment: I read your profile yesterday @stormy ;very impressive. You have alot to teach me and the community!
Comment: @Christy B.  Little wild flowers are nice but a lawn is a mono culture...normally.  If you raise your mower deck so that you cut no lower than 3 inches...you'll probably not touch this cutie.  I see a bit much un decomposed debris in your lawn.  Please bag your clippings, your mower should suck up this debris.  Do not leave clippings.  Another story for later.  Your mower blades need sharpening.  See the ragged ends of the grass blades? Not a good thing.  I would take a leaf rake and rake the grass hard before mowing.  Keep the deck on high.  Move slowly over the lawn.  Have you fertilized?
Comment: Lawn service takes care of it in this community: you take care of the back yard, they take care of the front, but Ill mention it to her-wether or not they do it is something different. I'll ask about fertilizer
Comment: 'Lawn Service' I know very well.  Those people rarely employ anyone who knows anything and have a hard time getting their employees licensed for pesticide, understanding 2 stroke engines much less caring about life and what the client expects.  They know nothing.  Clients rarely know enough to question their lawn service.  That means they get away doing a service they have no business doing.  I'll help you test your service.  I had many seminars just for maintenance laborers...and foremen.  To help them get their pesticide license.  Ask whether they have a license any license.
Comment: All of us have such diverse backgrounds!  We work best as a team.  My priority is my own information, not allowing what I know to go stagnant.  I need to learn, get feedback, I am selfish firstest.  I love finding gardener wannabees and encouraging them to continue learning and working at becoming a gardener.  Well, we are all a work in progress and I hope their is no end point...none of us should or could know everything!  Love hanging with others that know the same language!  Being questioned...
Comment: ..shoot 'THERE' not 'Their'...I gotta edit a bit more slowly.

What is this tiny pink flower in lawn?


Dumb Question about Oxidation

Question: This is probably a really dumb question, but I can't find a clearly spelled out for me yes or no answer by searching through google, so hopefully I'll get a yes or no answer her. Can metals, for example lead, be oxidized by being submerged in boiling water?
Comment: No, it's not a dumb question (I'd suggest to edit the "dumb" part out). Yes, metals can be oxidized in boiling water (and also at lower temperatures, e.g. alkali metals).
Comment: (1/2) Long story for my concern, told by hypochondriac) I wanted to shrink a section of my hat that I bought from Bangladesh, because it had been was protruding outward slightly. I boiled water, collected it with a dropper and then fed that just boiled water to the section for 20 minutes. Some of it spilled onto the metal button thing that all the seems meet at in the middle, on the inside of the hat during the process. Left it on my bed to dry. Later saw on a small part of the bed where the hat was, a faint orangish color surrounded by the circle dampness that was left.
Comment: (2/2) Paranoid self went to the thought that the metal button was lead for maybe a less regulated country like Bangladesh could let stuff like that slide even though the hat was by a western brand (Abercrombie and Fitch), and that it had deteriorated while under the boiling water and bled into the soakage of my hat, later soaking into my bed, leaving the faint oragish mark because lead oxide can be red apparently. There may be no connection between the mark and the metal button at all for all I know. And I may be making a mountain out of a molehill. But in your opinion is my concern plausible.
Answer: Nope definitely not lead, but yes for a few of the metals.
There are different reason why things oxidize and reduces
To have a thing oxidize, you need another thing that reduces
To oxidize, the thing (like Pb you say) has to lose electrons and become more positive. Reduction is vice versa.
Water has to reduce in order to oxidize Pb.
However, water is a very persistent compound, it doesn't change chemically after heated to high temperatures (boiling). Neither does it want electrons. And so without doubt water is very useless here.
Pb on the other hand, is not very keen on giving out electrons (at least compared to water), both of them (even when heated) does not interfere with each other and no chemical change is observed.
But.
Some metals have a grudge on electrons and would lose it very rapidly. For example Group 1 metals like sodium
Compare to sodium, water's resolve to reject electrons is very weak, and such, when Na is in contact with cold water, Na rapidly provides electrons to water.
This process is very quick and it produces hydrogen gas, and we can see it catching on fire.
Caution: do not touch the liquid after having water react with sodium.
So, yes, some metals do oxidize when contact with water, but also, no, some don't, at least for lead.

Dumb Question about Oxidation


Is there a single word to describe the loudest point in a musical composition?

Question: Coloquially, crescendo is often used--inaccurately--to refer to this. Climax might be used, but a musical climax is not necessarily about volume, and this term is not included in the Oxford Dictionary of Music. I am looking for a word used by composers and/or musicologists to particularly refer to the loudest point in a musical composition.
Comment: There really isn't any reason or need for such a term, as the loudest point - nor the quietest, or slowest, or fastest.  That's irrelevant to the overall analysis of a piece.   And BTW,  that is **not** a colloquial use of "crescendo."  If you've seen that in a novel or two, it's just been misused.
Comment: 1) Actually, the use of crescendo in this way is rampant--it far exceeds "a novel or two." This is one reason why it would be nice to have a real word to replace it. 2) Dynamics is irrelevant to the overall analysis of a piece? Funny that composers don't consider them irrelevant to the writing of a piece.
Comment: To be specific, I am thinking of the point at which a composer wishes the interpreter to play more loudly than at any other point in the composition. Therefore, it will likely include the notation "fff" or something more--Stravinsky's Firebird includes a "ffff" and Ligeti's Devil's Staircase includes a "ffffffff." So the question is, is there a term to describe the loudest point in any composition--i.e., that could be used to mean both Stravisnsky's "ffff" and Ligeti's "ffffffff"?
Comment: @CarlWitthoft To clarify, I am an editor, and I see "crescendo" routinely misused in this way. This is exactly what set me off on a search for the proper word. I can easily believe the word I'm looking for does not exist--that's probably why "crescendo" is misused--which would confirm that no such word is "needed." Still, it is clear that "the loudest" and "the slowest moments" are topics that are referred to in both analysis and reviews.
Comment: It sounds like you might be confusing the term for a marking for loudest possible volume and the highest volume in a specific piece of music.  There is no end to the number of ffff...'s one can place in sheet music thought I've not seen one past 4.  Also, the loudest volume in a piece may NOT always align with the "climax" of the music in the artistic sense of the term (thought they do often correlate).  Which one were you referring to?
Answer: Unfortunately "rise to a crescendo" has now entered the English language.  But I think musicians still know that a crescendo is the climb, not the summit!
If you find "climax" too vague and you specifically want to refer to the LOUDEST point of a piece, I think you'll have to say "loudest point". Or, if you're thinking in terms of compression, normalisation etc. the 'peak level'.
Answer: I'd go for "dynamic peak".  Interestingly, this commonly describes the location of the maximum, whereas the juxtaposition "peak dynamic" only refers to the value (such as fff).
Answer: I can't really see that it necessarily has anything to do with volume or intensity, but solely the intention of the composer. The word 'climax' suggests an end, the word 'crescendo' describes the climb - perhaps we start a new thing here and start calling it 'parte migliore' - literally : the best bit!
Answer: In the spirit of Sonnet meaning 'it Rings', we could use Levat - 'it lifts'.
We could use Magno Animo, for 'High Spirit'.
Someone else suggested 'Parte Migliore'. I quite like it, or berhaps Migliore - literally just the 'Better'. You could take that compositionally, emotionally, or qualitatively to the performance of the 'stars' of those phrases...
Answer:
I am looking for a word used by composers and/or musicologists to particularly refer to the loudest point in a musical composition.

I am composer, and I would just call it a climax. A climax can of course be other things but volume, but if there is a climax in volume I would just say that that is what there is.
Comment: The problem of course is that a piece can have many climaxes.  Fortunately, language gives us adjectives such as "overall" or "biggest" and others.
Answer: The point of culmination, or culminating moment... As in the crescendo culminates and now the rhythm/tempo/volume begins its descent (descendo? A new challenger appears. Lol). Apex works, as does peaks, peak & apex have the bonus of not sounding so final like climax & culminate do, but I think culmination is the "proper-composer-speak" word for it. Though, using culmination may unfortunately look more uppity, than calling a crescendo an uppity looks disassociated lol
Answer: FFFF = Fortissississimo, loudest possible
Comment: **1.** lots of composers don't write such extreme dynamic markings (until the late romantic, even **_fff_** was rather outrageous, and in earlier music you may not even find more than **_f_**) **2.** even if a work contains exactly one **_ffff_**, that may not actually be the loudest point. For example, if a symphony contains **_ffff_** for the strings somewhere, then this will sound very intense but not as loud as another place where timpani, cymbals and trombones together hit it at "merely" **_ff_** **3.** dynamics are never written with uppercase letters.


How to setup network scanning for HP 3055 in Windows 7/Vista 64 bits?

Question: Network scanning with HP 3055 works fine with XP, but I can't install it neither with Vista nor Windows 7 (both 64 bits OS).
Could anybody assist me with the issue?
Comment: Run the installer in Compatibility mode as suggested in the following link http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c02096212
Answer: HP has failed to release any 64-bit network scanner drivers. for now, you can only use the HP 3055 as a printer with 64-bit operating systems.
having said that, scanning should be possible via the USB interface.
Answer: Scanning is possible using the HP Laserjet 3055 with Windows 7 Home 64 bit, using the USB interface. Once you have installed the printer, Go to the START menu, open Devices and Printers, click on the FAX icon and go to the very top of the page, to the NEW SCAN tab. that will allow you to scan and then save the scan to whatever file you wish. If my experience is typical, documents take a long time to scan.
So far, their seems to be no network solution.
This solution is hardly acceptable, but it is better than nothing. I'm shocked that HP has failed to support its AIO users this way, up to this point.
Good luck
Comment: Thank, but I'm looking for network scanning.
Answer: You can scan and send faxes using Windows 7 Virual PC / XP Mode. Just run it, install drivers/software and enjoy. No other ways to solve problem if you have x64.
Answer: HP Laserjet 3055 do not have a Scanner Driver Compatible with Windows 7.
See the List of all the available drivers that we can download


Override Save Button in Lightning Modal

Question: My goal is to override the save button to call out to an external service synchronously. I understand I have to create a custom VisualForce page or Lightning component (I'm going to use the latter). My question is: how do I simply extend or re-use the existing Lightning modal that's displayed when one clicks the edit button? I'd rather not rebuild it, if possible. Or, if I have to, can I re-use existing components to rebuild it cheaply? Why doesn't Salesforce offer a straightforward way to accomplish this?
Answer: They sort of provide a way for you to do this, but you have to rebuild it.
It's called the lightning:overlayLibrary found here.
You basically have to dynamically create a modalBody and modalFooter and pass it into their overlay framework and it will render on the screen for you. It's all up to you to handle the styling and wiring of the button clicks.
Keep in mind that when overlayLibrary creates body and footer they will sit outside of the component hierarchy from the calling component (the one creating the modal) and body/footer will be siblings, meaning you need to communicate between them via app events OR wire component.getReference() between the two.
Because it's so time consuming to deal with dynamically creating modals all the time, I actually put this in a library on my github repo here. I still recommend you comb through the official documentation to understand why it is the way it is.
Comment: Thanks tsalb. Is there a way to have the overlay actually overlay the page instead of redirecting to a blank page?
Comment: @zed593 you need a custom button that calls `overlayLibrary` that sits on the flexipage itself (so quick actions are automatically out since they create a modal itself already).

Override Save Button in Lightning Modal


why did catkin_make never output the execuatble file again after I executed catkin_make_isolated command to compile code

Question: The system is ROS noetic,Ubuntu 20.04.06.  Once I executed the "catkin_make_isolated" command to compile my ROS1 workspace. After did it I found the catkin_make command can never output the executable file again. The compile process has no any error messages, but the executable file in devel/lib directory can not be produced again. I feel the cmake process is correct, but the make process has some problem maybe. My questions is: how can I restore to use the catkin_make instead if catkin_make_isolated to compile the ROS1 code again?
Comment: As a comment on your question. Please consider in your next question working to reduce the problem down to a minimal example which will make it easier for you and others who might want to help you to understand and solve your problem. My answer below is a guess based on the broad themes outline in your question. But I cannot be completely confident in if it will solve your problem without more information to reproduce your problem.
Answer: When you use catkin_make_isolated it sets up the workspace and invokes CMake to use isolated installation directories. These parameters are cached by CMake in various places such as the CMakeCache.txt files and other generated intermediate files.
If you want to switch between building an isolated workspace and a merged workspace you should clean all the build artifacts and rebuild your workspace to make sure that all the references use the preferred system.
I'll note that the merged workspace will only work for catkin packages. And will not work for pure CMake packages that catkin_make_isolated can support, and is generally recommended now.
Comment: I see. I have cleaned the build and devel directory files in desktop window (not in terminal) and  rebuilt before, but that is not enough. After read your answer I think maybe there are some  CMake files in other directories, or some hidden files I didn't clean. Or maybe I should do catkin_init_workspace. But it is troublesome and not worth. So I will use the better catkin_make_isolated in stead of catkin_make in future. Thank you.
Comment: Please take a moment to accept this answer so others know it's resolved for you.


Back wheel is slipping when pedals are rotating both the front and back sprockets

Question: When pedaling, the front chainring turns the back crankset which rotates the back wheel. However, sometimes it slips, meaning when rotating the pedals which turns the back crankset does not turn the back wheel.
Comment: Welcome to Bike Exchange. What exactly is slipping?  Your chain? Or is it the wheel slipping where it attaches to the frame.  Go ahead and edit your question to add additional detail and the group can make a better assessment of your problem and some solutions.
Comment: I'm not saying it's a duplicate (though it might be) but [a recent question of mine](https://bicycles.stackexchange.com/q/86464/7309) has some discussion that might help you pin it down
Answer: The question is somewhat vague as to what is actually slipping. "If" it is the rear hub that is slipping then some possible causes are the hub on your back wheel has either stuck or damaged pawls, or broken pawl springs, or altogether.
Comment: Welcome to Bike Exchange. The questioner needs to add a bit more information before we can confidently assess an answer. You may have pegged it, but with the question vague to all but the original questioner, no one can be sure. I would suggest adding more detail to your answer on how to RESOLVE the question, and also word it in a way that fits the currently vague question.


Using Office 2019 and can't see my outlook calendar appointments

Question: I just set up a new dell laptop with Office 2019 and set up outlook email. All good but calendar entries missing though I can see them fine on my old laptop - any advice? Thanks
Answer: On non cloud based versions of office, your calendar is often only stored locally, you will see "(This computer only)" next to the calendar in Outlook if this is true. So when you set up your new laptop, all your mail was pulled from the server, but your calendar that was only stored locally on your old laptop could not be accessed.
You can make a .pst backup of your calendar on your old laptop by following the steps below, which can then be imported to your new laptop.

Open Outlook on old laptop
Click File
Click Open & Export
Click Import/Export
Click Export to a file
Click Outlook Data File (.pst)
Select the Calendar folder
Save the backup somewhere accessible.

You then want to put this backup on a usb stick or cloud storage accessible from the new laptop and import the calendar file.
The first four steps are as above

Open Outlook on new laptop
Click File
Click Open & Export
Click Import/Export
Click Import from another program or file
Click Outlook Data File (.pst)
Navigate to the usb where you saved the backup and select it.
Select Calendar as the folder to import from
Select "Import items to the same folder in: firstname.lastname@example.com"

If the last step fails, you can start the steps from within your calendar on the new laptop and use the "Import items into the current folder" option in step 9.
Comment: This was a great fix for me - worked perfectly first time in 2 minutes. Note the file may be large - I had tried to cut USB bit by emailing it to myself but too large to send - really easy fix
Comment: Glad to hear you're back up and running! If you wouldn't mind, please take a minute to accept the answer as the accepted answer so that future visitors can see there's a solution!


angular services export class

Question: I'm new to angular and I have some questions about services in angular. In some examples the documentation used **export ** before class export and in some codes it used the class with out export no Export.
I would appreciated if some one help me to understand its difference completely.
I was trying to inject my service but after I imported it I got the "its not exported" error and it messed up my mind to completely understand each ones usage.
Comment: You'll need to export. The no export example is wrong. I recommend the new docs angular.dev if you're starting out too
Comment: Please have a look at this post: https://stackoverflow.com/q/51183230/12759949
Answer: You discovered a typo in their documentation where they forgot to add the export keyword before the class name of the service.  Any time you want to use a class in another file you have to export it in order for it to be available for other files to import.  Seeing that service files are intended to be shared classes you'll want to export them.
With that being said, it's not mandatory to always export your classes, interfaces, types, functions etc. You just won't be able to use them outside of the file you define them in which in some cases you may not need to use them anywhere else which is perfectly fine.

angular services export class


Should I run a machine learning model many times?

Question: I am comparing different classification models and for a given model (let's say logistic regression), everytime I run it, it obviously produces a slightly different value for the Accuracy and for the AUC. Since, I want to compare the different models, I want a pretty stable metric, so I thought of running each algorithm many times and taking the average of the accuracy and for the AUC. Is this something that is commonly done ? If not, does it make sense to do this ?
Answer: First thing to do is to make sure that you're not overfitting. If there is no such strong signal, then averaging out performance metrics you mentioned make sense. And, producing a basic confidence intervals (or +- std intervals) out of different runs of the same algorithm is a common practice in research papers.
Comment: Great, thank you!
Answer: Computing it multiple times can be more useful for specific algorithms. Let's take an example : while a regression will do the same thing if you use it on the exact same data (ie if you split your train and test with a random state to each time have the exact same rows), an algorithm like random forest will randomly take few attributes to make the forest (imagine you have 200 attributes, and make a RandomForest with 5 trees of 10 attributes, the algorithm will create 5 trees each based on 10 random attributes from your 200. It can easily be understood that, since the model does it at every fit, the result can be way different). I'd suggest you to look at the theory behind the algorith to know if you have to do multiple time the same test, of if the result will always be the same.
Also, if we take back the example of RandomForest, you can produce more trees, with more features, which will take time but make more reliable results (just take care of overfitting).
Last thing to check your Overfitting : get normal AUC, and another AUC based on predictions on X_train (so on the same set you used to fit your algorithm). If values are far from each other, you might overfit (your algorith didn't learn a tendancy, but the exact results on training set, and tries to apply it on test)


Databse ER Design for Apartment Complex and Automaker Employees

Question: I recently completed an assignment which required me to complete an ER diagram for an apartment complex housing automaker employees. There are multiple automaker companies, and each of these companies have employees. There is a series of apartment complexes owned by the same person that houses these employees. If an employee stays in an apartment complex for over 7 days, a discount is applied that is unique to the company.
Some of the requirements are as follows:

Keep track of the new Employees/Trainees and their permanent (Home) addresses and contact information who stay at each of the Alpha Apartment Buildings during a given training session.
Keep track of the new Employee's/Trainee's current address and contact information. (What apartment are they residing in?)
Keep track of the length of stay for an Employee/Trainee in a specific apartment. This should be based on a Check In and Check Out date.
Keep track of all the individual apartments a given Employee/Trainee has ever stayed in. Note: This is historical data. An Employee/Trainee that stays at the one of the Boarding Houses, may get the same apartment or a different one each time that they come to Detroit for training.
Keep track of the different apartments that are in each apartment building, along with each apartment   number and floor
Keep track of the different nightly charges for each of the different apartment types.
Keep track of the name, location, address and contact information of each of the apartment buildings
Keep track of the address and contact information of the Big Three Automakers
Keep track of which Employee/Trainee works at which auto company for billing purposes.
Keep track of which apartments at each building are available for rental.

My ER-diagram:

As someone new (4 months) to the logical design, I am wondering if there was anything that could be improved on or changed regarding this ER diagram. I have a firm grasp on the concept of relationships, but I get confused when it comes to invoices, order lines, etc.
I also want to make it clear that this assignment has already been turned in and cannot be re-submitted. This is strictly a question out of the desire to learn.
Answer: I think overall you have a decent enough design there. My only points of issue might be with the Invoice Table having a calculated field (TotalNights) and that the Discount uses just the DiscountID, not the amount being discounted. Like this, a person looking at the table would have to JOIN to the Discount Table to see what the discount is by itself, unless he wanted to do the manual math of breaking down the Total, Flat Rate and Discount amount.
Comment: Thanks for the feedback, I appreciate it! I suppose the discount info would be better off in the AutoMakers table. The dedicated table is unnecessary.


adding the middle 20 values of array 0-99

Question: This may seem quiete easy to everyone else but I am struggling to comprehend it.
I have to add up the numbers held in the middle 20 indexes of an array 0-99
but I cant work out from what index to what index I should add.
Is it from 40-60? or is that 22 values?
Comment: 40,41,42,43,44,45,46,47,48,49 (ten) 50,51,52,53,54,55,56,57,58,59 (twenty) 60 (twenty one). Trouble with basic arithmetics?
Answer: if you are having trouble counting things in lists of consecutive integers that are not starting at one then just imagine subtract the lowest index from all of them and then add 1. Then you will have a lsit of consecutive integers starting from 1 so whatever the top index is will be the count of the thing.
So in the case of 40-60 you can subtract 40 from everything and add one to see that these indexes map to the numbers 1 to 21.
To get your correct answer a simple extension of this can be used. 0-99 is 100 values (just add one to all of them to see this). That means you need to skip 40 values and then take the next 20.
So to work out the ones you skip you want to start at 0 and then take 40 items. You can easily see that after adding one to the list you want your top index to be 40 (so your indexes map to 1-40) which means the actual indexes are 0-39. So 40 then starts your list and in a similar way you can say that if 40 is your first index (40-39=1) then your last index will be 59 (since 59-39 = 20).
Thus the answer is that you are lookign at indexes 40-59.
I hope this not only helps you get the answer here but helps you work out how to do it on your own.
Answer: index 40 - index 59 is your middle-range ;)


Storing Tokens In The Most Secure Way

Question: What is the most secure way to store tokens, if you are to roll out an ICO or similar? I know there are many ways, i.e. sharding the private key but what is the best practice right now? If I assign the total supply of a token to the msg.sender, what is the best way for me to ensure that my private key is protected.
Answer: Here are my thoughts on this topic:
Don't store your private key or mnemonic on your machine if it is connected to the internet. This is a great target for hackers.
Over the years I have seen many different approaches. For example:

Hardware Wallets
Paper Wallets

However a cheaper option is storing the private key as an encrypted (password protected) text file on an USB-Stick. Keep in mind to unplug the stick when not in use. A downside to this is that in case your PC has a virus hackers still get your private key.
Another cheap alternative would be to just print your private key onto a sheet of paper (Make sure to hide it well).

Storing Tokens In The Most Secure Way


Problems with touch event

Question: Speaking of events we know that the touch screen method onTouchEvent (MotionEvent events) allows you to capture touch events on the screen and event.getX () and
event.getY () give me the coordinates of the touch as float values (ie values with a comma).
    Specifically, I realized that taking logcat using the fixed point the finger in a mobile phone screen and not moving it, the event is not only perceived but MotionEvent.ACTION_DOWN MotionEvent.ACTION_MOVE and returned coordinates are manifold. This i can understand because the surface of the finger touches more points and more by reading the device coordinates believe that the finger moves while holding it.
My problem is that I would read the color of one pixel of a color image when I hold your finger still. In particular I need the central area occupied by the finger.
First, assuming you have a Bitmap object, I have to round to integer coordinates of the touch as the getPixel (intX, int y) coordinates of the entire Bitmap wants to return the pixel color.
    Then how do I get the central point of touch? Be that there is a function that can help me? Keep in mind that while I stopped and read the value of a pixel on the image then I start to move slowly and even though I always record every move the center pixel. I need this because every move, if you change the color of the image in pixels, I want to vibrate or not the device.
     If I could stop thinking about themselves in a dynamic array to store the coordinates of different pixels and search for the center of gravity, but moving I do not know what to do. I think however, that the research center of gravity, if not done very efficiently, can be slow during the move and then give the wrong results. If the CG is not quite enough for me to another point belonging to the environment.
I hope you can help me maybe with a few lines of code sketched.
Thanks in advance.
Comment: Please format your post using code block to improve readability.
Comment: I don't think this type of your approach will attract the user's to answer your question.
Answer: To get the touch position of finger, just cast the getX() and getY() to int and perform your desired tasks.
public boolean onTouchEvent(MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_DOWN ) {
      getPixelAt((int)event.getX(), (int)event.getY());
    }
}

Answer: you can put you on main activity class when you can want to touch event occurs. let see you can put following code or not ? and return is most important as well.
@Override
     public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
    mDistanceX = 0;
  }
  return super.onTouchEvent(event);
     }

Problems with touch event


How can I reduce the salt taste in a dish

Question: Can a dish prepared with too much salt be overcome without changing the water or ingredient content? Or least in a drastic way.
Comment: You should also specify what kind of dish. A soup may be mitigated adding cream, but a steak will be more difficult :)
Answer: a stew or soup can be fixed by adding a halved potato into it and simmering for as long as it takes for the potato to cook. Carefully remove the potato with a slotted spoon afterwards.
Comment: This works very well in a lot of different dishes. Anything that is fluid enough to cook the potato.


replaceAll() \r\n in a JSON serialized string

Question: I can't get replaceAll to work on the '\r\n' sequence in a JSON serialized string.
I am serializing a Map object that contains long textarea fields with newlines.  I need to change '\r\n' to '\\r\\n' for Javascript purposes.  When I serialize the object, I see '\r\n' in the resulting string.  However, none of the replaceAll lines that I try will work:
Map<Id, Job_Posting__c> jobMap = new Map<Id, Job_Posting__c>();
// job map gets populated.
String x = JSON.serialize(jobMap);
String y = x.replaceAll('\r\n', '\\r\\n');
String z = x.replaceAll('\\r\\n', '\\\\r\\\\n');

Is there something about JSON serialized strings that force a different approach?  I see that the serialized string is between double quotes - does that make a difference?
Details:  I want to pass a serialized map of job posting records to a Javascript function in a Visualforce page.  The Javascript JSON.parse() fails with "unexpected token" when it hits the '\r\n'.  If I manually edit the JSON string to be '\\r\\n' then the parse works.
Here's the Javascript on the VF page:

Here's the VF controller:
public with sharing class HL_CCx_JobSelectionController {
    public String jobMapJSON { get; private set; }
    public List<Job_Posting__c> jobs { get; private set; }
    private Map<Id, Job_Posting__c> jobMap = new Map<Id, Job_Posting__c>();

    // Constructor
    public HL_CCx_JobSelectionController() {
        jobs = CCx_JobSelector.selectActiveJobs();
        if (jobs == null) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL, 'No jobs postings available.'));
            return;
        }

        jobMap.putAll(jobs);

        // Serialize
        jobMapJSON = JSON.serialize(jobMap);
        jobMapJSON = jobMapJSON.replaceAll('\r\n', '\\r\\n');
    }
}

Comment: Can you explain a bit more why you want to do this replacement? JSON supports \r\n and most JSON is valid JavaScript too.
Comment: @KeithC - I added some explanation to the original post, thanks.
Comment: Once you have an apex string, it shouldn't matter where the string came from.  What happens if you do this:  (a) get the serialized JSON string from this controller, copy to clipboard, (b) run in anonymous window: `String j = 'STRING FROM FIRST STEP'; System.debug(j.replaceAll('\r\n', '\\r\\n');`
Comment: Alternatively, what if you make the replacement in javascript?  `data_jobPostings = JSON.parse( options.jobPostings.replace(/\r\n/g, '\\r\\n') );`
Comment: When I do that in Apex I get 'rn', when I do the replace in Javascript I don't get any errors, but there's no line break between the text lines.
Comment: You probably just have to do .replaceAll("\\\\r", "") with four slashes rather than two to make it match
Answer: Why not just emit the JSON into the page so it is immediately parsed by JavaScript:
CCx.pageJobSelection.initialize(
    {!jobMapJSON}
);

and then there is no need to parse yourself:
module.initialize = function (options) {
    data_jobPostings = options;
};

This should avoid the need for any replacing.
Its also worth using JSON.serializePretty to make the JSON easier to manually review when you do a "View Page Source" of the page.
PS
This page:
<apex:page controller="AbcController">

</apex:page>

and controller (where cve__OccupationalDescription__c is a custom text area field):
public class AbcController {
    public String jsonString {
        get {
            return JSON.serializePretty(new Map<Id, Contact>([
                    select Id, FirstName, LastName, cve__OccupationalDescription__c
                    from Contact
                    limit 2
                    ]));
        }
    }
}

produce this valid JSON that the browser's JavaScript engine is happy with:

Comment: if the OP wants to pass in an options object (rather than a single data value), it could also work like this:  `CCx.pageJobSelection.initialize(
    options = data_jobPostings: {!jobMapJSON}
);`
Comment: If I try just {!jobMapJSON} or options = data_jobPostings: {!jobMapJSON}, I get unexpected token errors.
Comment: @DavidCheng Perhaps you can post what "View Page Source" shows you and the specific error message? I just added a working example to the answer.
Comment: Thanks, I went back to your original code snippets and it worked.  I had extra curly braces in the initialize method that caused the unexpected token error.
Comment: That's a nice workaround but I wish there was an answer to the question of why \r\n can't be replaced in JSON
Answer: final String CRLF = '\r\n';

String x = '\r\n';
String expected = '\\r\\n';

System.assertEquals(expected, x.replaceAll(CRLF, '\\\\r\\\\n'));

Comment: Alan - if you serialize x, then it doesn't work.


Are there any sephardic customs for a pidyon haben?

Question: I am persian and my wife is iraqi. We are looking to find sephardic and especially customs from our background to do at our son's pidyon haben. I believe it adds a lot to include customs beyond doing the basic of halacha.
Comment: Don't you think that it would be wise to contact a Persian community in this case? They're all over the world, I'm they'd be happy to help!
Comment: Welcome skald89. Looking forward to seeing you around.
Answer: The following differences are ones I have seen by Sefardim that is different than Ashkenazim.
1 - Sefardim have a custom that the Kohain takes a Hadas - Myrtle leaves - and makes a Bracha of Borei Atzel Besamim.
2 - By Sefardim the Kohain holds the baby. By Ashkenazim the baby is placed in front of the Kohain.
3 - Ashkenazim for the most part do the Pidyon only in the dayime. Sefardim do the Pidyon in the evening also.
Why are Pidyon HaBen ceremonies done towards evening?
Here is a audio link for some Sephardi Pidyon HaBen customs


Stopped receiving AIB bank code notifications

Question: I have recently stopped receiving notifications from my bank and one card company when they send me codes to log on to their sites on the PC.  I have a Huawei PSmart 9 phone and I am on 02 network.  Both the bank and 02 are saying that it is not their end causing the problem.  I have searched through the internet and tried every thing on my phone settings but nothing works.
Comment: Just for clarification, is it sent as an Android notification, or SMS? Also, did you recently change the phone? If it's an Android notification, since the Huawei and Google debacle, it might be possible that the bank app is using Google's push notification, and for the device to receive it, it needs to have updated Google Play Service. If it's an SMS, then it has something to do with the mobile carrier.
Comment: No Andrew I haven't changed the phone.  I will contact the bank and ask what way they send their notifications and act accordingly. Ta
Answer: After 9 months of having this problem I was finally given a solution today from a lovely gentleman in AIB. I had tried everything!!! I rang them every month, called into the branch, checked with phone provider etc. It was a case of change my phone or my bank.
Here's what worked for me.
Go to your messages. In the top right hand corner there should be three dots. Click on them. There will be a selection of options. Click on spam and blocked. My AIB messages were coming up as blocked. There were about 50 of them there. Click that AIB is not spam.
Best of luck


iMac 2011 27" Screen, Contrast Gone

Question: iMac 27" from 2011, OS El Capitain 10.11.6. Tried to increase screen contrast in Accessibility pref. pane, but instead got almost no contrast and very light colors!
Can hardly see the grid in Excel and it is even worse in the Calendar app where there are no visible lines separating the dates. Under Display Profiles for this Display there are 2 named iMac. I can see that they are not identical.One says  iMac-48812E13-8A483-7A3C-C675A9008885.icc,  the otheriMac-00000610-0000-A007-0000-00000428001C0.icc Which one should I use and how do I select it? Anyone knows how to get the previous setting back?
Comment: Could share some screenshot with your current settings?
Answer: Sounds like you have mixed up your Contrast settings. You can increased in System Preferences > Accessibility > Display > Enable Increase contrast. Make sure to set the display contrast slider to Normal.

iMac 2011 27" Screen, Contrast Gone


How can I beat Classic 9.0 on Smash 3DS?

Question: I'm stuck on Classic 9.0. I'm good enough to beat Classic 8.5, but every time I do 9.0, it's always a wii fit trainer who kills me right before master and crazy hand. Any tips would be useful, I'm using Shulk with +50 attack, -71 defense, and +33 speed. My custom moves for shulk are: Hyper Monado, Back Slash Charge, Advancing Air Slash, and Power vision. Once again, any tips would be greatly appreciated!
Answer: If the wii fit trainer is what is bothering you, I'd recommend working on your spacing. If you can avoid her (or his) projectiles, she struggles to outdistance shulk's sword. Also try looking up what wii fit's hitboxes look like - I've heard she has weird ones.


Force on a charged conducting sphere due to a uniform electric field

Question: If a charged conducting sphere is placed in a uniform electric field , will the force on it be simply qE ?
I know that the electric field lines enter a conductor perpendicularly so does this have any effect on the force's magnitude or direction ?
Answer: When a conductor is placed in an electric field (uniform for ease) a force exerted by this field acts on the charges in the sphere which pulls hem apart according to the applied field. The charges separate and creates a field until equilibrium is reached. A charge q on the sphere experiences a force $F=qE$.
The electrostatic force between two charges acts along a line joining the two charges. So in this case also, the force will be always $F=qE$. The force acts in a direction of the applied electric field. That's all.
Comment: To actually calculate the force you will need to find the charge distribution on the sphere first (as it is non uniform) and then integrate E dq over the surface of the sphere. This may cause the force to be different than qE.
Comment: Read the question Kartik. The field is uniform.
Comment: . .   Ok . . . Sorry i misunderstood the question.


How to make this strange embossed apple logo?

Question: I was on Pinterest and saw this image. It is pretty new to me and I have no idea where to start? How would you achieve this in any program? Please help me.
Comment: @user287001 when editing you should not be adding things to the post that the author didn't intend.
Comment: Hi. Welcome to GDSE. What have you tried? What has failed?  We like to answer questions here, but we expect at least some effort from users. GDSE isn't a tutorial on demand site. Also note the Apple logo is trademarked, and doing anything to it is illegal.
Comment: Sorry, that is my bad. If it is so, then please delete this post.
Answer: It's all a bit easier to discuss if we start with horizontal lines, like so:

As Ilmari Karonen said, this is just a displacement map. You start with a 3D topography h(x,y), and then each point (x,y) in the result should use the line starting at y0 = y − h(x,y).
With raster graphics, this can be rendered straight away, but to get clean vector lines we'd actually need to work the other way around: each line should be parameterised as
fy0(x) = y0 + h(x, fy0(x))
The problem is that this is only an implicit defining equation, because the RHS contains y = fy0(x). This could be solved with Newton-Raphson, but there's a simpler way: just construct the lines going from left to right, and at each point go up or down as needed to fulfill the equation. Assuming continuity, this is always just a small update, so we can approximate h as constant there.
Implementation in Haskell:
<code>type ℝ = Double

horizContourLine ::
     ((ℝ,ℝ) -> ℝ) -- ^ The topography/height function
  -> (ℝ,ℝ)        -- ^ x-interval on which to render the path
  -> ℝ            -- ^ Step size / resolution along the path
  -> ℝ            -- ^ Base-level y-coordinate of the line
  -> [(ℝ,ℝ)]      -- ^ Trail line
horizContourLine h (x₀,xe) δx y₀ = go (x₀,y₀)
 where go (x,y) = (x,yTgt)
            : if x<xe then go (x+δx, yTgt)
                      else []
        where yTgt = y₀ + h (x,y)
</code>
Then, with a suitable image input like

we get contours like

Full code: https://gist.github.com/leftaroundabout/8b7075d25adecdf16806ea5d7a7ea2aa
Rotation to diagonal lines is left as an exercise.
Answer: This is basically just a displacement map applied to a bunch of lines.
The tricky part is that applying a displacement map to a bitmap texture will stretch and compress the entire texture, including both the lines and the gaps between them.  To get the shading effect in your example image, you'll want to stretch only the gaps, not the lines themselves.  I can see two (or maybe three) ways around this:

Use a vector image editor that can be configured to only displace the path of the lines while leaving their width unchanged.  I'm not sure if any common off-the-shelf vector drawing software (Illustrator, Inkscape, etc.) supports this, but if they do, that would probably yield the cleanest result.

In a bitmap editor (Photoshop, GIMP, etc.), start with a texture consisting of alternating black and white stripes of equal width, apply the displacement map to that, then use an edge detection filter to convert the stripe boundaries into lines (or maybe auto-trace the displaced stripe boundaries in a vector drawing program).  The risk here is that, unless you work at a very high resolution (and then scale the final result down), the quality may suffer due to aliasing.

Write your own software to do one of the above.  Obviously this requires some programming skills that not everybody has, but as far as graphics programming tasks go, this actually shouldn't be a particularly hard one.

I actually tested option 2 using the displace filter in GIMP.  Unfortunately I don't really have time to write a step-by-step walkthrough right now (maybe later…), but as a teaser, here's the final result of my quick experiment:
Answer: The "displacement" mentioned by Ilmari Karonen and "relief effect" mentioned by Abdul Qayum are almost the same thing.
Here are some pictures from Image Relief Algorithm and its Application in Security Printing. We use an image to make cells (or grids) irregular (or to have a displacement), and then draw parrallel lines on them.
You can implement this algorithm by hands or use a software, such as GIMP displacement map or JURA (used by Abdul Qayum).


Displaying quicklaunch in SharePoint-Hosted apps

Question: I wanted to create a SharePoint-Hosted app with custom navigation bar on the left side (like Quicklaunch). As far as I read, one way to do it effectively is to create a custom masterpage with the navigation included in it. The problem is - what about lists? How to create side navigation that would be visible both on lists and on my custom aspx pages across the SharePoint-Hosted app?
Answer: Solved it. We can achieve it by injecting a static HTML (which we can get from an already rendered Quicklaunch) into the "sideNavBox" div using jQuery.
Comment: I have the same problem but I do not understand your solution. Can you please post some more details ?
Comment: @Tom It's been some time since I posted it but I'll try :) From what I remember, SharePoint Hosted Apps does not have support for the OOTB quick launch in the app web. However, the masterpage used by default still has the div with id `sideNavBox` in it (it's empty though). What you can do is to render the QL menu somewhere outside the app, copy the rendered HTML from the _#sideNavBox_ div and inject it into the same div in your app web using some JavaScript code.


Chrony sources are with unknown address

Question: I'm trying to setup chrony but it's not working.
I start the service using one of the following command:
 sudo systemctl stop chronyd; sudo systemctl start chronyd
 sudo systemctl restart chronyd

timedatectl says I'm not synched
 timedatectl
 Local time: Tue 2019-11-05 08:04:47 CET
 Universal time: Tue 2019-11-05 07:04:47 UTC
 RTC time: Tue 2019-11-05 07:04:47
 Time zone: Europe/Zurich (CET, +0100)
 System clock synchronized: no
 NTP service: active
 RTC in local TZ: no

Somehow chrony cannot seem to resolve my source (I'm using the default sources provided on Fedora)
chronyc activity
200 OK
0 sources online
0 sources offline
0 sources doing burst (return to online)
0 sources doing burst (return to offline)
1 sources with unknown address

chronyc sources
210 Number of sources = 0

My config file (/etc/chrony.conf)
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
pool 2.fedora.pool.ntp.org iburst

# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2

# Allow NTP client access from local network.
#allow 192.168.0.0/16

# Serve time even if not synchronized to a time source.
#local stratum 10

# Specify file containing keys for NTP authentication.
keyfile /etc/chrony.keys

# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC

# Specify directory for log files.
logdir /var/log/chrony

# Select which information is logged.
#log measurements statistics tracking

The strangest thing is if I stop the daemon and run chronyd by hand then it works.
sudo /usr/sbin/chronyd -d -d > chronyd.out

chronyc activity
200 OK
4 sources online
0 sources offline
0 sources doing burst (return to online)
0 sources doing burst (return to offline)
0 sources with unknown address

chronyc sources
210 Number of sources = 4
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^+ ns1.nexellent.net             2   6    77    37  +2998us[+2998us] +/-   13ms
^* 18.104.22.168                 3   6    77    38  +1348us[+2529us] +/-   16ms
^- mirror.tillo.ch               2   6    72   177  -1754us[ +375us] +/-   24ms
^- ntp0.as34288.net              2   6    75    50   +729us[ +729us] +/-   11ms

Any help to resolve this issue would be welcome.
Comment: What's the name (and location) of the configuration file that you're editing? How are you running it "normally"? It looks like the attempt you're running "by hand" is using a different configuration file.
Comment: @roaima I edited my post, the file I'm editing is /etc/chrony.conf
Comment: And how are you restarting the chrony daemon each time?
Comment: @roaima sudo systemctl stop chronyd; sudo systemctl start chronyd or sudo systemctl restart chronyd
Answer: I suspect you've resolved this by now - but if anyone else is having the same problem:
SELinux blocks resolver access from chronyd, simply disabling it allows you to test if this is the cause or add an exception.

Chrony sources are with unknown address


Is Proxima Centauri a Planet?

Question: Proxima Centauri meets all the requirements for Planet status, although it is a star, can an object be a star and a planet at the same time? normally, the answer should be no, but this is the problem you run into when you define words like Planet.. What are the criteria that exclude a star from being classified as a planet?
Comment: I'm pretty sure fusing hydrogen into helium is **not** an attribute of a planet. See https://en.wikipedia.org/wiki/Star#Characteristics
Comment: What are 'all the criteria' it fulfills to be both? What is the source of that claim which we should 'listen to'?
Answer: Per the IAU definition:

A "planet" is a celestial body that: (a) is in orbit around the Sun, (b) has sufficient mass for its self-gravity to overcome rigid body forces so that it assumes a hydrostatic equilibrium (nearly round) shape, and (c) has cleared the neighbourhood around its orbit.

Proxima Centauri is not in orbit around the sun, hence it is not a planet.
The IAU has a definition for an exoplanet too:

Objects with true masses below the limiting mass for thermonuclear fusion of deuterium (currently calculated to be 13 Jupiter masses for objects of solar metallicity) that orbit stars, brown dwarfs or stellar remnants and that have a mass ratio with the central object below the L4/L5 instability $(M/M_{\rm central} < 2/(25+ \sqrt{621})\approx 1/25 )$
are "planets" (no matter how they formed).
The minimal mass/ size required for an extrasolar object to be considered should be the same as that used in our Solar System.

Proxima, with a mass of 130 Jupiters is well above the upper mass limit for an exoplanet, and hence not an exoplanet.  It has stable hydrogen fusion in its core and hence is a star.
Comment: The IAU has defined planets for other systems: https://astronomy.stackexchange.com/questions/43305/iau-2018-exoplanet-definition
Comment: I'd forgotten that.  I've edited
Answer: No, Proxima Centauri is a system, specifically one of the suns in it.  Proxima Centauri B, for example, is a planet.  It's also actually one of the exoplanets found (in 2016) that is in the "habitable zone" and could possible host life!

Is Proxima Centauri a Planet?


A priori power Hansen Hurwitz

Question: I am in a situation where sampling proportional to some weight might be very beneficial. In order to estimate $\tau$ the population total / sum I use the Hansen Hurwitz estimator. That is,
$$\hat{\tau}_p = \frac{1}{n}\sum_{i=1}^n\frac{y_i}{p_i}$$
with variance
$$\hat{Var}(\hat{\tau}_p) = \frac{\frac{1}{n}\sum_{i=1}^n(\frac{y_i}{p_i}-\hat{\tau}_p)^2}{n-1}$$
where $p_i$ are the sampling weights and $y_i$ the observations
How can I estimate my sample size?
I have a set of $\hat{y}_i$ values that are extremely well correlated ($r>0.9$) with $y_i$. Normally I would just solve the variance equation for $n$, but I didn't manage to do that. Therefore, I simulated a few million sample draws and some variation around my estimates for $y_i$. However, for some large sample sizes (in my case 55-60) the power drops (from 0.97 to 0.9) and for $n>60$ rises to $1.0$. I am uncomfortable relying on the results with - what I feel are - such strong abnormalities.
Further, the weighting of the elements in the sample frame is very strong ($p_i$ ranging from $0.115$ to $1.9*10^{-6}$). Since I am sampling with replacement I am have several elements being selected multiple times. Up until now I just used a unique() function to get each element once. Does this bias the results?
Answer: You should first determine the desired CV. Then you can determine the n needed. It is not necessary to eliminate the duplicate units for the estimation (if the $\hat{y}_{i}$ are highly correlated with the $y_{i}$ is logical that the sample size is very small).

A priori power Hansen Hurwitz


Animation in OpenGL using 3D Models

Question: I have created a model in Blender. Now i want to read that 3D model in my c++ program. I figured that a model can be exported to various file formats e.g. .obj, .3ds or COLLADA and then can be read in a c++ program. I have been searching web for doing that for quite a while and found many tutorials. But i ran into issues with most of them. For example, IN the Nehe tutorial they are using glaux which I don't want to use in my program. And the remaining tutorials use md2 which is not supported by Blender.

So can anyone guide me which file format to use for exporting 3D model and how to load that in my OpenGL program? Also how can I animate that model? Is it possible to add extra effects like tone mapping after it has been loaded in the c++ program using OpenGL? if yes then how?

P.S. I am using Linux for game developement
Answer: I'd go for OBJ format. As you have already probably realised, there's hundreds of OBJ loaders for C++ out there. I believe one of the most mature ones is Assimp, it supports many different formats and it is pretty well documented. Here you have an example where they use it.
Comment: Obj doesnt have support for animated meshes though does it? just google "Blender opengl skinned mesh" and i expect you will find a format that suits what you want edit: couldnt delete my post, was meant to be a reply to a previous post reccomending the obj format
Comment: .obj does not support animation, and this answer is wrong. http://stackoverflow.com/questions/757145/do-wavefront-obj-files-support-animation
Comment: the lighthouse.com link doesn't work
Comment: It works for me in all my browsers... Try this link http://x90.es/1CC
Answer: Blender 2.60 has fixed COLLADA animation support, it was more or less broken in earlier versions. However, if you haven't loaded any model formats yet in your own code, I'd suggest learning to load .obj first. It's in ASCII so it's human readable and easy to read without external loader libraries.
Answer: 3ds isn't containing any animation data so that one won't work. Collada I don't know much about but when I decided on which format to use in my game I searched and compared a lot and finally I went with the B3D format, it supports skeletal animation and is loadable from Irrlicht (it also contains lighting values).
I use the 'b3d pipeline' exporter from 3dsMax and I have coded my own hlsl shader to animate and light the meshes, it works really well.
You can check out how Irrlicht does it (ie. loading and animating), it does the animation in software though but there are examples if you search a bit on how to do it with a shader (if you want that). A nice thing is that Irrlicht supports both OpenGL and Linux.
Another format that is quite straight forward is the .X format, there must be tons of examples out there on how to export, load, parse and set up the skeleton and animating with it.
It is a Microsof format though so maybe you won't want to use it :-)
Tone mapping and such has absolutely nothing to do with animating so yeah if you know how to use that technique you can do that with animated meshes.

Animation in OpenGL using 3D Models


Dual of colimit in $\text{Ban}_1$

Question: I learned in J. Castillo's Hitchhiker guide to categorical Banach space theory that, by a theorem of Semadeni and Zidenberg, limits and colimits exist in the category $\text{Ban}_1$ of Banach spaces and contractive maps. I am hoping now that the Banach space dual of a projective limit is the inductive limit of the corresponding duals; is this true? I wasn't able to get a hold on Semadeni and Zidenberg's paper, so I don't know if this question is addressed by them.
Comment: Your title asks about the dual of a colimit. You question asks about the dual of a limit. Which one did you mean?
Comment: Ops, yes, I meant limit. But in order not to outdate to your answer I guess it better stays like that.
Comment: Yes, it is below!
Comment: @RodrigoVargas Have you ever found an answer to this question
Answer: If I recall correctly, the duality functor $D: {\sf Ban}_1 \to {\sf Ban}_1^{\rm op}$ is a left adjoint -- the analogous statement for ${\sf Vect}$ and ${\sf Vect}^{\rm op}$ is in Mac Lane's CFTWM somewhere -- and so $D$ should preserve colimits. That is, if we think of it as a contravariant functor on ${\sf Ban_1}$, it should take colimits to limits.
However, you are asking about duals of limits (in the category-theoretic sense) and so one would not expect the dual of a limit to be the colimit of the duals. For instance, the product in ${\sf Ban}_1$ of countably many copies of the ground field is $\ell_\infty$, whose dual is (assuming Axiom of Choice in some form) not the same as $\ell_1$ (and $\ell_1$ is the coproduct of countably many copies of the ground field.
Actually, I think for your particular question we have a counterexample which doesn't use AC/Hahn-Banach. Consider an "inverse system" $\dots E_n \to E_{n-1} \to \dots E_0$ where $E_n=\ell_1^n$ and the linking maps are given by "omit the last entry of the vector". Then the inverse/projective limit should be $\ell_1$, whose dual is $\ell_\infty$. But the dual of the inverse system would be $E_0^* \to E_1^*\to\dots E_n^* \to \dots$ and here $E_n^*=\ell_n^\infty$ with linking maps given by obvious inclusion. The direct/inductive limit of this system will be $c_0$, not $\ell_\infty$.
Comment: Although your examples make me skeptical, I will still ask: can one hope then for some simple characterization of the dual of a limit in $\text{Ban}_1$?
Comment: In what I would call the "standard" setting, the dual of $\ell_\infty$ is a fairly nasty Banach space that is much bigger than $\ell_1$. So I think one would need to be looking at very special limits. I admit I haven't thought about pullbacks
Comment: But on a second thought, that might not be a problem. From looking at your examples, one might have $(\lim E_n)^* = (\text{colim } E_n^*)^{**}$... This should be the case at least for reflexive spaces: $(\lim E_n)^* = (\lim E_n^{**})^* = (\text{colim } E_n^*)^{**}$.

Dual of colimit in $\text{Ban}_1$


How you find the unpadded short plaintext using RSA?

Question: I am currently trying to understand how you find the unpadded short plaintext when you are using RSA. Please help with explaining the process and so I can understand this topic more.
Comment: **Hint:** try to encrypt all possible plaintext with the public key and compare? What is the public exponent?
Comment: If the public exponent is small e.g. 3 it may be possible to recover the plaintext by taking the e.g. cube root of the ciphertext.
Answer: As kelalaka hinted, the issue with particularly short plaintext in unpadded RSA is that it is subject to brute force via chosen plaintext attack.
For each plaintext $m$ in the short space you suspect the enciphered plaintext to originate from calculate $c = m^e \text{ mod } n$ where $e$ is the public encryption exponent and $n$ is the public modulus. Then compare $c$ to the ciphertext for which you are trying to find the plaintext. If identical, the message $m$ is the same as the padded short plaintext in question. Because RSA is deterministic, identical plaintexts produce identical ciphertexts.


Scheduled for an interview and given option to send my resume

Question: Through networking I am scheduled for an interview. The person told me I can send my resume if I want. Since the point of a resume is to get an interview, is it worth sending? In a certain sense it could only hurt my chances since I already have the interview. The job will hire base off experience, not awards or school etc. so I think sending my resume wouldn't add much. OTOH it just seems more normal to send my resume.
Comment: Contact telling you you can send your resume is polite version of asking you to send your resume (if you want the job). Not doing it would come off unprepared/unprofessional. E.g.: the guy that had the nerve to show up for the interview without even an up-to-date resume.
Answer: Yes.   Send it.    It will give them a chance to look at it, be prepared, and have questions.   I've been in interviews where the interviewer had no idea what to ask, and it was uncomfortable.    Besides questions, it will help them to be prepared to give information on the type of job you'd be good for.
Answer: As a hiring manager, I used resumes to determine who to offer interviews to. You are correct about that. However, I also used them to come up with questions that were particular to individuals.
A resume can highlight import aspects about you that you want the manager to know about. The kind of things that you excel at. The kind of things that if they ask you questions about them then you will get excited and authoritative in your responses to them.
Your fear that they may in fact withdraw the interview is also rather unlikely. Even if they see something that is a red flag, at this point it would have to be serious to cancel. They will instead probe you on it in the interview. So send the resume.
Answer:
Since the point of a resume is to get an interview, is it worth sending?

Actually, the point of a resume is to get to know the candidate a little bit (which could then result in interest and an interview).
I say it is worth sending, as it will show interest from your part, and also enable them to get a better idea of the experience you list on your resume (giving you higher chances of getting their attention).
It seems that you have your resume already prepared so I say you go for it and send it.
Answer: If you're worried that submitting your resume might hurt your chances then you may not be right for the job, and that will come out in short order if you start working there. It's probably best to find out beforehand than after the fact.
If for nothing else other than completeness sake, I'd suggest submitting it.


When we use Lorenz gauge or Coulomb gauge, the result formula for electric $E$ and magnetic field $B$ is same or different?

Question: Gauge condition can be chosen as you like or not?
is the Lorenz gauge is the only one correct? If  Coulomb gauge can obtained exactly same results as Lorenz gauge for the electromagnetic fields E and B, we can choose what we like, either Coulomb gauge or Lorenz gauge. If use different gauge we get different formula of electromagnetic fields $E$ and $B$, then we have to choose a corrected gauge to get the correct electromagnetic field formula. I am not clear that when we use Lorenz gauge or Coulomb gauge, the result formula for electric $E$ and magnetic field $B$  same or different?
Answer: Gauge condition is any human imposed restriction on the functions $\varphi(\mathbf x,t), \mathbf A(\mathbf x,t)$ that does not change electric and magnetic field implied by those potential functions.
For any single physical situation, one can use either potential functions obeying the Coulomb gauge condition or those obeying the Lorenz gauge condition. Both choices give the same electric and magnetic field.
Comment: Aharonov–Bohm effect proves that the vector potential **A** and scale potential $**\phi**$ has more physics meaning the electromagnetic field **E** and **B**. I have the felling if  **A** and **\phi** is obtained by using different gauge, the corresponding electric field and magnetic field are also different. Could someone prove that the electric field and magnetic field from different gauges are same?
Comment: The Aharonov-Bohm shift was measured to exist and be close to their prediction, but it is not clear those experiments prove the Aharonov-Bohms explanation of the effect that is based on superiority of the Coulomb-gauged potential as compared to EM field. There are other ways to explain Aharonov-Bohm shift that use only local interaction with EM field. See papers by Timothy Boyer on this subject, e.g. https://ui.adsabs.harvard.edu/abs/1973PhRvD...8.1679B/abstract


Duplicating an Xcode 4 Project

Question: Basically I want to make an independent copy of my Xcode project and all of my files. How can I do this? I'm researching graphing frameworks and I want to use the same UI for each.
Comment: What's wrong with simply copying the project folder including all the files?
Answer: Seconding @zoul's comment, this can be accomplished in Xcode 4.5 with four steps.

In Finder, duplicate the project folder. Do not update the .xcodeproj file name.
In Xcode, rename the project. Accept the proposed changes.
Still in Xcode, rename the scheme in "Manage Schemes".
In Info.plist, rename your Bundle identifier.
Comment: See http://stackoverflow.com/questions/5346767/is-there-a-way-to-rename-an-xcode-4-scheme for how to rename a scheme (it's a bit of a trick to discover).
Comment: To rename the project: Click the project name in the Project Navigator (left-side pane).
Comment: I don't know if this is Xcode 5 thing but the Bundle identifier (in the project settings) changed automatically. (probably after renaming something)
Answer: Few months ago, I had the need to create a different applications with the same source code.
I didn't wanted to copy the full directory, so I came up with a procedure that allowed me to mantain the source code in one place and create many different apps based on the same source code.
My procedure is the following:

duplicate the target to make a new target and change the name to the new name
change the name of the product and info.plist in the build options (select the new target and click info button), make sure this is for All Configurations
rename the info.plist file created at the duplication to  "newnameInfo".plist (click on the file and then info button and pick the target)
add icon.png to the resources for the specific target.
change the name of the icon
in the NewnameInfo.plist change the icon name to icon_xxx and the bundle identifier com.yourdomain.newname
in language/other flags you can have a flag to check at the code.
create a new APP_ID in the iOS Provisional Portal
if APN is used, configure the APN BEFORE creating the development profile
create a new development & distribution (ad-hoc or appstore)
in Target (info) choose the right profile for the code sign

I hope this helps.
--nnahum
Answer: Go to your project folder.  Right click on it.  Select "duplicate".
Is there something you want to achieve that this doesn't accomplish?
Comment: Yeah, the thing with doing that is that the duplicated project still references files in the older project. If I change something in my new project, it changes it in the old project as well. I can de-reference all of the files from inside XCode, and then drag in the files from the new folder, but this takes a while because I can't just click and drag the root folder in (it gives me import errors because it's trying to import indexing files and such which XCode doesn't allow, so it just doesn't import anything).
Answer: Copy and paste your project folder. Open the new folder and open the Xcode project file. Select the project name in the "Project Navigator" on the left side and then in "File Inspector" on the right hand side, change the name of the project under Identity and Type.
That way you will have a duplicate project with two different names.
Hope this helps!

Duplicating an Xcode 4 Project


How do I search for a mixed smart-normal switch plate?

Question: I want to change only ONE of the switches to a smart switch. I am confused about what I need to buy. Can I just use one of these smart switches? What confuses me is - how does the cover plate work? Do I need to change both to smart switches or do they make a cover plate with one of each?  How do I find that on the Internet, i.e. which search terms to use?
Comment: See also this https://diy.stackexchange.com/questions/224263/how-to-make-or-find-a-wall-plug-cover-for-mismatched-double-plugs/224403#224403
Answer: The large rectangular opening is called "Decora"
There are only 3 popular shapes:

Small slot:  the traditional switch, like you have now.
Two ovals: for traditional receptacles (also dual switches)
Large rectangle aka "Decora": which covers your smart switch, AND all Decora switches, AND all Decora receptacles, including all GFCI and AFCI receptacles and switches.

The big three. "blank" not pictured.  There are others, but they're rare.
Any competent hardware store will stock 2-gang cover plates of every possible combination, including "1 side blank" and "both sides blank".  Typically in at least 3 colors!

They also make plain switches in Decora, so if all else fails, you could replace the other switch with a "Decora plain switch", wired exactly the same.  And then you could use a 2-gang "Decora both sides" cover plate.  Those are so common Walmart stocks them.

graphic courtesy Kyle Switch Plates
source of graphic
Answer: Yes, you will need a new cover plate.  They make them in all sorts of combinations.
Here is an example:  Decorator/Toggle plate
Answer: You'll need to open it up to see exactly what is going on in the box and confirm that a neutral is present if it's needed for the smart switch.  Flip breakers until all controlled lights turn off, then remove the plastic cover plate and screws at the top and bottom of each switch under the coverplate.  Carefully pull the switches out so you can see what's going on in the box and take a picture that clearly shows all wires to add to your question.
Your smart switch probably needs line and neutral, which are usually present in a 2 gang switch box.  Assuming the required conductors are present, one or both switches can be switched out for a smart switch.
You have old style toggle cover plate, which can be replaced with decora for the smart switch by replacing the other switch with a generic decora switch.  Your hardware store may also carry combo plates with 1 toggle slot and one decora slot.  Also note/measure the dimensions of the box, where you live and what splices are present in the box.  The smart switch you want to put in may be oversized and not acceptable in the box, so you need to check.  Method of calculating box volume varies by region.
When you screw everything back together, take care to align the two straps so that the cover plate sits straight and level with the switches traight, level and evenly spaced.
Oh hold on.  Just checked your link and I've never heard of "Gosund" so it's probably rebranded off brand stuff, and anything electrical on Amazon requires a critical eye.  You need to check what certification marks are required in your region and make sure that any parts you want to install bear those markings.  For example, Canada allows electrical parts with markings from either Canadian Standards Association(CSA) or Underwriter's Labs(UL).
Furthermore, if you are buying from Amazon, Ebay or Aliexpress, you should not assume that a device that has the correct markings is legitimately marked.
Comment: The hardware store near me calls them Decora Combination cover plates.  Just search "Cover plate toggle decora" though and you should get hits that include something suitable for your region.  "Toggle" refers to the old style switch opening and "Decora" or "Decorator" refers to the newer universal slot.  I believe "Decora" is branding and "Decorator" is the cross-brand term.
Comment: It's the combo plate I am confused about. Where do I get a plate that has one toggle switch opening and one opening for a smart switch??? I don't know what to search for online or in Amazon.
Comment: @NeilDey Walk into a hardware store and they are sitting on a shelf.  This is the second "What is the web search term for Decora" question in a week.
Answer: You want a combo cover, unfortunately there is no single term that describes that shape. Decora is brand name term works pretty good, but you can also use terms rocker, decorator, or gfci combo covers.
Since you provided a link to Amazon I would caution that their pricing sometimes preys on the inattentive or uninformed buyer. You can get a effectively the same cover for $14.99 or $1.27. The $1.27 is probably the biggest vendor in the business (and owner of the Decora brand).


S-PFQP-G80 package

Question: I am having some troubles soldering a  S-PFQP-G80 package since I get solder bridges between pins after putting it into the reflow oven and I was wondering it would make sense to decrease the pad width in the footprint. I was hoping to get a bit more space between pads and prevent bridging. Currently footprint dimensions are 0.3mmx1.45mm and the pin width is 0.17-0.27mm. This being said I guess that I would have to reassure that the pins and pads are perfectly aligned.
Answer: The leads should get aligned when the chip is soldered, by surface tension pulling them into place. You should be able to decrease the pad width slightly. If it's only a few that are bridged you could use desolder braid.

S-PFQP-G80 package


Why it is not recommend to use root login in linux

Question: I am a developer using Linux fedora.I seen in lot of links that it is not a good idea to use root user,because someone can easily hack my password.Instead create a separate account for development purpose.But i am using my own fedora machine and myself only using.In this case is it recommend to use a separate account instead of "root".Need more clarification
Comment: If I were you, I'd use a non-root user. It's just good practice. I'm no developer, but I'd imagine you'd want to code as a non-root user as well, to ensure that your code works well when *not* logged in as a root user, but I could be wrong.
Comment: Using root in Linux is like using the default account in Windows XP... full system control with no restrictions... bad idea...
Answer: The primary reasons are thus:

Every hacker / virus knows that there is a root account. If they are blindly attacking a system, it's a known entry point, and very likely to be a target. This is why your root account should have logins disabled.
Everyone makes mistakes. You'll be in a rush, accidentally hit the wrong key, not double-check/realize the full list of files in that wildcard you just entered... eventually, you'll be sitting at your system thinking. "Crap. I did not want to do that. How do I undo that?" It happens to the best of us. By not using the root account, you can be relatively confident that whatever you just did, did not mess up your system's ability to operate.
Privilege escalation - If there is a security vulnerability that's exploited (in say, your web browser), by not running your programs as root will limit damage. If your web browser is running as root (because you logged in as root), then any security failures will have access to your entire system.
Acountability - There is only one root account. If everything is using the root account, it's difficult to find out who did what. This applies less in a single-user environment, but that's still not a good argument to avoid good security practices. With something like sudo, every command that's executed with super-user powers is logged, along with the specific user that requested it be executed.
Comment: Good, so if we don't care about any of those we can go ahead and use root. Afterall, there is usually nothing stopping normal users from sending absolutely any network packet into your network, the only thing non root usually can't do is listen on low port numbers.
Answer: You don't need to and it is insecure.
You just don't want application to run with elevated privileges. There was a bug a while ago in an application that would erase everything on you /usr directory. If the application was running as an ordinary user that user should not have enough permission to execute that action.
You would also start your browser with elevated privileges as well. Infected web pages exploring failures in that browse could compromise your system among other problems.
There was a similar question on ubuntu forum a few years ago, you might want to check:
https://askubuntu.com/questions/16178/why-is-it-bad-to-run-as-root


Make an app handleOpenURL only

Question: I have an app that is part of a suite of related apps. It's job is to receive data from other apps and to do some very specific things with it. All works fine launching the app and passing data with handleOpenURL. But, I'd like to make the app ONLY launch when called from another app. That is, not tap-able on the home screen. Ideas?
Answer: If not opened with a URL, display a dashboard showing the other apps that are installed, and force the user to start one of them. (check by using UIApplication canOpenURL)
Answer: Mystery solved: the launchOptions in appDidFinishLaunching contain the calling URL and calling app Bundle ID if the app was launched from another app. So I just check there. Thanx.
Comment: how is it not tappable from the home screen then?

Make an app handleOpenURL only


What is the best objective comparison of the level of corruption in Russia to other countries?

Question: I am looking for the best objective source to compare corruption in Russia to other countries. The often cited Corruption Perceptions Index (as far as I can tell) is not objective since it is based on subjective opinion of mostly western experts. The Global Corruption Barometer would be great, except that Russia is not included in the 2013 version cited on wikipedia. Russia publishes some data in the Антикоррупционная инициатива бизнеса, i.e. business anticorruption initiative, but this does not allow comparison to other countries.
Comment: How could this possibly be done objectively?  Thought experiment: in country A, the police routinely hold innocent people in jail until bribes are paid, but the rest of the government is honest.  In country B, the police and low-level officials are honest, but cabinet ministers route ten-figure contracts to their cronies.  I don't see how you could **objectively** declare one of those countries to be more corrupt than the other.  Corruption occurs in many different ways with no objective comparison between their severities.
Comment: The accusations of bias would have more traction if influential Western countries didn't also drop, significantly, as well.  For example, the US went from #19 in 2012 to #25 in 2020.  Likewise, Canada under Trudeau's Liberals has significantly slipped.  The index might have its issues, but it also seems to correlate with other indices.  https://en.wikipedia.org/wiki/Corruption_Perceptions_Index#Validity  : *... compared the CPI with other subjective indicators have found that, while not perfect, the CPI is argued to be broadly consistent with one-dimensional measures of corruption*
Comment: The accusation is not so much of being biased, but of being subjective (although this obviously opens the door for bias). This has led to considerable criticism of the CPI elsewhere, e.g. https://foreignpolicy.com/2013/07/22/corrupting-perceptions/. Having an index which is based on experts is only useful for people who trust those experts. Therefore the question, what verifiable methodology is the expert opinion based on.
Comment: Fair enough.  You did not use the word *bias*, I did, so that is a valid point.  It is important to distinguish *bias* from systemic methodology errors.  The first may very well lead to Western penalization of non-Western countries.  The second tho should have the same effects across the board (unless weighting was slanted to lower Western indicators of corruption while heightening non-Western ones).  The point is still that "Western expertise", is not as relevant to *methodology* errors as *bias* errors.  You might want to clarify then - much inconvenient stuff gets dismissed as "Western".
Comment: @Nate: what you are addressing: when we measure something, we can ask: what are we measuring?, and: is it relevant? For the CPI, the first answer for me is "I don't know" / "can someone tell me?" / "the opinion of some experts?", and as a result, my answer to the second question is "I am unable to determine this". For the global corruption barometer, I have a much better sense as to the answer to the first question, and as a result we can better argue about the second question. Clearly better methods to measure corruption would be nice, and maybe someone will point out that this has been done.
Answer: It is 2016 numbers, but here is The Global Corruption Barometer for Russia.
You can click around the map to compare with other countries.
Comment: Note:  Yes, it's the same publishers as CPI, but it is used a different method, apparently.


Is it possible to make use of a pseudo-random permutation to construct a one-way compression function?

Question: Let $f_k(B)$ denote the underlying function (a pseudo-random permutation) of a block cipher: it uses an $x$-bit key $k$ to encrypt an $y$-bit block $B$.
The question: is it possible to make use of $f_k(B)$ to construct a cryptographically secure One-way compression function that transforms any sequence of $y$ bits to a sequence of $y/2$ bits? If yes, then what is an example of how to do it? If no, then why?
For example, consider the following construction. Let $V$ denote a sequence of $x$ zero bits: $$V = 0^x.$$ Then $W$ denotes the inverse of $V$: $$W = 1^x.$$ Consider a function that outputs the first half of a bitstring $T$, where
$$T = f_V(b) \oplus f_W(B),$$ assuming that $B$ denotes the input, $b$ denotes the inverse of $B$ and $\oplus$ denotes a standard XOR.
Can we use such function as a compression function?
Comment: $b$ is the bitwise complement of $B$, $b = \overline{B}$, `b = \overline{B}`
Answer: This is possible in the ideal cipher model, and is the basis of the Davies-Meyer and other hashes; see https://en.wikipedia.org/wiki/One-way_compression_function. There has been a lot of work looking at this, but I think a good place to start is the paper Black-Box Analysis of the Block-Cipher-Based Hash-Function Constructions from PGV. It is important, however, to be aware that the ideal cipher model is very strong. For example, AES suffers from related-key attacks and so is not a good basis for such constructions. In addition, due to DES weak keys, some of these constructions are completely broken with DES. However, it does explain the rationale behind the SHA256 and other SHA constructions that essentially construct a type of block cipher and apply a Davies-Meyer type transformation.
Comment: So it does not make any sense to talk about the fixed-length input compression from $y$ bits to $y/2$ bits? All described schemes are iterated and output $y$ bits from the variable-length input...
Comment: Actually, you will notice that they all start with a basic construction that takes $2n$ bits to $n$ bits, which is the same as you are looking at. They then iterate to get something from a general input length (as in Merkle-Damgård).


Team Explorer 2008: Executing a query brings up a certain work item instead of a list of results

Question: Strange problem I'm having here:
When I run a work item query in Team Explorer 2008, instead of getting a list of results as usual, I'm getting a single work item (always the same one, the query is okay though).
However, when I click "Edit query" I get the correct list of results below the editor.
I don't know what causes this behaviour.
Answer: May be your result list is older one and not updated with new result; try to close & open visual studio ;).