Is my digital piano suitable for learning to play?

Question: So here's a quick introduction: I started playing trumpet in school when I was in 5th grade, moved on to baritone/euphonium in 7th grade, taught myself acoustic guitar in 8th grade, and now I'm starting to learn piano (9th grade). Yeah, it's pretty late, but eh, who cares.
Anyway, I got a digital piano for Christmas (yesterday). We decided that a digital piano would be suitable for now, since we don't know for sure how casually I'll be playing, but at the same time purchasing a piano with good sound quality. I think we did pretty well in that area:
http://www.casio-music.com/euro/instruments/digital-pianos/compact/cdp-230r/
I know many people have said the polyphony isn't that great, and the piano doesn't really have that many "flashy buttons," but again, these weren't part of my main concern - sound quality and preparation for potential upgrade to an acoustic piano.
I've been playing on it all of yesterday, and I've really enjoyed it. I was able to play a few simple tunes like "Silent Night" and "Heart and Soul" since I fortunately had the experience of reading music from my other instruments, and since I had somewhat "prepared" for the piano with some studying of piano key notes.
Onto my question: The piano does have Casio's "Scaled Hammer Action," making the lower octave notes weightier than than higher ones. But I'm not sure if the keys in general are as "hard" to play as an acoustic piano would be. Would it be difficult if I were to upgrade to a regular piano? If I stayed with this one, how far off would the difference be? Lastly, is there a way to actually see how "weighted" these digital piano's keys are compared to a regular one other than physically testing them?
Thank you!
-Chris
Answer: Yes, you can learn on that instrument.  No, it is not exactly the same as a real piano.
Answer: I've found that generally these sorts of keyboards, while weighted, are not as heavy as a real piano, but that's not always a bad thing. As long as they're weighted enough that you can feel the difference between playing piano and forte then you should be fine when switching to a real piano. One important thing to do while learning is using a variety of dynamics by varying the pressure you put on the keys. As long as you can do that on this keyboard you'll be fine, I personally learnt on a keyboard a bit like this and the transition to a real piano was easy enough.
Comment: I got a distinction in my grade 8 piano using only the sustain pedal, I think that it's really important to have a good sustain pedal as it's extremely useful later on, but I personally don't use the other two pedals much. Don't worry about getting a sustain pedal right away, you could get the piano first and the pedal a couple of months later when you have the money, as it's not crucial to have in the early stages.
Comment: Thank you for your answer. I wanted to add, though, that I've been looking at this piano: http://goo.gl/9FLxWt , the Casio PX150, which seems to have a phenominal (ebony/ivory) key feel based on its reviews. It also has a much better polyphony (128vs48) than mine, the CDP-230R. The keys being weighted as far as far as lower notes being harder seems to be the same on both, except for the PX 150's having "Tri-Sensor, Scaled Hammer Action." Being just $130 more, I'm tempted to go for it, but I don't want to lose sight of my budget when I need to buy a stand, bench, etc. What do you think?
Comment: I think that ideally you would go to a music shop and try out both to see which has action that you prefer, however if that is not possible the PX150 does have extremely good reviews. Note that it weighs 3kg more than the one you originally mentioned, just something to bear in mind if you need to carry it anywhere. Don't worry about the stand/bench blowing your budget, they can usually be bought second hand very cheaply. I think that since this keyboard will probably stay with you for a long time, it is better to go for the higher quality one.
Comment: Yeah, I'm actually really considering it at this point. Just one last thing - I'm seeing a lot of bundles for REALLY cheap (only 520-530 range; originally piano by itself is 499). But what's bothering me is that if I want a bundle with the three pedal system, it would cost me around $650. I know some people are saying the three pedals are very necessary later down the line while others are saying they aren't used much on a daily basis. What do you think?
Answer: Besides the weight that we can define as the amount of pressure needed, a real piano has a very large linear and angular momentum of its keys and inner mechanism. This is very hard to replicate without using material having the same weight as the original (which would make digital pianos very big and heavy).
Digital pianos mostly replicate the pressure force by using some spring and friction mechanisms. They are sufficient for most practicing and learning purposes.
You may need a real piano when you really progress a lot on expression techniques because of the lacking body and string resonance of a digital piano. Also you may need to practice on a real piano when you need to develop condition for playing quite long pieces.


Make synchronous function in javascript?

Question: I wanna synchronized functions just like jQuery's $.ajax({ .., async: false, .. });.
function A() { lalala .. };
function B() { dadada .. };
function C() { .. };

, those all including some effect like fadeIn, Out, slide... etc.
However I just found if those functions called like below..
A();
B();
C();

All effect start at almost same time. In my understanding, this happens because the function called synchronously but it doesn't mean that function B() started after function A() was completely finished.. right?
Then, how can I make those functions work in order?
I found a way use callback function but it's not enough for me..
Comment: Do A(), B(), & C() all do some async operations?
Comment: what's inside those functions ?, in jquery animate (if you are using it) the only thing you can use is the callback function to execute your next animation
Comment: until and unless function is asynchronous explicitly, all get executed one by one.
Answer: Have a look at using jQuery $.Deferred();
That can allow you to run each function in sequence, one waiting after the other. For example:
var a = function() {
    var defer = $.Deferred();

    console.log('a() called');

    setTimeout(function() {
        defer.resolve(); // When this fires, the code in a().then(/..../); is executed.
    }, 5000);

    return defer;
};

var b = function() {
    var defer = $.Deferred();

    console.log('b() called');

    setTimeout(function () {
        defer.resolve();
    }, 5000);

    return defer;
};

var c = function() {
    var defer = $.Deferred();

    console.log('c() called');

    setTimeout(function () {
        defer.resolve();
    }, 5000);

    return defer;
};

a().then(b).then(c);

Using defer.resolve(); means you can control when the function yields execution to the next function.
Comment: SOF actually hides that last line that really brings this all together. the a(0).then(b).then(c);. This comment exists to help the next guy who didnt notice the scroll bar to the left :D
Comment: To the editor who made a change to my post - "Links are always nice :)" I did put the link to deferred in my first attempt, but the text editor flagged up saying "Links to jQuery something or other aren't allowed." So I left it out at the time. I like links too :)
Answer: You have indeed specified three synchronous functions, meaning B will only trigger when A has finished.
However, doing asynchronous tasks like starting an animation won't stop A from completing, so it appears that B isn't waiting until completion.
Read about jQuery Deferreds. Deferreds is a design pattern, so it's not specific to jQuery, however they have a great implementation.
function methodA () {
    var dfd = $.Deferred();

    console.log('Start A');

    // Perform async action, like an animation or AJAX call
    $('#el').slideOut(2000, function () {
        // This callback executes when animation is done.
        console.log('End A');
        dfd.resolve();
    });

    // Return unchangeable version of deferred.
    return dfd.promise();
};

function methodB () {
    console.log('Start B');
};

methodA().then(methodB);

Answer: I suppose that each function makes some ajax request or animation
function A() {
  return $.ajax(....);
  // or
  // return $('#animate').animate({ width: 100 }, 1000 ).promise();
  // or
  // var def = $.Defered();
  // in async function def.resolve();
  // return def.promise();
}

function B() {
  return $.ajax(....);
  // or
  // return $('#animate').animate({ width: 200 }, 3000 ).promise();
  // var def = $.Defered();
  // in async function def.resolve();
  // return def.promise();
}

function C() {
  return $.ajax(....);
  // or
  // return $('#animate').animate({ width: 300 }, 1000 ).promise();
  // var def = $.Defered();
  // in async function def.resolve();
  // return def.promise();
}

$.when(A(), B(), C(), function (aRes, bRes, cRes) {
})

//C().then(B()).then(A()).done(function () {
//  console.log('DONE');
//});

For a more detailed answer please explain what your functions do


Calculating Avg Days to Pay: Which formula to use?

Question: I want to find the average days to pay for a client based on last year's many invoices. Nearly all of them are paid.
Most formulas for this activity rely on outstanding amounts for the client. In this scenario, is there any reason I wouldn't just figure out the difference between bill and paid dates rather than using something more sophisticated? Also, generally speaking, why wouldn't I use the difference between bill and pay dates every time - what is the benefit of a more sophisticated formula using amounts outstanding?
If there is a better stack to use for this question, please let me know.
Comment: *"I want to find the average days to pay for a client based on last year's many invoices."* Is this your question, how to compute that average? Or did you want to ask about a different issue, whether that average makes any sense for something else that you want to do?
Comment: There are several ways to do it and I wanted to know why using one way (e.g.  (APx # days outstanding ) / Cost of Goods) would be preferable to just calculating the difference between the date billed and date collected. I though that answer I checked did a good job of that.
Answer: The average to use should reflect your purpose in averaging.
You might be evaluating policies for a particular customer, who has paid late in the past, Perhaps you are considering whether to continue offering them 30-day payment terms, or to insist that they pay cash upfront.
You might make that decision based on their unweighted average time to pay in the last year. Or if their extra approvals for payments over $10,000 is an issue, you might average just the payments over that amount. Or you might look at their 75th percentile or maximum payment time instead.
By contrast, you might be evaluating your overall needs for cash reserves given that payments are not immediate.
In that case, you might take the weighted average of payment times over all invoices, weighted by the invoice amounts. Then you can identify which customers contribute the most to that average using the corresponding weighted average of payment times for each customer.
Comment: Excellent response and exactly what I needed. Thank you!


Dovecot emails not deletable

Question: I have a Dovecot mail server running an everything is working fine - all emails arrive and new messages can go out.
To give the users the possibility to read their emails and to write them, i have installed an RoundCube webmailer. It is working all
The emails are stored in mbox format, so in a single file.
Now to the problem:
When an email is deleted via the webmail interface, it is still there - when i reload the view, the mail is showed grayed out. I have also tried to move it to the trash manually and then delete it from there - but they are still grayed out in the inbox.
Regards and thanks for the help
Comment: Is dovecot showing any errors in its logs? Does dovecot have permission to write to the mbox file?
Comment: that is not the problem - i've tried to set 777 (only for testing, security etc.) and it still didn't work.

Another thing is, that ls is showing me, that the last editing date was the 22nd September 2013, so not today - meaning, that dovecot did not even wrote to it ...
Answer: When you "delete" somthing in IMAP it does not usually get deleted immediately, instead the /deleted flag gets set on the message. That message will sit on the server until either an IMAP EXPUNGE command is received for the mailbox, or doomsday arrives.
There should be a button in RoundCube to perform an expunge operation [also referred to as 'compacting' the mailbox in other clients] and/or an option to expunge on logout.
Comment: I have googled a lot and found out, that i have to set the chomd -t permission to /var/mail - that helped and now the deletion of emails is possible.

Roundcube itself does, as i thing, the imap expunge when deleteing emails from trash automatically - the first deletion itself is just a move to another folder, and already that didn't worked out.
Answer: Check you configuration file. Be sure to add the add_privileged_group directive set to the right group (mail).
add_privileged_group=mail

Restart the dovecot daemon. You should now be able to delete your emails, from your MUA interface.

Dovecot emails not deletable


Styles player for Yamaha DGX 660

Question: I have a DGX 660 keyboard.
On this keyboard 200 styles files are preinstalled. But you can use 100 more...
2 ways exist: load them on the keyboard or use them on a USB key. The bank total can't exceed 300.
I found lot of styles on internet, thousands and thousands... I wanted to test them to keep the ones I like. If we use apps like Midi and Style Player or Stylemagic YA, I can't hear harmonic sounds to really evaluate them. The only way I found to hear the quality of a style file is to drop them 100 by 100 on a USB key and use them with the keyboard.
You can imagine the time needed to do this evaluation.
Someone have a solution for that ?
Answer: As far as I'm aware, Yamaha themselves never released a style editor to the public.
I haven't worked there for 20 years, but I don't think that has changed in the intervening period.
I used to, in the 90s, actually make these things for a living ;-)
I was part of Yamaha's writing & mixing/editing team who made the internal styles & a lot of the first release-cycle of the then-known 'disk styles' you could buy, initially for the high end products such as the PSR-6700, right up to the last before I left, the PSR-9000 & Tyros. Lower models would be handled by another team, who trimmed down, re-voiced & re-edited from the data we made for the top models.
So, my information is 20 years out of date, but these styles were always actually made in a static C Maj7 chord. The note function & movement was then re-calculated live during playback. Using C Maj7 as the base data gave each note a 'function' from which the ABC could be calculated. Root, 3, 5, & "flavour". There were some rather sophisticated algorithms & different rule-sets which dictated which note went to where on transposition, & these rules could be set per track/instrument by the programmer. Whether it was simple transposition of the entire chord - the simplest was to transpose in parallel, up until a certain key, then wrap over to transpose down [dumb but sometimes useful]. Much smarter algorithms could dictate quite clever re-voicing to make a player's voicings always appear to move to the nearest 'good' note for the chord, with correct voice-leading etc. Even more complex algorithms for other scale & non-scale notes were capable of keeping the whole thing sounding reasonably musical.
Unfortunately, the exact details of how this was done [because no other company had managed to achieve it] I have to keep to myself even to this day.
Anyway, the background aside, I still don't think there is a dedicated publicly-available Yamaha resource to handle these files at consumer-level. All 3rd party software will have had to try to reverse-engineer how the algorithms are applied.
The best resource I know of for this 3rd party software is curated by a chap called Jørgen Sørensen on his site - The Unofficial YAMAHA Keyboard Resource Site On two pages he has links to all the known editors for Yamaha keyboards - http://www.jososoft.dk/yamaha/software.htm [& see the header bar for 'Software 2'].
I haven't tested any of this myself, but I feel sure this is going to be your best resource.
Comment: Arranger keyboards were a valuable resource for me for learning music during the 80s, and I think a lot of music makers today would benefit from learning to play songs as chords and melody on an arranger keyboard. Do some Yamaha keyboards try to figure out the prevailing scale and key? Because that's often needed to make meaningful note choices. I remember the DSR-2000 model had a useful "I don't understand this chord" fallback where it would just play the lowest note as bass and all chord notes in a basic rhythm. Many modern keyboards fail to serve the user by trying to be too "intelligent".
Comment: I could tell you but then I'd have to shoot you ;-)) No, seriously, I can't say at all. It's very *sekrit* how it all works & appears to have some modicum of 'intelligence'. My knowledge is also going to be 20 years out of date.

Styles player for Yamaha DGX 660


"Error 1067: The process terminated unexpectedly" when trying to install MySQL on Win7 x64

Question: I've run into a brick wall trying to install MySQL v5.5 on my machine.
My PC is Windows 7 x64, Enterprise edition.
MySQL installs fine, but when I run the "MySQL Instance Configuration Wizard", it pauses forever on the step "Start Service" (I can let it run for 30 minutes with no response). If I go into services, I see that the "MySQL" service hasn't started, and if I try to start it, it says "Windows could not start MySQL Service on Local Computer. Error 1067: The process terminated unexpectedly."
I've tried the following:

Turning off firewall.
Uninstalling all antivirus software.
Installing / reinstalling 32-bit version of MySQL.
Installing / reinstalling 64-bit version of MySQL.
Uninstalling, deleting the contents of "C:\program files\MySQL" and "C:\program files (x86)\MySQL", reinstalling.
Checking to see that there is no rogue services named MySQL???? (from a previous install).
Checking that port 3306 is not used by an alternate program.
Changing the default port that MySQL uses.
Checking for "my.ini" and "my.ini.cnf" in "C:\windows" (nothing there but that can cause a problem).
Running both MySQL installer, and configuration wizard, in "Adminstrator mode".
Turning off UAC.
Installing with defaults, not changing anything.
Rebooting my machine (about 6 reboots so far).
Opening up port 3306 in the firewall (both TCP and UDP, inbound and outbound).
Swearing at the klutz of a programmer who designed MySQL so you can't even install it (as if that would help!)

My machine is working 100% in every other way. InfiniDB (a MySQL compatible database) installs 100%, as does Visual Studio 2010, Microsoft SQL Server, etc, etc.
Your advice on how to work around this?
p.s. Here is the screen it got stuck on for 15 minutes until I killed the process:

Update 2010-12-20
Tried MySQL v5.1, it didn't work either. Its amazing - if you type "mysqld /?", or "mysqld -help", it doesn't give you any help. And, if you try to restart the service manually, it doesn't display any error messages. Could it be any more unhelpful?
Update 2010-12-21
Installed MySQL 6.0 alpha, and it worked. However, I'd rather not use an alpha release, given that the "stable" release is anything but :(
Update 2010-12-21
Found http://dev.mysql.com/doc/refman/5.1/en/windows-troubleshooting.html, dealing with troubleshooting under Windows.
Discovered that you can generate an error log if the service doesn't start - see here: http://dev.mysql.com/doc/refman/5.1/en/error-log.html
Update 2010-12-21
Aha! A clue. To actually see the error, add "--console":
mysqld --console

This returns:
101221 13:57:28 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use Windows interlocked functions
InnoDB: Compressed tables use zlib 1.2.3
101221 13:57:28  InnoDB: Initializing buffer pool, size = 203.0M
101221 13:57:28  InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file .\ib_logfile0 is of different size 0 56623104 bytes
InnoDB: than specified in the .cnf file 0 106954752 bytes!
101221 13:57:28 [ERROR] Plugin 'InnoDB' init function returned error.
101221 13:57:28 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
101221 13:57:28 [ERROR] Unknown/unsupported storage engine: INNODB
101221 13:57:28 [ERROR] Aborting
101221 13:57:28 [Note] mysqld: Shutdown complete

Update 2010-12-21
It now installs properly. See the answer below.
Comment: In my case, the "my.ini" file had bad configured paths.
Hope it helps someone else.
Answer: Here's how I fixed the problem:
Step 1: By default, its impossible to find out the reason why the service is failing to start. So, tell it to start in non-service mode, and pipe errors to the console:
mysqld --console

Step 2: In my particular case, I had to delete the contents of:
C:\ProgramData\MySQL

... then reinstall. The MySQL v5.5 installer has a bug: if you uninstall MySQL v5.5 to fix a problem with a bad installation, it fails to clean up C:\ProgramData\MySQL, meaning that it is impossible to install MySQL v5.5 on that machine, from that moment on, without deleting this rogue directory.
Hints:

Ensure you kill any instances of "mysqld" in the process monitor.
To remove any existing services, use "sc delete MYSQLxx".

Open letter to the MySQL development team at Oracle:

---start open letter to Oracle---
Dear MySQL dev team at Oracle:
If, when MySQL is installed, the service fails to start, please let us
  know why by either (a) pointing us in the direction of the error log
  or (b) displaying this error log.
Failure to do so casts Oracle in an incompetent light.
Yours sincerely,
Everyone that installs MySQL on Windows.
---end open letter to Oracle---
Answer: I agree with Gravitas but you do not need to do a re-install (especially when installing MySQL Server x.x in a different folder other than the default in C:/Program Files/).
These steps helped me run the service successfully.Worked in Win7 x64 so I assume x32 will be just fine :)
Open 'my.ini' file where MySQL Server x.x is installed (mine was 5.5 but 5.1 is also OK)
Go to the line where it says:
datadir=C:/ProgramData/MySQL/MySQL Server x.x/data -> (This is the default path)
Change the above line with something like this:
datadir="<Drive_Letter>:/path/where/MySQL/is/installed/MySQL Server x.x/data/"
Copy all contents of C:/ProgramData/MySQL/MySQL Server x.x/ to the newly designated datadir
EXCEPT ib_logfile0 & ib_logfile1 (relocate them elsewhere as a backup).
Delete C:/ProgramData/MySQL/MySQL Server x.x/.
Re-run MySQLInstanceConfig.
Check TCP/IP networking but DO NOT change security settings (leave them unaltered).
Start service (ib_logfile(1,2) will be regenerated).
P.S.:Reboot and clean temporary files -after reboot- with CCleaner. For some (weird?) reason, you cannot connect to MySQL DBMS from an IDE or MySQL Workbench CE x.x after applying the above settings until rebooting.

NOTE:Editing security settings will cause the configuration utility to hang due to another bug
  introduced when enabling TCP/IP with any other setting(s).

Hope this helps!
Answer: http://mydailytech.com/post/how-to-fix-mysql-error-1067/
check and follow the above link - it should resolve as it did in my case.
Hope that helps
Comment: Sorry, this didn't resolve the issue. I even tried reinstalling it in C:\MYSQL55\ just to make sure that long filenames didn't alter things, rebooting my machine, etc. I'm beginning to wonder if MySQL v5.5 and earlier is just plain broken under Windows 7 x64?
Answer: Quoted from the website that rigatum posted:
When installing MySQL, if you install it in a non-standard directory, then you'll need to specify where your defaults file's path is before you can run MySQL or install the MySQL service, otherwise you'll get Error 1067.
First let's open up the command prompt.  Navigate to your MySQL install folder and find wherever mysqld.exe is.  Then run this:
mysqld –remove MySql

That will uninstall the MySQL service.
Now reinstall the service with the defaults-file parameter:
mysqld –install <service name> –defaults-file=<full path of "my.ini" file>

For example:
mysqld –install MySql –defaults-file=c:\mysql\my.ini

Enjoy your error-free MySQL install.
Comment: no its not plain broken at all, i have it working flawlessly on 65 dev windows 7 machines at work, 18 servers (both nix and windows 2008R2), and on my home computers mix of windows 2008 and seven.

i think it is not uninstalling something properly and which is why it is getting stuck at some point - happened to me but that was a while ago.

I had uninstalled, manually deleted all mysql directories and deleted the service instance too from windows.
Comment: Sorry, this didn't resolve the issue. I even tried reinstalling it in C:\MYSQL55\ just to make sure that long filenames didn't alter things, rebooting my machine, etc. I'm beginning to wonder if MySQL v5.5 and earlier is just plain broken under Windows 7 x64?
Answer: And I just add - not only programdata\mysql must be deleted in this case but also innoDB folder: \mysql datafiles
Answer: For the record, I tried for several hours to get 5.5.20 to install on Windows 2008 64bit.  It never would start.  I tried every example I could find to fix.  Including the accepted answer on here.  Never worked.
So I downgraded to 5.1.61 and it worked like a champ.  First time.
Answer: What I did was

With the daemon not running, I rename the data folder under the Program Data\MySQL to something else.
Uninstall mysql from control panel
Re-install. In configuring security settings fails with error #1045. I checked that MySQL has been installed as a service and the root password was blank. I verified this by running mysql utility without username
When prompted to retry or skip, I clicked skip and clicked back button until the dialog where you specify current root password and new password. I remove the password in the current root password field as this is blank already and supplied my new root password.
Configuration proceeded with no more errors
Stop the service
Copy the database folders from the old data folder which was renamed. Did not copy the log files and ibdata file.
Paste the folders to the current (new) data folder.
Restarted the service
Test in mysql utility to see if the database will be shown which it did.

Btw, I dumped the database with mysqldump --all-databases just in case :)
Answer: Adding the logical innodb_flush_method=normal to my.ini worked for me. I'm on Windows 7 x64 running MySQL 5.7, moving databases to a 3TB HDD. A quick walkthrough:

Stop the service in the Windows command prompt with net stop sqlXX
Copy over the data folder with the command xcopy "C:\ProgramData\MySQL\MySQL Server X.X\data" "<new_directory>\data" /s
In "<new_directory>\data" delete ib_logfile0 and ib_logfile1
Open C:ProgramData\MySQL\MySQL Server X.X\my.ini, set datadir="<new directory>/data", add innodb_flush_method=normal at the bottom of the file, and save
Restart the service with the command net start mysqlXX

Here the XX is your version number. I'm using 5.7, so I used net start mysql57.
According to the linked discussion, the default value for this is innodb_flush_method=unbuffered, which depends on a 512 byte sector size, which is normal for <2TB HDDs. If the HDD is >2TB, it will usually be formatted with 4096 byte sectors, causing the 1067 error.
I'd tried all of the above too and this is the only thing that solved it.
http://bugs.mysql.com/bug.php?id=28913


Is it better to use the latest version released 1 month ago, or use the older but still supported version?

Question: I am going to create a new website: Is it better to use the latest major version recently released, or the previous still-supported version? For example, if Drupal 9 were released one month ago, should I use Drupal 9, or Drupal 8, or Drupal 7?
Answer:
If all the modules you need works on D7, I see no reason to not use it.

That pretty much sums it up. In some more simple projects we are using D7 already. Anything complex, without the budget to invest in helping develop the D7 versions of the modules required, we are still finding ourselves starting in D6.
Worth noting, anything you start in D6, make sure the maintainer intends to create a D7 version and, if not, you have the ability and budget to do so yourself. Sooner or later you'll need to migrate, so select your modules with care.
Answer: If all the modules you need works on D7, I see no reason to not use it.
So a round of quick testing should probably help you out, provided you know which modules you will use.
Answer: The major advantages to dev in 7 vs. 6 in my opinion are:

Drupal 7 has better out-of-the-box accessibility best practices rolled-in (see: http://groups.drupal.org/node/116744)
When Drupal 8 comes out (whenever that may be), Drupal 6 will no longer be supported. If all the modules and functionality you need are (or soon will be) available in 7, you'll save yourself the hassles of having to upgrade your site if you start with 7.
Drupal 7 abstracts out the back-end database, so now SQL Server and other back-end databases can be used instead of just mySQL and PostgreSQL. Now that Oracle owns mySQL, that has caused some angst as to what its future will be. Plus if you develop a site for a larger corporation and might need to port it over to "their" backend database, you're theoretically buying some wiggle room with 7.
It's shiny and new and I'm guessing that most devs will want to develop modules and themes for 7 going forward, so 6 will not get the fancy new add-ons that will be coming out for 7.
It'll be a faster and easier to get started as you won't have to install a slew of modules just to get the base functionality that 7 already has.
See #4
Answer: If you're uncomfortable with the differences between alpha, beta, dev, RC (and don't know how to use drush) etc then I'd be wary of moving to Drupal 7.
Most modules are still in active development will have multiple releases - the version you launch site with will likely be out of date quickly.
that being said, I LOVE D7 and haven't found many issues with module support :D
Comment: It's worth noting that the majority of modules do not have stable 7 versions, if any at all.  If you are creating a complex site, you will run into problems.


Force HTTP to HTTPS redirect

Question: I have a site on SharePoint and I have implemented HTTP To HTTPS redirect successfully.
However, if user goes to the URL and remove 's' from 'https' then site becomes accessible without SSL.
I want a way to force redirect the user to HTTPS in all cases. How can I achieve this using IIS or SharePoint Central Administration?
Answer: You could set up HSTS (RFC 6797) for the domain in question along with the redirection from HTTP to HTTPS. (HSTS is not supported if turned on for a HTTP site, and in fact including the HSTS header on a HTTP connection is a violation of the RFC; HTTPS must be used, and the RFC requires that any HSTS headers received over non-secure transports be ignored.)
By setting up HSTS (HTTP Strict Transport Security), you instruct any compliant web browser to:

refuse to connect to the server if there are any errors in the HTTPS establishment process
refuse to connect to the server over plain-text HTTP

for the duration of the max-age stated in the HSTS header.
Just make sure you don't mess up the HTTPS configuration or have a certificate problem, or you will lock people out. (Sections 8.4 Errors in Secure Transport Establishment and 12.1 No User Recourse.)
Most modern web browsers support HSTS, and turning it on does not cause any appreciable harm (a tiny extra HTTP header) for those that do not.
For additional usefulness, you should combine this with a fixed 301 Moved Permanently whenever a page is requested over HTTP, pointing at the corresponding location using HTTPS. Your question is a little unclear as to whether you actually have accomplished this or not; you say that you "have implemented HTTP To HTTPS redirect successfully", but if you had fully succeeded, the user would simply be redirected back to HTTPS whenever they try to access the site over HTTP. When used in conjunction with this, HSTS has the advantage that it instructs the browser to not use HTTP at all for the domain name in question; a 301 redirect applies only to a specific URL.

Force HTTP to HTTPS redirect


Acesso a formulário externo com recaptcha

Question: Olá!
Estou fazendo uma aplicação na área de orçamento participativo, gostaria de saber qual a melhor solução (se houver) para conectar a uma página externa web, preencher um formulário, permitir ao usuário resolver o recaptcha da página externa e recuperar os dados de resposta da página externa.
Página externa:
http://apps.tse.jus.br/saae/consultaLocalVotacaoNome.do
Eu vi algumas soluções aqui para receber os dados de cpf e cnpj da receita federal, porém nesses casos usa o captcha de "imagem", essa página traz o recaptcha novo "check box".
Tentei carregar essa página dentro na minha pagina em um iframe mais dai não consigo nem recuperar o html do iframe por ser uma questão de domínio cruzado.
Desde já obrigado pela atenção!
Comment: Teria como fazer esta mesma aplicação com o este site https://www8.receita.fazenda.gov.br/SimplesNacional/controleAcesso/Autentica.aspx?id=60 Preciso acesso esta pagina com os dados que vem do banco de dados
Comment: Você conseguiu resolver seu problema? por coincidência estou fazendo um projeto semelhante de procura de CPF por exemplo, e a maioria usa o recaptcha, enche o saco...
Answer: Não é possível resolver o CAPTCHA em outra aplicação, que não a página porque uma das informações enviadas a página que recebe o action, é um token fornecido pelo Google. Se possível use Iframe. Espero ter ajudado.
Comment: O captcha antigo (aquele que gera uma imagem com caracteres) é usado no site da receita, achei uma solução em PHP para ele:
https://github.com/Massa191/Consultas_CNPJ_CPF_Receita_Federal

A diferença para o meu exemplo é que nele usa aquele recaptcha "chekbox".

O iframe até me resolveria, o problema que encontrei nele é que não consigo obter os dados da página após o redirecionamento do formulário pela questão de domínio cruzado.
Comment: se você conseguir resolver o problema do captcha, você pode usar ajax pra passar e receber o resto dos valores, não?
Comment: Acredito que sim, mais ainda não consegui uma solução para esse recaptcha "novo" que usa um "check box".


Generator polynomial cyclic codes

Question: How do I find the generator polynomial for a q-ary cyclic code. I know that for a binary cyclic code, a polynomial that divides $x^n - 1$ can be considered as a generator polynomial (e.g. $1 + x + x^3$ divides $x^7 - 1$ and thus $g(x) = 1 + x + x^3$.
But for non-binary cases I am unsure what is a necessary and sufficient condition to find a generator polynomial. Can someone please give an example. I know that for RS codes $g(x) = (x - a_1)(x - a_2)$. But are there other codes as well ?
Also, if $q = 2^m$, then does this constitute as a special case with additional properties?
Comment: If $g(x) \mid x^n - 1$ then $\langle g(x) \rangle$ gives a cyclic code independently of the field.
Comment: Thanks. But can you give me an example.
Answer: For instance $\langle (x + 1)(x+2)\rangle$ is a cyclic code over GF$(3)$ of length 6 and dimension 4.
In fact, all cyclic codes of length $n$ over GF$(q)$ are given by the following procedure. Let $$g_1^{k_1}\cdots g_l^{k_l} = x^n - 1$$ be the irreducible factorization of $x^n - 1$ over GF$(q)$. If $C$ is cyclic code of length $n$ then $C = \langle g(x) \rangle$ where $g$ is a combination of $g_i^{l_i}$s.
For the example that I mentioned, what I did is factor $x^6 - 1$ over GF$(3)$, namely, $$x^6 - 1 = (x+1)^3(x+2)^3$$ and then I took some combination of irreducble factors.
Comment: If this was the answer you were looking for, accept it so that is considered closed.

Generator polynomial cyclic codes


Running dnsmasq in docker container on Debian - check_dhcp ignores dnsmasq

Question: I'm testing configuration for my dnsmasq DHCP on my Virtualbox Debian machine.
On production I want dnsmasq to provide static IP addresses to guest systems running via qemu + libvirt + openvswitch ( that one I got covered, they are running via docker and they work )
dnsmasq configuration:
# Tried both eth0 and br0 for an interface - more about it near bottom
interface=br0
domain-needed
bogus-priv
no-resolv
local=/mydomain.io/
no-poll
no-hosts
domain=mydomain.io
dhcp-range=192.168.1.129,192.168.1.254,255.255.255.128,192.168.1.255,12h
dhcp-option=3
log-queries
log-dhcp

Dockerfile:
FROM alpine:3.5 MAINTAINER firstname.lastname@example.com

# webproc release settings ENV WEBPROC_VERSION 0.1.7 ENV WEBPROC_URL https://github.com/jpillora/webproc/releases/download/$WEBPROC_VERSION/webproc_linux_amd64.gz

# fetch dnsmasq and webproc binary RUN apk update \
        && apk add --no-cache dnsmasq \
        && apk add --no-cache --virtual .build-deps curl \
        && curl -sL $WEBPROC_URL | gzip -d - > /usr/local/bin/webproc \
        && chmod +x /usr/local/bin/webproc \
        && apk del .build-deps

# configure dnsmasq run mkdir -p /etc/default/ RUN echo -e "ENABLED=1\nIGNORE_RESOLVCONF=yes" > /etc/default/dnsmasq

# run! CMD ["webproc","--config","/etc/dnsmasq.conf","--","dnsmasq","--no-daemon","--dhcp-broadcast"]

Commands to build and run the container:
docker build -t dnsmasq .
docker run -d  --name=dnsmasq  --volume=/data/dnsmasq.conf:/etc/dnsmasq.conf -p 53:53/udp -p 192.168.56.101:5380:8080 --net host -e "USER=foo" -e "PASS=bar" dnsmasq

docker logs dnsmasq
[webproc] 2017/01/11 07:17:09 loaded config files changes from disk
[webproc] 2017/01/11 07:17:09 agent listening on http://0.0.0.0:8080...
dnsmasq: started, version 2.76 cachesize 150
dnsmasq: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth no-DNSSEC loop-detect inotify
dnsmasq-dhcp: DHCP, IP range 192.168.1.129 -- 192.168.1.254, lease time 12h
dnsmasq: using local addresses only for domain mydomain.io
dnsmasq: cleared cache
dnsmasq-dhcp: no address range available for DHCP request via eth0
dnsmasq-dhcp: no address range available for DHCP request via eth0
dnsmasq-dhcp: no address range available for DHCP request via eth0

check_dhcp command ( from monitoring-plugins-basic package )
/usr/lib/nagios/plugins/check_dhcp -v -s 192.168.1.129 -r 192.168.1.130
Requested server address: 192.168.1.129
DHCP socket: 3
Hardware address: 08:00:27:b6:c1:90
DHCPDISCOVER to 255.255.255.255 port 67
DHCPDISCOVER XID: 984913524 (0x3AB49674)
DHCDISCOVER ciaddr:  0.0.0.0
DHCDISCOVER yiaddr:  0.0.0.0
DHCDISCOVER siaddr:  0.0.0.0
DHCDISCOVER giaddr:  0.0.0.0
send_dhcp_packet result: 548

recv_result_1: 548
recv_result_2: 548
receive_dhcp_packet() result: 548
receive_dhcp_packet() source: 10.0.2.2
Result=OK
DHCPOFFER from IP address 10.0.2.2 via 10.0.2.2
DHCPOFFER XID: 984913524 (0x3AB49674)
DHCPOFFER chaddr: 080027B6C190
DHCPOFFER ciaddr: 0.0.0.0
DHCPOFFER yiaddr: 10.0.2.15
DHCPOFFER siaddr: 10.0.2.4
DHCPOFFER giaddr: 0.0.0.0
Option: 53 (0x01)
Option: 1 (0x04)
Option: 3 (0x04)
Option: 6 (0x08)
Option: 15 (0x04)
Option: 51 (0x04)
Option: 54 (0x04)
Lease Time: 86400 seconds
Renewal Time: 0 seconds
Rebinding Time: 0 seconds
Added offer from server @ 10.0.2.2 of IP address 10.0.2.15

No (more) data received (nfound: 0)
Result=ERROR
Total responses seen on the wire: 1
Valid responses for this machine: 1
CRITICAL: Received 1 DHCPOFFER(s), 0 of 1 requested servers responded, requested address (192.168.1.130) was not offered, max lease time = 86400 sec.

When attached to br0 with interface=br0 after check_dhcp command I'm not getting even
dnsmasq-dhcp: no address range available for DHCP request via eth0

... in logs. Contrary to when dnsmasq is attached to eth0
Its like my dnsmasq gets ignored and I get response from docker dhcp server.
Last but not least my route -n
0.0.0.0         10.0.2.2        0.0.0.0         UG    0      0        0 eth0
10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.168.1.128   0.0.0.0         255.255.255.128 U     0      0        0 br0
192.168.56.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1

~ thanks for help, greatly appreciated
Answer: I had solved the same "challenge". At the end I found out, that I didn't have set IP address of my host server. After manual setting IP dnsmasq worked.
ip addr add <IP> dev <NET_INTERFACE>


Erro: The name 'ViewBag' does not exist in the current context

Question: Bom dia,
Possuo projetos utilizando System.Web.MVC na versão 22.214.171.124, trabalhava normalmente na versão 2013 do Visual Studio, agora estou tentando trabalhar com Visual Studio 2015 e minhas Views não reconhecem mais algumas propriedades por exemplo ViewBag e @model, elas continuam funcionando porem ficam grifadas em vermelho com a seguinte mensagem "The name 'ViewBag' does not exist in the current context".
Procurei diversas soluções online mas ainda não encontrei nada que resolva. Não gostaria de ter que atualizar para MVC 5 pois tenho muitos projetos em paralelo e teria que atualizar todos.
Existe alguma solução para este problema que creio que seja de compatibilidade ?
Comment: Tô sem tempo de criar uma resposta, dá uma olhada [aqui](http://stackoverflow.com/questions/4960148/the-name-viewbag-does-not-exist-in-the-current-context)
Comment: Clique na sua na sua view (ex: Index.cshtml) com o botão direito e vai em "Open With", e verifique se a opção "Razor Editor" está como Default.
Answer: Existe um update para o Visual Studio 2015 que habilita novamente a sintaxe do MVC4.
Ainda assim, não vejo vantagem em manter um projeto no MVC4. Aqui tem um guia de migração para o MVC5 que já usei algumas vezes em projetos meus.
Comment: Obrigado Cigano, funcionou corretamente a atualização. Também não vejo vantagem mas estou sem tempo para migrar os projetos pra MVC 5, assim que possível realizarei a migração. Obrigado!
Answer: Já passei por isso algumas vezes e parece que o problema está relacionado ao HTML Editor quando ele tenta interpretar código em Razor, eu consegui resolver esse problema algumas fechando todas as abas que estava abertas e reabrindo aquela em que o problema ocorria. Caso isso não resolva o problema já vi algumas pessoas recomendando reiniciar as configurações de usuário iniciando o Visual Studio com o argumento de linha de comando /ResetUserData.
devenv /ResetUserData

No Stack Overflow em inglês, existe algumas perguntas sobre o mesmo problema no Visual Studio 2015 e foram resolvidas dessa maneira também:

Visual Studio 2015 Broken Razor Intellisense
Visual Studio 2015 not syntax highlighting razor nor Intellisense


Uniqueness of a linear map for which $Tv_{k} = w_{k}$

Question: I am reading Sheldon Axler's masterpiece Linear Algebra Done Right (Fourth Edition).  If you thought you knew linear algebra, read this - you'll learn more in the first 50 pages than the entirety of a typical 300+ level course.
Anyways, I am having a bit of trouble following one of his results.  He states and proves the following.
3.4 linear map lemma
Suppose $v_{1}, \ldots, v_{n}$ is a basis of $V$ and $w_{1}, \ldots, w_{n} \in W$.  Then there exists a unique linear map $T: V \rightarrow W$ such that $Tv_{k} = w_{k}$ for each $k = 1, 2, \ldots, n$.
Proof
In the interest of brevity, I will skip the first part of the proof where he shows that the function
$$T(c_{1}v_{1} + \ldots + c_{n}v_{n}) = c_{1}w_{1} + c_{2}w_{2} + \cdots + c_{n}w_{n}$$
is indeed a linear map from $V$ to $W$ for which $Tv_{k} = w_{k}$ for each $k = 1, \ldots, n$.
The next part is what confuses me.
To prove uniqueness, now suppose that $T \in \mathcal{L}(V, W)$ and that $Tv_{k} = w_{k}$ for each $k = 1, \ldots, n$.  Let $c_{1}, \ldots, c_{n} \in \mathbf{F}$ (where $\mathbf{F}$ is a field, usually $\mathbb{R}$ or $\mathbb{C}$).  Then the homogeneity of $T$ implies that $T(c_{k}v_{k}) = c_{k}w_{k}$ for each $k = 1, \ldots, n$.  The additivity of $T$ now implies that
$$T(c_{1}v_{1} + \ldots + c_{n}v_{n}) = c_{1}w_{1} + \cdots + c_{n}w_{n}$$
Thus $T$ is uniquely determined on span$(v_{1}, \ldots, v_{n})$ by the equation above.  Because $v_{1}, \ldots, v_{n}$ is a basis of $V$, this implies that $T$ is uniquely determined on $V$, as desired.
Thanks in advance.
Comment: if you had another $T_0$ for which $T_0v_k=w_k$, then $T$ and $T_0$ will send a base, the v's, to the same base, the w's. that means that every element of V will have identical image through $T$ and $T_0$
Comment: When this type of argument leaves me less than enlightened, I modify it as follows: "Let $S,T \in \mathcal{L}(V,W)$" and then make $S$ satisfy whatever we require of $T$, and then computing $S - T$.  Here, we get to $T(c_1v_1 + \cdots + c_nv_n) = \dots = S(c_1v_1 + \cdots + c_nv_n)$, so $S$ and $T$ are equal on the span of the $v_i$, and are therefore equal on $V$.
Comment: @temp minor change in "the same base, the w's". Get rid of the insinuation that the w's have to be a base too.
Comment: youu are right, I meant "to the same subspace of W, whose base are the w's" and I write it poorly
Answer: The point is that because $\{v_1, v_2, \ldots, v_n \}$ is a basis, there's only one way to express any element of $V$ as a linear combination of the $v_i$ (that follows from linear independence), and each element of $V$ can be expressed as such a linear combination (that follows because the $v_i$ span $V$).
So for any element $v \in V$, express $v= \sum c_iv_i$.  We now know that $Tv=\sum c_i w_i$, and we can come up with such a combination for all $v \in V$.
Answer: @Robert Shore has already answered.
Just a hint: try to construct examples. It will get easier and easier with practice.
Here, I propose the following example : $$V=W=\mathbb R^2, v_1=w_1(1,0), v_2=(0,1), w_2=(0,0)$$
There exists a unique linear map $T$ such that $T(v_1)=w_1$ and $T(v_2)=w_2$:$$T:\mathbb R^2 \to \mathbb R^2$$ $$v=(x,y)=xv_1+yv_2\mapsto (x,0)=xw_1$$

This is the projection on $\mathbb Rv_1$ parallel to $\mathbb Rv_2$


Why must a linux server be rebooted to properly handle a change in resolv.conf?

Question: I know this has to just be a lack of my understanding but here's the problem.
We recently changed DNS servers from 192.168.1.1 to .2, so I went around to all 8 of my linux servers and changed /etc/resolv.conf to reflect the change.  Note that they're all static, there's no DHCP involved.
After making the change I can immediately test the results using nslookup and dig, and it all looks good.  I did a /etc/init.d/networking restart - to restart the networking subsystem - and restarted apache and postfix on each of the servers, just to be sure.
A few days later I get a report stating on of our websites isn't sending emails anymore.  Perusing the logs I found that the mod_php process couldn't resolve dns entries to send mail.  After beating my head on it for about 30 mins I rebooted the server and everything returned to normal.
The next day on a different server (using CentOS rather than our normal Ubuntu), I get a report stating that emails aren't going through, and sure enough looking at the logs indicates that Postfix can't resolve names.  Rebooted and it almost instantly delivers all the queued mail.
So what am I missing here?  What portion of this process did I fail to understand correctly?
Answer: You probably got bitten by nscd: http://linux.die.net/man/8/nscd
Cheers
Comment: Thanks!  It seems highly possible this is what was giving me problems.  I wasn't even aware local dns caching was part of the common linux system.
Comment: Did you actually test? Jason's hypothesis is possible but not certain.
Comment: @bortzmeyer - yes, I agree.  Your own answer is the same as I would have given (and indeed have to two related questions recently).  It's much more likely to be cached res_init() state than nscd.
Answer: Most applications intialize the resolver once, at startup (with res_init), and never do it again afterwards. It is not a problem for short-life applications like ping but more serious for long-running daemons.
The Apache process (which runs mod_php) was probably in that case. Restarting Apache would have suffice.
Answer: resolv.conf directs resolvers on where to look for names.  In most cases, this is going to be the libc resolver, but there may be other cases such as vPostMaster which uses the Python DNS resolver library for SPF lookups.
So, it COULD be that the resolver is caching the resolv.conf information for long-running processes, but it sounded like you restarted postfix, which should have caused it to start using a fresh resolv.conf file.
Check your /etc/nsswitch.conf to see if it specifies anything special happening for "hosts".  For example, the default Fedora 11 line on my laptop is:
hosts:      files mdns4_minimal [NOTFOUND=return] dns
So in this case it uses mdns as well as /etc/hosts and DNS.  In this case, if DNS changes weren't being picked up, I'd wonder if it were the mdns that were causing it.
Sean
Answer: Probably some caching going on. We had a similar problem with sendmail and just restarting the service fixed it.
Sometimes it's easier to just reboot the server and clear all those caches anywhere in the system than spend all that time identifying which service is caching too long. On the other hand, it can turn out to be an investment when it happens again and you know which service to restart.
Comment: I agree, rebooting is the easiest way out, but if the server is critical finding time to reboot can be difficult.  Thanks for your help!


sql query to manipulate strings

Question: I have table named "path" with a single column named "path file name" and it contains something like this below:
1. U:01.03.141878Box1819P3FarihaTanzir(Moniruzzaman)0103141(756).jpg
2. U:01.03.141876Box1807P3Arif(Mahfuz)151213Picture 96609.jpg
3. U:01.03.141130Box1781P3RakhiSwpna(Farah)0103141 (1486).jpg
4. U:01.03.141952Box1810P1Sufia(Jakia)010314Picture 25304.jpg

I want to get the names within the first braces() like: 1.Moniruzzaman 2.Mahfuz 3.Farah 4.Jakia
I have used combination of patindex(), charindex() and substring function with left and right but could not get the desired result.
Comment: CHARINDEX(REVERSE(string)) should help get the rightmost ) and (, after which a simple SUBSTRING will get your results.  Note that () are "parenthesis" - braces are {}.
Comment: Please edit your question and include the query you tried.
Comment: Is it always the first set of parenthesis that contains your desired item?
Comment: i have used a query like : SELECT
    CASE WHEN CHARINDEX('(', [path file name])>0
        THEN LEFT([path file name], CHARINDEX(')', [path file name]))
    ELSE [path file name] END [path file name] into [names]
FROM(
    SELECT
        CASE WHEN CHARINDEX(')', [path file name])>0 THEN
            REPLACE(RIGHT([path file name], CHARINDEX(')', REVERSE([wallet])) - 1), ')', '')
        ELSE [path file name] END [path file name]
    FROM
        [path]
)x
Answer: Here is a method that uses stuff() twice:
select stuff(stuff(col, charindex(')', col), len(col), ''),
                   1, charindex('(', col), '')

You can test it by adding:
from (select 'asbc(axx)asfdsf(123)d' as col) t

This assumes that the first closing paren ()) appears after the first opening paren (().
Answer: Try this :-
Declare @var varchar(100)
Set @var ='U:01.03.141878Box1819P3FarihaTanzir(Moniruzzaman)0103141(756).jpg'

Select substring(@var,
                charindex('(',@var)+1,
                                   charindex(')',@var)-charindex('(',@var)-1)

SQL FIDDLE DEMO

sql query to manipulate strings


"The calling thread cannot access this object because a different thread owns it"

Question: I have a WPF application that uses multi-threading to perform notifications. But I've faced the problem with "The calling thread cannot access this object because a different thread owns it." exception.
When my main window is loaded I create a new thread for notification window
private void RibbonWindow_Loaded(object sender, RoutedEventArgs rae)
{
    Thread newWindowThread = new Thread(new ThreadStart(() =>
    {
        var reminders = new List<Reminder>();

        // Go to the database to get active reminders...

        var notificationsViewModel = new NotificationsViewModel(reminders);
        var notificationsView = new NotificationsView();
        notificationsView.DataContext = notificationsViewModel;
        var checkAccess = notificationsView.Dispatcher.CheckAccess();

        if (checkAccess)
        {
            notificationsView.Show();
        }

        System.Windows.Threading.Dispatcher.Run();
    }));

    newWindowThread.IsBackground = true;
    newWindowThread.SetApartmentState(ApartmentState.STA);
    newWindowThread.Start();
}

Constructor for view is default:
public partial class NotificationsView : Window
{
    public NotificationsView()
    {
        InitializeComponent();
    }
}

Constructor for view model and model to bind
public NotificationsViewModel(List<ReminderCommon> reminders)
{
    this.Reminders = reminders;

    this.ReminderModel = reminders.First();
}

public ReminderCommon ReminderModel
{
    get
    {
        return this.m_ReminderModel;
    }
    set
    {
        this.m_ReminderModel = value;

        base.OnPropertyChanged("ReminderModel");
    }
}

Finally, my view
<Border BorderThickness="1" Background="Beige" BorderBrush="DarkKhaki" CornerRadius="5">
    <StackPanel Margin="5">
        <TextBlock Text="{Binding ReminderModel.Message}" TextWrapping="NoWrap" Margin="5" FontWeight="Bold"></TextBlock>
        <TextBlock Text="{Binding ReminderModel.DateFormatted}" TextWrapping="NoWrap" Margin="5"></TextBlock>
        <TextBlock Text="{Binding ReminderModel.Patient}" TextWrapping="NoWrap" Margin="5"></TextBlock>
        <TextBlock Text="{Binding ReminderModel.PatientPhoneNumbers}" TextWrapping="Wrap" Margin="5"></TextBlock>
        <TextBlock Text="{Binding ReminderModel.Doctor}" TextWrapping="NoWrap" Margin="5"></TextBlock>
        <CheckBox IsChecked="{Binding ReminderModel.IsCompleted}" Margin="5" />
    </StackPanel>
</Border>
</Border>

I receive exception on
notificationsView.Show();

Exception details
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.DependencyObject.GetValue(DependencyProperty dp)
at System.Windows.Media.SolidColorBrush.get_Color()
at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Primitives.BulletDecorator.ArrangeOverride(Size arrangeSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.StackPanel.ArrangeOverride(Size arrangeSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Grid.ArrangeOverride(Size arrangeSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at MS.Internal.Helper.ArrangeElementWithSingleChild(UIElement element, Size arrangeSize)
at System.Windows.Controls.ContentPresenter.ArrangeOverride(Size arrangeSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Documents.AdornerDecorator.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Window.ArrangeOverride(Size arrangeBounds)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at System.Windows.Window.SetRootVisual()
at System.Windows.Window.SetRootVisualAndUpdateSTC()
at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
at System.Windows.Window.CreateSourceWindowDuringShow()
at System.Windows.Window.SafeCreateWindowDuringShow()
at System.Windows.Window.ShowHelper(Object booleanBox)
at System.Windows.Window.Show()
at Dentist.MainWindow.<RibbonWindow_Loaded>b__0() in D:\development\Dental Soft\Lotus\AMS\Dentist\MainWindow.xaml.cs:line 210
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

TargetSite: {Void VerifyAccess()}

Also I mentioned two strange things: this code perfectly works in Windows 8, but doesn't work in Windows 7 and Windows XP and when I delete <CheckBox IsChecked="{Binding ReminderModel.IsCompleted}" Margin="5" /> from view code works. The same exceptions occurs if I use <Button /> (just control, without any bindings!)
Comment: possible duplicate of [How to deal with cross-thread access exceptions?](http://stackoverflow.com/questions/11923865/how-to-deal-with-cross-thread-access-exceptions)
Comment: I have edited your title. Please see, "[Should questions include "tags" in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not".
Comment: You are creating WPF objects (the notification view) from a bachground thread? That's not supposed to work, is it?
Comment: I've made the thread foreground, but still the same problem.
Comment: Did you paste the exception in the search box?  This question has been answered about a thousand times... probably several times a day.  Microsoft should probably build the answer right into Visual Studio and make everyone read it the first time they instantiate a thread in their code...
Comment: :) Of course, I've looked for such problems. I don't see the place where I try to change UI content from another thread. And I cannot understand, how  or  (just  or  without any binding) influence on this exception. If there are no such elements on the view everything is OK.
Comment: The view has UI elements.  You can only create UI elements on the main thread.  You can create data in the backgound and then bind that data to the UI elements.
Answer: You do not need another thread just to have another window running in parallel. Only do data-related actions on a background thread, do not create GUI elements there.


How to find the standard deviation?

Question: I need help figuring out the standard deviation if 6% is the "mean" than how many Standard deviation away is 9%. "is it 0.5 std dev away or more?"
A goal for female population is set at 6% (goal set by outside vendor based on market availability) and the company has 9% female population (599 female out of 6550) so how many SDs is 9% from 6%?
Comment: Please add the `[self-study]` tag & read its
[wiki](http://stats.stackexchange.com/tags/self-study/info). Then tell us
what you understand thus far, what you've tried & where you're stuck. We'll
provide hints to help you get unstuck.
Comment: Can you expand a bit on what you mean by the last paragraph?
Comment: @mdewey it is just an example as we have 599 female out of 6550 people and that percentage is 9% but there is a set goal of how many females they should have which is 6% so I need to find out how many Std Devs is 9% from 6%.
Answer: You want to calculate the z-score corresponding to $\hat{p}=0.09$ (sample proportion) and $p_0=0.06$ (true proportion). This gives you the number of standard deviations away an observation is from $p_0=0.06$. What is the standard error for the sample proportion?
Comment: I dont know the standard error for the sample proportion.599/6550

How to find the standard deviation?


React Native 0.60.0 & 0.60.x Android For animated GIF support

Question: In latest version of React Native 0.60.x animated GIF is not working I am using following fresco version.
compile 'com.facebook.fresco:fresco:1.10.0'
compile 'com.facebook.fresco:animated-gif:1.10.0'

Answer: Use following it works for me for RN v0.60.3
implementation 'com.facebook.fresco:fresco:2.0.0'
implementation 'com.facebook.fresco:animated-gif:2.0.0'

Comment: I used this version on a branch and fixed it, but no on a different branch I implemented this and its still not animating gif.
Answer: Change the version to 2.0.0
    compile 'com.facebook.fresco:animated-gif:2.0.0'

You don't need to use  compile 'com.facebook.fresco:fresco:1.10.0'
EDIT.
On my project compile is still working, but changing it to implementation isn't giving any issue so you are good to go!
implementation 'com.facebook.fresco:animated-gif:2.0.0'

Comment: It gives warning `compile` is deprecated so `implementation` is required
Comment: change compile to implementation


Is null matrix skew-symmetric

Question: My question is:
Is null matrix skew-symmetric?
I think it is true as A'=-A is trivially satisfied for a null matrix.
Please help.
Comment: Yes. (It's also symmetric)
Answer: To test if a matrix is skew symmetric, you need to show that:
$$-A=A^T$$
For example in the case of $2\times 2$ matrices, you need:
$$\begin{bmatrix}-a&-b\\-c&-d\end{bmatrix}=\begin{bmatrix}a&c\\b&d\end{bmatrix}$$
When we set $a=b=c=d=0$ this is trivially satisfied.

Also this is satisfied non-trivially for example in the reals, when $-a=a,-b=c,d=-d$, say:
$$M_c=\begin{bmatrix}0&-c\\c&0\end{bmatrix}:c\in \Bbb R$$
Clearly $-M_c = \begin{bmatrix}0&c\\-c&0\end{bmatrix}$ and $M_c^T = \begin{bmatrix}0&c\\-c&0\end{bmatrix}$
Answer: A skew-symmetric (or antisymmetric) matrix is a square matrix A, whose transpose is also its negative ($A'=-A$).
A null (or zero) matrix is an $m \times n$ matrix with all its entries being zero.
If the zero matrix is a square matrix, it satisfies the properties for skew-symmetricity. (if $m \neq n$, it is not skew-symmetric)
Comment: You are right, I have edited it now.

Is null matrix skew-symmetric


ionic3 sqlite error while compiling the app on xcode

Question: hello i got this errors while im compiling my app :
duplicate symbol _OBJC_CLASS_$_SQLitePlugin and duplicate symbol _OBJC_METACLASS_$_SQLitePlugin my pakckege.josn file have these packages:
"cordova-plugin-sqlite-2": "~1.0.4",
"cordova-sqlite-storage": "^2.1.3",
"pouchdb-adapter-cordova-sqlite"

and these plugins:
"cordova-sqlite-storage"
"cordova-plugin-sqlite-2"

i dont know where is the conflicts
Answer: From the Github issue page from the author :
Github issue page

Those two libraries are competitors, not complementary packages. They both add the same object, called SQLitePlugin. ideally you should use one or the other, not both.

So you should remove one of these two plugins, either cordova-sqlite-storage, either cordova-plugin-sqlite-2


Where can I go to play an acoustic piano regularly?

Question: I love my digital piano.  She's got weighted keys and can be quiet when she needs to, but for practice there are few things which compare to a real nice acoustic piano.
I live in London so there must be some places to go every week or 2 for the real deal.  Bonus points for cheaper places, but I'm willing to accept that a Bosendorfer might push the price up!
So, the question is, Where might I be able to go to play a good quality acoustic piano regularly?
Comment: No idea on the accuracy or validity of this information, sorry: http://streetpianos.com/london2012/ It says some are still available.
Comment: I live in Colorado, so this isn't much help to you (...now), but I'm planning to start a non-profit organization to provide access to practice rooms and pianos for people who don't have them at home.
Comment: Make it an answer man, let me give you rep :D There are indeed plenty of street pianos around.  Including one in Camden Market and Multiple at st Pancras Station
Comment: @KyleStrand That's a great idea! I don't have a piano to play regularly, this would be of great help :) *bon courage*!
Comment: You could also contact ABRSM and ask if they can aid you. I'm not sure if they can but it does not take a lot to send an email.
Answer: I would suggest schools, but more and more schools are getting rid of their pianos. However, if you find one, ask about seeing the caretaker and going in at holidays (now!) or weekends. Some pubs may provide, and maybe you could play in the background when punters are in. Occasionally rehearsal studios (not cheap) have a real piano.Colleges , especially music colleges, will have the facility - you either ask nicely, or walk in brazenly, it's up to you !
Alternatively, print some fliers, and go posting locally. There will be a neighbour, possibly an old biddy, who would love you to play the piano her kids learnt on 40 yrs ago !
Some churches will have retained their piano, or there may be one in the Church Hall that needs playing : always mention that acoustic pianos need regular playing !
Comment: I think I've covered my back, so to speak...
Comment: Do you think ministers would be offended if I asked to play with their organ?
Comment: I'm only guessing, but it could depend on their persuasion. You'll find their organs have a very different action from their pianos, though.
Comment: Bravo on raising the tone Ti... wait...
Comment: i am PRETTY sure he was jokin'...
Answer: No idea on the accuracy or validity of this information, sorry: http://streetpianos.com/london2012 says some are still available.
Failing that, these look reasonably priced: http://www.jspianos.com/hire/practice-room-hire - I might use them myself next time I'm working in London, since real pianos kinda scare me.
Answer: schools, churches, nursing homes.  that's probably about it.
nursing homes have sort of gone to digitals or else you may find their acoustic way out of tune.  but it's worth a shot.  you'll definitely have an appreciative audience.
other than that, pony up the cash and buy one, or make do with your digital.  My cp-33 is fine for me, at least.  I like to come across an acoustic, though.
Comment: The problem is not cost unfortunately, It's space.  London is not exactly known for spacious living conditions
Comment: True.  Same for me.  I could fit an upright in my microscopic living room, but, mmmm, if I'm going acoustic, it'll have to be a grand.
Comment: There's a business opportunity here, I'm sure of it!
Comment: It'll be like those driving days you can go on in a Ferrari
Comment: There are some quite small studio pianos available, a ship's piano is one that comes to mind, soundboard same height as the keys.With 88 notes, all are going to be as wide as each other though.
Answer: Here's a couple of central practice rooms I've used:
http://www.jspianos.com/hire/practice-room-hire
http://themusicstudios.co.uk/rates.php
And a list from RAM (PDF):
http://www.ram.ac.uk/viewfile.cfm?id=794&h=C4EEABAD93A5D4D0B5D22A704D1F4E39F63F9CDC2DA53FE99DC276FCF6EF25DD
Typical prices are between £10 and £20 an hour.
Answer: It might be worth trying Lonely Pianos - They list pianos and rehearsal rooms that are available to hire. http://lonelypianos.com/


After 10 minutes File watcher start in c#

Question: I'm craeting FileWatcher in c# and all operation save in database but I want every after 10 minute filewatcher started and insert record into databse so how i do ?
Comment: show your code snippet,.
Comment: Question in English read, how I do?
Answer: you can use dispatcher to execute the code on each 10 minutes
example
<code>DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Interval = new TimeSpan(0, 10, 0);
dispatcherTimer.Tick += timer_Tick;

private void timer_Tick(object sender, EventArgs e)
{
           //your save db code
}
</code>
Add reference of System.Windows.Threading dll for DispatcherTimer


Entry point of Minix's processes

Question: I'm studying Operating Systems and, of course, Minix 3.
Can someone tell me which file and line of code in Minix 3 are the entry points of:

Kernel;
Process Manager;
Memory Manager;
Virtual Memory Manager;
Any Device Driver.

Any of above will help me a lot.
Thanks.
I'm using the main github source:
https://github.com/Stichting-MINIX-Research-Foundation/minix
Answer: Try first searching for the device drivers since they are more "self-contained". Device drivers are found inhttps://github.com/Stichting-MINIX-Research-Foundation/minix/tree/master/minix/drivers
Instead of just pointing the entry points, I will show how I usually do. I will use the minix/drivers/video/fb/fb.h as an example. The fb is a driver responsible for controlling video displayed on a monitor. I could open any file, but I chose the fb.h since it is a header file and will contain the signatures of public functions.
I am on Linux so I can use the grep -r command. The -r flag search recursively for the given pattern. So by inspecting fb.h I found the following functions:
int arch_fb_init(int minor, struct edid_info *info);
int arch_get_device(int minor, struct device *dev);
int arch_get_varscreeninfo(int minor, struct fb_var_screeninfo *fbvsp);
int arch_put_varscreeninfo(int minor, struct fb_var_screeninfo *fbvs_copy);
int arch_get_fixscreeninfo(int minor, struct fb_fix_screeninfo *fbfsp);
int arch_pan_display(int minor, struct fb_var_screeninfo *fbvs_copy);

Well, arch_fb_init seems to be an entry point. To verify if arch_fb_init is indeed an entry point, I use
grep -r "arch_fb_init"

Which in turn returns the following
$ grep -r "arch_fb_init"
drivers/video/fb/arch/earm/fb_arch.c:arch_fb_init(int minor, struct edid_info *info)
drivers/video/fb/fb.h:int arch_fb_init(int minor, struct edid_info *info);
drivers/video/fb/fb.c:  if (arch_fb_init(minor, infop) == OK) {

The second match is the fb.h itself. The other two are in fb_arch.c and fb.c. Then I go to those files and inspect each of them. Opening fb_arch.c and searching for arch_fb_init I find on line 315 an implementation of this function. By now, the implementation of the function could be more interesting because we want to figure out the caller/callee hierarchy.
Opening fb.c I find an occurrence of arch_fb_init on line 74, which is a call to arch_fb_init. This call to arch_fb_init is performed by another function named fb_open (line 60 on fb.c).
Now I repeat the process but now searching for fb_open. Performing another grep now returns the following.
$ grep -r "fb_open"
drivers/video/fb/fb.c:static int fb_open(devminor_t minor, int access, endpoint_t user_endpt);
drivers/video/fb/fb.c:  .cdr_open   = fb_open,
drivers/video/fb/fb.c:fb_open(devminor_t minor, int UNUSED(access), endpoint_t UNUSED(user_endpt))

All the occurrences are also in fb.c. By inspecting fb.c, one can see that the first grep match is a declaration of the fb_open function, and the third one is the implementation itself. The second one is using fb_open to construct a table (line 46 on file fb.c) that you can see below
/* Entry points to the fb driver. */
static struct chardriver fb_tab =
{
    .cdr_open   = fb_open,
    .cdr_close  = fb_close,
    .cdr_read   = fb_read,
    .cdr_write  = fb_write,
    .cdr_ioctl  = fb_ioctl
};

The commentary "Entry points to the fb driver." indicates that we are getting closer. If you have an IDE capable of parsing the Minix project, it will be easier to find all the callers/callee. If you don't have an IDE, you can use the grep command with the -r flag. If you know object orientation, this fb_tab is kind of a virtual table. Probably is setting callbacks that the kernel can use when calling this driver. I'm not sure because I never worked with minix before, but I have some general knowledge in OS, and the names used imply that I may be right.
Now searching for fb_tab by using grep, I get the following:
$ grep -r "fb_tab"
drivers/video/fb/fb.c:static struct chardriver fb_tab =
drivers/video/fb/fb.c:  chardriver_task(&fb_tab);

All the occurrences once again in fb.c. The first match is the definition of fb_tab itself. The second one is the following
int
main(int argc, char *argv[])
{
    env_setargs(argc, argv);
    fb_edid_args_parse();

    sef_local_startup();
    chardriver_task(&fb_tab);
    return OK;
}

By inspecting this main function, env_setargs and fb_edid_args_parse are probably just parsing arguments and setting flags. Now, the sef_local_startup and chardriver_task functions may be worth performing a grep.
Performing a grep on chardriver_task returns the following:
$ grep -r "chardriver_task"
drivers/examples/hello/hello.c:    chardriver_task(&hello_tab);
drivers/sensors/tsl2550/tsl2550.c:  chardriver_task(&tsl2550_tab);
drivers/sensors/bmp085/bmp085.c:    chardriver_task(&bmp085_tab);
drivers/sensors/sht21/sht21.c:  chardriver_task(&sht21_tab);
drivers/printer/printer/printer.c:  chardriver_task(&printer_tab);
drivers/system/log/log.c:  chardriver_task(&log_dtab);
drivers/system/random/main.c:  chardriver_task(&r_dtab);
drivers/bus/i2c/i2c.c:  chardriver_task(&i2c_tab);
drivers/bus/pci/main.c: chardriver_task(&driver);
drivers/video/fb/fb.c:  chardriver_task(&fb_tab);
include/minix/chardriver.h:void chardriver_task(const struct chardriver *cdp);
servers/input/input.c:  chardriver_task(&input_tab);
lib/libchardriver/chardriver.c: *               chardriver_task                  *
lib/libchardriver/chardriver.c:void chardriver_task(const struct chardriver *cdp)
lib/libaudiodriver/audio_fw.c:  chardriver_task(&audio_tab);

Many of the matches are calling the chardriver_task similar to the one found in fb.c but the following probably is the declaration
include/minix/chardriver.h:void chardriver_task(const struct chardriver *cdp);

And this one probably is the implementation
lib/libchardriver/chardriver.c:void chardriver_task(const struct chardriver *cdp)

As you can see, there isn't a clear entry point. It depends on what you're searching for. In the case of the fb driver, if you're searching for its initialization, it is probably the main function. However, if you're searching for how the kernel will be calling the driver probably is by the callbacks set on fb_tab.
If you can edit your question, someone will probably give you a better answer.
Comment: Woooow, very thank you, Hadley Siqueira!!!
Your answer was very helpfull.
I want to know where are those entry points because, e.g. if I want to implement my own bootloader, I will to know how to call all of them. Which IDE could be helpfull for me, in this case?
If someone could help me some more, I thanks.
Comment: Do you know osdev wiki? (https://wiki.osdev.org/Expanded_Main_Page). If you're beginning from absolute zero its a good start point. There you can find about bootloaders (both GRUB and how to make your own). It also talks about kernels, drivers and so on. Regarding the IDE, I don't know one because I don't use one. Maybe Qt Creator could help, but I never tried so I can't know for sure
Comment: @Paulo this site also has contents for OS development http://www.osdever.net/
Comment: Another tutorial http://www.jamesmolloy.co.uk/tutorial_html/

Entry point of Minix's processes


I've got a small problem with induction

Question: Let me take a quick example:
We want to prove by induction that $3^n-1$ is a multiple of 2, where n is a positive integer.
So we start with our "base case" and show that $3^1-1$ is indeed a multiple of 2.
We then "assume" that $3^{k+1}-1$ will yield the same result and then go on to prove our case:
$3^{k+1}-1=3 \cdot 3^k-1=2 \cdot 3^k+3^k-1$ so because we know that 2 times something must be a multiple of 2, we have proven it for the first part of our equation...But the next part is what bothers me. How can we say that just because it works for $3^1-1$ then it must work for all k? I'm understanding it as if we're 'assuming' that it works for all k but how does that not make the whole proof collapse? You can't just assume in mathematics as far as I know.
Comment: The assumption is not that it works for all k. It's that it works for a particular choice of k.

In other words, you prove that if your proposition is true for a particular number which we denote with "k", then it will work for "k+1" as well. From this and the fact that it works for k=1 it follows that it works for all k.
Answer: Say that you are trying to prove that for all $k$, the statement $P(k)$ is true.  (In your case, $P(k)$ is the statement "$3^k-1$ is a multiple of $2$".)
In induction, we prove two things: that $P(1)$ is true (called the "base case") and that the statement "If $P(k)$ is true, then $P(k+1)$ is also true" is true for each $k$, called the "inductive step".
Then we know $P(1)$ is true, by the base case.
Therefore, by the inductive step, $P(2)$ is true.
Therefore, by the inductive step, $P(3)$ is true.
Therefore, by the inductive step, $P(4)$ is true.
And so on, and so on!
Induction can almost be thought of as a machine for generating a proof: it shows you that you COULD prove it directly for any fixed value of $n$, by writing out a proof that passes through $k=1,2,\ldots,n-1$.
Answer: You have checked that $3^1 -1 = 2$ : so OK for the base case.
Then you must prove that $3^{k+1} - 1 = 2n$, assuming that $3^k - 1 = 2p$.
But : $3^{k+1} - 1 = 3(3^k) - 1 = 3(3^k-1)+2 = 3(2p)+2 = (3p+1)2$.
Answer:
Show that the claim holds for $k_{0}\in\mathbb{N}$
Let $k\in\mathbb{N}$ and show that if the claim holds for $k$, then it holds for $k+1$.
Deduce: let $k\geq k_{0}$, then $k=k_{0}+n$. Do you agree with me that you can show in $n$ steps that the claim holds for $k$?

As $k$ was arbitrary, it holds for all $k\geq k_{0}$.
Answer: A common analogy for mathematical induction is that of setting up dominoes.
The base case is the first domino that you set up. The next thing, the inductive step says something like "if the $k$'th domino falls, then so will the $k+1$'th domino.
Mathematical induction basically says "If you set up at least one domino and have assured one will knock the next one down, then all the dominos will fall down."
During the inductive step, you assume that $3^k-1$ is divisible by 2. You ask "does that ensure the next domino will fall? That is, will $3^{k+1}-1$ be divisible by 2? You would then seek to relate this step to the last one. Since $3(3^k-1)=3^{k+1}-3=3^{k+1}-1+2$, you can rearrange to find that $3^{k+1}-1=3(3^k-1)-2$, and since both things on the right are divisible by $2$, the thing on the left is divisible by $2$.

I've got a small problem with induction


TCP ACK Window shrinking

Question: (Note: I am not a networking engineer) We are sending files to an outside vendor and getting random timeouts on different services. It seems that we are getting timeouts most often on larger files. We did a packet capture that shows our window shrinking and suspect that the small payloads make it before the window hits 0, where large payloads give us a RST.
<code>    11369 > su-mit-tg [ACK] Seq=677231 Ack=253694 Win=32768 Len=0
    11369 > su-mit-tg [ACK] Seq=677231 Ack=256614 Win=29848 Len=0
    11369 > su-mit-tg [ACK] Seq=677231 Ack=259534 Win=26928 Len=0
    11369 > su-mit-tg [ACK] Seq=677231 Ack=262454 Win=24008 Len=0
    11369 > su-mit-tg [ACK] Seq=677231 Ack=265374 Win=21088 Len=0
    11369 > su-mit-tg [ACK] Seq=677231 Ack=268294 Win=18168 Len=0
    11369 > su-mit-tg [ACK] Seq=677231 Ack=271214 Win=15248 Len=0
    11369 > su-mit-tg [ACK] Seq=677231 Ack=274134 Win=12328 Len=0
    11369 > su-mit-tg [ACK] Seq=677231 Ack=277054 Win=9408 Len=0
    11369 > su-mit-tg [ACK] Seq=677231 Ack=279974 Win=6488 Len=0
    11369 > su-mit-tg [ACK] Seq=677231 Ack=282894 Win=3568 Len=0
    11369 > su-mit-tg [ACK] Seq=677231 Ack=285814 Win=648 Len=0
</code>
Edit: I'm referring to different web-services that we are calling from our application. The timeouts don't consistently fail on a specific service, but instead hit all the services at different times. I cannot send it from a different network.
Comment: `1.`What does this mean: `getting random timeouts on different services`? What do you mean by `different services`? Do you mean different file transfer methods? `2.` Have you tried sending the files from a different network? If so, do you get the same results?
Answer: I think this problem related to IO problem related or  application problem and for any reason  the socket buffer  has finished the space
I did something like this to reproduce the IO related problem in linux:
<code>/dev/vdb                 2.0G  1.6G  470M  77% /brick1

[root@nod01 ~]# ls -l /dev/vdb
brw-rw---- 1 root disk 252, 16 Apr 19 22:46 /dev/vdb

echo "252:16 $((1024*250))" > /sys/fs/cgroup/blkio/blkio.throttle.write_bps_device ## Limit write to 250KB per second

cd /brick1 ## change directory for downloading the Centos Iso

wget ftp://mirror.fdcservers.net/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-bin-DVD2.iso

00:19:58.992042 IP mirror.50966 > nod01.example.com.46637: Flags [.], ack 1, win 46, options [nop,nop,TS val 2662018758 ecr 5131800], length 0
00:19:58.992107 IP nod01.example.com.46637 > mirror.50966: Flags [.], ack 11256736, win 0,  options [nop,nop,TS val 5144749 ecr 2661992655], length 0 ## I'm telling to the sender, please don't send me more data, because my socket buffer is full

[root@nod01 ~]# netstat -tunap | grep wget
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp   5264896      0 192.168.122.244:46637   184.108.40.206:50966     ESTABLISHED 15574/wget          #### note the sender has 5M of data in the doesn't buffer, because it cannot write fast in /brick1 as data arrive
tcp        0      0 192.168.122.244:51331   184.108.40.206:21        ESTABLISHED 15574/wget
</code>

TCP ACK Window shrinking


How to add classes to h2 block title tags in sidebar region

Question: I need to add a class to the h2 block titles in a sidebar.  How can I do this in pre-process?  I haven't been able to find an example that shows how to isolate certain blocks.  I'm using Omega.
Answer: template_preprocess_block()
Inspect the block object in this preprocess function. You could use either the 'module' and 'delta' properties to target a specific block or the 'region' property to target all blocks in a certain region.
H2 css-classes are listed in the title_attributes_array. The code below shows how to add a new class. This example is based on a block generated by Views:
function MYTHEME_preprocess_block(&$variables) {
  $block = $variables['block'];
  if ($block->module == 'views' && $block->delta == 'name_of_my_view-block') {
    $variables['title_attributes_array']['class'][] = 'my-new-class';
  }
}

Sidenote: dpm() by the Devel module is a handy tool for printing out the available data in variables:
function MYTHEME_preprocess_block(&$variables) {
  dpm($variables);
}

Comment: Thanks.  That did it! Question - is the $variables['block'] value a ref to the $variables['elements']['#block'] array?
Comment: Can I wrap the h2 tag in another div, or do I need to do that in a block template file?  I need to style the h2 titles with a ribbon using CSS.


Listing top level terms in views including those without children

Question: My vocabulary looks like this
Level 1a

Child a
Child b
Child c

Level 1b

Child a
Child b
Child c

Level 1c
Level 1d

Child a
Child b
Child c

Level 1e
I have managed to display parents and children terms using Taxonomy term: Parent term and filter on (Parent) Taxonomy term: Parent term (not empty). But terms without children on the same level with "parent" are not displayed.
To get the children I used filter "(Parent) Taxonomy term: Parent term (not empty)". If I set the same filter to "is empty", I get all level 1 terms including those terms without children just like I want it. So right now it seems like an either-or situation. I can only get the top terms or the children terms but not both.
How do I get the top level terms including those without children and corresponding child terms for those with children?
Comment: Why have we created view for this? Are we using it as an Expose filter in views?
Answer: If you add a filter to parent term = "empty (NULL)" it will display all terms that have no parent above them.
For more detailed steps, try this blog post I wrote: http://fdiv.net/2012/08/11/taxonomy-views-browser-arbitrary-depth
Answer: The case seems to be old, but just in case someone bumps into it searching for help.
Just try Views Tree module, which provides a display plugin (next to grid, table, list, etc.). You'll be able to show the taxonomy exactly as asked here.
Answer: Taxonomy Menu Module can help you with this.


scroll do site desce para regiao do mapa - google maps

Question: Fala galera, ainda tenho pouca experiência e estou com um probleminha bem chato.
quando crio uma página com um mapa, ao acessar esta página, o scroll vai para o local onde está o mapa.
eu descobri (na verdade eu acho) que o problema é relacionado ao script do botão de fechar "X" que possui a classe .gm-ui-hover-effect - pois quando eu forço com display: none!important; o problema para de acontecer.
mas... isso não é uma solução, é apenas um jeito de fugir do problema.
Alguém que tenha mais conhecimento poderia ajudar com isso??? :)
"obs: o problema só acontece online, não da pra reproduzir no localhost, necessário subir numa hospedagem qualquer de exemplo".
Pra exemplificar melhor, subí neste endereço que vai ficar pouco tempo, Página com mapa mas de qualquer forma o código está abaixo:
Valeu ;)

function init_map() {
    var myOptions = {
        zoom: 13,
        center: new google.maps.LatLng(-23.09401258715213, -46.43584007282058),
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
        map = new google.maps.Map(document.getElementById('gmap_canvas'), myOptions);
        marker = new google.maps.Marker({
        map: map,
        position: new google.maps.LatLng(-23.09401258715213, -46.43584007282058)
    });
        infowindow = new google.maps.InfoWindow({
        content: 'Informações do Local Aqui'
    });
        google.maps.event.addListener(marker, 'click', function () {
        infowindow.open(map, marker);
    });
        infowindow.open(map, marker);
}
    google.maps.event.addDomListener(window, 'load', init_map);
.div{
    width: 100%;
    height:700px;
}
.div1{
    background-color:red;
}
.div2{
    background-color:blue;
}
.div3{
    background-color:yellow;
    height: 30px;
    margin-bottom: 10px;
}
/********************************** GOOGLE MAPS **********************************/
#gmap {
    overflow: hidden;
    height: 360px;
    width: 100%;
    color: #1795eb;
}
#gmap_canvas {
    width:100%;
    height:100%;
}
#gmap_canvas img {
    max-width: none !important;
    background: none !important;
}
.gm-ui-hover-effect{
    /* display: none!important; */
}

A página deveria carregar aqui encima

Mas carrega aqui embaixo na regiao do mapa

Answer: Basta olhar na documentação sobre cada método que você esta usando, veja: InfoWindowOpenOptions
O padrão é rolar para exibir o infoWindow quando disponível, para "tornar intuitivo" provavelmente, mas como a própria documentação indica você pode desligar isso setando o shouldFocus como false, não é nem questão de "scroll", na verdade o que ocorre é do infoWindow se torna o objeto em "foco", então quem faz a rolagem é o próprio navegador, pois objetos em foco devem ficar dentro do view-port.
Exemplo:
infoWindow.open({
    anchor: marker,
    map: map, /*opcional, já que tem o anchor que possui o map definido*/
    shouldFocus: false
});

Comment: Poxa perfeito obrigado mano,
eu pensei que era um bug no script e na verdade era uma função da api kkkkk.
Valeu funcionou perfeitamente e estou fuçando um pouco na documentação pra entender melhor o mapa.
Abraços


Django Url regex NoReverseMatch error

Question: Have this html, that i want to pass 2 arguments to a function when that url is pressed:
htmlpage
{% for n in notifications %}

{{ n.title }} - {{ n.description }}
                    Don't show again
{% endfor %}

urls.py
url(r'^notification_htmlv2/update_status/([0-9]{4})/([0-9]{4})$', 'Notifications.views.updateStatus',
                       name="update-notify-status"),

views.py
def updateStatus(request,noteId,noteTile):
q=History.objects.filter(notification_id=noteId,title=noteTile).order_by('-id')[0]

When i start the program it gives an error of "NoReverseMatch".
Im following this example:https://docs.djangoproject.com/en/1.8/topics/http/urls/
reverse resolution of url's chapter
Comment: n.title is probably a string which would not be matched by ([0-9]{4}), you would need something like this: [\w-]+
Answer: I bet neither n.id nor n.title matches ([0-9]{4}).
You should update your url pattern to handle any possible id and title values.
Something like:
r'^notification_htmlv2/update_status/([0-9]+)/([a-zA-Z0-9]+)$'

Comment: Ive added what you suggested, but continues to give that error.
`Reverse for 'update-notify-status' with arguments '(4L, u'EUW')' and keyword arguments '{}' not found. 1 pattern(s) tried: ['notification_htmlv2/update_status/([0-9]{4})/([a-zA-Z0-9]+)$']`
Comment: @Zecarlos You have not replaced the pattern for `id` (you still have `([0-9]{4})`, I suggested `([0-9]+)`), the `{4}` means it only matches a length of 4, the length of your `id` is 1. The `+` means match one character or more.

Django Url regex NoReverseMatch error


Display Custom User Profile Fields in a Block on All of Their Published Pages

Question: I have created a role, and have added additional fields to their profile using Profile 2. The fields are part of the location module, and are just basic contact info (address and phone number). They are also able to chose a name, which is used in the url for both their profile and content.
So, when a user creates their account, the url is site.com/their-name. When the user adds content the URL is site.com/their-name/content.
My goal is to display their contact info in a block on all pages they publish. I was able to do this for their profile page with the following view (see attached image). However, I would like this block to appear on all pieces of content that they author.
Answer: You should take a look at the Context module.

Context allows you to manage contextual conditions and reactions for
  different portions of your site. You can think of each context as
  representing a "section" of your site. For each context, you can
  choose the conditions that trigger this context to be active and
  choose different aspects of Drupal that should react to this active
  context.
Think of conditions as a set of rules that are checked during page
  load to see what context is active. Any reactions that are associated
  with active contexts are then fired.

Or a simpler solution might be to change your path from "their-name/content" to "user/their-name/content" and only show the block on "user/*/content".
Comment: Thank you for the reply, Scott. The issue is that this block needs to be dynamic, and only show the contact information related to the author of the current node a user visits. So, if I am on user-name-a/content the block would display the contact information for user-name-a. If I am on user-name-b/content the block would display the contact information of user-name-b.

Using contextual filters I am able to achieve this for the user's profile page, but none of the nodes they have published.
Comment: @StephenMartin, I thought you said you had the view and block working?
Answer: I think, you have not added correct contextual filter in the views. You should add Content: Nid contextual filters into your views, which will filter the current node, then add relationship Content: Author into your views which will add relationship between current node and its author.
Answer: I ended up being able to figure it.

Add Content:Author relationship.
Add (author) User: Profile relationship.
Add contextual filter (author) User: Uid
WHEN THE FILTER VALUE IS NOT AVAILABLE > Provide default value >
Content ID from URL
Select "Also look for a node and use the node author"


How do you mock a type within a type in Golang?

Question: The package 'gopkg.in/redis.v3' contains some code
type Client struct {
}

func (*client) Eval (string, []string, []string) *Cmd {
}

type Cmd struct {
}

func (*Cmd) Result () (interface{}, error) {
}

Which works successfully in the following way
func myFunc (cli *redis.Client) {
    result, err := cli.Eval('my script').Result()
}

The problem is that sometimes the Redis cluster gets hammered, has a moment, and the interface returned as a result is nil.
This is reasonably easy to handle but I wish to put a test in place that will ensure that it is actually handled and no type assertion panic occurs.
Traditionally I would insert a mock Redis client into myFunc that can ultimately return nil.
type redisClient interface {
    Eval(string, []string, []string) redisCmd
}

type redisCmd interface {
    Result() (interface{}, error)
}

func myFunc (cli redisClient) {
    result, err := cli.Eval('my script').Result()
}

The problem I am facing is the compiler doesn't recognise that redis.Client satisfies the interface redisClient because it doesn't recognise that the redis.Cmd returned from Eval satisfies redisCmd.
> cannot use client (type *redis.Client) as type redisClient in argument to myFunc:
>    *redis.Client does not implement redisClient (wrong type for Eval method)
>          have Eval(sting, []string, []string) *redis.Cmd
>          want Eval(sting, []string, []string) redisCmd

Answer: The problem is that your interface does not match the redis client. If you change the interface to:
type redisClient interface {
    Eval(string, []string, []string) *redis.Cmd
}

it will compile. That being said, it looks like you really want rediscmd, so you will need to make a wrapper around the redis client:
type wrapper struct{
  c *redis.Client
}

func (w wrapper) Eval(x sting, y []string, z []string) redisCmd {
  return w.c.Eval(x,y,z) // This assumes that *redis.Cmd implements rediscmd
}