EzDevInfo.com

fetch

A window.fetch JavaScript polyfill.

Nodejs npm show latest version of a module

How do I use npm to show the latest version of a module? I am expecting something like npm --lastest express to print out v3.0.0.


Source: (StackOverflow)

PDO::fetchAll vs. PDO::fetch in a loop

Just a quick question.

Is there any performance difference between using PDO::fetchAll() and PDO::fetch() in a loop (for large result sets)?

I'm fetching into objects of a user-defined class, if that makes any difference.

My initial uneducated assumption was that fetchAll might be faster because PDO can perform multiple operations in one statement while mysql_query can only execute one. However I have little knowledge of PDO's inner workings and the documentation doesn't say anything about this, and whether or not fetchAll() is simply a PHP-side loop dumped into an array.

Any help?


Source: (StackOverflow)

Advertisements

Hibernate fetching strategy - when to use "join" and when to use "select"?

Most Hibernate associations support "fetch" parameter:

fetch="join|select"

with "select" being default value.

How to decide which one to use for which association?

I tried changing all from "select" to "join" application wide - number of generated queries decreased probably 10 times but performance stayed exactly the same (even become a tiny bit worse).

Thanks.


Source: (StackOverflow)

Linq for NHibernate and fetch mode of eager loading

Is there a way to set the fetchmode to eager for more than one object using linq for nhibernate. There seems to be an expand method which only allows me to set one object. However I need to set it for more than one object. Is this possible? Thanks


Source: (StackOverflow)

Difference between JOIN and JOIN FETCH in Hibernate

Help me understand where to use a regular JOIN and where a JOIN FETCH.

For example, if we have these two queries

FROM Employee emp
JOIN emp.department dep

and

FROM Employee emp
JOIN FETCH emp.department dep

Is there any difference between them? If yes, which one to use when?


Source: (StackOverflow)

Does "git fetch --tags" include "git fetch"?

A nice and simple question - is the function of "git fetch" a strict sub-set of git fetch --tags?

I.e. if I run git fetch --tags, is there ever a reason to immediately run git fetch straight afterward?

What about git pull and git pull --tags? Same situation?


Source: (StackOverflow)

Fetch vs FetchMany in NHibernate Linq provider

NHibernate eager loading can be done using Fetch and FetchMany, as described here http://mikehadlow.blogspot.com/2010/08/nhibernate-linq-eager-fetching.html

What is the difference between these two methods and under what circumstance would each be used?


Source: (StackOverflow)

Core Data: Query objectIDs in a predicate?

I am fetching a set of objects from a Core Data persistent store using a fetch request and a predicate. My current predicate simply checks whether an attribute is >= a certain value. This all works great, except that I want to finally exclude any objects that are currently held in an array.

I basically need to be able to exclude a set of objects, and the only way I think I can do this is to be able to get a list of objectID's from my managed objects array, and create another expression in my predicate to ensure that any objects returned don't have the same objectID. I.E. "ANY records.objectID NOT IN %@", arrayOfObjectIDs

How can I do this?

Any ideas?

Thanks,

Mike


Source: (StackOverflow)

php pdo: get the columns name of a table

How can I get all the column names from a table using PDO?

id         name        age
1          Alan        35      
2          Alex        52
3          Amy         15

The info that I want to get are,

id         name        age

EDIT:

Here is my attempt,

$db = $connection->get_connection();
$select = $db->query('SELECT * FROM contacts');

$total_column = $select->columnCount();
var_dump($total_column);

for ($counter = 0; $counter < $total_column; $counter ++) {
    $meta = $select->getColumnMeta($counter);
    $column[] = $meta['name'];
}
print_r($column);

Then I get,

Array
(
    [0] => id
    [1] => name
    [2] => age
    ...

)

Source: (StackOverflow)

Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_list-1.xml, reason: Connection to https://dl-ssl.google.com refused [closed]

Using Android SDK Manager when I try to update it just gives the following messages about not being able to connect. I've tried disabled firewall and anti malware. I also tried to run as admin and move to c:\android. I'm running windows 7 64bit. I've also tried forcing etc.

Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_list-1.xml, reason: Connection to refused Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-1.xml, reason: Connection to refused


Source: (StackOverflow)

JPA 2 Criteria Fetch Path Navigation

With JPA 2 Criteria Join method I can do the following:

    //Join Example (default inner join)
    int age = 25;
    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
    CriteriaQuery<Team> c = cb.createQuery(Team.class);
    Root<Team> t = c.from(Team.class);
    Join<Team, Player> p = t.join(Team_.players);
    c.select(t).where(cb.equal(p.get(Player_.age), age));
    TypedQuery<Team> q = entityManager.createQuery(c);
    List<Team> result = q.getResultList();

How can I do the same with fetch method, I expected that Fetch interface had get method for path navigation but it doesn't:

    //Fetch Join Example

    int age = 25;
    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
    CriteriaQuery<Team> cq = cb.createQuery(Team.class);
    Root<Team> t = cq.from(Team.class);
    Fetch<Team,Player> p = t.fetch(Team_.players);
    cq.where(cb.equal(p.get(Player_.age), age)); //This leads to compilation error there is no such method get in interface Fetch
    TypedQuery<Team> q = entityManager.createQuery(cq);
    List<Team> result = q.getResultList();

According to Hiberante Documentation fetch returns a Join object which is wrong. http://docs.jboss.org/hibernate/stable/entitymanager/reference/en/html/querycriteria.html#querycriteria-from-fetch


Source: (StackOverflow)

Git push fails to github: failed to read object

The story:

I've been developing a RoR-app in both my desktop and laptop. It was quite handy to commit changes made on another, push them to github and fetch & merge on other.

The starting point is this: I committed latest changes on my desktop, pushed them to github and then fetched and merged them into my laptop. Then, I made some commits on laptop and pushed to github. Took the changes, merged to my desktop (with --no-ff). THEN, happened the probable source of all mischiefs: I reverted the desktop to commit where it was before the latest fetch & merge. Made some development work with it, committed, pushed to github. In the laptop, I did the revert as well, though I reverted it to a commit which was made somewhere between the latest fetch from github, fetched again and merged those. Some error messages came after reverting desktop and laptop both, but things worked still fairly well and I kept working on both machines.

Until now. I tried to push from my laptop to github, which gives the following output:

 Counting objects: 106, done.
 error: unable to find 5a2a4ac...
 error: unable to find bc36923...
 error: unable to find ecb0d86... 
 error: unable to find f76d194...
 error: unable to find f899df7...
 Compressing objects: 100% (64/64), done.
 fatal: failed to read object 5a2a4ac... : Invalid argument
 error: failed to push some refs to 'git@github:username/repo.git'

So, the question is, what exactly took place here?

EDIT: It seems that because of suspending my laptop and moving it from place to place in that state screwed up the hard drive somehow. The fsck output is unavailable because we worked around the problem and kept on working, but IIRC some branches and commits were dangling, including that commit which git failed to read. - Teemu


Source: (StackOverflow)

git refusing to fetch into current branch

I set up a remote repository and I can push new changes to it, but I cannot fetch from it, I always get the (rather cryptic) error message:

fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository
fatal: The remote end hung up unexpectedly

What does it mean? What should I do to enable fetching?

(Note that this remote repo is only used as a backup repo, so it should be pretty much an exact copy of my local repository. I really can't understand why I can push to it but not fetch from it...)


Source: (StackOverflow)

How to fetch a field lazily with Hibernate Criteria

Each row of the table Person (having name, firstname and age) shall be read.

EntityManager em = emf.createEntityManager();
Session s = (Session) em.getDelegate();
Criteria criteria = s.createCriteria(Person.class);
criteria.setFetchMode("age", FetchMode.SELECT);

But the SQL shows

Hibernate:
    select
        person0_.name,
        person0_.firstname,
        person0_.age
    from 
        SCOPE.PERSON person0_

How to let the age be lazy ONLY for the Criteria??


Source: (StackOverflow)

git fetch doesn't fetch all branches

I have cloned a repository, after which somebody else has created a new branch, which I'd like to start working on. I read the manual, and it seems dead straight easy. Strangely it's not working, and all the posts I've found suggest I'm doing the right thing. So I'll subject myself to the lambasting, because there must be something obviously wrong with this:

The correct action seems to be

git fetch
git branch -a
* master
  remotes/origin/HEAD --> origin/master
  remotes/origin/master
git checkout -b dev-gml origin/dev-gml

At this point there is a problem, for some reason after git fetch I can't see the dev-gml remote branch. Why not? If I clone the repository freshly, it's there, so certainly the remote branch exists:

$ mkdir ../gitest
$ cd ../gitest
$ git clone https://github.com/example/proj.git
Cloning into proj...
remote: Counting objects: 1155, done.
remote: Compressing objects: 100% (383/383), done.
remote: Total 1155 (delta 741), reused 1155 (delta 741)
Receiving objects: 100% (1155/1155), 477.22 KiB | 877 KiB/s, done.
Resolving deltas: 100% (741/741), done.
$ cd projdir
$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/dev-gml
  remotes/origin/master

I've tried git update, git pull, git fetch --all, git pretty-please in all possible permutations...


Source: (StackOverflow)