text:
Q: Async REST Queries and setting field values to global variables I'm having a problem wrapping my head around these sharepoint async REST queries. The problem is that an async REST query isn't setting a field.value because the assignment is happening to soon. Even when postponing the assignment in document.read() and ExecuteOrDelayUntilScriptLoaded(). I've pulled the REST command from this microsoft technote. There's a lot more going on in the script, but this is it in a nutshell:
var id = 1;
var global1 = '';
ExecuteOrDelayUntilScriptLoaded(function() {
    getListDetails()
}, "sp.js");

function getListDetails(siteUrl) {

var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('mylist');

var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(
    '<View><Query><Where><Eq><FieldRef Name=\'ID\' /><Value Type=\'Integer\'>' + id.toString() + '</Value></Eq></Where></Query></View>'
);
this.collListItem = oList.getItems(camlQuery);

clientContext.load(collListItem);
clientContext.executeQueryAsync(
    Function.createDelegate(this, this.onQuerySucceededgetListDetails),
    Function.createDelegate(this, this.onQueryFailed)
    );
}

function onQuerySucceededgetListDetails(sender, args) {
    var listItemEnumerator = collListItem.getEnumerator();
    while (listItemEnumerator.moveNext()) {
        var oListItem = listItemEnumerator.get_current();
        global1 = oListItem.get_item('Title');
    }
}

$(document).ready(function() {
    myfield.value = global1;
});

I had considered not setting global1 as a global but within the onQuerySucceededgetListDetails() scope but I then run into other issues with the rest of the script.
What else can I do to force the assignment?

A: Consider using JQuery deferreds/Promises. Here is an example:
$(document).ready(function () {
        //don't exectute any jsom until sp.js file has loaded.
        SP.SOD.executeFunc('sp.js', 'SP.ClientContext', prepareTables);
    });

function prepareTables() {
    getItemsWithCaml('External User Account Request').then(
            function (camlItems) {
                var listItemEnumerator = camlItems.getEnumerator();
                while (listItemEnumerator.moveNext()) {
                    var listItem = listItemEnumerator.get_current();
                    console.log(listItem.get_item('Title'));
                } console.log('Completed table prparation.');
            },
            function (sender, args) {
                console.log('An error occured while retrieving list items:' + args.get_message());
            }
        );
}

function getItemsWithCaml(listTitle) {
    //use of $.Deferred in the executeQueryAsync delegate allows the consumer of this method to write 'syncronous like' code
    var deferred = $.Deferred();
    var clientContext = new SP.ClientContext.get_current();
    var list = clientContext.get_web().get_lists().getByTitle(listTitle);
    var camlQuery = new SP.CamlQuery();
    var items = list.getItems(camlQuery);
    clientContext.load(items);
    clientContext.executeQueryAsync(
        Function.createDelegate(this,
            function () { deferred.resolve(items); }),
        Function.createDelegate(this,
            function (sender, args) { deferred.reject(sender, args); }));

    return deferred.promise();
};

See this for more information:
http://www.sharepointnadeem.com/2014/10/sharepoint-using-deferredspromises-or.html


text:
Q: Retain text cursor position in VS2008 editor after "Break All" I'm having trouble finding a way to prevent the VS2008 debugger from automatically jumping to the currently executing line of code when I click "Break All" to edit a source file. I want to keep my editing cursor where it is in a specific method.
A possible workaround is to use Bookmarks to jump back once debugging, but with frequent breaks and large source files (and programmer multitasking) it becomes cumbersome quickly.
I'm also open to other workarounds as well, or strategic suggestions in general.
Thanks!

A: I would assume that the Navigate Backward button will bring you back to where the caret was before the break.

A: I also have an open source (GPL) add-in for Visual Studio 2005/2008 that binds the Navigate commands to the back/forward buttons on your mouse.

A: You can also use the keyboard shortcut Ctrl+-, that's Ctrl and the minus key.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Replace just one instance of a character not every single occurrence I am working on a code that replaces the symbol in the code which happens to be a patterned message where every single non-space is a "*".
However, my code replaces c, but instead of just replacing c in the code it replaces all instances of c not just the c in the index order of the patterned message.
for c in pattern:
        if c == ("*"):
            i += 1
            pattern =
pattern.replace(c,msg[(i%letters)])
    print(pattern)

so it returns
    T     T     T
   TTT   TTT   TTT
  TTTTT TTTTT TTTTT
   TTT   TTT   TTT
    T     T     T,
not T     h     r
   eeD   iam   ond
  s!Th   reeD iamo
  dsT   hre   Dia
   m    o     n

NOTE, i can not use list in my code

A: If I understand what you are trying to do:
You want the line
pattern = pattern.replace(c,msg[(i%letters)])

to replace only the first occurrence of c. There is a third optional argument to replace that specifies the maximum replacements (in order)
pattern = pattern.replace(c,msg[(i%letters)],1)


text:
Q: Curl POST not sending data I am trying to connect to an echosign api which used to work and now has suddenly stop working, I have tried debugging but can't seem to resolve it, this is my code
  public function get_access_token_get()
  {
    $echoSign = new EchoSign();

    $ch = curl_init('https://secure.echosign.com:443/api/rest/v2/auth/tokens');
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($echoSign->echosign_creds));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));

    $result = json_decode(curl_exec($ch));

    curl_close($ch);

    echo "<pre>"; print_r($result); echo "</pre>"; exit();

    return $result->accessToken;
  }

A: I have tested your curl code with other urls, and its working fine for them, then i tried to call your url with other curl methods and it gives empty response, so I believe you should check with the echosign support to see whats wrong.


text:
Q: HashSet c# element in HashSet modify how is it possible to modify a element in HashSet?
my HashSet looks like:
HashSet<int> mynumbers = new HashSet<int>();
mynumbers.Add(rnd.Next(1, 11));
mynumbers.Add(rnd.Next(1, 11));

the output can be done with:
Console.WriteLine( mynumbers.ElementAt(0) + "and" + mynumbers.ElementAt(1));

looks like for example:
2 and 10
but how can i now modify the first value in the HashSet.
this is not possible:
mynumbers.ElementAt(0) = 1;

A: Since the items in that particular hash set are immutable you can't mutate the item.  You would need to be adding items of a mutable type in order to mutate them (and even then, you'd be causing major problems for yourself if you mutated it in such a way that changed the equality or hash code of that object).
You can remove that item from the set and add a new one (using the methods of the  corresponding names for those actions), but that's in no way changing the item that you added.
And of course a HashSet is an unordered collection, there is no "first" item in the collection, a given object simply is or isn't in the collection, it's not in the collection at a given position.  If you need the items in your collection to have a position, then you'll need to use a different type of collection.


text:
Q: Failed to open zip file (gradle dependency) I am trying to build a simple program, but I get an error that a zip file failed to open and some gradle dependency cache corruption message.
I tried deleting the .gradle file and replacing it with one from a working project from another PC, but it didn't work also. Any ideas?


text:
Q: Installing strapi on Amazon Lightsail Can anyone point me with a step by step guide to install strapi on Amazon Lightsail, i've tried all the possible options but cant make it work.

*

*I create a MEANT or NODE instance

*Add a static IP

*Install strapi

*start strapi
I now have to go to localhost(my ip) :1337 but no answer
I have no experience with reverse proxy or ngnix servers, so maybe it's obvious to any with some experience.
Thanks in advance.

A: You need to use a process manager and edit .env file.

*

*Install PM2 and use .env files.

*Then create ecosystem.config.js file
It's already documented in AWS general guide, Amazon Lightsail has no difference. Just jump first a few steps
That's all.


text:
Q: taking address as argument in function c++ What does a and b hold in function swapp ?
are they holding value or address ?
what kinda variables are they I am lost here !
#include <iostream>
using namespace std;
template <class T1 = int>
void swapp(T1 &a, T1 &b)
{
    T1 temp;
    temp = a;
    a = b;
    b = temp;
}
int main()
{
    int x = 5, y = 10;
    swapp(x, y);
    cout << x << " " << y;
    return 0;
}

A: when you are using objects as parameter of a function you have to use "&" if you are trying to change their property. if you don't put the "&" before the name of the object, the function will not act on the object itself but on a copy of the object,
which means that it won't swap.
here if it helps : https://isocpp.org/wiki/faq/references

A:
What does a and b hold in function swapp ?

a and b refer to the objects that were passed as arguments.

are they holding value

No.

or address ?

This is a reasonable way to think about it.

what kinda variables are they

They are references.


text:
Q: Plist reading weird behavior I am using a series of code to read Plist file in my app, However a weird behavior kicks in. Here is an example of the code.
//init loading from PLIST here, and then associate value.
NSString *pathString=[NSString stringWithFormat:@"%@Levels",targetWorld];
NSString *path = [[NSBundle mainBundle] pathForResource:pathString ofType:@"plist"];
NSString *levelNameNumber = [[NSString alloc] initWithFormat:targetLevel];

NSDictionary *levelsList = [[NSDictionary alloc] initWithContentsOfFile:path];
NSDictionary *level = [levelsList objectForKey:levelNameNumber];

NSEnumerator *levelFormations = [level objectEnumerator];

for( NSDictionary *worldSize in levelFormations )
{
    worldWidth = [[worldSize objectForKey:@"width"] intValue];
    worldHeight = [[worldSize objectForKey:@"height"] intValue];

    NSLog(@"height is %d",worldHeight);
    NSLog(@"width is %d",worldWidth);

}

[levelNameNumber release];
[levelsList release];

As it've shown, i've set up NSLog to keep watch of the value. Here is the log
2012-05-09 21:14:38.313 CapNTail[361:10a03] height is 344
2012-05-09 21:14:38.315 CapNTail[361:10a03] width is 123
2012-05-09 21:14:38.324 CapNTail[361:10a03] height is 0
2012-05-09 21:14:38.326 CapNTail[361:10a03] width is 0

They seems to reset themselves back to zero. The best i could get so far is it might be the for loop is causing this up since both logs have gotten printed twice( Seems like it runs a second loop and reset it.) Any idea what's wrong?
Example code of my plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"     "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>level1</key>
<dict>
    <key>worldSize</key>
    <dict>
        <key>width</key>
        <integer>123</integer>
        <key>height</key>
        <integer>344</integer>
    </dict>
    <key>formation</key>
    <dict>
        <key>playerPosX</key>
        <integer>0</integer>
        <key>playerPosY</key>
        <integer>0</integer>

    </dict>
</dict>

A: You're confusing fast enumeration with an NSEnumerator.
Either use NSEnumerator and loop over it using while ((object = [enumerator nextObject])) {, or use fast enumeration on the level object (no need to make an NSEnumerator).
To try the latter strategy (recommended), replace this:
NSEnumerator *levelFormations = [level objectEnumerator];

for( NSDictionary *worldSize in levelFormations )
{
    worldWidth = [[worldSize objectForKey:@"width"] intValue];
    worldHeight = [[worldSize objectForKey:@"height"] intValue];

    NSLog(@"height is %d",worldHeight);
    NSLog(@"width is %d",worldWidth);

}
with:
for( NSDictionary *worldSize in level )
{
    worldWidth = [[worldSize objectForKey:@"width"] intValue];
    worldHeight = [[worldSize objectForKey:@"height"] intValue];

    NSLog(@"height is %d",worldHeight);
    NSLog(@"width is %d",worldWidth);
}

Does that work?
See also this question.


text:
Q: AutoHotKey: Send a button when another is held down, and after released in AutoHotKey
I want to write a script that will press a button once when the right mouse button is held
and press another once its released.
I tried writing something (I used numpad0 instead of mousebutton)
Numpad0::
Send {d}

Numpad0 Up::
Send {u}

but, it keeps sending du all the time, instead of just d and a final u.
why is that?

A: If you're putting your hotkey command on a different line to where the hotkey is declared you need to use a return statement to end it:
Numpad0::
Send {d}
return

Numpad0 Up::
Send {u}
return

You can also just declare each hotkey on one line without a return if you're not trying to do too much:
Numpad0:: Send {d}
Numpad0 Up:: Send {u}


text:
Q: Default behavior when press enter in HTML text input elements I'm working on a cross-browser compatibility issue with HTML input fields.
On my Chrome 63.0, when I pressed enter in an input[type=text], it triggers change event, and no blur event is fired. ( I tired with this https://jsfiddle.net/agentmilindu/ekhT4/2984/ )
However, I see in some browsers, a blur event is triggered when pressing enter.
I see lot of question on StackOverflow asking how to stop triggering this blur event when enter is pressed,

*

*Prevent both blur and keyup events to fire after pressing enter in a textbox

*onkeypress + onblur in javascript
The app( a PhoneGap app written in React ) I'm currently investigating has a function which gets triggered by blur event when the user press enter, but in new browsers ( new phones and on my Chrom 63.0 also ) this is not working.
Now I'm confused what is the actual default behaviour when someone press enter in an input[type=text] filed. Should it be change+blur or only change? Is there any document which I can refer?

A: I cant say much for apps, but for browsers; (i tried your fiddle in both chrome 61 and Firefox 55), these are my observations;
1) blur is triggered on focus out; text changes or not doesn't matter; if there is focus out, then blur triggers
2) change is triggered only if:
i)  text content changes within the input box changes
ii) enter key is pressed

either alone will not trigger change;
Hope this helps.


text:
Q: Native Drag and Drop File uploader using electron Im working on making a simple file uploader to upload jpeg files to a server. But I've hit a snag.
I cant seem to get the Native File Drag and drop to work. When ever I drag an image or any other file over to where the file uploader is, it just shows the stop cursor. Like so:

<input class="upload" type="file" id="Filedata" capture="" name="Filedata" multiple="" onchange="update()" accept="image/jpeg">
       <script type="text/javascript" charset="utf-8">
         document.getElementById('Filedata').ondragstart = (event) => {
         event.preventDefault()
         ipcRenderer.send('ondragstart', '/path/to/item')
       }
       </script>

The above is my code that I am linking to. It worked fine on a Chrome test but it wont work correctly on the Electron app. What have I failed to do? Is there anything I'm missing. Ive place the other half of the code in my main.js
const { ipcMain } = require('electron')
ipcMain.on('ondragstart', (event, filePath) => {
  event.sender.startDrag({
    file: filePath,
    icon: '/path/to/icon.jpg'
  })
})

Anyone have any ideas as to what I've done wrong? Any help would be greatly appreciated, here is the repo of my project
EDIT
Full reinstall has worked Thank you.

A: After downloading the repo and testing I haven't seen any issues so it appears something was removed or changed by accident. There's two ways you could resolve this issue.
Option 1:
run npm update electron-prebuilt -save after reading "Updating Electron"
Option 2:
uninstall Electron and re-install with:

*

*uninstall: npm uninstall electron

*re-install: npm install electron
I did notice in your main.js that you've defined the constant ipcMain on line 34. It's a good practice to call constants at the top and you can modify:
const {app, BrowserWindow} = require('electron')

to:
const {app, BrowserWindow, ipcMain} = require('electron')


text:
Q: How do I display data into two column with Thymeleaf and HTML? I have been searching left and right but still can't find a good solution to this. Also I'm pretty new to programing so please excuse the way I describe thing :). I'm using Spring, MySQL, Java, Thymeleaf.
Basically, I have a list of object passed from the controller:
[person [code=1, name=A, car=ford1],person [id=2, name=A, car=ford2], person [id=1, name=B, car=toyota1], person [id=2, name=B, car=toyota2] ]
I want to display this data using Thymeleaf in either an HTML table or bootstrap grid system.
This is what I got:

          ID
          Name
          Car
           Name
          Car

            [[${person.id}]]

            [[${person.name}]]

            [[${person.car}]]

so this display the data like this:

ID
Name
Car
Name
Car

1
A
ford1

2
A
ford2

1
B
toyota1

2
B
toyota2

but I want it to display like this:

ID
Name
Car
Name
Car

1
A
ford1
B
toyota1

2
A
ford2
B
toyota2

I think I probably need to somehow split this data into id 1 and id 2. Here is two ways I could think of doing this:

*

*Using Thymeleaf th:if="${person.id.equals(1)} to get the data for id 1 and then repeat for 2, I just don't know how to put this into the table.

*format the data using a query, I'm not sure how to do this without turning the result into one single column with GROUP_CONCAT.

Maybe I need to change the SQL table, please give me some suggestion.
Edit: So I think I found the answer to this MySQL pivot

A: Group your list of persons by id. Let's say you have a list like this:
List<Person> persons = Arrays.asList(
    new Person(1, "A", "ford1"),
    new Person(2, "A", "ford2"),
    new Person(1, "B", "toyota1"),
    new Person(2, "B", "toyota2")
)

Group it:
Map<Integer, List<Person>> groupedByIdPersons = persons.stream().collect(Collectors.groupingBy(Person::getId));

Use it in Thymeleaf:

*

*Iterate over whole map in th:block to create header. Repeats as many times as there are collections grouped by the id.

*Iterate over whole map to extract both key/value, then iterate only over values in th:block

            ID
            Name
            Car

            ${person.id}
            ${person.name}
            ${person.car}


text:
Q: How to returned poll data after each nodejs api call to reactjs component I need to poll the data until the response.Status === 'UpdatesComplete'.
I have written this node js API function which basically polls the data -
const getResults = async (location) => {
  try {
    const response = await poll(location);
    if (response.Status && response.Status === 'UpdatesComplete') {
      return response;
    }
    return await getResults(location);
  } catch (err) {
    throw err;
  }
};

app.get('/url', async (req, res) => {
  try {
    const results = await getResults(req.query);
    res.json(formatData(results));
  } catch (err) {
    res.status(500).send(err);
    console.error(err);
  }
});

I am calling this API from ReactJS class component inside ComponentDidMount lifecycle method -
componentDidMount = () => {
    axios.get('url', {
      params: params
    })
    .then(response => {
      console.log(response.data, 'data');
      // setting the data on state
      this.setState({ filteredList: response.data });

    })
    .catch(err => {
      this.setState({ error: true });
    });
  };

This is working fine. But since the API is returning data till all the data has been fetched(after doing polling), it's taking a very long time on view to load the data. I am basically looking for returning the polling data to view as soon as the data fetched and simultaneously polling the API until all the data has been fetched. In this case, data will keep on updating after each polling on the view which will improve the user experience.
Thanks in advance.

A: You are finding the lazy loading or infinite scroll solution on the server-side. There is no simple way to do this.
The basic idea of the solution is to paginate your result with polling. ie.
call url?size=2&offset=0 from the client-side. Then on the server-side just poll first 2 results and return. next time call url?size=2&offset=2 and so-on.


text:
Q: Where in London is 12 Grimmauld Place? As of Order of the Phoenix (summer of 1995), 12 Grimmauld Place is a townhouse in a cul-du-sac located in a run-down neighborhood of London.
The fashionableness of neighborhoods changes quite frequently in cities, but presumably, Grimmauld Place was a fashionable neighborhood when the Black family initially occupied it (or maybe not...).
I don't know much about London myself, but are there enough clues in the story to get an approximate neighborhood for 12 Grimmauld Place?

*

*Do we know how far back into the Black family 12 Grimmauld Place goes (Phineas Nigellus's portrait and the mounted house-elves might be a clue)?

*the age of the neighborhood (architecture, layout of rooms, number of storeys, density of houses) might be a clue

*distance from King's Cross might be a clue

A: Canonically... We Don't KnowTM.
Pottermore lists the location of Number Twelve, Grimmauld Place as London only.
There is no specific writing on the location, like there is for Number Four, Privet Drive as an example. However, Pottermore is the source for canon information for the Wizarding World, so if any information in canon was presented, it would have been listed.
Update:
The Diagon Alley attraction at Universal Studios (Orlando, FL) displays placard on the Gimmauld Place building as London Borough of Islington. However I suspect as the other answer here states that this because of the filming location.  I also don't lend any real canon level to an amusement park but I still though it was neat...

A: There is no definite location according to canon sources, however some educated guesses have been made on possible locations.
First and foremost, there seems to be some inaccurate information out there saying that it was in Islington. The scenes in the film were filmed in Islington, and, from available evidence, Islington could be where Grimmauld Place is located in-universe, however there doesn't appear to be anything in canon sources that definitely say Islington is the place. The filming location for the movie was done at "Claremont Square, Islington, London N1" 1  This may be where the confusion in some sources comes from.
There does not appear to be a real world location for 12 Grimmauld Place. However, with some detective work, some approximations can be made.

Grimmauld Place was therefore probably about three quarters of a mile
from King's Cross, somewhere to the north of it, and closer to either
Camden Town or Caledonian Road station than it is to King's Cross.
Consequently, the Ministry of Magic is probably near Leicester Square
or Charing Cross stations, close to both the Leaky Cauldron and to the
Muggle government ministries.2

Please see the quoted portions below for more detail on how this was ascertained.
This excellent detective work, by Ravenclaw Rambler, uses the books to determine possible locations for Grimmauld place.

Number twelve, Grimmauld Place is the location of much of the action
in Chapters 4 to 10 of Harry Potter and the Order of the Phoenix. It
is Sirius Black's ancestral home, and the headquarters of the Order of
the Phoenix. This essay discusses its possible location, and also that
of the Ministry of Magic.
It has been suggested that Grimmauld Place is in the Tufnell Park area
of north London, with which JKR was familiar. However, this is
two-and-a-half miles from King's Cross railway station, and a passage
at the beginning of OP10 makes it clear that King's Cross is only a
twenty-minute walk away—for a large group encumbered by a lot of heavy
luggage. This puts Grimmauld Place about a mile, or a bit less, from
King's Cross. Grimmauld Place must therefore lie on a circle a little
less than a mile in radius, with King's Cross at its centre.
What else do we know? Well, in OP7 we have a description of Harry and
Mr. Weasley's journey by Underground to the Ministry of Magic. There
are several very interesting points about this journey. Firstly, they
walk along several streets to a "miserable little underground
station." King's Cross is served by the Underground as well as the
main line station: indeed, with eight platforms, it is one of the
biggest on the Underground network. Clearly King's Cross does not
answer the description of the station used by Harry and Mr. Weasley.
It is presumably more convenient to use this small station, rather
than King's Cross, for the journey to the Ministry of Magic. Any
location identified for Grimmauld Place must be consistent with a
plausible reason for not taking the Underground from this station to
go to King's Cross to catch the Hogwarts Express on September 1st.
Secondly, it is stated several times that the journey on the
Underground takes Harry and Mr. Weasley to the very heart of
London—therefore the station they go to is significantly more central
than the station they started at. Moreover, at one point Mr. Weasley
tells Harry that there are "four more stops"—indicating that they
travel at least four stops, and probably more.
Finally, they arrive at a station which they leave by escalator. This
is significant because in general only the deep-level tube lines built
after 1890 have escalators. The Circle Line and the three other lines
it shares tracks with date from mid-Victorian times, and were
originally worked by steam trains, which of course needed ventilation
to allow the steam to escape. They are much closer to the surface and
their platforms are reached by ordinary stairs.
So, we are looking for somewhere rather insalubrious, a little less
than one mile from King's Cross, whose nearest tube station is on a
deep level tube line, and from which a journey of four stops or more
on the Underground will take you to a station in central London. Note
that the tube station itself may be more or less than twenty minutes'
walk from King's Cross.
There are no less than fifteen stations on the London Underground
within a mile of King's Cross: in alphabetical order they are Angel,
Caledonian Road, Camden Town, Chancery Lane, Euston, Euston Square,
Farringdon, Goodge Street, Great Portland Street, Highbury &
Islington, Holborn, Mornington Crescent, Russell Square, Tottenham
Court Road, and Warren Street. Let us see if we can narrow it down a
bit.
King's Cross is on the northern edge of central London—see map at
http://maps.google.com/maps?ll=51.530640,-0.123596&spn=0.035355,0.070694&hl=en.
A diagrammatic map of the underground network can be found at
https://tfl.gov.uk/cdn/static/cms/documents/large-print-tube-map.pdf.
Harry and Mr. Weasley travel "towards central London," so we can
assume that they start from a station that is less central than their
destination. Moreover, if they started too near the centre, a journey
of four or more stops would take them out of the central area.
Let us perform an orbit of King's Cross, starting in the east, and
working round clockwise.
Due east of King's Cross, a bit less than a mile away in Islington, is
Angel Station, on the Northern Line. I think we can eliminate this
one, as if you travel four stops north or south you will be heading
away from the centre of London. Interestingly, on Pentonville Road,
leading uphill from King's Cross to the Angel, there is a small park
named after Joseph Grimaldi (1779 – 1837) the father of modern circus
clowning, who was buried in this former churchyard
http://www.its-behind-you.com/grimaldi.html. It would be nice to think
of Grimaldi Park as being Grimmauld Place, but if it were, surely
Harry and Mr Weasley would have used nearby King's Cross station in
OP7, not a "miserable little" one further away (and uphill). [fn1]
South-east of King's Cross is Farringdon, on the Circle Line, and
nearby is Chancery Lane, on the Central Line. These are both much too
central: Chancery Lane in particular is in the centre of "Lawyers
London" (Chancery is one of the divisions of the High Court). This
seems to be an unlikely area to find Grimmauld Place. I have already
explained why the Circle Line's absence of escalators at its stations
makes that line unlikely, whilst if you travel four or more stops away
from Chancery Lane you are heading away from the centre of London, and
also rapidly run out of stations with escalators—many Central Line
stations still use lifts.
To the south of King's Cross we have Holborn and Tottenham Court Road.
Again, these are large stations, and are very central, so that
travelling four or more stops from either of these would take you away
from the centre of London.
Aldwych is an interesting possibility—definitely run down in the mid
1990s, and with a peak-hour-only service it could not have been used
to go to King's Cross for 11am. Against it though, we find that it was
extremely central, it was one end of a shuttle service to Holborn, so
they would have to change there (people who count stops on the first
leg of a tube journey on which they have to change trains, only count
to the interchange station) and it closed in May 1994. This would put
the dates in the canon out by at least two years since the date of
Nearly Headless Nick's Deathday in CS8 gives the events in the early
part ofOrder of the Phoenix as having taken place in August 1995.
A little closer to King's Cross lies Bloomsbury, served by Russell
Square station, with Goodge Street a little further west. These are
both quite small stations, near the edge of the central area, and
travelling four stops south would take you to Piccadilly Circus or
Embankment respectively, which are both very central. Goodge Street is
of particular interest because the journey from Goodge Street to
King's Cross would involve a change of trains, so it may be easier to
walk rather than take the underground.
We now come to a collection of stations, on various lines, strung out
close together along the Euston Road to the south west of King's
Cross. Great Portland Street and Euston Square are on the Circle Line,
and the same considerations as at Farringdon would seem to rule them
out. Euston is a big Underground station—it serves a main line station
bigger than King's Cross. Warren Street is a possibility—it is four
stops from Charing Cross, the official centre of London, from which
distances are measured, and at the end of Whitehall, where most
Government Ministries are located—perhaps including the Ministry of
Magic. However, Warren Street is on a direct line to King's Cross—if
Grimmauld Place was near Warren Street, why did the party not use it
to travel to King's Cross on September 1st?
West of King's Cross lies Mornington Crescent, famous from the BBC
radio comedy show I'm Sorry I Haven't a Clue—the game Mornington
Crescent has only one rule, which is that the players take turns to
name a Tube station, and the first one to say "Mornington Crescent" is
the winner! The station is small, not on a direct line to King's
Cross, and four stops would take you to Tottenham Court Road, five to
Leicester Square and six to Charing Cross, all of which are very
central. This would be a most promising candidate except for the
unfortunate circumstance that it was mothballed from 1992 to 1998,
neatly bracketing the events in the early part of Order of the
Phoenix, for which the canonical date is 1995, as I have already
discussed.
About twenty minutes walk north of King's Cross lies York Way station.
This is definitely very run down, and would fit the bill almost
perfectly except for the fact that it closed in 1932. If Harry and Mr
Weasley used this station, we have to resolve a very large number of
anomalies: Harry would have had to be born no later than 1917.  Frank
Bryce could have been injured in the Crimean War (or maybe the
American Civil War), but the Ford Anglia appearing in Chamber of
Secrets would have had to be fitted with a "flux capacitor" like the
DeLorean in Back to the Future (or perhaps a Time-Turner) as no Ford
was badged as an Anglia until 1940! I think we'd better carry on
looking!
There remain Camden Town, to the north west of King's Cross,
Caledonian Road, to the north (just off the attached map), and
Highbury & Islington to the northeast. As these are all rather further
than a mile from King's Cross, Grimmauld Place would have to be some
distance to the south of them to be only a twenty-minute walk from
King's Cross. This actually supports them as possibilities, as it
would explain why they were not used for the journey to King's Cross.
(Another possible explanation is that Camden Town is "exit only" on
Sunday mornings to reduce the crowds visiting Camden Market, so it
could not have been used to travel to King's Cross to catch the
Hogwarts Express at 11am on the day before term started—Hogwarts terms
always seem to start on Mondays. A ) At the canonical date of 1995
the area had some seedy parts, although it has been largely
"gentrified" in the subsequent ten years, and a large area was swept
away for the construction of the new railway line connecting St.
Pancras station to the Channel Tunnel. To see what it used to be like,
watch the 1950s Ealing comedy The Ladykillers, much of which was
filmed on location in this area.
Five stops from Highbury & Islington takes you to Green Park station:
on the other side of the eponymous park lies Whitehall, the Muggle
seat of government. Could this also be where the Ministry of Magic is
to be found? It's possible, although the walk to the Ministry of Magic
is said to be through the streets rather than a park.
More promisingly, five stops from either Caledonian Road (on the
Piccadilly Line) or Camden Town (on the Northern Line), takes you to
the intersection of those two lines at Leicester Square station, which
is on the Charing Cross Road, where the Leaky Cauldron is to be found
(see Harry Potter and the Philosopher's Stone). Although distance is
no object to wizards who can Apparate, it would make some kind of
sense for the wizards' pub to be near the Ministry of Magic. One more
stop down the Northern Line takes you to Charing Cross itself, at the
northern end of Whitehall.
Grimmauld Place was therefore probably about three quarters of a mile
from King's Cross, somewhere to the north of it, and closer to either
Camden Town or Caledonian Road station than it is to King's Cross.
Consequently, the Ministry of Magic is probably near Leicester Square
or Charing Cross stations, close to both the Leaky Cauldron and to the
Muggle government ministries.
HP Lexicon

A - An alternative explanation as to why the day after the arrival at Hogwarts (2nd September) always seems to be a Monday is that Hogwarts may choose to operate a normal Monday timetable on the first day of term, regardless of what day of the week it actually is — just as my local railway company operates a Sunday service on Good Friday, and a church may have its usual Sunday services on festivals like Christmas and Ascension Day. Similar tinkering with the school calendar would help to explain a lot of date anomalies in the books, such as why there were lessons on Valentines Day 1993 (which was a Sunday), or even how there could be two Mondays in a row.2
From the available evidence, it would seem that Grimmauld Place would fall somewhere on this map:

Final Note : The HP Wikia is a really bad source of information, I have learned this the hard way while trying to back up my memory of events.

A: Apparently it is somewhere in Islington. The London Borough of Islington is just next to Camden Borough which is where Kings Cross is located. It was chosen as a filming location in accordance with a conversation David Yates had had with Jo.


text:
Q: Incorrectly Binding Data in MVVM Utilizing Prism and Xamarin I'm picking back up on an application I started awhile back.
I'm creating an application utilizing Xamarin and Prism for MVVM, and utilizing an ASP.NET WEB API.
I have an API working correctly, but I think I'm missing something in terms of "wiring" the View Model.
Here is an example of my ViewModel:
        private string _technician;

    public string Technician
    {
        get { return _technician; }
        set { _technician = value; }
    }

And using RestSharp to POST:
            var client = new RestClient("http:apiurl/");
        var request = new RestRequest("api", Method.POST);
        WorkOrderLog orderLog = new WorkOrderLog();

        orderLog.Technician = Technician;
        orderLog.WOType = "M";
        orderLog.AssetDesc = AssetDesc;
        orderLog.AssetNumber = AssetNumber;
        orderLog.DeptCode = DeptCode;
        orderLog.FaultCode = FaultCode;
        orderLog.Priority = Priority;
        orderLog.StartTime = DateTime.Now;
        orderLog.Active = true;
        orderLog.Complete = false;
        orderLog.Suspended = false;

        request.AddJsonBody(orderLog);
        client.Execute(request);

When I run the action to POST, I insert data succesfully into the table, but am getting NULL values for the values I am trying to bind on the View. So the Static WOType works, but the others don't for example.
Here is the Binding to the View:
<Picker Title="Priority" SelectedItem="{Binding Priority, Mode=TwoWay}"  >
<Label Text="Technician"  FontSize="Large" Padding="0" HorizontalOptions="Center" BindingContext="{Binding Technician}"></Label>

Am I overlooking something simple? I'm utilizing the AutoWireViewModel inside of Prism.
Again, utilizing Prism MVVM with Xamarin.
Thank you guys for assisting.

A: I feel you are missing a few things.
Since you are using Prism your ViewModel should look like this
public class YourViewModel : BindableBase
{
    public Untitled-4(Parameters)
    {

    }

    private string _technician;
    public string Technician
    {
        get => _title;
        set => SetProperty(ref _technician, value);
    }

   ...
   //The rest of your properties should look like the one above
}

On the XAML the binding should be:
<Label Text="{Binding Technician}"  FontSize="Large" Padding="0" HorizontalOptions="Center" />

You don't need to set the Context Xamarin.Forms and Prism will take care of that since you are using AutoWireViewModel.
Something I am not understanding is why Binding to a Label. Maybe what you want is to use an Entry where you can get information from the user.
<Entry Text="{Binding Technician, Mode=TwoWay}" HorizontalOptions="Center" />

Note: For more information about Prims and XF: https://prismlibrary.com/docs/xamarin-forms/creating-your-first-prism-app.html


text:
Q: Form Inline and Horizontal With image I'm trying to program a mixed form, horizontal and inline, with an image, but my bootstrap is not helping me.
Here is what I have:

Here is what I want:

And, finally, the code:
<form class='form-horizontal' method='post' enctype="multipart/form-data">

                    Foto
                    <img class='fotoassociado' src='../../<?php if($sqlcmd->Foto == '') {echo 'photos/no_photo.jpg';} else {echo $sqlcmd->Foto;} ?>' />
                    <input type='file' class='form-control' name='foto' id='foto' />

                    Nome
                    <input type='text' class='form-control' name='nome' id='nome' value='<?php echo $sqlcmd->Nome; ?>' />

                    E-mail
                    <input type='email' class='form-control' name='email' id='email' value='<?php echo $sqlcmd->Email; ?>' />

                    RG
                    <input type='rg' class='form-control rg' name='rg' id='rg' value='<?php echo $sqlcmd->RG; ?>' />

                    CPF
                    <input type='cpf' class='form-control cpf' name='cpf' id='cpf' value='<?php echo $sqlcmd->CPF; ?>' />

                    Residencial
                    <input type='text' class='form-control' name='TelRes' id='TelRes' value='<?php echo $sqlcmd->TelResidencial; ?>' />

                    Comercial
                    <input type='text' class='form-control' name='TelCom' id='TelCom' value='<?php echo $sqlcmd->TelComercial; ?>' />

                    Celular
                    <input type='text' class='form-control' name='TelCel' id='TelCel' value='<?php echo $sqlcmd->TelCelular; ?>' />

            </form>

A:

form.form-horizontal {
    float: right;
    width: 83%;
}

 <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

<form class='form-horizontal' method='post' enctype="multipart/form-data">

                    Foto
                    <input type='file' class='form-control' name='foto' id='foto' />

                    Nome
                    <input type='text' class='form-control' name='nome' id='nome' value='name' />

                    E-mail
                    <input type='email' class='form-control' name='email' id='email' value='Email' />

                    RG
                    <input type='rg' class='form-control rg' name='rg' id='rg' value='RG' />

                    CPF
                    <input type='cpf' class='form-control cpf' name='cpf' id='cpf' value='cpf' />

                    Residencial
                    <input type='text' class='form-control' name='TelRes' id='TelRes' value='TEl' />

                    Comercial
                    <input type='text' class='form-control' name='TelCom' id='TelCom' value='telc' />

                    Celular
                    <input type='text' class='form-control' name='TelCel' id='TelCel' value='telcal' />

            </form>

A:
Try having, the image and the labels you want inline, under the tag
This might help.

A: Try floating the image. For example:
.fotoassociado {
    float: left;
}

Or if you want that whole form group then you'll make that whole div float left, by either selecting the first form-group...
.form-group:first-of-type {
    float: left;
 }

or by adding an additional class.

.float-left {
    float: left;
 }


text:
Q: predict() error : X does not have valid feature names, but LinearRegression was fitted with feature names warnings.warn( import pandas as pd
import numpy as np
from sklearn import linear_model

df = pd.read_csv('https://raw.githubusercontent.com/codebasics/py/master/ML/1_linear_reg/Exercise/canada_per_capita_income.csv')

reg = linear_model.LinearRegression()
reg.fit( df[['year']], df['per capita income (US$)'] )

reg.predict(2020)

I am using scikit 1.0.2 version. I am new learner and exactly copied this from a video it works in video but do not work on me, What should I do?
X does not have valid feature names, but LinearRegression was fitted with feature names
  warnings.warn(

A: mask = df['year'] == 2000
aaa = reg.predict(df.loc[mask, 'year'].values.reshape(-1, 1))
print(aaa[0])

Output
24719.392589963274

Use an equality test and apply masking to access the value. And extract the value from aaa[0].


text:
Q: AutoFac and CustomPrincipal I have a custom class that implements IPrincipal like that:
public class UserPrincipal : IPrincipal
{
    private readonly User _user;

    public UserPrincipal(IIdentity identity, User user)
    {
        _user = user;
        Identity = identity;
    }

    public bool IsInRole(string role)
    {
        return _user.Permissions.Any(x => x.Name == role);
    }

    public IIdentity Identity { get; }
}

Is that the right way to register it with AutoFac?
builder.RegisterType<IPrincipal>().As<UserPrincipal>();

I get an error:
An exception of type 'System.ArgumentException' occurred in Autofac.dll but was not handled in user code
Additional information: The type 'System.Security.Principal.IPrincipal' is not assignable to service 'MyNamespace.Identity.UserPrincipal'.

A: you have to change your registration code. Register the concrete type (RegisterType<T>) and use the interface type for the mapping (As<T>).
builder.RegisterType<UserPrincipal>().As<IPrincipal>();


text:
Q: Make an existing SVG to spin (loading icon) I have a svg icon and I want to make it spin (load). Is this possible? I've found online sites that they can create rotating icons but I haven't found a converter that will make an existing svg icon to spin.

A:

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% {  transform: rotate(359deg); }
}
#star {
    animation: spin 2s linear infinite;

}
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg id=star width="4cm" height="4cm" viewBox="0 0 700 400" xmlns="http://www.w3.org/2000/svg" version="1.1">
  <polygon fill="red" stroke="red" stroke-width="10"
            points="350,75  379,161 469,161 397,215
                    423,301 350,250 277,301 303,215
                    231,161 321,161" />

</svg>

A: If you are using bootstrap then you can use like this .
eg:
http://www.w3schools.com/icons/fontawesome_icons_spinner.asp
For Custom SVG
try SVG rotate path
example: http://jsfiddle.net/YEA7T/
HTML code:
IMG

SVG

<svg version="1.2" baseProfile="tiny" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
     x="0px" y="0px" width="319.046px" height="168.518px" viewBox="0 0 319.046 168.518" xml:space="preserve">

<path fill="#000000" class="gear" d="M189.857,70.346l-10.563-3.885c-1.063,2.165-2.405,4.178-3.978,5.992l7.143,8.659l-5.782,4.958l-7.099-8.605
    c-1.988,1.293-4.169,2.335-6.495,3.077l1.915,11.108L157.566,93l-1.931-11.188c-2.404,0.065-4.762-0.199-7.029-0.757l-3.873,10.835
    l-7.088-2.61l3.948-11.043c-1.99-1.149-3.829-2.558-5.478-4.179l-9.018,7.729l-4.847-5.875l9.229-7.91
    c-1.076-1.911-1.939-3.978-2.549-6.172l-12.118,2.206l-1.302-7.564l12.393-2.259c0.001-2.184,0.257-4.326,0.746-6.392l-12.01-4.418
    l2.587-7.23l12.193,4.487c1.011-1.822,2.229-3.516,3.608-5.063l-8.405-10.191l5.783-4.955l8.445,10.235
    c1.71-1.076,3.551-1.971,5.506-2.646l-2.274-13.166l7.436-1.356l2.255,13.085c2.095-0.11,4.155,0.024,6.153,0.391l4.422-12.366
    l7.09,2.61L167.087,29.4c1.907,0.961,3.694,2.145,5.33,3.531l9.569-8.2l4.848,5.875l-9.348,8.008
    c1.228,1.843,2.249,3.854,3.021,6.01l11.76-2.143l1.307,7.563L182.09,52.14c0.171,2.391,0.029,4.747-0.392,7.025l10.746,3.952
    L189.857,70.346z"/>

</svg>

CSS
.gear {
    -webkit-animation: rotation 2s infinite linear;
    -moz-animation: rotation 2s infinite linear;
    -o-animation: rotation 2s infinite linear;
    animation: rotation 2s infinite linear;
    transform-origin: 50% 50%;
    -webkit-transform-origin: 50% 50%;
    -moz-transform-origin: 50% 50%;
}

@-webkit-keyframes rotation {
    from {-webkit-transform: rotate(0deg);}
    to   {-webkit-transform: rotate(359deg);}
}
@-moz-keyframes rotation {
    from {-moz-transform: rotate(0deg);}
    to   {-moz-transform: rotate(359deg);}
}
@-o-keyframes rotation {
    from {-o-transform: rotate(0deg);}
    to   {-o-transform: rotate(359deg);}
}
@keyframes rotation {
    from {transform: rotate(0deg);}
    to   {transform: rotate(359deg);}
}


text:
Q: Any difference between "onClick" and get ref to add clickListener in React? Directly add a clickListener to component
<Grid onClick={this.state.event}/>

Set a ref then add clickListener
componentDidMount() {
    ReactDOM.findDOMNode(this.refs.grid).addEventListener('click', this.state.event);
}

componentWillUnmount() {
    ReactDOM.findDOMNode(this.refs.grid).removeEventListener('click', this.state.event);
}

<Grid fluid ref="grid"/>

A: Check please React documentation
Refs: https://reactjs.org/docs/refs-and-the-dom.html
Synthetic events: https://reactjs.org/docs/events.html
With refs you work with so-called uncontrolled components with browser-specific event data. You should be careful with refs, because you work with DOM element directly and it might lead to side effects in conjuction with React component's  lifecycle. Some examples to use refs might be handling focus, text selections, custom formatting and cursor positioning in form inputs, integration of non-React 3rd-party libraries etc. Usually libraries like redux-form use refs heavily.
React's way with onClick (controlled components) provides cross-browser synthetic event data. React is smart enough and it uses only a single instance of event data to save memory. It is recommended to use controlled components to allow React fully control your components to avoid unintended behaviours, unless refs are explicitly needed.
If you develop some library to work with i.e. form elements, then using refs could be your convention.

A: String refs are deprecated in react 16.3 and refs are used mainly for the purpose of managing custom components and managing events like focus and selection. Use of refs is just an escape mechanism as it doesn't follow the conventional flow of parent-child hierarchy in react. Also, refs don't work for functional components, unless you are just accessing the Dom elements alone.
Read the don't overuse refs blog in react:
https://reactjs.org/docs/refs-and-the-dom.html
Maintaining single source of Truth for child components:
https://reactjs.org/docs/lifting-state-up.html


text:
Q: Facebook Graph API in iPhone Not working after Feb 6 Changes I got alert & mail from facebook as following:
February 2013 Breaking Changes
Sunday
Your app, , needs to be updated for the February 2013 Breaking Changes.
Once your app is compliant, set the migration setting to "Enabled" in the Advanced section of the App Dashboard.
I have also ENABLED migration setting , but still getting error. I have also attached screenshots of both error and alert here.
Please help if any have solved this issue.

A: Did you manage to resolve your issue?
I searched for a while on this and found a very simple solution:

*

*Go to your app settings and select the advanced tab.

*Change the 'App type' to web

That's it, it got my apps working, hope it helps.

A: Change the facebook Url from this url..

https://graph.facebook.com/oauth/authorize?client_id=404196699634359&redirect_uri=http://www.facebook.com....

to

http://facebook.com/dialog/oauth?client_id=404196699634359&redirect_uri=http://www.facebook.com...


text:
Q: HTML/CSS radio button multi-level accordion closes automatically on selection I've grabbed a few examples from multiple codepen sources to create a multi-level accordion just with HTML/CSS using the type radio button. When you click on the 'main' radio button it opens up and if you click on the other 'main' radio button it closes the previous radio button however if you open the 'main' radio button then click on the radio button inside the radio button it does not open it closes the 'main' radio button, see example here.
<!DOCTYPE html>

        <meta charset="UTF-8">
        <title>Settings</title>
        <link href="https://fonts.googleapis.com/css?family=Poppins:400,500,600,700" rel="stylesheet">
        <link rel="stylesheet" href="./style.css">

                <input type="radio" id="radio-1" class="accordion-input" name="accordion">

                        Lorem ipsum

                        Lorem ipsum

                            <input type="radio" id="radio-2" class="accordion-input" name="accordion">

                                    Lorem ipsum

                                    Lorem ipsum

                                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin id congue dolor. Vivamus eleifend vitae nunc sed tincidunt.

                <input type="radio" id="radio-3" class="accordion-input" name="accordion">

                        Lorem ipsum

                        Lorem ipsum

                            <input type="radio" id="radio-4" class="accordion-input" name="accordion">

                                    Lorem ipsum

                                    Lorem ipsum

                                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin id congue dolor. Vivamus eleifend vitae nunc sed tincidunt.

body {
    background-color: #6fcae7;
    overflow-y: scroll;
    overflow-x: hidden;
}

#accordion {
    margin: 50px 0 0;
    font-family: "Poppins", sans-serif;
}

.accordion-tab {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 10px; /* 10px adds to bottom */
    border-radius: 4px;
    background-color: #ffffff;
    box-shadow: 0 0 0 1px #ececec;
}
.accordion-tab:hover {
    box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.11);
}

.accordion-input {
    display: none;
}

.accordion-input:checked ~ .accordion-content + .accordion-tab-content {
    max-height: 3000px;
}

.accordion-input:checked ~ .accordion-content:after {
    transform: rotate(0);
}

.accordion-label {
    position: absolute;
    width: 100%;
    height: 100%;
    max-height: 80px;
    z-index: 1;
    cursor: pointer;
}

.accordion-content {
    position: relative;
    height: 80px;
    padding: 0 87px 0 30px;
    white-space: nowrap;
}

.accordion-content:before, .accordion-content:after {
    content: '';
    display: inline-block;
    vertical-align: middle;
}

.accordion-content:before {
    height: 100%;
}

.accordion-label:hover ~ .accordion-content:after {
  background-image: url("accordion-arrow-hover.svg");
}

.accordion-content:after {
    width: 24px;
    height: 100%;
    background-image: url("accordion-arrow.svg");
    background-repeat: no-repeat;
    background-position: center;
    transform: rotate(180deg);
}

.accordion-content + .accordion-tab-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s;
}

.accordion-content > div, .total-games > div {
    display: inline-block;
    vertical-align: middle;
}

.accordion-info {
    width: 95%;
}

.accordion-tab-content {
    background-color: #f9f9f9;
    color: #363636;
    font-size: 13px;
    font-weight: 400;
    border-radius: 0 0 4px 4px;
}

.wrapper {
  padding: 30px;
}

.platform-image {
    display: inline-block;
    height: 44px;
    width: 44px;
    border-radius: 50%;
    background-color: #e4e4e4;
    vertical-align: middle;
}

.platform-name {
    font-size: 14px;
    color: #242a32;
    width: 75%;
    margin-left: 16px;
    font-weight: 500;
    color: #242a32;
    vertical-align: middle;
}

.total-games {
    font-size: 14px;
    color: #5d5d5d;
}

.game-image {
    display: inline-block;
    height: 44px;
    width: 44px;
    border-radius: 50%;
    background-color: #e4e4e4;
    vertical-align: middle;
}

.game-name {
    font-size: 14px;
    color: #242a32;
    width: 75%;
    margin-left: 16px;
    font-weight: 500;
    color: #242a32;
    vertical-align: middle;
}

A: You could use checkboxes because when one is checked, the other will uncheck.
With radio's, you can do it by the use of the name attribute. If the radio should have a toggle relationship, they should have the same name like in the example here below:

body {
    background-color: #6fcae7;
    overflow-y: scroll;
    overflow-x: hidden;
}

#accordion {
    margin: 50px 0 0;
    font-family: "Poppins", sans-serif;
}

.accordion-tab {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 10px; /* 10px adds to bottom */
    border-radius: 4px;
    background-color: #ffffff;
    box-shadow: 0 0 0 1px #ececec;
}
.accordion-tab:hover {
    box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.11);
}

.accordion-input {
    display: none;
}

.accordion-input:checked ~ .accordion-content + .accordion-tab-content {
    max-height: 3000px;
}

.accordion-input:checked ~ .accordion-content:after {
    transform: rotate(0);
}

.accordion-label {
    position: absolute;
    width: 100%;
    height: 100%;
    max-height: 80px;
    z-index: 1;
    cursor: pointer;
}

.accordion-content {
    position: relative;
    height: 80px;
    padding: 0 87px 0 30px;
    white-space: nowrap;
}

.accordion-content:before, .accordion-content:after {
    content: '';
    display: inline-block;
    vertical-align: middle;
}

.accordion-content:before {
    height: 100%;
}

.accordion-label:hover ~ .accordion-content:after {
  background-image: url("accordion-arrow-hover.svg");
}

.accordion-content:after {
    width: 24px;
    height: 100%;
    background-image: url("accordion-arrow.svg");
    background-repeat: no-repeat;
    background-position: center;
    transform: rotate(180deg);
}

.accordion-content + .accordion-tab-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s;
}

.accordion-content > div, .total-games > div {
    display: inline-block;
    vertical-align: middle;
}

.accordion-info {
    width: 95%;
}

.accordion-tab-content {
    background-color: #f9f9f9;
    color: #363636;
    font-size: 13px;
    font-weight: 400;
    border-radius: 0 0 4px 4px;
}

.wrapper {
  padding: 30px;
}

.platform-image {
    display: inline-block;
    height: 44px;
    width: 44px;
    border-radius: 50%;
    background-color: #e4e4e4;
    vertical-align: middle;
}

.platform-name {
    font-size: 14px;
    color: #242a32;
    width: 75%;
    margin-left: 16px;
    font-weight: 500;
    color: #242a32;
    vertical-align: middle;
}

.total-games {
    font-size: 14px;
    color: #5d5d5d;
}

.game-image {
    display: inline-block;
    height: 44px;
    width: 44px;
    border-radius: 50%;
    background-color: #e4e4e4;
    vertical-align: middle;
}

.game-name {
    font-size: 14px;
    color: #242a32;
    width: 75%;
    margin-left: 16px;
    font-weight: 500;
    color: #242a32;
    vertical-align: middle;
}
<!DOCTYPE html>

        <meta charset="UTF-8">
        <title>Settings</title>
        <link href="https://fonts.googleapis.com/css?family=Poppins:400,500,600,700" rel="stylesheet">
        <link rel="stylesheet" href="./style.css">

                <input type="radio" id="radio-1" class="accordion-input" name="accordion">

                        Lorem ipsum

                        Lorem ipsum

                            <input type="radio" id="radio-2" class="accordion-input" name="sub-accordion-1">

                                    Lorem ipsum

                                    Lorem ipsum

                                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin id congue dolor. Vivamus eleifend vitae nunc sed tincidunt.

                <input type="radio" id="radio-3" class="accordion-input" name="accordion">

                        Lorem ipsum

                        Lorem ipsum

                            <input type="radio" id="radio-4" class="accordion-input" name="sub-accordion-2">

                                    Lorem ipsum

                                    Lorem ipsum

                                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin id congue dolor. Vivamus eleifend vitae nunc sed tincidunt.

                            <input type="radio" id="radio-5" class="accordion-input" name="sub-accordion-2">

                                    Lorem ipsum

                                    Lorem ipsum

                                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin id congue dolor. Vivamus eleifend vitae nunc sed tincidunt.


text:
Q: Got Error: NoMethodError: undefined method `fetch_value' for nil:NilClass when trying to create a new record in the rails console I have been trying to add a record from the rails console in Rails 5.0 with Ruby 2.4. The model is called "AuditionGroup"
When I lookup AuditionGroup everything works perfectly:
2.4.0 :017 > AuditionGroup
 => AuditionGroup(id: integer, audition_date: date, audition_time: time, class: string, created_at: datetime, updated_at: datetime)

Then when I try to add a new record I get the following error message:
2.4.0 :018 > newgroup = AuditionGroup.new
NoMethodError: undefined method `fetch_value' for nil:NilClass
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activerecord-5.0.1/lib/active_record/attribute_methods/read.rb:66:in `_read_attribute'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activerecord-5.0.1/lib/active_record/attribute_methods/read.rb:36:in `__temp__36c6163737'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activerecord-5.0.1/lib/active_record/core.rb:313:in `initialize'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activerecord-5.0.1/lib/active_record/inheritance.rb:65:in `new'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activerecord-5.0.1/lib/active_record/inheritance.rb:65:in `new'
    from (irb):18
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/railties-5.0.1/lib/rails/commands/console.rb:65:in `start'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/railties-5.0.1/lib/rails/commands/console_helper.rb:9:in `start'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/railties-5.0.1/lib/rails/commands.rb:18:in `<top (required)>'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `require'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `block in require'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `require'
    from /Users/Nick/Sites/testapp/bin/rails:9:in `<top (required)>'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:287:in `load'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:287:in `block in load'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:287:in `load'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/spring-2.0.0/lib/spring/commands/rails.rb:6:in `call'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/spring-2.0.0/lib/spring/command_wrapper.rb:38:in `call'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/spring-2.0.0/lib/spring/application.rb:191:in `block in serve'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/spring-2.0.0/lib/spring/application.rb:161:in `fork'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/spring-2.0.0/lib/spring/application.rb:161:in `serve'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/spring-2.0.0/lib/spring/application.rb:131:in `block in run'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/spring-2.0.0/lib/spring/application.rb:125:in `loop'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/spring-2.0.0/lib/spring/application.rb:125:in `run'
    from /Users/Nick/.rvm/gems/ruby-2.4.0/gems/spring-2.0.0/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /Users/Nick/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/Nick/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'

This is my AuditionGroup model
class AuditionGroup < ApplicationRecord
  self.table_name = "auditiongroups"
  has_many :auditions
end

A: The root of the problem is that you have a column called class.
Google for a list of "reserved" words in Rails, class is one of these.

A: This is related to this post. In this case add attr_accessor to your class to all attributes that were being set.


text:
Q: How can I decode a large, multi-byte string file progressively in Java? I have a program that may need to process large files possibly containing multi-byte encodings. My current code for doing this has the problem that creates a memory structure to hold the entire file, which can cause an out of memory error if the file is large:
Charset charset = Charset.forName( "UTF-8" );
CharsetDecoder decoder = charset.newDecoder();
FileInputStream fis = new FileInputStream( file );
FileChannel fc = fis.getChannel();
int lenFile = (int)fc.size();
MappedByteBuffer bufferFile = fc.map( FileChannel.MapMode.READ_ONLY, 0, lenFile );
CharBuffer cb = decoder.decode( bufferFile );
// process character buffer
fc.close();

The problem is that if I chop up the file byte contents using a smaller buffer and feed it piecemeal to the decoder, then the buffer could end in the middle of a multi-byte sequence. How should I cope with this problem?

A: It is as easy as using a Reader.
A CharsetDecoder is indeed the underlying mechanism which allows the decoding of bytes into chars. In short, you could say that:
// Extrapolation...
byte stream --> decoding       --> char stream
InputStream --> CharsetDecoder --> Reader

The less known fact is that most (but not all... See below) default decoders in the JDK (such as those created from a FileReader for instance, or an InputStreamReader with only a charset) will have a policy of CodingErrorAction.REPLACE. The effect is to replace any invalid byte sequence in the input with the Unicode replacement character (yes, that infamous �).
Now, if you are concerned about the ability for "bad characters" to slip in, you can also select to have a policy of REPORT. You can do that when reading a file, too, as follows; this will have the effect of throwing a MalformedInputException on any malformed byte sequence:
// This is 2015. File is obsolete.
final Path path = Paths.get(...);
final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder()
    .onMalformedInput(CodingErrorAction.REPORT);

try (
    final InputStream in = Files.newInputStream(path);
    final Reader reader = new InputStreamReader(in, decoder);
) {
    // use the reader
}

ONE EXCEPTION to that default replace action appears in Java 8: Files.newBufferedReader(somePath) will try and read in UTF-8, always, and with a default action of REPORT.

A: Open and read the file as a text file, so the file reader will do the separation into characters for you.  If the file has lines, just read it line by line.  If it isn't split into lines, then read in in blocks of 1,000 (or whatever) characters.  Let the file library deal with the low-level stuff of converting the UTF multi-byte sequences into characters.

A: @fge, I didn't know about the report option - cool.
@Tyler, the trick, I think, is using the BufferedReader's read() method:
Excerpt from here: https://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html#read%28char[],%20int,%20int%29
public int read(char[] cbuf,
       int off,
       int len)
         throws IOException

Here is some example output (code below):
read #1, found 32 chars
read #2, found 32 chars
read #3, found 32 chars
read #4, found 32 chars
read #80, found 32 chars
...
read #81, found 32 chars
read #82, found 7 chars
Done, read total=2599 chars, readcnt=82

Note on the output above it happened to end with the last '7' characters; you can adjust the buffer array size to process whatever "chunk" size you want... this is just an example to suggest you wont' have to worry about getting stuck somewhere "mid-byte" in a multi-byte UTF8 character.
import java.io.*;

class Foo {
   public static void main( String args[] ) throws Exception {
      String encoding = "UTF8";
      String inFilename = "unicode-example-utf8.txt";
      // Test file from http://www.i18nguy.com/unicode/unicode-example-intro.htm
      // Specifically the Example Data, CSV format:
      //     http://www.i18nguy.com/unicode/unicode-example-utf8.zip
      char buff[] = new char[ 32 ]; // or whatever size...
      // I know the readers  can be combined to just nest the temp instances,
      // for an  example i think it is easier to parse the structure
      // with each reader explicitly declared.
      FileInputStream finstream = new FileInputStream( inFilename );
      InputStreamReader instream = new InputStreamReader( finstream, encoding );
      BufferedReader in = new BufferedReader( instream );
      int n;
      long total = 0;
      long readcnt = 0;
      while( -1 != (n = in.read( buff, 0, buff.length ) ) ) {
         total += n;
         ++readcnt;
         System.out.println("read #"+readcnt+", found "+n+" chars ");
      }
      System.out.println( "Done, read total="+total+" chars, readcnt="+readcnt );
      in.close();
   }
}


text:
Q: Passing a ViewModel reference to another ViewModel (the same reference that's tied to the View)? So I have a View with two subviews. One of the subviews is an on screen keyboard with textbox. Below that are some buttons which are part of a different subview. See below:

When I press the keyboard buttons it types in the textbox. Both the subview with the buttons and the subview with the keyboard have their own ViewModels. My question is, how do I reference the keyboard view from the button view (so I can get the contents of the text field, for example, or clear it if the user clicks "Go Back").
I'm trying to conceptualize it, but I can't figure out how I would get the same instance of the ViewModel of the keyboard that the Main View has.
I can create a variable:
private KeyboardViewModel keyboard;

But how do I instantiate that variable with the instance that the Main View already has (so I can access those properties from the button viewmodel)?

A: The main problem is that you misplaced your datasource in one of your ViewModel when the datasource is actually needed to be reuse in multiple View/ViewModel. What you need to do is to refactor the datasource out into a singleton instance or an seperate instance that can be injected into different ViewModels' constructor. By decoupling out the datasource from a particular ViewModel can give it freedom for different place to access.
public class DataCache
{
    private static DataCache singletonInstance;

    // You can have freedom to choose the event-driven model here
    // Using traditional Event, EventAggregator, ReactiveX, etc
    public EventHandler OnMessageChanged;

    private DataCache()
    {

    }

    public static DataCache Instance
    {
        get { return singletonInstance ?? (singletonInstance = new DataCache()); }
    }

    public string OnScreenMessage { get; set; }

    public void AddStringToMessage(string c)
    {
        if (string.IsNullOrWhiteSpace(c)) return;

        OnScreenMessage += c;
        RaiseOnMessageChanged();
    }

    public void ClearMessage()
    {
        OnScreenMessage = string.Empty;
        RaiseOnMessageChanged();
    }

    private void RaiseOnMessageChanged()
    {
        if (OnMessageChanged != null)
            OnMessageChanged(null, null);
    }
}

public class MainViewModel : ViewModelBase
{
    private readonly MessageViewModel messageVM;
    private readonly KeyboardViewModel keyboardVM;
    private readonly ButtonsViewModel buttonsVM;

    private readonly DataCache dataCache;

    public MainViewModel()
    {
        messageVM = new MessageViewModel();
        keyboardVM = new KeyboardViewModel();
        buttonsVM = new ButtonsViewModel();
    }

    public ViewModelBase MessageViewModel { get { return messageVM; } }
    public ViewModelBase KeyboardViewModel { get { return keyboardVM;  } }
    public ViewModelBase ButtonsViewModel { get { return buttonsVM; } }
}

public class MessageViewModel : ViewModelBase
{
    private readonly DataCache dataCache = DataCache.Instance;

    public MessageViewModel()
    {
        dataCache.OnMessageChanged += RaiseMessageChanged;
    }

    private void RaiseMessageChanged(object sender, EventArgs e)
    {
        OnPropertyChanged("Message");
    }

    public string Message
    {
        get { return dataCache.OnScreenMessage; }
        set { dataCache.OnScreenMessage = value; }
    }
}

public class KeyboardViewModel : ViewModelBase
{
    private readonly DataCache dataCache = DataCache.Instance;

    private ICommand onClickButtonCommand;
    public ICommand OnClickButton
    {
        get
        {
            return onClickButtonCommand ?? (onClickButtonCommand = new RelayCommand(p => dataCache.AddStringToMessage((string)p)));
        }
    }
}

public class ButtonsViewModel : ViewModelBase
{
    private readonly DataCache dataCache = DataCache.Instance;

    private ICommand onGoBackCommand;
    public ICommand OnGoBackButton
    {
        get
        {
            return onGoBackCommand ?? (onGoBackCommand = new RelayCommand(p => dataCache.ClearMessage()));
        }
    }
}

public class RelayCommand : ICommand
{
    #region Fields

    private readonly Action<object> _execute;
    private readonly Predicate<object> _canExecute;

    #endregion Fields

    #region Constructors

    public RelayCommand(Action<object> execute, Predicate<object> canExecute = null)
    {
        if (execute == null)
            throw new ArgumentNullException("execute");

        _execute = execute;
        _canExecute = canExecute;
    }
    #endregion Constructors

    #region ICommand Members

    [DebuggerStepThrough]
    public bool CanExecute(object parameter)
    {
        return _canExecute == null || _canExecute(parameter);
    }

    public event EventHandler CanExecuteChanged;

    public void RaiseCanExecuteChanged()
    {
        var handler = CanExecuteChanged;
        if (handler != null) handler(this, EventArgs.Empty);
    }

    public void Execute(object parameter)
    {
        _execute(parameter);
    }

    #endregion ICommand Members
}

<Window x:Class="StudentScoreWpfProj.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:StudentScoreWpfProj"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    mc:Ignorable="d"
    d:DataContext="{d:DesignInstance Type=local:MainViewModel,IsDesignTimeCreatable=True}"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <local:MessgaeView DataContext="{Binding MessageViewModel}" />
    <local:KeyboardView Grid.Row="1" DataContext="{Binding KeyboardViewModel}" />
    <local:ButtonsView Grid.Row="2" DataContext="{Binding ButtonsViewModel}" />
</Grid>

<UserControl x:Class="StudentScoreWpfProj.ButtonsView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:local="clr-namespace:StudentScoreWpfProj"
         mc:Ignorable="d"
         d:DataContext="{d:DesignInstance Type=local:ButtonsViewModel,IsDesignTimeCreatable=True}"
         d:DesignHeight="300" d:DesignWidth="300">
<Grid>
    <StackPanel Orientation="Horizontal">
        <Button Content="GoBack" Command="{Binding OnGoBackButton}"></Button>
        <Button Content="Continue"></Button>
    </StackPanel>
</Grid>

<UserControl x:Class="StudentScoreWpfProj.KeyboardView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:local="clr-namespace:StudentScoreWpfProj"
         mc:Ignorable="d"
         d:DataContext="{d:DesignInstance Type=local:KeyboardViewModel,IsDesignTimeCreatable=True}"
         d:DesignHeight="300" d:DesignWidth="300">
<Grid>
     <StackPanel Orientation="Horizontal">
        <Button Content="A" Command="{Binding OnClickButton}" CommandParameter="A"></Button>
        <Button Content="B" Command="{Binding OnClickButton}" CommandParameter="B"></Button>
        <Button Content="C" Command="{Binding OnClickButton}" CommandParameter="C"></Button>
    </StackPanel>
</Grid>

<UserControl x:Class="StudentScoreWpfProj.MessgaeView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:local="clr-namespace:StudentScoreWpfProj"
         mc:Ignorable="d"
         d:DataContext="{d:DesignInstance Type=local:MessageViewModel,IsDesignTimeCreatable=True}"
         d:DesignHeight="300" d:DesignWidth="300">
<Grid>
    <TextBox Text="{Binding Message}"/>
</Grid>

A: You could do several things ...
You could create a static instance for easy access, and expose what you want on it (not recommended, read comments).
You could use dependency injection, so your other viewmodel will take the keyboard viewmodel as a parameter (please have a look at my other answer, it'll get you started quicly).
You could use a messenger to help you talk between them as well. most mvvm frameworks will have some ( have a look at this SO question, and at this code project article to get you started. They are specifically for MVVM light, but they'll help you understand the concept) .

A: How about using ServiceLocator from Microsoft.Practices.ServiceLocation?
ServiceLocator.Current.GetInstance<ViewModelName>();


text:
Q: Could not set Image on Navigation bar only in "ios 5.0" In my universal app,
I am setting an image on navigation bar...using **

objective c category...on UINavigationBar

**
The code works fine in ios 5.0 in iphone
*The code works fine in ios 4.3 in iPhone/iPad*
*But not working in **ios 5.0 iPad***

- (void) drawRect:(CGRect)rect
    {
    UIImage *image;

   image = [UIImage imageNamed: @"Navigation.png"];

    [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];

      [self setTintColor:[UIColor clearColor]];

      NSLog(@"Draw Rect");

    }

A: To set a BG image for navigation bar in iOS 5 you can use the below code
if ([self.navigationController.navigationBar respondsToSelector:@selector( setBackgroundImage:forBarMetrics:)]){
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"Navigation.png"] forBarMetrics:UIBarMetricsDefault];
}

But please keep in mind that this wont work in iOS 4. To make it work in both you also need to add a category to UINavigationBar
@implementation UINavigationBar (UINavigationBarCategory)
- (void)drawRect:(CGRect)rect {
UIImage *img = [UIImage imageNamed:@"Navigation.png"];
[img drawInRect:rect];
}

A: If you want to set the background application-wide you can use iOS5's UIAppearance.
[[UINavigationBar appearance] setBackgroundImage:X forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundImage:X forBarMetrics:UIBarMetricsLandscape];


text:
Q: Is there some case when PHP error suppression "@" could be really necessary? In PHP is possible to suppress errors by using the @ symbol before the statement.
Example:
if (@$flag[$i]) {
    ...
}

Although I have seen it used in many places, I have never seen a situation that was really necessary. As the error suppression was not yet removed from PHP (not even deprecated), I can assume it's really useful. Can someone point me a situation that it is really necessary?

A: It may be useful in cases when you need to call functions that can emit errors but you want to validate the reasons by yourself and take actions according to your own validations, avoiding errors leaking from your code. This situation is common when writing libraries, for example.


text:
Q: Load DataTable to WPF DataGrid MVVM I have been trying to move my project to MVVM for some time.
There is a DataTable I am getting from Database:
MainProcess.cs:
    public static DataTable CustomersInLiinos = new DataTable();

    public static void MergedTable()
    {
        var t1 = ConnectAndRetriveDatatatableS(); // t1
        var t2 = ConnectAndRetriveDatatatableF(); // t2

        CustomersInLiinos = t1.Copy();
        CustomersInLiinos.Merge(t2);
    }

ViewModel.cs:
    private async Task ExecuteLoadMainTableDataAsync(object commandParameter)
    {
        if (MainProcess.CheckForVPNInterface())
        {
            if (MainProcess.CustomersInLiinos != null)
            {
                this.HasProgress = true;

                IEnumerable<Item> resultItems = await LoadMainTableDataAsync();
                this.Items = new ObservableCollection<Item>(resultItems);
                EnableItemsFiltering();

                this.HasProgress = false;
            }
        }
        else
        {
            throw new VpnInterfaceException("Please, check your VPN connection!");
        }
    }

Inside ViewModel.cs I have also this:
    public Task<DataView> LoadMainTableDataAsync()
    {
        return Task.Run(() =>
        {
            MainProcess.MergedTable();

            return MainProcess.CustomersInLiinos.DefaultView;
        });
    }

Curently I am having an error pointing at await LoadMainTableDataAsync();:

Severity  Code    Description Project File    Line    Suppression State
Error CS0266  Cannot implicitly convert type 'System.Data.DataView' to
'System.Collections.Generic.IEnumerable<Liinos_inspector_FilterTest.Item>'.
An explicit conversion exists (are you missing a cast?)

I understand that there is an error in LoadMainTableDataAsync? I am loading data to DataView and should load to IEnumerable instead?
Would it be easier to utilize this:
    public class JoinedFandS
    {
       public string YRNRO { get; set; }
       public string HAKUNIMI { get; set; }
       public string NIMIA { get; set; }
       public string NIMIB { get; set; }
    }

    public static IEnumerable<JoinedFandS> GetMyJoinedResult()
    {
        var t1 = ConnectAndRetriveDatatatableS(); // t1
        var t2 = ConnectAndRetriveDatatatableF(); // t2

        var firstTable = ...

        var secondTable = ...

        var results = firstTable.Concat(secondTable);

        return results;
    }

EDIT:
<Window x:Class="Liinos_inspector_FilterTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Liinos_inspector_FilterTest="clr-namespace:Liinos_inspector_FilterTest"
        mc:Ignorable="d"
        Title="Liinos database inspector" Height="672" Width="1000" Icon="Images/logo_icon-small.jpg" Background="White" MinWidth="1000">

  <Window.DataContext>
    <ViewModel />
  </Window.DataContext>

Severity  Code    Description Project File    Line    Suppression State
Error XLS0414 The type 'ViewModel' was not found. Verify that you are
not missing an assembly reference and that all referenced assemblies
have been built.  Liinos inspector FilterTest MainWindow.xaml 11

and

Severity  Code    Description Project File    Line    Suppression State
Error XDG0008 ViewModel is not supported in a Windows Presentation
Foundation (WPF) project. Liinos inspector
FilterTest    MainWindow.xaml 11

What should I use instead of ViewModel?

A: This is a data type mismatch. You cannot press a DataView into a collection. It's also more practicable to store the DataTable instead of the DataView. It's cheaper to get the view from the table, than getting the table from the view (in case you need to operate on the DataTable later).
Fixing this error also needs fixing the filtering.
DataGrid can handle a DataTable directly.
Note that you must await the return value of LoadMainTableDataAsync. Otherwise this method would return prematurely (because the result is computed in a background thread). I am sure, that this part of you code doesn't even compile. Maybe this is just example code.
This example also adjusts the filtering based on the new data structure. To filter a DataTable.DataView you must use the DataView.RowFilter property (see Expression Syntax for help). You need to adjust the actual filter logic to your requirements:
ViewModel.cs
class ViewModel : INotifyPropertyChanged
{
  public ICommand LoadMainTableDataCommand => new RelayCommand(async param => ExecuteLoadMainTableDataAsync());

  private DataTable mainDataTable;
  public DataTable MainDataTable
  {
    get => this.mainDataTable;
    set
    {
      this.mainDataTable = value;
      OnPropertyChanged();

      // Set the DataTable filter expression
      EnableRowFiltering();
    }
  }

  // Binding source for the first name TextBox
  private string firstNameSearchKey;
  public string FirstNameSearchKey
  {
    get => this.firstNameSearchKey;
    set
    {
      this.firstNameSearchKey = value;
      OnPropertyChanged();

      // Refresh the DataTable filter expression
      EnableRowFiltering();
    }
  }

  // Binding source for the last name TextBox
  private string lastNameSearchKey;
  public string LastNameSearchKey
  {
    get => this.lastNameSearchKey;
    set
    {
      this.lastNameSearchKey = value;
      OnPropertyChanged();

      // Refresh the DataTable filter expression
      EnableRowFiltering();
    }
  }

  private bool hasProgress;
  public bool HasProgress
  {
    get => this.hasProgress;
    set
    {
      this.hasProgress = value;
      OnPropertyChanged();
    }
  }

  public void EnableRowFiltering()
  {
    // The filter assumes a column 'FirstName' and a column 'LastName' in the DataView.
    // The filter expression mimics string.StartsWith.
    this.MainDataTable.DefaultView.RowFilter =
      $"FirstName LIKE '{this.FirstNameSearchKey}*' " +
      $"OR LastName LIKE '{this.LastNameSearchKey}*'";
  }

  private async Task ExecuteLoadMainTableDataAsync()
  {
    if (MainProcess.CheckForVPNInterface())
    {
      if (MainProcess.Customers != null)
      {
        this.HasProgress = true;

        this.MainDataTable = await LoadMainTableDataAsync();

        this.HasProgress = false;
      }
    }
    else
    {
      throw new VpnInterfaceException("Please, check your VPN connection!");
    }
  }

  public async Task<DataTable> LoadMainTableDataAsync()
  {
    return await Task.Run(() =>
    {
      MainProcess.MergedTable();

      return MainProcess.CustomersInLiinos;
    });
  }

  public event PropertyChangedEventHandler PropertyChanged;
  protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
    => this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

MainWindow.xaml
<Window>
  <Window.DataContext>
    <ViewModel />
  </Window.DataContext>

  <Window.Resources>
    <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
  </Window.Resources>

  <StackPanel>
    <ProgressBar IsIndeterminate="True"
                 Visibility="{Binding HasProgress, Converter={StaticResource BooleanToVisibilityConverter}}" />

    <Button Command="{Binding LoadMainTableDataCommand}"
            Content="Load Data" />

    <TextBox Text="{Binding FirstNameSearchKey}" />
    <TextBox Text="{Binding LastNameSearchKey}" />
    <DataGrid ItemsSource="{Binding MainDataTable}" />
  <StackPanel>
</Window>


text:
Q: How to extract cell data for a specific column with xpath? So I've been looking for a solution to this, and while I've found some answers none of them seem to work. The table I'm attempting to extract data from looks like so:

#

1

2

3

4

5

6

7

1
    info here
    info here
    info here
     info here

     ℹ

In this example, how would I select cells for the 6th column? Another caveat to this is that not all cells have info in them. Ive tried using
//td[position()<=(count(//tr/th[.='6']/preceding-sibling::*)+1)]

however this doesn't seem to work. Lastly, I'm attempting to use this xpath for data extraction using Octoparse. Literally nothing I try works, anyone have any ideas?

A: position()<=<NUMBER> means that you want to select all the cells with index less or equal to <NUMBER>. Did you mean
//td[position()=(count(//tr/th[.='6']/preceding-sibling::*)+1)]

?


text:
Q: How can I copy/rename/overwrite image using PHP, submit and radio buttons? I am just starting out with PHP, and I am trying to make a way for a client to be able to change an image using radio buttons and form submission.  My intention is for one of 2 image files (Open/Closed.jpg) to be copied and renamed to another location (images/status/Status.jpg) so that coding isn't needed to make the change.
The "new" image will then be used elsewhere.  I have tried various copy() and rename() calls, but with no luck.  Below is the code I am working with.  I feel my problem lies with the submit call, but all things I have tried have not worked.  So I am back to my original code (below) trying for a fresher start with help from seasoned users/programmers.

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="">
<meta name="keywords" content="">
<title></title>
<link href="style.css" type="text/css" rel="stylesheet" />

<?php
// define variables and set to empty values
$WinterStatusErr = "";
$WinterStatus = "";

if ($_SERVER["REQUEST_METHOD"] == "POST")
{
   if (empty($_POST["WinterStatus"]))
     {$WinterStatusErr = "Status is required";}
   else
     {$WinterStatus = test_input($_POST["WinterStatus"]);}
}
function test_input($data)
{
     $data = trim($data);
     $data = stripslashes($data);
     $data = htmlspecialchars($data);
     return $data;
}
?>

* required selection

<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
   <input type="radio" name="WinterStatus" <?php if (isset($WinterStatus) &&          $WinterStatus=="open") echo "checked";?>  value="Open">Open
   <input type="radio" name="WinterStatus" <?php if (isset($WinterStatus) && $WinterStatus=="closed") echo "checked";?>  value="Closed">Closed
   * <?php echo $WinterStatusErr;?>

   <input type="submit" name="submit" value="Submit" <?php
if ($Winterstatus == "Open")
    { copy ("images/Open.jpg", "images/status/Status.jpg"); }
   elseif ($Winterstatus == "Closed")
    { copy ("images/Closed.jpg", "images/status/Status.jpg");}
?>>
</form>

<?php echo $WinterStatus ?>

A: first remove the if statement from your submit input, then change $Winterstatus in the if statment to $WinterStatus.

A: in php you can use exec() to execute a command. on linux the "cp" command should do what you are asking.  Permission/security issues will be a problem though, so i would recommend just changing a variable to the new image rather then actually moving it...a lot simpler and safer -- if I knew where you reference the image I could help you figure that out.


text:
Q: How to specify a function with flexible domain but same range? As an example, I could be interested in functions that operate on $\mathbf{R}$ and $\mathbf{R}^2$. One way to say this is "all functions $f:\mathbf{R} \to \{0,1\}$ and all functions $f: \mathbf{R}^2 \to \{0,1\}$." The more domains I want to specify, the more I have to say. Is there a more elegant way to consider all of these functions that have many domains?

A: Let $f:\mathbb R^n\rightarrow \{0,1\}$, with $n\leq2$ be a function such that $\dots$


text:
Q: some ways of expressing future I have learnt some words can use present tense to express the future.
Like:
Even if it rains, I will go outside. Can I change this one to: Even if you have jobs to do tomorrow, you are still playing!!!
If you booked a ticket, you can enjoy our best service now. Can I change this one to: Even if you booked a ticket, you still can't enjoy the service for some reason. (Here the past tense is about guessing, not the unreality.)
And about Even if he had jobs to do tomorrow, he was still playing.Obviously, he was fired. (Just change the first example to the past, now someone is talking about the reason why he got fired.)
Thanks so much!


text:
Q: Tangent Circles A semicircle T has diameter AB=25 Point P lies on AB with AP=16 ans C is on the semicircle such that PC is perpendicular to AB. A circle w is drawn so taht it is tangent to segment PC, segment PB and T, what is the radius of w?
My try: connect A and C to get a right triangle, we get that the length of CP, we get the length of CP which is 12, i now am having trouble finding the radius, i tried creating triangle CPB but i am not sure if CB is collinear with the circle's center. Any help?

A: Let $r$ be the radius of $w$.
Let $M$ and $N$ be centres of $T$ and $w$ respectively. Denote the foot of perpendicular from $N$ to $AB$ by $K$.
Then $MK=25\div 2-9+r=3.5+r$, $NK=r$ and $MN=25\div2-r=12.5-r$.
By Pythagoras' Theorem,
\begin{align*}
r^2+(3.5+r)^2&=(12.5-r)^2\\
2r^2+7r+12.25&=156.25-25r+r^2\\
r^2+32r-144&=0\\
(r-4)(r+36)&=0\\
r&=4
\end{align*}

A: Try to draw a figure first. Let's call $O$ the middle of $AB$, $O'$ the center of the small circle, and $M$ the point where the small circle and the $T$ semicircle are tangent. If a circle is tangent to a line, it means that the radius is perpendicular to that line. Therefore, if two circles are tangent, it means that the two centers and the tangent point are all on the same line.
$$OM=R\\O'M=r\\OO'=R-r$$
The small center is tangent to $OB$ at a distance $r$ from $P$, and tangent to $PC$ at a distance $r$ from $P$. Witing Pythagora's theorem for the $OO'P$, you get $$(R-r)^2=r^2+(OP+r)^2$$
When you plug in the values, $R=12.5$ and $OP=3.5$, you get
$(12.5-r)^2=r^2+(3.5+r)^2$

A: The trick is noticing that three points, the center of the larger circle, the center of the smaller circle and the point tangency are co-linear.
with the given information you will find a right triangle with sides $r,r+3.5$ and the hypothenuse of $12.5-r$
Upon using the Pythagorean theorem, you get $r=4.$


text:
Q: Querying the Firebase Firestore and ordering it causes an error I am doing a simple query to get the data I need from the firestore.
this.unsubscribe = this.ref
  .where('channelId', '==', `${currentChannel.id}`)
  .orderBy('createdAt', 'asc')
  .onSnapshot(this.onCollectionUpdate);

Ref is just a reference to my collection.
When I have either the .where or the .orderBy it works fine but when I chain them together which is something that according to the docs as seen here https://firebase.google.com/docs/firestore/query-data/order-limit-data?authuser=0 you can do it but in my case it throws an error:
SnapshotError: Firestore: Operation was rejected because the system is not in a state required for the operation's execution
Any help will be much appreciated.

A: After waiting for almost 25 mins it magically sorted itself out.
For people reading this please be patient in case you get this error and the console says that everything has been enabled. It takes much more time.


text:
Q: legacy code visual basic to c# I'm building an c# app that is designed to replicate and enhance the functionality of an VB6 app developed many years ago.
My problem is that one module in the old app does some realy complicated things and trying to replicate this starting from specs would be a big pain for me. Even if this sounds like the best idea.
My question is : is there a way i could keep the old VB module and integrate it into the c# app, so that i wouldn't have to rewrite everything ?
Thanks!

A: Yes.  You can turn the module into a COM object, and .Net will happily call into COM objects. Depending on what you have right now you may need to find a copy of Visual Studio 6 to make that happen (it's still available on MSDN if you have a subscription).  To give you more exact instructions we'd need to see more of your code.

A: Visual Studio has a wizard that allows you to convert VB6 into VB.NET, which you could then reference in your C# project and use. However, this migration tool is no longer shipped with Visual Studio 2010 (it was shipped in older versions) Even still though, there generally is a lot of manual touchup work required, you are generally better off rewriting it by hand which could result in higher quality code, anyway. My recommendation to you is to rewrite the code, you can make touchups and make sure that it works correctly without having to go the COM/Interop route, but don't necessarily shun that option either. If rewriting all the code really is an issue, then interop is a solution.

A: You can use COM or export the module as a DLL. Here's some information for you regarding VB6 and COM.

A: In theory yes, turning it into a com module, and calling it from your c# code. Whether this would be easier or not, I am not sure.
The problem is that this issue will not go away, and if there are changes needed to the module, or the interface, then someone has to do it. So practical yes, but consider carefully what you are doing.

A: You can migrate the existing vb code to vb.net and compile it as a separate assembly and add it to the C# application.

A: Can't VS2010 (maybe 2008) support both VB and C# projects in the same solution? If I'm not mistaken, they can. So you could actually convert your VB6 code into VB.Net and have the project in your solution with the C# stuff.


text:
Q: Beginner HTML/CSS Mistake I'm taking a beginning web design class on Treehouse, and I have a question about centering a class in HTML with CSS, It's not coming out right, even though I have checked instructions. Can someone please look at this code and tell me what I've done wrong?
Here's the HTML:

class="card-title">Background

And, Here's the CSS:
.card-title {
   text-align:center;
}

The output is like this: "class="card-title">Background"

I'm sure the answer is something super simple, because this is a simple course. But I'm just learning, and I'm rather nervous, so any help you can provide will be awesome!

A: You are closing the h2 too early. Also note that when you set a parent element to display: flex - all its children are affected - you may need to set a flex value on the h2  - or rethink the use of flex (thats is assuming your class of flex is to set the display:flex on the main element and its childrent - cards). If its as simple as centering the text, you won't need to use flex. And I am assuming that you are closing the  and the div.card as well..
It should be

Background

A: The mistake is here

class="card-title">Background

should be

Background